Overview
ETH Balance
0 ETH
Eth Value
$0.00More Info
Private Name Tags
ContractCreator
View more zero value Internal Transactions in Advanced View mode
Advanced mode:
Loading...
Loading
Contract Source Code Verified (Exact Match)
Contract Name:
BlocjerkTokenV4
Compiler Version
v0.8.3+commit.8d00100c
Optimization Enabled:
Yes with 200 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT pragma solidity ^0.8.3; // Slight modifiations from base Open Zeppelin Contracts // Consult /oz/README.md for more information import "./oz/ERC20Upgradeable.sol"; import "./oz/ERC20SnapshotUpgradeable.sol"; import "./oz/ERC20PausableUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol"; /** * BlocjerkTokenV4 is a fork version of DeHubTokenV4 contract. */ contract BlocjerkTokenV4 is OwnableUpgradeable, ERC20Upgradeable, ERC20PausableUpgradeable, ERC20SnapshotUpgradeable { event AuthorizedSnapshotter(address account); event DeauthorizedSnapshotter(address account); event BuySellTaxRate(uint256 buyTaxRate, uint256 sellTaxRate); // Mapping which stores all addresses allowed to snapshot mapping(address => bool) authorizedToSnapshot; // TaxRate is based on 100% as 10000 // If buy tax rate is 5%, then set it with 500 // If sell tax rate is 0.2%, then set it with 20 uint256 public buyTaxRate; uint256 public sellTaxRate; // TaxRate can be set differently according to DEX, while $DJ token can be added liquidity in several pools // <address> is a pool address // If transfering from pool to user is buying tx, // If transfering to pool is selling tx mapping(address => bool) public poolsToTax; address public taxTo; function initialize( string memory name, string memory symbol ) public initializer { __Ownable_init(); __ERC20_init(name, symbol); __ERC20Snapshot_init(); __ERC20Pausable_init(); } // Call this on the implementation contract (not the proxy) function initializeImplementation() public initializer { __Ownable_init(); _pause(); } /** * Mints new tokens. * @param account the account to mint the tokens for * @param amount the amount of tokens to mint. */ function mint(address account, uint256 amount) external onlyOwner { _mint(account, amount); } /** * Burns tokens from an address. * @param account the account to mint the tokens for * @param amount the amount of tokens to mint. */ function burn(address account, uint256 amount) external onlyOwner { _burn(account, amount); } /** * Pauses the token contract preventing any token mint/transfer/burn operations. * Can only be called if the contract is unpaused. */ function pause() external onlyOwner { _pause(); } /** * Unpauses the token contract preventing any token mint/transfer/burn operations * Can only be called if the contract is paused. */ function unpause() external onlyOwner { _unpause(); } /** * Creates a token balance snapshot. Ideally this would be called by the * controlling DAO whenever a proposal is made. */ function snapshot() external returns (uint256) { require( authorizedToSnapshot[_msgSender()] || _msgSender() == owner(), "zDAOToken: Not authorized to snapshot" ); return _snapshot(); } /** * Authorizes an account to take snapshots * @param account The account to authorize */ function authorizeSnapshotter(address account) external onlyOwner { require( !authorizedToSnapshot[account], "zDAOToken: Account already authorized" ); authorizedToSnapshot[account] = true; emit AuthorizedSnapshotter(account); } /** * Deauthorizes an account to take snapshots * @param account The account to de-authorize */ function deauthorizeSnapshotter(address account) external onlyOwner { require(authorizedToSnapshot[account], "zDAOToken: Account not authorized"); authorizedToSnapshot[account] = false; emit DeauthorizedSnapshotter(account); } /** * Utility function to transfer tokens to many addresses at once. * @param recipients The addresses to send tokens to * @param amounts The amounts of tokens to send * @return Boolean if the transfer was a success */ function transferBulk( address[] calldata recipients, uint256[] calldata amounts ) external onlyOwner returns (bool) { require(!paused(), "ERC20Pausable: token transfer while paused"); require(recipients.length == amounts.length, "Invalid arguments length"); address sender = _msgSender(); uint256 length = recipients.length; uint256 total = 0; for (uint256 i = 0; i < length; ++i) { total += amounts[i]; } require( _balances[sender] >= total, "ERC20: transfer amount exceeds balance" ); _balances[sender] -= total; _updateAccountSnapshot(sender); for (uint256 i = 0; i < length; ++i) { address recipient = recipients[i]; require(recipient != address(0), "ERC20: transfer to the zero address"); // Note: _beforeTokenTransfer isn't called here // This function emulates what it would do (paused and snapshot) _balances[recipient] += amounts[i]; _updateAccountSnapshot(recipient); emit Transfer(sender, recipient, amounts[i]); } return true; } /** * Utility function to transfer tokens to many addresses at once. * @param sender The address to send the tokens from * @param recipients The addresses to send tokens to * @param amounts The amounts of tokens to send * @return Boolean if the transfer was a success */ function transferFromBulk( address sender, address[] calldata recipients, uint256[] calldata amounts ) external onlyOwner returns (bool) { require(!paused(), "ERC20Pausable: token transfer while paused"); require(recipients.length == amounts.length, "Invalid arguments length"); uint256 length = recipients.length; uint256 total = 0; for (uint256 i = 0; i < length; ++i) { total += amounts[i]; } require( _balances[sender] >= total, "ERC20: transfer amount exceeds balance" ); // Ensure enough allowance uint256 currentAllowance = _allowances[sender][_msgSender()]; require( currentAllowance >= total, "ERC20: transfer total exceeds allowance" ); _approve(sender, _msgSender(), currentAllowance - total); _balances[sender] -= total; _updateAccountSnapshot(sender); for (uint256 i = 0; i < length; ++i) { address recipient = recipients[i]; require(recipient != address(0), "ERC20: transfer to the zero address"); // Note: _beforeTokenTransfer isn't called here // This function emulates what it would do (paused and snapshot) _balances[recipient] += amounts[i]; _updateAccountSnapshot(recipient); emit Transfer(sender, recipient, amounts[i]); } return true; } function burnBulk( address[] calldata accounts, uint256[] calldata amounts ) external onlyOwner { require(accounts.length == amounts.length, "Invalid argument"); uint256 len = accounts.length; for (uint256 i = 0; i < len; ++i) { _burn(accounts[i], amounts[i]); } } /** * Set Buy and Sell tax rate, 100% is based on 10000, i.e. 5% should input 500 * @dev Only callable by owner */ function setBuySellTaxRate( uint256 buyTaxRate_, uint256 sellTaxRate_ ) external onlyOwner { require(buyTaxRate != buyTaxRate_ && sellTaxRate != sellTaxRate_); buyTaxRate = buyTaxRate_; sellTaxRate = sellTaxRate_; emit BuySellTaxRate(buyTaxRate_, sellTaxRate_); } /** * Set target wallet address that send tax to * @dev Only callable by owner */ function setTaxTo(address taxTo_) external onlyOwner { require(taxTo != taxTo_); taxTo = taxTo_; } function addPoolToTax(address pool_) external onlyOwner { require(pool_ != address(0)); poolsToTax[pool_] = true; } function _beforeTokenTransfer( address from, address to, uint256 amount ) internal virtual override( ERC20PausableUpgradeable, ERC20SnapshotUpgradeable, ERC20Upgradeable ) { bool alreadyPaused = paused(); if (to == address(0)) { if (alreadyPaused) { _unpause(); } } super._beforeTokenTransfer(from, to, amount); if (to == address(0)) { if (alreadyPaused) { _pause(); } } } function _transfer( address sender, address recipient, uint256 amount ) internal virtual override { uint256 taxAmount = 0; // Calculate the tax amount based on whether it is a buy or sell if (poolsToTax[recipient]) { // sending tokens to pool, sell transaction taxAmount = (amount * sellTaxRate) / 10000; } else if (poolsToTax[sender]) { // sending tokens from pool, buy transaction taxAmount = (amount * buyTaxRate) / 10000; } // Transfer the amount minus the tax super._transfer(sender, recipient, amount - taxAmount); // Transfer the tax to the tax wallet if (taxTo != address(0) && taxAmount > 0) { super._transfer(sender, taxTo, taxAmount); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol) pragma solidity ^0.8.0; import "../utils/ContextUpgradeable.sol"; import "../proxy/utils/Initializable.sol"; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract OwnableUpgradeable is Initializable, ContextUpgradeable { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ function __Ownable_init() internal onlyInitializing { __Ownable_init_unchained(); } function __Ownable_init_unchained() internal onlyInitializing { _transferOwnership(_msgSender()); } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { _checkOwner(); _; } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if the sender is not the owner. */ function _checkOwner() internal view virtual { require(owner() == _msgSender(), "Ownable: caller is not the owner"); } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { _transferOwnership(address(0)); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); _transferOwnership(newOwner); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Internal function without access restriction. */ function _transferOwnership(address newOwner) internal virtual { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[49] private __gap; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (proxy/utils/Initializable.sol) pragma solidity ^0.8.2; 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 proxied contracts do not make use of 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. * * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be * reused. This mechanism prevents re-execution of each "step" but allows the creation of new initialization steps in * case an upgrade adds a module that needs to be initialized. * * For example: * * [.hljs-theme-light.nopadding] * ``` * contract MyToken is ERC20Upgradeable { * function initialize() initializer public { * __ERC20_init("MyToken", "MTK"); * } * } * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable { * function initializeV2() reinitializer(2) public { * __ERC20Permit_init("MyToken"); * } * } * ``` * * 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 prevent the implementation contract from being used, you should invoke * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed: * * [.hljs-theme-light.nopadding] * ``` * /// @custom:oz-upgrades-unsafe-allow constructor * constructor() { * _disableInitializers(); * } * ``` * ==== */ abstract contract Initializable { /** * @dev Indicates that the contract has been initialized. * @custom:oz-retyped-from bool */ uint8 private _initialized; /** * @dev Indicates that the contract is in the process of being initialized. */ bool private _initializing; /** * @dev Triggered when the contract has been initialized or reinitialized. */ event Initialized(uint8 version); /** * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope, * `onlyInitializing` functions can be used to initialize parent contracts. * * Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a * constructor. * * Emits an {Initialized} event. */ modifier initializer() { bool isTopLevelCall = !_initializing; require( (isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1), "Initializable: contract is already initialized" ); _initialized = 1; if (isTopLevelCall) { _initializing = true; } _; if (isTopLevelCall) { _initializing = false; emit Initialized(1); } } /** * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be * used to initialize parent contracts. * * A reinitializer may be used after the original initialization step. This is essential to configure modules that * are added through upgrades and that require initialization. * * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer` * cannot be nested. If one is invoked in the context of another, execution will revert. * * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in * a contract, executing them in the right order is up to the developer or operator. * * WARNING: setting the version to 255 will prevent any future reinitialization. * * Emits an {Initialized} event. */ modifier reinitializer(uint8 version) { require(!_initializing && _initialized < version, "Initializable: contract is already initialized"); _initialized = version; _initializing = true; _; _initializing = false; emit Initialized(version); } /** * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the * {initializer} and {reinitializer} modifiers, directly or indirectly. */ modifier onlyInitializing() { require(_initializing, "Initializable: contract is not initializing"); _; } /** * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call. * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized * to any version. It is recommended to use this to lock implementation contracts that are designed to be called * through proxies. * * Emits an {Initialized} event the first time it is successfully executed. */ function _disableInitializers() internal virtual { require(!_initializing, "Initializable: contract is initializing"); if (_initialized < type(uint8).max) { _initialized = type(uint8).max; emit Initialized(type(uint8).max); } } /** * @dev Internal function that returns the initialized version. Returns `_initialized` */ function _getInitializedVersion() internal view returns (uint8) { return _initialized; } /** * @dev Internal function that returns the initialized version. Returns `_initializing` */ function _isInitializing() internal view returns (bool) { return _initializing; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (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 { __Pausable_init_unchained(); } function __Pausable_init_unchained() internal onlyInitializing { _paused = false; } /** * @dev Modifier to make a function callable only when the contract is not paused. * * Requirements: * * - The contract must not be paused. */ modifier whenNotPaused() { _requireNotPaused(); _; } /** * @dev Modifier to make a function callable only when the contract is paused. * * Requirements: * * - The contract must be paused. */ modifier whenPaused() { _requirePaused(); _; } /** * @dev Returns true if the contract is paused, and false otherwise. */ function paused() public view virtual returns (bool) { return _paused; } /** * @dev Throws if the contract is paused. */ function _requireNotPaused() internal view virtual { require(!paused(), "Pausable: paused"); } /** * @dev Throws if the contract is not paused. */ function _requirePaused() internal view virtual { 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()); } /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[49] private __gap; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20Upgradeable { /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `to`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address to, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `from` to `to` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom( address from, address to, uint256 amount ) external returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol) pragma solidity ^0.8.1; /** * @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 * ==== * * [IMPORTANT] * ==== * You shouldn't rely on `isContract` to protect against flash loan attacks! * * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract * constructor. * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize/address.code.length, which returns 0 // for contracts in construction, since the code is only stored at the end // of the constructor execution. return account.code.length > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://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 functionCallWithValue(target, data, 0, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value ) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value, string memory errorMessage ) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract. * * _Available since v4.8._ */ function verifyCallResultFromTarget( address target, bool success, bytes memory returndata, string memory errorMessage ) internal view returns (bytes memory) { if (success) { if (returndata.length == 0) { // only check isContract if the call was successful and the return data is empty // otherwise we already know that it was a contract require(isContract(target), "Address: call to non-contract"); } return returndata; } else { _revert(returndata, errorMessage); } } /** * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason or using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { if (success) { return returndata; } else { _revert(returndata, errorMessage); } } function _revert(bytes memory returndata, string memory errorMessage) private pure { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly /// @solidity memory-safe-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (utils/Arrays.sol) pragma solidity ^0.8.0; import "./StorageSlotUpgradeable.sol"; import "./math/MathUpgradeable.sol"; /** * @dev Collection of functions related to array types. */ library ArraysUpgradeable { using StorageSlotUpgradeable for bytes32; /** * @dev Searches a sorted `array` and returns the first index that contains * a value greater or equal to `element`. If no such index exists (i.e. all * values in the array are strictly less than `element`), the array length is * returned. Time complexity O(log n). * * `array` is expected to be sorted in ascending order, and to contain no * repeated elements. */ function findUpperBound(uint256[] storage array, uint256 element) internal view returns (uint256) { if (array.length == 0) { return 0; } uint256 low = 0; uint256 high = array.length; while (low < high) { uint256 mid = MathUpgradeable.average(low, high); // Note that mid will always be strictly less than high (i.e. it will be a valid array index) // because Math.average rounds down (it does integer division with truncation). if (unsafeAccess(array, mid).value > element) { high = mid; } else { low = mid + 1; } } // At this point `low` is the exclusive upper bound. We will return the inclusive upper bound. if (low > 0 && unsafeAccess(array, low - 1).value == element) { return low - 1; } else { return low; } } /** * @dev Access an array in an "unsafe" way. Skips solidity "index-out-of-range" check. * * WARNING: Only use if you are certain `pos` is lower than the array length. */ function unsafeAccess(address[] storage arr, uint256 pos) internal pure returns (StorageSlotUpgradeable.AddressSlot storage) { bytes32 slot; /// @solidity memory-safe-assembly assembly { mstore(0, arr.slot) slot := add(keccak256(0, 0x20), pos) } return slot.getAddressSlot(); } /** * @dev Access an array in an "unsafe" way. Skips solidity "index-out-of-range" check. * * WARNING: Only use if you are certain `pos` is lower than the array length. */ function unsafeAccess(bytes32[] storage arr, uint256 pos) internal pure returns (StorageSlotUpgradeable.Bytes32Slot storage) { bytes32 slot; /// @solidity memory-safe-assembly assembly { mstore(0, arr.slot) slot := add(keccak256(0, 0x20), pos) } return slot.getBytes32Slot(); } /** * @dev Access an array in an "unsafe" way. Skips solidity "index-out-of-range" check. * * WARNING: Only use if you are certain `pos` is lower than the array length. */ function unsafeAccess(uint256[] storage arr, uint256 pos) internal pure returns (StorageSlotUpgradeable.Uint256Slot storage) { bytes32 slot; /// @solidity memory-safe-assembly assembly { mstore(0, arr.slot) slot := add(keccak256(0, 0x20), pos) } return slot.getUint256Slot(); } }
// 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 { } 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; } /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[50] private __gap; }
// 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 CountersUpgradeable { 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 (last updated v4.8.0) (utils/math/Math.sol) pragma solidity ^0.8.0; /** * @dev Standard math utilities missing in the Solidity language. */ library MathUpgradeable { enum Rounding { Down, // Toward negative infinity Up, // Toward infinity Zero // Toward zero } /** * @dev Returns the largest of two numbers. */ function max(uint256 a, uint256 b) internal pure returns (uint256) { return a > b ? a : b; } /** * @dev Returns the smallest of two numbers. */ function min(uint256 a, uint256 b) internal pure returns (uint256) { return a < b ? a : b; } /** * @dev Returns the average of two numbers. The result is rounded towards * zero. */ function average(uint256 a, uint256 b) internal pure returns (uint256) { // (a + b) / 2 can overflow. return (a & b) + (a ^ b) / 2; } /** * @dev Returns the ceiling of the division of two numbers. * * This differs from standard division with `/` in that it rounds up instead * of rounding down. */ function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) { // (a + b - 1) / b can overflow on addition, so we distribute. return a == 0 ? 0 : (a - 1) / b + 1; } /** * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0 * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv) * with further edits by Uniswap Labs also under MIT license. */ function mulDiv( uint256 x, uint256 y, uint256 denominator ) internal pure returns (uint256 result) { unchecked { // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256 // variables such that product = prod1 * 2^256 + prod0. uint256 prod0; // Least significant 256 bits of the product uint256 prod1; // Most significant 256 bits of the product assembly { let mm := mulmod(x, y, not(0)) prod0 := mul(x, y) prod1 := sub(sub(mm, prod0), lt(mm, prod0)) } // Handle non-overflow cases, 256 by 256 division. if (prod1 == 0) { return prod0 / denominator; } // Make sure the result is less than 2^256. Also prevents denominator == 0. require(denominator > prod1); /////////////////////////////////////////////// // 512 by 256 division. /////////////////////////////////////////////// // Make division exact by subtracting the remainder from [prod1 prod0]. uint256 remainder; assembly { // Compute remainder using mulmod. remainder := mulmod(x, y, denominator) // Subtract 256 bit number from 512 bit number. prod1 := sub(prod1, gt(remainder, prod0)) prod0 := sub(prod0, remainder) } // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1. // See https://cs.stackexchange.com/q/138556/92363. // Does not overflow because the denominator cannot be zero at this stage in the function. uint256 twos = denominator & (~denominator + 1); assembly { // Divide denominator by twos. denominator := div(denominator, twos) // Divide [prod1 prod0] by twos. prod0 := div(prod0, twos) // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one. twos := add(div(sub(0, twos), twos), 1) } // Shift in bits from prod1 into prod0. prod0 |= prod1 * twos; // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for // four bits. That is, denominator * inv = 1 mod 2^4. uint256 inverse = (3 * denominator) ^ 2; // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works // in modular arithmetic, doubling the correct bits in each step. inverse *= 2 - denominator * inverse; // inverse mod 2^8 inverse *= 2 - denominator * inverse; // inverse mod 2^16 inverse *= 2 - denominator * inverse; // inverse mod 2^32 inverse *= 2 - denominator * inverse; // inverse mod 2^64 inverse *= 2 - denominator * inverse; // inverse mod 2^128 inverse *= 2 - denominator * inverse; // inverse mod 2^256 // Because the division is now exact we can divide by multiplying with the modular inverse of denominator. // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1 // is no longer required. result = prod0 * inverse; return result; } } /** * @notice Calculates x * y / denominator with full precision, following the selected rounding direction. */ function mulDiv( uint256 x, uint256 y, uint256 denominator, Rounding rounding ) internal pure returns (uint256) { uint256 result = mulDiv(x, y, denominator); if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) { result += 1; } return result; } /** * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down. * * Inspired by Henry S. Warren, Jr.'s "Hacker's Delight" (Chapter 11). */ function sqrt(uint256 a) internal pure returns (uint256) { if (a == 0) { return 0; } // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target. // // We know that the "msb" (most significant bit) of our target number `a` is a power of 2 such that we have // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`. // // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)` // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))` // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)` // // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit. uint256 result = 1 << (log2(a) >> 1); // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128, // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision // into the expected uint128 result. unchecked { result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; return min(result, a / result); } } /** * @notice Calculates sqrt(a), following the selected rounding direction. */ function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = sqrt(a); return result + (rounding == Rounding.Up && result * result < a ? 1 : 0); } } /** * @dev Return the log in base 2, rounded down, of a positive value. * Returns 0 if given 0. */ function log2(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >> 128 > 0) { value >>= 128; result += 128; } if (value >> 64 > 0) { value >>= 64; result += 64; } if (value >> 32 > 0) { value >>= 32; result += 32; } if (value >> 16 > 0) { value >>= 16; result += 16; } if (value >> 8 > 0) { value >>= 8; result += 8; } if (value >> 4 > 0) { value >>= 4; result += 4; } if (value >> 2 > 0) { value >>= 2; result += 2; } if (value >> 1 > 0) { result += 1; } } return result; } /** * @dev Return the log in base 2, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log2(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log2(value); return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0); } } /** * @dev Return the log in base 10, rounded down, of a positive value. * Returns 0 if given 0. */ function log10(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >= 10**64) { value /= 10**64; result += 64; } if (value >= 10**32) { value /= 10**32; result += 32; } if (value >= 10**16) { value /= 10**16; result += 16; } if (value >= 10**8) { value /= 10**8; result += 8; } if (value >= 10**4) { value /= 10**4; result += 4; } if (value >= 10**2) { value /= 10**2; result += 2; } if (value >= 10**1) { result += 1; } } return result; } /** * @dev Return the log in base 10, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log10(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log10(value); return result + (rounding == Rounding.Up && 10**result < value ? 1 : 0); } } /** * @dev Return the log in base 256, rounded down, of a positive value. * Returns 0 if given 0. * * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string. */ function log256(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >> 128 > 0) { value >>= 128; result += 16; } if (value >> 64 > 0) { value >>= 64; result += 8; } if (value >> 32 > 0) { value >>= 32; result += 4; } if (value >> 16 > 0) { value >>= 16; result += 2; } if (value >> 8 > 0) { result += 1; } } return result; } /** * @dev Return the log in base 10, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log256(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log256(value); return result + (rounding == Rounding.Up && 1 << (result * 8) < value ? 1 : 0); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (utils/StorageSlot.sol) pragma solidity ^0.8.0; /** * @dev Library for reading and writing primitive types to specific storage slots. * * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts. * This library helps with reading and writing to such slots without the need for inline assembly. * * The functions in this library return Slot structs that contain a `value` member that can be used to read or write. * * Example usage to set ERC1967 implementation slot: * ``` * contract ERC1967 { * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc; * * function _getImplementation() internal view returns (address) { * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value; * } * * function _setImplementation(address newImplementation) internal { * require(Address.isContract(newImplementation), "ERC1967: new implementation is not a contract"); * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation; * } * } * ``` * * _Available since v4.1 for `address`, `bool`, `bytes32`, and `uint256`._ */ library StorageSlotUpgradeable { struct AddressSlot { address value; } struct BooleanSlot { bool value; } struct Bytes32Slot { bytes32 value; } struct Uint256Slot { uint256 value; } /** * @dev Returns an `AddressSlot` with member `value` located at `slot`. */ function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `BooleanSlot` with member `value` located at `slot`. */ function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `Bytes32Slot` with member `value` located at `slot`. */ function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `Uint256Slot` with member `value` located at `slot`. */ function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "./ERC20Upgradeable.sol"; import "@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.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 ERC20PausableUpgradeable is Initializable, ERC20Upgradeable, PausableUpgradeable { function __ERC20Pausable_init() internal initializer { __Context_init_unchained(); __Pausable_init_unchained(); __ERC20Pausable_init_unchained(); } function __ERC20Pausable_init_unchained() internal initializer {} /** * @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"); } uint256[50] private __gap; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "./ERC20Upgradeable.sol"; import "@openzeppelin/contracts-upgradeable/utils/ArraysUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/utils/CountersUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol"; /** * @dev This contract extends an ERC20 token with a snapshot mechanism. When a snapshot is created, the balances and * total supply at the time are recorded for later access. * * This can be used to safely create mechanisms based on token balances such as trustless dividends or weighted voting. * In naive implementations it's possible to perform a "double spend" attack by reusing the same balance from different * accounts. By using snapshots to calculate dividends or voting power, those attacks no longer apply. It can also be * used to create an efficient ERC20 forking mechanism. * * Snapshots are created by the internal {_snapshot} function, which will emit the {Snapshot} event and return a * snapshot id. To get the total supply at the time of a snapshot, call the function {totalSupplyAt} with the snapshot * id. To get the balance of an account at the time of a snapshot, call the {balanceOfAt} function with the snapshot id * and the account address. * * ==== Gas Costs * * Snapshots are efficient. Snapshot creation is _O(1)_. Retrieval of balances or total supply from a snapshot is _O(log * n)_ in the number of snapshots that have been created, although _n_ for a specific account will generally be much * smaller since identical balances in subsequent snapshots are stored as a single entry. * * There is a constant overhead for normal ERC20 transfers due to the additional snapshot bookkeeping. This overhead is * only significant for the first transfer that immediately follows a snapshot for a particular account. Subsequent * transfers will have normal cost until the next snapshot, and so on. */ abstract contract ERC20SnapshotUpgradeable is Initializable, ERC20Upgradeable { function __ERC20Snapshot_init() internal initializer { __Context_init_unchained(); __ERC20Snapshot_init_unchained(); } function __ERC20Snapshot_init_unchained() internal initializer {} // Inspired by Jordi Baylina's MiniMeToken to record historical balances: // https://github.com/Giveth/minimd/blob/ea04d950eea153a04c51fa510b068b9dded390cb/contracts/MiniMeToken.sol using ArraysUpgradeable for uint256[]; using CountersUpgradeable for CountersUpgradeable.Counter; // Snapshotted values have arrays of ids and the value corresponding to that id. These could be an array of a // Snapshot struct, but that would impede usage of functions that work on an array. struct Snapshots { uint256[] ids; uint256[] values; } mapping(address => Snapshots) private _accountBalanceSnapshots; Snapshots private _totalSupplySnapshots; // Snapshot ids increase monotonically, with the first value being 1. An id of 0 is invalid. CountersUpgradeable.Counter private _currentSnapshotId; /** * @dev Emitted by {_snapshot} when a snapshot identified by `id` is created. */ event Snapshot(uint256 id); /** * @dev Creates a new snapshot and returns its snapshot id. * * Emits a {Snapshot} event that contains the same id. * * {_snapshot} is `internal` and you have to decide how to expose it externally. Its usage may be restricted to a * set of accounts, for example using {AccessControl}, or it may be open to the public. * * [WARNING] * ==== * While an open way of calling {_snapshot} is required for certain trust minimization mechanisms such as forking, * you must consider that it can potentially be used by attackers in two ways. * * First, it can be used to increase the cost of retrieval of values from snapshots, although it will grow * logarithmically thus rendering this attack ineffective in the long term. Second, it can be used to target * specific accounts and increase the cost of ERC20 transfers for them, in the ways specified in the Gas Costs * section above. * * We haven't measured the actual numbers; if this is something you're interested in please reach out to us. * ==== */ function _snapshot() internal virtual returns (uint256) { _currentSnapshotId.increment(); uint256 currentId = _currentSnapshotId.current(); emit Snapshot(currentId); return currentId; } /** * @dev Retrieves the balance of `account` at the time `snapshotId` was created. */ function balanceOfAt( address account, uint256 snapshotId ) public view virtual returns (uint256) { (bool snapshotted, uint256 value) = _valueAt( snapshotId, _accountBalanceSnapshots[account] ); return snapshotted ? value : balanceOf(account); } /** * @dev Retrieves the total supply at the time `snapshotId` was created. */ function totalSupplyAt( uint256 snapshotId ) public view virtual returns (uint256) { (bool snapshotted, uint256 value) = _valueAt( snapshotId, _totalSupplySnapshots ); return snapshotted ? value : totalSupply(); } // Update balance and/or total supply snapshots before the values are modified. This is implemented // in the _beforeTokenTransfer hook, which is executed for _mint, _burn, and _transfer operations. function _beforeTokenTransfer( address from, address to, uint256 amount ) internal virtual override { super._beforeTokenTransfer(from, to, amount); if (from == address(0)) { // mint _updateAccountSnapshot(to); _updateTotalSupplySnapshot(); } else if (to == address(0)) { // burn _updateAccountSnapshot(from); _updateTotalSupplySnapshot(); } else { // transfer _updateAccountSnapshot(from); _updateAccountSnapshot(to); } } function _valueAt( uint256 snapshotId, Snapshots storage snapshots ) private view returns (bool, uint256) { require(snapshotId > 0, "ERC20Snapshot: id is 0"); // solhint-disable-next-line max-line-length require( snapshotId <= _currentSnapshotId.current(), "ERC20Snapshot: nonexistent id" ); // When a valid snapshot is queried, there are three possibilities: // a) The queried value was not modified after the snapshot was taken. Therefore, a snapshot entry was never // created for this id, and all stored snapshot ids are smaller than the requested one. The value that corresponds // to this id is the current one. // b) The queried value was modified after the snapshot was taken. Therefore, there will be an entry with the // requested id, and its value is the one to return. // c) More snapshots were created after the requested one, and the queried value was later modified. There will be // no entry for the requested id: the value that corresponds to it is that of the smallest snapshot id that is // larger than the requested one. // // In summary, we need to find an element in an array, returning the index of the smallest value that is larger if // it is not found, unless said value doesn't exist (e.g. when all values are smaller). Arrays.findUpperBound does // exactly this. uint256 index = snapshots.ids.findUpperBound(snapshotId); if (index == snapshots.ids.length) { return (false, 0); } else { return (true, snapshots.values[index]); } } function _updateAccountSnapshot(address account) internal { _updateSnapshot(_accountBalanceSnapshots[account], balanceOf(account)); } function _updateTotalSupplySnapshot() internal { _updateSnapshot(_totalSupplySnapshots, totalSupply()); } function _updateSnapshot( Snapshots storage snapshots, uint256 currentValue ) private { uint256 currentId = _currentSnapshotId.current(); if (_lastSnapshotId(snapshots.ids) < currentId) { snapshots.ids.push(currentId); snapshots.values.push(currentValue); } } function _lastSnapshotId( uint256[] storage ids ) private view returns (uint256) { if (ids.length == 0) { return 0; } else { return ids[ids.length - 1]; } } uint256[46] private __gap; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol"; import "@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.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 guidelines: functions revert instead * of 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 ERC20Upgradeable is Initializable, ContextUpgradeable, IERC20Upgradeable { // Diff from Open Zeppelin Standard mapping(address => uint256) internal _balances; mapping(address => mapping(address => uint256)) internal _allowances; uint256 private _totalSupply; string private _name; string private _symbol; /** * @dev Sets the values for {name} and {symbol}. * * The defaut value of {decimals} is 18. To select a different value for * {decimals} you should overload it. * * All three of these values are immutable: they can only be set once during * construction. */ function __ERC20_init( string memory name_, string memory symbol_ ) internal initializer { __Context_init_unchained(); __ERC20_init_unchained(name_, symbol_); } function __ERC20_init_unchained( string memory name_, string memory symbol_ ) internal initializer { _name = name_; _symbol = symbol_; } /** * @dev Returns the name of the token. */ function name() public view virtual returns (string memory) { return _name; } /** * @dev Returns the symbol of the token, usually a shorter version of the * name. */ function symbol() public view virtual returns (string memory) { return _symbol; } /** * @dev Returns the number of decimals used to get its user representation. * For example, if `decimals` equals `2`, a balance of `505` tokens should * be displayed to a user as `5,05` (`505 / 10 ** 2`). * * Tokens usually opt for a value of 18, imitating the relationship between * Ether and Wei. This is the value {ERC20} uses, unless this function is * overloaded; * * NOTE: This information is only used for _display_ purposes: it in * no way affects any of the arithmetic of the contract, including * {IERC20-balanceOf} and {IERC20-transfer}. */ function decimals() public view virtual returns (uint8) { return 18; } /** * @dev See {IERC20-totalSupply}. */ function totalSupply() public view virtual 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" ); _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" ); _approve(_msgSender(), spender, currentAllowance - subtractedValue); return true; } /** * @dev Moves tokens `amount` from `sender` to `recipient`. * * This is 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"); _balances[sender] = senderBalance - amount; _balances[recipient] += amount; emit Transfer(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: * * - `to` 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); } /** * @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"); _balances[account] = accountBalance - amount; _totalSupply -= amount; emit Transfer(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 to 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 {} uint256[45] private __gap; }
{ "optimizer": { "enabled": true, "runs": 200 }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"spender","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"AuthorizedSnapshotter","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"buyTaxRate","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"sellTaxRate","type":"uint256"}],"name":"BuySellTaxRate","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"DeauthorizedSnapshotter","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint8","name":"version","type":"uint8"}],"name":"Initialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"id","type":"uint256"}],"name":"Snapshot","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"inputs":[{"internalType":"address","name":"pool_","type":"address"}],"name":"addPoolToTax","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"spender","type":"address"}],"name":"allowance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"approve","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"authorizeSnapshotter","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"uint256","name":"snapshotId","type":"uint256"}],"name":"balanceOfAt","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"burn","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"accounts","type":"address[]"},{"internalType":"uint256[]","name":"amounts","type":"uint256[]"}],"name":"burnBulk","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"buyTaxRate","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"deauthorizeSnapshotter","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"subtractedValue","type":"uint256"}],"name":"decreaseAllowance","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"addedValue","type":"uint256"}],"name":"increaseAllowance","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"name","type":"string"},{"internalType":"string","name":"symbol","type":"string"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"initializeImplementation","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"mint","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","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":"","type":"address"}],"name":"poolsToTax","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"sellTaxRate","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"buyTaxRate_","type":"uint256"},{"internalType":"uint256","name":"sellTaxRate_","type":"uint256"}],"name":"setBuySellTaxRate","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"taxTo_","type":"address"}],"name":"setTaxTo","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"snapshot","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"taxTo","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"snapshotId","type":"uint256"}],"name":"totalSupplyAt","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transfer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"recipients","type":"address[]"},{"internalType":"uint256[]","name":"amounts","type":"uint256[]"}],"name":"transferBulk","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"sender","type":"address"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"sender","type":"address"},{"internalType":"address[]","name":"recipients","type":"address[]"},{"internalType":"uint256[]","name":"amounts","type":"uint256[]"}],"name":"transferFromBulk","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"unpause","outputs":[],"stateMutability":"nonpayable","type":"function"}]
Contract Creation Code
608060405234801561001057600080fd5b5061296e806100206000396000f3fe608060405234801561001057600080fd5b506004361061021c5760003560e01c806370a0823111610125578063a457c2d7116100ad578063e9825ffa1161007c578063e9825ffa14610463578063f2fde38b14610476578063f6dd8f7514610489578063f8f5f0b31461049c578063fbc1284f146104c05761021c565b8063a457c2d7146103f0578063a9059cbb14610403578063d85b975614610416578063dd62ed3e1461042a5761021c565b80639316c3e7116100f45780639316c3e7146103a757806395d89b41146103ba5780639711715a146103c2578063981b24d0146103ca5780639dc29fac146103dd5761021c565b806370a082311461035f578063715018a6146103725780638456cb591461037a5780638da5cb5b146103825761021c565b806339509351116101a85780634cd88b76116101775780634cd88b76146103115780634ee2cd7e146103245780635c975abb14610337578063634b384114610342578063691f224f146103555761021c565b806339509351146102db5780633f4ba83a146102ee57806340c10f19146102f65780634c10879d146103095761021c565b806318160ddd116101ef57806318160ddd1461028a57806323b872dd1461029c57806324024efd146102af578063307b8a02146102b9578063313ce567146102cc5761021c565b806306fdde031461022157806308b704ac1461023f578063095ea7b3146102545780631672ba2214610277575b600080fd5b6102296104d3565b6040516102369190612649565b60405180910390f35b61025261024d366004612418565b610565565b005b61026761026236600461251d565b6105a5565b6040519015158152602001610236565b610252610285366004612418565b6105bc565b6067545b604051908152602001610236565b6102676102aa366004612464565b610603565b61028e61012f5481565b6102676102c736600461249f565b6106b9565b60405160128152602001610236565b6102676102e936600461251d565b6109da565b610252610a11565b61025261030436600461251d565b610a23565b610252610a39565b61025261031f3660046125af565b610afa565b61028e61033236600461251d565b610bcf565b60975460ff16610267565b610252610350366004612628565b610c18565b61028e61012e5481565b61028e61036d366004612418565b610c88565b610252610ca7565b610252610cb9565b6033546001600160a01b03165b6040516001600160a01b039091168152602001610236565b6102676103b5366004612546565b610cc9565b610229610f57565b61028e610f66565b61028e6103d8366004612610565b610ff6565b6102526103eb36600461251d565b611021565b6102676103fe36600461251d565b611033565b61026761041136600461251d565b6110ce565b6101315461038f906001600160a01b031681565b61028e610438366004612432565b6001600160a01b03918216600090815260666020908152604080832093909416825291909152205490565b610252610471366004612418565b6110db565b610252610484366004612418565b6111a8565b610252610497366004612546565b61121e565b6102676104aa366004612418565b6101306020526000908152604090205460ff1681565b6102526104ce366004612418565b6112f0565b6060606880546104e290612876565b80601f016020809104026020016040519081016040528092919081815260200182805461050e90612876565b801561055b5780601f106105305761010080835404028352916020019161055b565b820191906000526020600020905b81548152906001019060200180831161053e57829003601f168201915b5050505050905090565b61056d6113c5565b6001600160a01b03811661058057600080fd5b6001600160a01b0316600090815261013060205260409020805460ff19166001179055565b60006105b233848461141f565b5060015b92915050565b6105c46113c5565b610131546001600160a01b03828116911614156105e057600080fd5b61013180546001600160a01b0319166001600160a01b0392909216919091179055565b6000610610848484611544565b6001600160a01b03841660009081526066602090815260408083203384529091529020548281101561069a5760405162461bcd60e51b815260206004820152602860248201527f45524332303a207472616e7366657220616d6f756e74206578636565647320616044820152676c6c6f77616e636560c01b60648201526084015b60405180910390fd5b6106ae85336106a9868561285f565b61141f565b506001949350505050565b60006106c36113c5565b60975460ff16156106e65760405162461bcd60e51b8152600401610691906127be565b8382146107305760405162461bcd60e51b8152602060048201526018602482015277092dcecc2d8d2c840c2e4ceeadacadce8e640d8cadccee8d60431b6044820152606401610691565b836000805b828110156107815785858281811061075d57634e487b7160e01b600052603260045260246000fd5b905060200201358261076f9190612808565b915061077a816128b1565b9050610735565b506001600160a01b0388166000908152606560205260409020548111156107ba5760405162461bcd60e51b8152600401610691906126df565b6001600160a01b03881660009081526066602090815260408083203384529091529020548181101561083e5760405162461bcd60e51b815260206004820152602760248201527f45524332303a207472616e7366657220746f74616c206578636565647320616c6044820152666c6f77616e636560c81b6064820152608401610691565b61084d89336106a9858561285f565b6001600160a01b0389166000908152606560205260408120805484929061087590849061285f565b9091555061088490508961161d565b60005b838110156109ca5760008989838181106108b157634e487b7160e01b600052603260045260246000fd5b90506020020160208101906108c69190612418565b90506001600160a01b0381166108ee5760405162461bcd60e51b81526004016106919061269c565b87878381811061090e57634e487b7160e01b600052603260045260246000fd5b9050602002013560656000836001600160a01b03166001600160a01b0316815260200190815260200160002060008282546109499190612808565b9091555061095890508161161d565b806001600160a01b03168b6001600160a01b03166000805160206129198339815191528a8a8681811061099b57634e487b7160e01b600052603260045260246000fd5b905060200201356040516109b191815260200190565b60405180910390a3506109c3816128b1565b9050610887565b5060019998505050505050505050565b3360008181526066602090815260408083206001600160a01b038716845290915281205490916105b29185906106a9908690612808565b610a196113c5565b610a21611647565b565b610a2b6113c5565b610a358282611699565b5050565b600054610100900460ff1615808015610a595750600054600160ff909116105b80610a735750303b158015610a73575060005460ff166001145b610a8f5760405162461bcd60e51b815260040161069190612725565b6000805460ff191660011790558015610ab2576000805461ff0019166101001790555b610aba611772565b610ac26117a1565b8015610af7576000805461ff0019169055604051600181526000805160206128f9833981519152906020015b60405180910390a15b50565b600054610100900460ff1615808015610b1a5750600054600160ff909116105b80610b345750303b158015610b34575060005460ff166001145b610b505760405162461bcd60e51b815260040161069190612725565b6000805460ff191660011790558015610b73576000805461ff0019166101001790555b610b7b611772565b610b8583836117de565b610b8d611869565b610b956118f2565b8015610bca576000805461ff0019169055604051600181526000805160206128f9833981519152906020015b60405180910390a15b505050565b6001600160a01b038216600090815260fb6020526040812081908190610bf690859061197b565b9150915081610c0d57610c0885610c88565b610c0f565b805b95945050505050565b610c206113c5565b8161012e5414158015610c3657508061012f5414155b610c3f57600080fd5b61012e82905561012f81905560408051838152602081018390527f0a915b823dc5304db7e024607ee0a48c27464798ca7178935e46965db7bd41e1910160405180910390a15050565b6001600160a01b0381166000908152606560205260409020545b919050565b610caf6113c5565b610a216000611a7b565b610cc16113c5565b610a216117a1565b6000610cd36113c5565b60975460ff1615610cf65760405162461bcd60e51b8152600401610691906127be565b838214610d405760405162461bcd60e51b8152602060048201526018602482015277092dcecc2d8d2c840c2e4ceeadacadce8e640d8cadccee8d60431b6044820152606401610691565b33846000805b82811015610d9257868682818110610d6e57634e487b7160e01b600052603260045260246000fd5b9050602002013582610d809190612808565b9150610d8b816128b1565b9050610d46565b506001600160a01b038316600090815260656020526040902054811115610dcb5760405162461bcd60e51b8152600401610691906126df565b6001600160a01b03831660009081526065602052604081208054839290610df390849061285f565b90915550610e0290508361161d565b60005b82811015610f48576000898983818110610e2f57634e487b7160e01b600052603260045260246000fd5b9050602002016020810190610e449190612418565b90506001600160a01b038116610e6c5760405162461bcd60e51b81526004016106919061269c565b878783818110610e8c57634e487b7160e01b600052603260045260246000fd5b9050602002013560656000836001600160a01b03166001600160a01b031681526020019081526020016000206000828254610ec79190612808565b90915550610ed690508161161d565b806001600160a01b0316856001600160a01b03166000805160206129198339815191528a8a86818110610f1957634e487b7160e01b600052603260045260246000fd5b90506020020135604051610f2f91815260200190565b60405180910390a350610f41816128b1565b9050610e05565b50600198975050505050505050565b6060606980546104e290612876565b33600090815261012d602052604081205460ff1680610f8f57506033546001600160a01b031633145b610fe95760405162461bcd60e51b815260206004820152602560248201527f7a44414f546f6b656e3a204e6f7420617574686f72697a656420746f20736e616044820152641c1cda1bdd60da1b6064820152608401610691565b610ff1611acd565b905090565b60008060006110068460fc61197b565b915091508161101757606754611019565b805b949350505050565b6110296113c5565b610a358282611b28565b3360009081526066602090815260408083206001600160a01b0386168452909152812054828110156110b55760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f77604482015264207a65726f60d81b6064820152608401610691565b6110c433856106a9868561285f565b5060019392505050565b60006105b2338484611544565b6110e36113c5565b6001600160a01b038116600090815261012d602052604090205460ff166111565760405162461bcd60e51b815260206004820152602160248201527f7a44414f546f6b656e3a204163636f756e74206e6f7420617574686f72697a656044820152601960fa1b6064820152608401610691565b6001600160a01b038116600081815261012d6020908152604091829020805460ff1916905590519182527f51f8ef0f426007e7662fabfb0a7d46d2e383ffe4f627aebfac09c281546877399101610aee565b6111b06113c5565b6001600160a01b0381166112155760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610691565b610af781611a7b565b6112266113c5565b8281146112685760405162461bcd60e51b815260206004820152601060248201526f125b9d985b1a5908185c99dd5b595b9d60821b6044820152606401610691565b8260005b818110156112e8576112d886868381811061129757634e487b7160e01b600052603260045260246000fd5b90506020020160208101906112ac9190612418565b8585848181106112cc57634e487b7160e01b600052603260045260246000fd5b90506020020135611b28565b6112e1816128b1565b905061126c565b505050505050565b6112f86113c5565b6001600160a01b038116600090815261012d602052604090205460ff16156113705760405162461bcd60e51b815260206004820152602560248201527f7a44414f546f6b656e3a204163636f756e7420616c726561647920617574686f6044820152641c9a5e995960da1b6064820152608401610691565b6001600160a01b038116600081815261012d6020908152604091829020805460ff1916600117905590519182527f2e457b8fcc8c01e995f48f89abb9cf6a72dce32622702d6ffa54c372be369ff99101610aee565b6033546001600160a01b03163314610a215760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610691565b6001600160a01b0383166114815760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610691565b6001600160a01b0382166114e25760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610691565b6001600160a01b0383811660008181526066602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591015b60405180910390a3505050565b6001600160a01b0382166000908152610130602052604081205460ff16156115895761271061012f54836115789190612840565b6115829190612820565b90506115ca565b6001600160a01b0384166000908152610130602052604090205460ff16156115ca5761271061012e54836115bd9190612840565b6115c79190612820565b90505b6115de84846115d9848661285f565b611c71565b610131546001600160a01b0316158015906115f95750600081115b1561161757610131546116179085906001600160a01b031683611c71565b50505050565b6001600160a01b038116600090815260fb60205260409020610af79061164283610c88565b611dc7565b61164f611e12565b6097805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b6001600160a01b0382166116ef5760405162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f2061646472657373006044820152606401610691565b6116fb60008383611e5b565b806067600082825461170d9190612808565b90915550506001600160a01b0382166000908152606560205260408120805483929061173a908490612808565b90915550506040518181526001600160a01b038316906000906000805160206129198339815191529060200160405180910390a35050565b600054610100900460ff166117995760405162461bcd60e51b815260040161069190612773565b610a21611eae565b6117a9611ede565b6097805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a25861167c3390565b600054610100900460ff16158080156117fe5750600054600160ff909116105b806118185750303b158015611818575060005460ff166001145b6118345760405162461bcd60e51b815260040161069190612725565b6000805460ff191660011790558015611857576000805461ff0019166101001790555b61185f611f24565b610b958383611f4b565b600054610100900460ff16158080156118895750600054600160ff909116105b806118a35750303b1580156118a3575060005460ff166001145b6118bf5760405162461bcd60e51b815260040161069190612725565b6000805460ff1916600117905580156118e2576000805461ff0019166101001790555b6118ea611f24565b610ac261201c565b600054610100900460ff16158080156119125750600054600160ff909116105b8061192c5750303b15801561192c575060005460ff166001145b6119485760405162461bcd60e51b815260040161069190612725565b6000805460ff19166001179055801561196b576000805461ff0019166101001790555b611973611f24565b6118ea6120c4565b600080600084116119c75760405162461bcd60e51b815260206004820152601660248201527504552433230536e617073686f743a20696420697320360541b6044820152606401610691565b60fe54841115611a195760405162461bcd60e51b815260206004820152601d60248201527f4552433230536e617073686f743a206e6f6e6578697374656e742069640000006044820152606401610691565b6000611a2584866120f7565b8454909150811415611a3e576000809250925050611a74565b6001846001018281548110611a6357634e487b7160e01b600052603260045260246000fd5b906000526020600020015492509250505b9250929050565b603380546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6000611add60fe80546001019055565b6000611ae860fe5490565b90507f8030e83b04d87bef53480e26263266d6ca66863aa8506aca6f2559d18aa1cb6781604051611b1b91815260200190565b60405180910390a1905090565b6001600160a01b038216611b885760405162461bcd60e51b815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f206164647265736044820152607360f81b6064820152608401610691565b611b9482600083611e5b565b6001600160a01b03821660009081526065602052604090205481811015611c085760405162461bcd60e51b815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e604482015261636560f01b6064820152608401610691565b611c12828261285f565b6001600160a01b03841660009081526065602052604081209190915560678054849290611c4090849061285f565b90915550506040518281526000906001600160a01b0385169060008051602061291983398151915290602001611537565b6001600160a01b038316611cd55760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610691565b6001600160a01b038216611cfb5760405162461bcd60e51b81526004016106919061269c565b611d06838383611e5b565b6001600160a01b03831660009081526065602052604090205481811015611d3f5760405162461bcd60e51b8152600401610691906126df565b611d49828261285f565b6001600160a01b038086166000908152606560205260408082209390935590851681529081208054849290611d7f908490612808565b92505081905550826001600160a01b0316846001600160a01b031660008051602061291983398151915284604051611db991815260200190565b60405180910390a350505050565b6000611dd260fe5490565b905080611dde846121a2565b1015610bca578254600180820185556000858152602080822090930193909355938401805494850181558252902090910155565b60975460ff16610a215760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b6044820152606401610691565b6000611e6960975460ff1690565b90506001600160a01b038316611e87578015611e8757611e87611647565b611e928484846121f3565b6001600160a01b038316611617578015611617576116176117a1565b600054610100900460ff16611ed55760405162461bcd60e51b815260040161069190612773565b610a2133611a7b565b60975460ff1615610a215760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b6044820152606401610691565b600054610100900460ff16610a215760405162461bcd60e51b815260040161069190612773565b600054610100900460ff1615808015611f6b5750600054600160ff909116105b80611f855750303b158015611f85575060005460ff166001145b611fa15760405162461bcd60e51b815260040161069190612725565b6000805460ff191660011790558015611fc4576000805461ff0019166101001790555b8251611fd790606890602086019061229e565b508151611feb90606990602085019061229e565b508015610bca576000805461ff0019169055604051600181526000805160206128f983398151915290602001610bc1565b600054610100900460ff161580801561203c5750600054600160ff909116105b806120565750303b158015612056575060005460ff166001145b6120725760405162461bcd60e51b815260040161069190612725565b6000805460ff191660011790558015610ac2576000805461ff0019166101001790558015610af7576000805461ff0019169055604051600181526000805160206128f983398151915290602001610aee565b600054610100900460ff166120eb5760405162461bcd60e51b815260040161069190612773565b6097805460ff19169055565b8154600090612108575060006105b6565b82546000905b80821015612155576000612122838361224b565b600087815260209020909150859082015411156121415780915061214f565b61214c816001612808565b92505b5061210e565b60008211801561218157508361217e8661217060018661285f565b600091825260209091200190565b54145b1561219a5761219160018361285f565b925050506105b6565b5090506105b6565b80546000906121b357506000610ca2565b815482906121c39060019061285f565b815481106121e157634e487b7160e01b600052603260045260246000fd5b90600052602060002001549050610ca2565b6121fe83838361226d565b6001600160a01b038316612222576122158261161d565b61221d612290565b610bca565b6001600160a01b038216612239576122158361161d565b6122428361161d565b610bca8261161d565b600061225a6002848418612820565b61226690848416612808565b9392505050565b60975460ff1615610bca5760405162461bcd60e51b8152600401610691906127be565b610a2160fc61164260675490565b8280546122aa90612876565b90600052602060002090601f0160209004810192826122cc5760008555612312565b82601f106122e557805160ff1916838001178555612312565b82800160010185558215612312579182015b828111156123125782518255916020019190600101906122f7565b5061231e929150612322565b5090565b5b8082111561231e5760008155600101612323565b80356001600160a01b0381168114610ca257600080fd5b60008083601f84011261235f578081fd5b50813567ffffffffffffffff811115612376578182fd5b6020830191508360208260051b8501011115611a7457600080fd5b600082601f8301126123a1578081fd5b813567ffffffffffffffff808211156123bc576123bc6128e2565b604051601f8301601f19908116603f011681019082821181831017156123e4576123e46128e2565b816040528381528660208588010111156123fc578485fd5b8360208701602083013792830160200193909352509392505050565b600060208284031215612429578081fd5b61226682612337565b60008060408385031215612444578081fd5b61244d83612337565b915061245b60208401612337565b90509250929050565b600080600060608486031215612478578081fd5b61248184612337565b925061248f60208501612337565b9150604084013590509250925092565b6000806000806000606086880312156124b6578081fd5b6124bf86612337565b9450602086013567ffffffffffffffff808211156124db578283fd5b6124e789838a0161234e565b909650945060408801359150808211156124ff578283fd5b5061250c8882890161234e565b969995985093965092949392505050565b6000806040838503121561252f578182fd5b61253883612337565b946020939093013593505050565b6000806000806040858703121561255b578384fd5b843567ffffffffffffffff80821115612572578586fd5b61257e8883890161234e565b90965094506020870135915080821115612596578384fd5b506125a38782880161234e565b95989497509550505050565b600080604083850312156125c1578182fd5b823567ffffffffffffffff808211156125d8578384fd5b6125e486838701612391565b935060208501359150808211156125f9578283fd5b5061260685828601612391565b9150509250929050565b600060208284031215612621578081fd5b5035919050565b6000806040838503121561263a578182fd5b50508035926020909101359150565b6000602080835283518082850152825b8181101561267557858101830151858201604001528201612659565b818111156126865783604083870101525b50601f01601f1916929092016040019392505050565b60208082526023908201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260408201526265737360e81b606082015260800190565b60208082526026908201527f45524332303a207472616e7366657220616d6f756e7420657863656564732062604082015265616c616e636560d01b606082015260800190565b6020808252602e908201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160408201526d191e481a5b9a5d1a585b1a5e995960921b606082015260800190565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b6020808252602a908201527f45524332305061757361626c653a20746f6b656e207472616e736665722077686040820152691a5b19481c185d5cd95960b21b606082015260800190565b6000821982111561281b5761281b6128cc565b500190565b60008261283b57634e487b7160e01b81526012600452602481fd5b500490565b600081600019048311821515161561285a5761285a6128cc565b500290565b600082821015612871576128716128cc565b500390565b600181811c9082168061288a57607f821691505b602082108114156128ab57634e487b7160e01b600052602260045260246000fd5b50919050565b60006000198214156128c5576128c56128cc565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fdfe7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa26469706673582212205e1aee4c89f24b3ab79c89f9f571d0e0f115f6bbcdb1af1c2f533c173936ee2c64736f6c63430008030033
Deployed Bytecode
0x608060405234801561001057600080fd5b506004361061021c5760003560e01c806370a0823111610125578063a457c2d7116100ad578063e9825ffa1161007c578063e9825ffa14610463578063f2fde38b14610476578063f6dd8f7514610489578063f8f5f0b31461049c578063fbc1284f146104c05761021c565b8063a457c2d7146103f0578063a9059cbb14610403578063d85b975614610416578063dd62ed3e1461042a5761021c565b80639316c3e7116100f45780639316c3e7146103a757806395d89b41146103ba5780639711715a146103c2578063981b24d0146103ca5780639dc29fac146103dd5761021c565b806370a082311461035f578063715018a6146103725780638456cb591461037a5780638da5cb5b146103825761021c565b806339509351116101a85780634cd88b76116101775780634cd88b76146103115780634ee2cd7e146103245780635c975abb14610337578063634b384114610342578063691f224f146103555761021c565b806339509351146102db5780633f4ba83a146102ee57806340c10f19146102f65780634c10879d146103095761021c565b806318160ddd116101ef57806318160ddd1461028a57806323b872dd1461029c57806324024efd146102af578063307b8a02146102b9578063313ce567146102cc5761021c565b806306fdde031461022157806308b704ac1461023f578063095ea7b3146102545780631672ba2214610277575b600080fd5b6102296104d3565b6040516102369190612649565b60405180910390f35b61025261024d366004612418565b610565565b005b61026761026236600461251d565b6105a5565b6040519015158152602001610236565b610252610285366004612418565b6105bc565b6067545b604051908152602001610236565b6102676102aa366004612464565b610603565b61028e61012f5481565b6102676102c736600461249f565b6106b9565b60405160128152602001610236565b6102676102e936600461251d565b6109da565b610252610a11565b61025261030436600461251d565b610a23565b610252610a39565b61025261031f3660046125af565b610afa565b61028e61033236600461251d565b610bcf565b60975460ff16610267565b610252610350366004612628565b610c18565b61028e61012e5481565b61028e61036d366004612418565b610c88565b610252610ca7565b610252610cb9565b6033546001600160a01b03165b6040516001600160a01b039091168152602001610236565b6102676103b5366004612546565b610cc9565b610229610f57565b61028e610f66565b61028e6103d8366004612610565b610ff6565b6102526103eb36600461251d565b611021565b6102676103fe36600461251d565b611033565b61026761041136600461251d565b6110ce565b6101315461038f906001600160a01b031681565b61028e610438366004612432565b6001600160a01b03918216600090815260666020908152604080832093909416825291909152205490565b610252610471366004612418565b6110db565b610252610484366004612418565b6111a8565b610252610497366004612546565b61121e565b6102676104aa366004612418565b6101306020526000908152604090205460ff1681565b6102526104ce366004612418565b6112f0565b6060606880546104e290612876565b80601f016020809104026020016040519081016040528092919081815260200182805461050e90612876565b801561055b5780601f106105305761010080835404028352916020019161055b565b820191906000526020600020905b81548152906001019060200180831161053e57829003601f168201915b5050505050905090565b61056d6113c5565b6001600160a01b03811661058057600080fd5b6001600160a01b0316600090815261013060205260409020805460ff19166001179055565b60006105b233848461141f565b5060015b92915050565b6105c46113c5565b610131546001600160a01b03828116911614156105e057600080fd5b61013180546001600160a01b0319166001600160a01b0392909216919091179055565b6000610610848484611544565b6001600160a01b03841660009081526066602090815260408083203384529091529020548281101561069a5760405162461bcd60e51b815260206004820152602860248201527f45524332303a207472616e7366657220616d6f756e74206578636565647320616044820152676c6c6f77616e636560c01b60648201526084015b60405180910390fd5b6106ae85336106a9868561285f565b61141f565b506001949350505050565b60006106c36113c5565b60975460ff16156106e65760405162461bcd60e51b8152600401610691906127be565b8382146107305760405162461bcd60e51b8152602060048201526018602482015277092dcecc2d8d2c840c2e4ceeadacadce8e640d8cadccee8d60431b6044820152606401610691565b836000805b828110156107815785858281811061075d57634e487b7160e01b600052603260045260246000fd5b905060200201358261076f9190612808565b915061077a816128b1565b9050610735565b506001600160a01b0388166000908152606560205260409020548111156107ba5760405162461bcd60e51b8152600401610691906126df565b6001600160a01b03881660009081526066602090815260408083203384529091529020548181101561083e5760405162461bcd60e51b815260206004820152602760248201527f45524332303a207472616e7366657220746f74616c206578636565647320616c6044820152666c6f77616e636560c81b6064820152608401610691565b61084d89336106a9858561285f565b6001600160a01b0389166000908152606560205260408120805484929061087590849061285f565b9091555061088490508961161d565b60005b838110156109ca5760008989838181106108b157634e487b7160e01b600052603260045260246000fd5b90506020020160208101906108c69190612418565b90506001600160a01b0381166108ee5760405162461bcd60e51b81526004016106919061269c565b87878381811061090e57634e487b7160e01b600052603260045260246000fd5b9050602002013560656000836001600160a01b03166001600160a01b0316815260200190815260200160002060008282546109499190612808565b9091555061095890508161161d565b806001600160a01b03168b6001600160a01b03166000805160206129198339815191528a8a8681811061099b57634e487b7160e01b600052603260045260246000fd5b905060200201356040516109b191815260200190565b60405180910390a3506109c3816128b1565b9050610887565b5060019998505050505050505050565b3360008181526066602090815260408083206001600160a01b038716845290915281205490916105b29185906106a9908690612808565b610a196113c5565b610a21611647565b565b610a2b6113c5565b610a358282611699565b5050565b600054610100900460ff1615808015610a595750600054600160ff909116105b80610a735750303b158015610a73575060005460ff166001145b610a8f5760405162461bcd60e51b815260040161069190612725565b6000805460ff191660011790558015610ab2576000805461ff0019166101001790555b610aba611772565b610ac26117a1565b8015610af7576000805461ff0019169055604051600181526000805160206128f9833981519152906020015b60405180910390a15b50565b600054610100900460ff1615808015610b1a5750600054600160ff909116105b80610b345750303b158015610b34575060005460ff166001145b610b505760405162461bcd60e51b815260040161069190612725565b6000805460ff191660011790558015610b73576000805461ff0019166101001790555b610b7b611772565b610b8583836117de565b610b8d611869565b610b956118f2565b8015610bca576000805461ff0019169055604051600181526000805160206128f9833981519152906020015b60405180910390a15b505050565b6001600160a01b038216600090815260fb6020526040812081908190610bf690859061197b565b9150915081610c0d57610c0885610c88565b610c0f565b805b95945050505050565b610c206113c5565b8161012e5414158015610c3657508061012f5414155b610c3f57600080fd5b61012e82905561012f81905560408051838152602081018390527f0a915b823dc5304db7e024607ee0a48c27464798ca7178935e46965db7bd41e1910160405180910390a15050565b6001600160a01b0381166000908152606560205260409020545b919050565b610caf6113c5565b610a216000611a7b565b610cc16113c5565b610a216117a1565b6000610cd36113c5565b60975460ff1615610cf65760405162461bcd60e51b8152600401610691906127be565b838214610d405760405162461bcd60e51b8152602060048201526018602482015277092dcecc2d8d2c840c2e4ceeadacadce8e640d8cadccee8d60431b6044820152606401610691565b33846000805b82811015610d9257868682818110610d6e57634e487b7160e01b600052603260045260246000fd5b9050602002013582610d809190612808565b9150610d8b816128b1565b9050610d46565b506001600160a01b038316600090815260656020526040902054811115610dcb5760405162461bcd60e51b8152600401610691906126df565b6001600160a01b03831660009081526065602052604081208054839290610df390849061285f565b90915550610e0290508361161d565b60005b82811015610f48576000898983818110610e2f57634e487b7160e01b600052603260045260246000fd5b9050602002016020810190610e449190612418565b90506001600160a01b038116610e6c5760405162461bcd60e51b81526004016106919061269c565b878783818110610e8c57634e487b7160e01b600052603260045260246000fd5b9050602002013560656000836001600160a01b03166001600160a01b031681526020019081526020016000206000828254610ec79190612808565b90915550610ed690508161161d565b806001600160a01b0316856001600160a01b03166000805160206129198339815191528a8a86818110610f1957634e487b7160e01b600052603260045260246000fd5b90506020020135604051610f2f91815260200190565b60405180910390a350610f41816128b1565b9050610e05565b50600198975050505050505050565b6060606980546104e290612876565b33600090815261012d602052604081205460ff1680610f8f57506033546001600160a01b031633145b610fe95760405162461bcd60e51b815260206004820152602560248201527f7a44414f546f6b656e3a204e6f7420617574686f72697a656420746f20736e616044820152641c1cda1bdd60da1b6064820152608401610691565b610ff1611acd565b905090565b60008060006110068460fc61197b565b915091508161101757606754611019565b805b949350505050565b6110296113c5565b610a358282611b28565b3360009081526066602090815260408083206001600160a01b0386168452909152812054828110156110b55760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f77604482015264207a65726f60d81b6064820152608401610691565b6110c433856106a9868561285f565b5060019392505050565b60006105b2338484611544565b6110e36113c5565b6001600160a01b038116600090815261012d602052604090205460ff166111565760405162461bcd60e51b815260206004820152602160248201527f7a44414f546f6b656e3a204163636f756e74206e6f7420617574686f72697a656044820152601960fa1b6064820152608401610691565b6001600160a01b038116600081815261012d6020908152604091829020805460ff1916905590519182527f51f8ef0f426007e7662fabfb0a7d46d2e383ffe4f627aebfac09c281546877399101610aee565b6111b06113c5565b6001600160a01b0381166112155760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610691565b610af781611a7b565b6112266113c5565b8281146112685760405162461bcd60e51b815260206004820152601060248201526f125b9d985b1a5908185c99dd5b595b9d60821b6044820152606401610691565b8260005b818110156112e8576112d886868381811061129757634e487b7160e01b600052603260045260246000fd5b90506020020160208101906112ac9190612418565b8585848181106112cc57634e487b7160e01b600052603260045260246000fd5b90506020020135611b28565b6112e1816128b1565b905061126c565b505050505050565b6112f86113c5565b6001600160a01b038116600090815261012d602052604090205460ff16156113705760405162461bcd60e51b815260206004820152602560248201527f7a44414f546f6b656e3a204163636f756e7420616c726561647920617574686f6044820152641c9a5e995960da1b6064820152608401610691565b6001600160a01b038116600081815261012d6020908152604091829020805460ff1916600117905590519182527f2e457b8fcc8c01e995f48f89abb9cf6a72dce32622702d6ffa54c372be369ff99101610aee565b6033546001600160a01b03163314610a215760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610691565b6001600160a01b0383166114815760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610691565b6001600160a01b0382166114e25760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610691565b6001600160a01b0383811660008181526066602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591015b60405180910390a3505050565b6001600160a01b0382166000908152610130602052604081205460ff16156115895761271061012f54836115789190612840565b6115829190612820565b90506115ca565b6001600160a01b0384166000908152610130602052604090205460ff16156115ca5761271061012e54836115bd9190612840565b6115c79190612820565b90505b6115de84846115d9848661285f565b611c71565b610131546001600160a01b0316158015906115f95750600081115b1561161757610131546116179085906001600160a01b031683611c71565b50505050565b6001600160a01b038116600090815260fb60205260409020610af79061164283610c88565b611dc7565b61164f611e12565b6097805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b6001600160a01b0382166116ef5760405162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f2061646472657373006044820152606401610691565b6116fb60008383611e5b565b806067600082825461170d9190612808565b90915550506001600160a01b0382166000908152606560205260408120805483929061173a908490612808565b90915550506040518181526001600160a01b038316906000906000805160206129198339815191529060200160405180910390a35050565b600054610100900460ff166117995760405162461bcd60e51b815260040161069190612773565b610a21611eae565b6117a9611ede565b6097805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a25861167c3390565b600054610100900460ff16158080156117fe5750600054600160ff909116105b806118185750303b158015611818575060005460ff166001145b6118345760405162461bcd60e51b815260040161069190612725565b6000805460ff191660011790558015611857576000805461ff0019166101001790555b61185f611f24565b610b958383611f4b565b600054610100900460ff16158080156118895750600054600160ff909116105b806118a35750303b1580156118a3575060005460ff166001145b6118bf5760405162461bcd60e51b815260040161069190612725565b6000805460ff1916600117905580156118e2576000805461ff0019166101001790555b6118ea611f24565b610ac261201c565b600054610100900460ff16158080156119125750600054600160ff909116105b8061192c5750303b15801561192c575060005460ff166001145b6119485760405162461bcd60e51b815260040161069190612725565b6000805460ff19166001179055801561196b576000805461ff0019166101001790555b611973611f24565b6118ea6120c4565b600080600084116119c75760405162461bcd60e51b815260206004820152601660248201527504552433230536e617073686f743a20696420697320360541b6044820152606401610691565b60fe54841115611a195760405162461bcd60e51b815260206004820152601d60248201527f4552433230536e617073686f743a206e6f6e6578697374656e742069640000006044820152606401610691565b6000611a2584866120f7565b8454909150811415611a3e576000809250925050611a74565b6001846001018281548110611a6357634e487b7160e01b600052603260045260246000fd5b906000526020600020015492509250505b9250929050565b603380546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6000611add60fe80546001019055565b6000611ae860fe5490565b90507f8030e83b04d87bef53480e26263266d6ca66863aa8506aca6f2559d18aa1cb6781604051611b1b91815260200190565b60405180910390a1905090565b6001600160a01b038216611b885760405162461bcd60e51b815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f206164647265736044820152607360f81b6064820152608401610691565b611b9482600083611e5b565b6001600160a01b03821660009081526065602052604090205481811015611c085760405162461bcd60e51b815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e604482015261636560f01b6064820152608401610691565b611c12828261285f565b6001600160a01b03841660009081526065602052604081209190915560678054849290611c4090849061285f565b90915550506040518281526000906001600160a01b0385169060008051602061291983398151915290602001611537565b6001600160a01b038316611cd55760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610691565b6001600160a01b038216611cfb5760405162461bcd60e51b81526004016106919061269c565b611d06838383611e5b565b6001600160a01b03831660009081526065602052604090205481811015611d3f5760405162461bcd60e51b8152600401610691906126df565b611d49828261285f565b6001600160a01b038086166000908152606560205260408082209390935590851681529081208054849290611d7f908490612808565b92505081905550826001600160a01b0316846001600160a01b031660008051602061291983398151915284604051611db991815260200190565b60405180910390a350505050565b6000611dd260fe5490565b905080611dde846121a2565b1015610bca578254600180820185556000858152602080822090930193909355938401805494850181558252902090910155565b60975460ff16610a215760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b6044820152606401610691565b6000611e6960975460ff1690565b90506001600160a01b038316611e87578015611e8757611e87611647565b611e928484846121f3565b6001600160a01b038316611617578015611617576116176117a1565b600054610100900460ff16611ed55760405162461bcd60e51b815260040161069190612773565b610a2133611a7b565b60975460ff1615610a215760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b6044820152606401610691565b600054610100900460ff16610a215760405162461bcd60e51b815260040161069190612773565b600054610100900460ff1615808015611f6b5750600054600160ff909116105b80611f855750303b158015611f85575060005460ff166001145b611fa15760405162461bcd60e51b815260040161069190612725565b6000805460ff191660011790558015611fc4576000805461ff0019166101001790555b8251611fd790606890602086019061229e565b508151611feb90606990602085019061229e565b508015610bca576000805461ff0019169055604051600181526000805160206128f983398151915290602001610bc1565b600054610100900460ff161580801561203c5750600054600160ff909116105b806120565750303b158015612056575060005460ff166001145b6120725760405162461bcd60e51b815260040161069190612725565b6000805460ff191660011790558015610ac2576000805461ff0019166101001790558015610af7576000805461ff0019169055604051600181526000805160206128f983398151915290602001610aee565b600054610100900460ff166120eb5760405162461bcd60e51b815260040161069190612773565b6097805460ff19169055565b8154600090612108575060006105b6565b82546000905b80821015612155576000612122838361224b565b600087815260209020909150859082015411156121415780915061214f565b61214c816001612808565b92505b5061210e565b60008211801561218157508361217e8661217060018661285f565b600091825260209091200190565b54145b1561219a5761219160018361285f565b925050506105b6565b5090506105b6565b80546000906121b357506000610ca2565b815482906121c39060019061285f565b815481106121e157634e487b7160e01b600052603260045260246000fd5b90600052602060002001549050610ca2565b6121fe83838361226d565b6001600160a01b038316612222576122158261161d565b61221d612290565b610bca565b6001600160a01b038216612239576122158361161d565b6122428361161d565b610bca8261161d565b600061225a6002848418612820565b61226690848416612808565b9392505050565b60975460ff1615610bca5760405162461bcd60e51b8152600401610691906127be565b610a2160fc61164260675490565b8280546122aa90612876565b90600052602060002090601f0160209004810192826122cc5760008555612312565b82601f106122e557805160ff1916838001178555612312565b82800160010185558215612312579182015b828111156123125782518255916020019190600101906122f7565b5061231e929150612322565b5090565b5b8082111561231e5760008155600101612323565b80356001600160a01b0381168114610ca257600080fd5b60008083601f84011261235f578081fd5b50813567ffffffffffffffff811115612376578182fd5b6020830191508360208260051b8501011115611a7457600080fd5b600082601f8301126123a1578081fd5b813567ffffffffffffffff808211156123bc576123bc6128e2565b604051601f8301601f19908116603f011681019082821181831017156123e4576123e46128e2565b816040528381528660208588010111156123fc578485fd5b8360208701602083013792830160200193909352509392505050565b600060208284031215612429578081fd5b61226682612337565b60008060408385031215612444578081fd5b61244d83612337565b915061245b60208401612337565b90509250929050565b600080600060608486031215612478578081fd5b61248184612337565b925061248f60208501612337565b9150604084013590509250925092565b6000806000806000606086880312156124b6578081fd5b6124bf86612337565b9450602086013567ffffffffffffffff808211156124db578283fd5b6124e789838a0161234e565b909650945060408801359150808211156124ff578283fd5b5061250c8882890161234e565b969995985093965092949392505050565b6000806040838503121561252f578182fd5b61253883612337565b946020939093013593505050565b6000806000806040858703121561255b578384fd5b843567ffffffffffffffff80821115612572578586fd5b61257e8883890161234e565b90965094506020870135915080821115612596578384fd5b506125a38782880161234e565b95989497509550505050565b600080604083850312156125c1578182fd5b823567ffffffffffffffff808211156125d8578384fd5b6125e486838701612391565b935060208501359150808211156125f9578283fd5b5061260685828601612391565b9150509250929050565b600060208284031215612621578081fd5b5035919050565b6000806040838503121561263a578182fd5b50508035926020909101359150565b6000602080835283518082850152825b8181101561267557858101830151858201604001528201612659565b818111156126865783604083870101525b50601f01601f1916929092016040019392505050565b60208082526023908201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260408201526265737360e81b606082015260800190565b60208082526026908201527f45524332303a207472616e7366657220616d6f756e7420657863656564732062604082015265616c616e636560d01b606082015260800190565b6020808252602e908201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160408201526d191e481a5b9a5d1a585b1a5e995960921b606082015260800190565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b6020808252602a908201527f45524332305061757361626c653a20746f6b656e207472616e736665722077686040820152691a5b19481c185d5cd95960b21b606082015260800190565b6000821982111561281b5761281b6128cc565b500190565b60008261283b57634e487b7160e01b81526012600452602481fd5b500490565b600081600019048311821515161561285a5761285a6128cc565b500290565b600082821015612871576128716128cc565b500390565b600181811c9082168061288a57607f821691505b602082108114156128ab57634e487b7160e01b600052602260045260246000fd5b50919050565b60006000198214156128c5576128c56128cc565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fdfe7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa26469706673582212205e1aee4c89f24b3ab79c89f9f571d0e0f115f6bbcdb1af1c2f533c173936ee2c64736f6c63430008030033
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 30 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
Loading...
Loading
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.