Warning! Contract bytecode has been changed and doesn't match the verified one. Therefore, interaction with this smart contract may be risky.
- Contract name:
- EKG
- Optimization enabled
- false
- Compiler version
- v0.8.24+commit.e11b9ed9
- EVM Version
- Verified at
- 2026-09-17T19:05:30.493897Z
Constructor Arguments
000000000000000000000000ad5c70588101d168b52577004a3a209ab90ab49a000000000000000000000000da5734cd1013359bfea1943ee4b109f87e916a89
Arg [0] (address) : 0xad5c70588101d168b52577004a3a209ab90ab49a
Arg [1] (address) : 0xda5734cd1013359bfea1943ee4b109f87e916a89
contracts/EKG.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.24;
import {ERC20} from "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import {ReentrancyGuard} from "@openzeppelin/contracts/utils/ReentrancyGuard.sol";
import {SafeCast} from "@openzeppelin/contracts/utils/math/SafeCast.sol";
/// @title EKG
/// @notice Fixed cap token. Minted only by the Mine contract, on a schedule that
/// cannot be changed. Holders accrue native PLS with no lock and no
/// registration: the Mine pushes a share of every commit in here and it
/// is split across every eligible holder by balance.
contract EKG is ERC20, ReentrancyGuard {
using SafeCast for uint256;
uint256 public constant CAP = 369_000_000e18;
/// @dev The magnitude of the dividend accumulator. 2**64 leaves enormous
/// headroom for precision (a single PLS spread across the full cap
/// still moves this by tens of thousands) while keeping
/// `perTokenAccrued * balance` far below 2**256 in every reachable
/// state, including a supply that has been burned down to dust. At
/// 2**128 a single donation made against a tiny supply could push the
/// product past 2**256 and make every transfer and every mint revert
/// forever, with no owner and no way back.
uint256 private constant MAG = 2 ** 64;
address public immutable minter;
/// @notice The buy and burn contract. The only address allowed to destroy
/// tokens, and it only ever destroys what it has just bought off
/// the open market with its own PLS.
address public immutable buyBurn;
/// @notice The denominator the dividend accumulator is never divided by
/// anything smaller than. Dividing by a supply of a few wei would
/// magnify one PLS into a number large enough to overflow every
/// later transfer and mint, permanently, with no owner and no way
/// back. Below this the remainder simply is not credited.
uint256 public constant MIN_ELIGIBLE = 1e18;
// Dividend accounting. Accrual is per eligible token, so addresses that are
// excluded (pools, protocol contracts) never take a share that nobody can claim.
uint256 public perTokenAccrued;
uint256 public eligibleSupply;
uint256 public totalDistributed;
mapping(address => int256) private _corrections;
mapping(address => uint256) public withdrawn;
mapping(address => bool) public excluded;
event Distributed(uint256 amount, uint256 perTokenAccrued);
event Claimed(address indexed account, uint256 amount);
event ExclusionSet(address indexed account, bool excluded);
error NotMinter();
error CapExceeded();
error NothingToClaim();
error TransferFailed();
error NoEligibleSupply();
error CannotUnexclude();
error NotTheBurner();
error CannotSendToProtocol();
constructor(address minter_, address buyBurn_) ERC20("EKG", "EKG") {
minter = minter_;
buyBurn = buyBurn_;
}
// ---------------------------------------------------------------- minting
function mint(address to, uint256 amount) external {
if (msg.sender != minter) revert NotMinter();
if (totalSupply() + amount > CAP) revert CapExceeded();
_mint(to, amount);
}
/// @notice Burning is not open, and that is deliberate.
///
/// Supply leaving this token is supposed to mean one thing: the
/// protocol went to the market, paid the going price, and destroyed
/// what it bought. An open burn would let anyone shrink the supply
/// without paying anybody for it, which reads on a chart exactly
/// like the real thing and is worth nothing to a holder.
///
/// So the authority to burn sits with the buy and burn contract,
/// and that contract has no code path that burns anything except
/// its own balance, which it can only obtain by buying.
function burnFrom(address account, uint256 amount) external {
if (msg.sender != buyBurn) revert NotTheBurner();
_spendAllowance(account, msg.sender, amount);
_burn(account, amount);
}
// ------------------------------------------------------------- exclusions
/// @notice Excluding an address is one way and only the Mine can do it.
/// The Mine only ever excludes its own contracts and the trading
/// pair, and it can only do each of those once. Nothing can be
/// brought back in, so this can never be used to wipe a holder's
/// accrued dividends twice or to game the split.
function setExcluded(address account, bool value) external {
if (msg.sender != minter) revert NotMinter();
if (!value) revert CannotUnexclude();
if (excluded[account]) return;
excluded[account] = true;
uint256 bal = balanceOf(account);
if (bal > 0) {
eligibleSupply -= bal;
_corrections[account] = 0;
}
emit ExclusionSet(account, true);
}
// -------------------------------------------------------------- dividends
/// @notice Anyone may push PLS to every holder. The Mine does it on each commit.
function distribute() external payable {
_distribute();
}
function _distribute() internal {
if (msg.value == 0) return;
if (eligibleSupply == 0) revert NoEligibleSupply();
uint256 denom = eligibleSupply < MIN_ELIGIBLE ? MIN_ELIGIBLE : eligibleSupply;
perTokenAccrued += (msg.value * MAG) / denom;
totalDistributed += msg.value;
emit Distributed(msg.value, perTokenAccrued);
}
function accumulated(address account) public view returns (uint256) {
if (excluded[account]) return 0;
int256 raw = int256(perTokenAccrued * balanceOf(account)) + _corrections[account];
if (raw < 0) return 0;
return uint256(raw) / MAG;
}
function claimable(address account) public view returns (uint256) {
uint256 total = accumulated(account);
uint256 taken = withdrawn[account];
return total > taken ? total - taken : 0;
}
function claim() external nonReentrant {
uint256 amount = claimable(msg.sender);
if (amount == 0) revert NothingToClaim();
withdrawn[msg.sender] += amount;
(bool ok,) = msg.sender.call{value: amount}("");
if (!ok) revert TransferFailed();
emit Claimed(msg.sender, amount);
}
// --------------------------------------------------------------- internal
function _update(address from, address to, uint256 value) internal override {
super._update(from, to, value);
// Checked before the zero-value shortcut, so a zero transfer cannot be
// used to fake a Transfer event to a protocol address.
// The buy and burn contract is deliberately NOT on this list. It has to
// be able to receive EKG, because receiving EKG from the pool is how a
// buyback works, and anything else sent there is destroyed on the next
// call rather than stranded.
// MINTING to the minter is allowed (from == 0): openMine() mints the
// founding pool's EKG side into the Mine and spends it into the pair in
// the same transaction. A TRANSFER to the minter stays blocked, because
// tokens sent there by hand would be stranded forever.
if ((to == minter && from != address(0)) || to == address(this)) revert CannotSendToProtocol();
if (value == 0) return;
bool fromEligible = from != address(0) && !excluded[from];
bool toEligible = to != address(0) && !excluded[to];
// Checked rather than cast: a silent wrap here would corrupt the
// account's correction and freeze its balance forever.
int256 delta = (perTokenAccrued * value).toInt256();
if (fromEligible) _corrections[from] += delta;
if (toEligible) _corrections[to] -= delta;
if (fromEligible && !toEligible) eligibleSupply -= value;
else if (!fromEligible && toEligible) eligibleSupply += value;
}
/// @notice A plain transfer is a donation to every holder. It reverts
/// rather than swallowing PLS when there is nobody to pay.
receive() external payable {
_distribute();
}
}
@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.4.0) (token/ERC20/extensions/IERC20Metadata.sol)
pragma solidity >=0.6.2;
import {IERC20} from "../IERC20.sol";
/**
* @dev Interface for the optional metadata functions from the ERC-20 standard.
*/
interface IERC20Metadata is IERC20 {
/**
* @dev Returns the name of the token.
*/
function name() external view returns (string memory);
/**
* @dev Returns the symbol of the token.
*/
function symbol() external view returns (string memory);
/**
* @dev Returns the decimals places of the token.
*/
function decimals() external view returns (uint8);
}
@openzeppelin/contracts/token/ERC20/ERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.5.0) (token/ERC20/ERC20.sol)
pragma solidity ^0.8.20;
import {IERC20} from "./IERC20.sol";
import {IERC20Metadata} from "./extensions/IERC20Metadata.sol";
import {Context} from "../../utils/Context.sol";
import {IERC20Errors} from "../../interfaces/draft-IERC6093.sol";
/**
* @dev Implementation of the {IERC20} interface.
*
* This implementation is agnostic to the way tokens are created. This means
* that a supply mechanism has to be added in a derived contract using {_mint}.
*
* TIP: For a detailed writeup see our guide
* https://forum.openzeppelin.com/t/how-to-implement-erc20-supply-mechanisms/226[How
* to implement supply mechanisms].
*
* The default value of {decimals} is 18. To change this, you should override
* this function so it returns a different value.
*
* We have followed general OpenZeppelin Contracts guidelines: functions revert
* instead returning `false` on failure. This behavior is nonetheless
* conventional and does not conflict with the expectations of ERC-20
* applications.
*/
abstract contract ERC20 is Context, IERC20, IERC20Metadata, IERC20Errors {
mapping(address account => uint256) private _balances;
mapping(address account => mapping(address spender => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private _symbol;
/**
* @dev Sets the values for {name} and {symbol}.
*
* Both values are immutable: they can only be set once during construction.
*/
constructor(string memory name_, string memory symbol_) {
_name = name_;
_symbol = symbol_;
}
/**
* @dev Returns the name of the token.
*/
function name() public view virtual returns (string memory) {
return _name;
}
/**
* @dev Returns the symbol of the token, usually a shorter version of the
* name.
*/
function symbol() public view virtual returns (string memory) {
return _symbol;
}
/**
* @dev Returns the number of decimals used to get its user representation.
* For example, if `decimals` equals `2`, a balance of `505` tokens should
* be displayed to a user as `5.05` (`505 / 10 ** 2`).
*
* Tokens usually opt for a value of 18, imitating the relationship between
* Ether and Wei. This is the default value returned by this function, unless
* it's overridden.
*
* NOTE: This information is only used for _display_ purposes: it in
* no way affects any of the arithmetic of the contract, including
* {IERC20-balanceOf} and {IERC20-transfer}.
*/
function decimals() public view virtual returns (uint8) {
return 18;
}
/// @inheritdoc IERC20
function totalSupply() public view virtual returns (uint256) {
return _totalSupply;
}
/// @inheritdoc IERC20
function balanceOf(address account) public view virtual returns (uint256) {
return _balances[account];
}
/**
* @dev See {IERC20-transfer}.
*
* Requirements:
*
* - `to` cannot be the zero address.
* - the caller must have a balance of at least `value`.
*/
function transfer(address to, uint256 value) public virtual returns (bool) {
address owner = _msgSender();
_transfer(owner, to, value);
return true;
}
/// @inheritdoc IERC20
function allowance(address owner, address spender) public view virtual returns (uint256) {
return _allowances[owner][spender];
}
/**
* @dev See {IERC20-approve}.
*
* NOTE: If `value` is the maximum `uint256`, the allowance is not updated on
* `transferFrom`. This is semantically equivalent to an infinite approval.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function approve(address spender, uint256 value) public virtual returns (bool) {
address owner = _msgSender();
_approve(owner, spender, value);
return true;
}
/**
* @dev See {IERC20-transferFrom}.
*
* Skips emitting an {Approval} event indicating an allowance update. This is not
* required by the ERC. See {xref-ERC20-_approve-address-address-uint256-bool-}[_approve].
*
* NOTE: Does not update the allowance if the current allowance
* is the maximum `uint256`.
*
* Requirements:
*
* - `from` and `to` cannot be the zero address.
* - `from` must have a balance of at least `value`.
* - the caller must have allowance for ``from``'s tokens of at least
* `value`.
*/
function transferFrom(address from, address to, uint256 value) public virtual returns (bool) {
address spender = _msgSender();
_spendAllowance(from, spender, value);
_transfer(from, to, value);
return true;
}
/**
* @dev Moves a `value` amount of tokens from `from` to `to`.
*
* This internal function is equivalent to {transfer}, and can be used to
* e.g. implement automatic token fees, slashing mechanisms, etc.
*
* Emits a {Transfer} event.
*
* NOTE: This function is not virtual, {_update} should be overridden instead.
*/
function _transfer(address from, address to, uint256 value) internal {
if (from == address(0)) {
revert ERC20InvalidSender(address(0));
}
if (to == address(0)) {
revert ERC20InvalidReceiver(address(0));
}
_update(from, to, value);
}
/**
* @dev Transfers a `value` amount of tokens from `from` to `to`, or alternatively mints (or burns) if `from`
* (or `to`) is the zero address. All customizations to transfers, mints, and burns should be done by overriding
* this function.
*
* Emits a {Transfer} event.
*/
function _update(address from, address to, uint256 value) internal virtual {
if (from == address(0)) {
// Overflow check required: The rest of the code assumes that totalSupply never overflows
_totalSupply += value;
} else {
uint256 fromBalance = _balances[from];
if (fromBalance < value) {
revert ERC20InsufficientBalance(from, fromBalance, value);
}
unchecked {
// Overflow not possible: value <= fromBalance <= totalSupply.
_balances[from] = fromBalance - value;
}
}
if (to == address(0)) {
unchecked {
// Overflow not possible: value <= totalSupply or value <= fromBalance <= totalSupply.
_totalSupply -= value;
}
} else {
unchecked {
// Overflow not possible: balance + value is at most totalSupply, which we know fits into a uint256.
_balances[to] += value;
}
}
emit Transfer(from, to, value);
}
/**
* @dev Creates a `value` amount of tokens and assigns them to `account`, by transferring it from address(0).
* Relies on the `_update` mechanism
*
* Emits a {Transfer} event with `from` set to the zero address.
*
* NOTE: This function is not virtual, {_update} should be overridden instead.
*/
function _mint(address account, uint256 value) internal {
if (account == address(0)) {
revert ERC20InvalidReceiver(address(0));
}
_update(address(0), account, value);
}
/**
* @dev Destroys a `value` amount of tokens from `account`, lowering the total supply.
* Relies on the `_update` mechanism.
*
* Emits a {Transfer} event with `to` set to the zero address.
*
* NOTE: This function is not virtual, {_update} should be overridden instead
*/
function _burn(address account, uint256 value) internal {
if (account == address(0)) {
revert ERC20InvalidSender(address(0));
}
_update(account, address(0), value);
}
/**
* @dev Sets `value` as the allowance of `spender` over the `owner`'s tokens.
*
* This internal function is equivalent to `approve`, and can be used to
* e.g. set automatic allowances for certain subsystems, etc.
*
* Emits an {Approval} event.
*
* Requirements:
*
* - `owner` cannot be the zero address.
* - `spender` cannot be the zero address.
*
* Overrides to this logic should be done to the variant with an additional `bool emitEvent` argument.
*/
function _approve(address owner, address spender, uint256 value) internal {
_approve(owner, spender, value, true);
}
/**
* @dev Variant of {_approve} with an optional flag to enable or disable the {Approval} event.
*
* By default (when calling {_approve}) the flag is set to true. On the other hand, approval changes made by
* `_spendAllowance` during the `transferFrom` operation sets the flag to false. This saves gas by not emitting any
* `Approval` event during `transferFrom` operations.
*
* Anyone who wishes to continue emitting `Approval` events on the `transferFrom` operation can force the flag to
* true using the following override:
*
* ```solidity
* function _approve(address owner, address spender, uint256 value, bool) internal virtual override {
* super._approve(owner, spender, value, true);
* }
* ```
*
* Requirements are the same as {_approve}.
*/
function _approve(address owner, address spender, uint256 value, bool emitEvent) internal virtual {
if (owner == address(0)) {
revert ERC20InvalidApprover(address(0));
}
if (spender == address(0)) {
revert ERC20InvalidSpender(address(0));
}
_allowances[owner][spender] = value;
if (emitEvent) {
emit Approval(owner, spender, value);
}
}
/**
* @dev Updates `owner`'s allowance for `spender` based on spent `value`.
*
* Does not update the allowance value in case of infinite allowance.
* Revert if not enough allowance is available.
*
* Does not emit an {Approval} event.
*/
function _spendAllowance(address owner, address spender, uint256 value) internal virtual {
uint256 currentAllowance = allowance(owner, spender);
if (currentAllowance < type(uint256).max) {
if (currentAllowance < value) {
revert ERC20InsufficientAllowance(spender, currentAllowance, value);
}
unchecked {
_approve(owner, spender, currentAllowance - value, false);
}
}
}
}
@openzeppelin/contracts/token/ERC20/IERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.4.0) (token/ERC20/IERC20.sol)
pragma solidity >=0.4.16;
/**
* @dev Interface of the ERC-20 standard as defined in the ERC.
*/
interface IERC20 {
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
/**
* @dev Returns the value of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the value of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves a `value` amount of tokens from the caller's account to `to`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address to, uint256 value) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets a `value` amount of tokens as the allowance of `spender` over the
* caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 value) external returns (bool);
/**
* @dev Moves a `value` amount of tokens from `from` to `to` using the
* allowance mechanism. `value` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(address from, address to, uint256 value) external returns (bool);
}
@openzeppelin/contracts/utils/Context.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol)
pragma solidity ^0.8.20;
/**
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
function _contextSuffixLength() internal view virtual returns (uint256) {
return 0;
}
}
@openzeppelin/contracts/utils/math/SafeCast.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.6.0) (utils/math/SafeCast.sol)
// This file was procedurally generated from scripts/generate/templates/SafeCast.js.
pragma solidity ^0.8.20;
/**
* @dev Wrappers over Solidity's uintXX/intXX/bool casting operators with added overflow
* checks.
*
* Downcasting from uint256/int256 in Solidity does not revert on overflow. This can
* easily result in undesired exploitation or bugs, since developers usually
* assume that overflows raise errors. `SafeCast` restores this intuition by
* reverting the transaction when such an operation overflows.
*
* Using this library instead of the unchecked operations eliminates an entire
* class of bugs, so it's recommended to use it always.
*/
library SafeCast {
/**
* @dev Value doesn't fit in a uint of `bits` size.
*/
error SafeCastOverflowedUintDowncast(uint8 bits, uint256 value);
/**
* @dev An int value doesn't fit in a uint of `bits` size.
*/
error SafeCastOverflowedIntToUint(int256 value);
/**
* @dev Value doesn't fit in an int of `bits` size.
*/
error SafeCastOverflowedIntDowncast(uint8 bits, int256 value);
/**
* @dev A uint value doesn't fit in an int of `bits` size.
*/
error SafeCastOverflowedUintToInt(uint256 value);
/**
* @dev Returns the downcasted uint248 from uint256, reverting on
* overflow (when the input is greater than largest uint248).
*
* Counterpart to Solidity's `uint248` operator.
*
* Requirements:
*
* - input must fit into 248 bits
*/
function toUint248(uint256 value) internal pure returns (uint248) {
if (value > type(uint248).max) {
revert SafeCastOverflowedUintDowncast(248, value);
}
return uint248(value);
}
/**
* @dev Returns the downcasted uint240 from uint256, reverting on
* overflow (when the input is greater than largest uint240).
*
* Counterpart to Solidity's `uint240` operator.
*
* Requirements:
*
* - input must fit into 240 bits
*/
function toUint240(uint256 value) internal pure returns (uint240) {
if (value > type(uint240).max) {
revert SafeCastOverflowedUintDowncast(240, value);
}
return uint240(value);
}
/**
* @dev Returns the downcasted uint232 from uint256, reverting on
* overflow (when the input is greater than largest uint232).
*
* Counterpart to Solidity's `uint232` operator.
*
* Requirements:
*
* - input must fit into 232 bits
*/
function toUint232(uint256 value) internal pure returns (uint232) {
if (value > type(uint232).max) {
revert SafeCastOverflowedUintDowncast(232, value);
}
return uint232(value);
}
/**
* @dev Returns the downcasted uint224 from uint256, reverting on
* overflow (when the input is greater than largest uint224).
*
* Counterpart to Solidity's `uint224` operator.
*
* Requirements:
*
* - input must fit into 224 bits
*/
function toUint224(uint256 value) internal pure returns (uint224) {
if (value > type(uint224).max) {
revert SafeCastOverflowedUintDowncast(224, value);
}
return uint224(value);
}
/**
* @dev Returns the downcasted uint216 from uint256, reverting on
* overflow (when the input is greater than largest uint216).
*
* Counterpart to Solidity's `uint216` operator.
*
* Requirements:
*
* - input must fit into 216 bits
*/
function toUint216(uint256 value) internal pure returns (uint216) {
if (value > type(uint216).max) {
revert SafeCastOverflowedUintDowncast(216, value);
}
return uint216(value);
}
/**
* @dev Returns the downcasted uint208 from uint256, reverting on
* overflow (when the input is greater than largest uint208).
*
* Counterpart to Solidity's `uint208` operator.
*
* Requirements:
*
* - input must fit into 208 bits
*/
function toUint208(uint256 value) internal pure returns (uint208) {
if (value > type(uint208).max) {
revert SafeCastOverflowedUintDowncast(208, value);
}
return uint208(value);
}
/**
* @dev Returns the downcasted uint200 from uint256, reverting on
* overflow (when the input is greater than largest uint200).
*
* Counterpart to Solidity's `uint200` operator.
*
* Requirements:
*
* - input must fit into 200 bits
*/
function toUint200(uint256 value) internal pure returns (uint200) {
if (value > type(uint200).max) {
revert SafeCastOverflowedUintDowncast(200, value);
}
return uint200(value);
}
/**
* @dev Returns the downcasted uint192 from uint256, reverting on
* overflow (when the input is greater than largest uint192).
*
* Counterpart to Solidity's `uint192` operator.
*
* Requirements:
*
* - input must fit into 192 bits
*/
function toUint192(uint256 value) internal pure returns (uint192) {
if (value > type(uint192).max) {
revert SafeCastOverflowedUintDowncast(192, value);
}
return uint192(value);
}
/**
* @dev Returns the downcasted uint184 from uint256, reverting on
* overflow (when the input is greater than largest uint184).
*
* Counterpart to Solidity's `uint184` operator.
*
* Requirements:
*
* - input must fit into 184 bits
*/
function toUint184(uint256 value) internal pure returns (uint184) {
if (value > type(uint184).max) {
revert SafeCastOverflowedUintDowncast(184, value);
}
return uint184(value);
}
/**
* @dev Returns the downcasted uint176 from uint256, reverting on
* overflow (when the input is greater than largest uint176).
*
* Counterpart to Solidity's `uint176` operator.
*
* Requirements:
*
* - input must fit into 176 bits
*/
function toUint176(uint256 value) internal pure returns (uint176) {
if (value > type(uint176).max) {
revert SafeCastOverflowedUintDowncast(176, value);
}
return uint176(value);
}
/**
* @dev Returns the downcasted uint168 from uint256, reverting on
* overflow (when the input is greater than largest uint168).
*
* Counterpart to Solidity's `uint168` operator.
*
* Requirements:
*
* - input must fit into 168 bits
*/
function toUint168(uint256 value) internal pure returns (uint168) {
if (value > type(uint168).max) {
revert SafeCastOverflowedUintDowncast(168, value);
}
return uint168(value);
}
/**
* @dev Returns the downcasted uint160 from uint256, reverting on
* overflow (when the input is greater than largest uint160).
*
* Counterpart to Solidity's `uint160` operator.
*
* Requirements:
*
* - input must fit into 160 bits
*/
function toUint160(uint256 value) internal pure returns (uint160) {
if (value > type(uint160).max) {
revert SafeCastOverflowedUintDowncast(160, value);
}
return uint160(value);
}
/**
* @dev Returns the downcasted uint152 from uint256, reverting on
* overflow (when the input is greater than largest uint152).
*
* Counterpart to Solidity's `uint152` operator.
*
* Requirements:
*
* - input must fit into 152 bits
*/
function toUint152(uint256 value) internal pure returns (uint152) {
if (value > type(uint152).max) {
revert SafeCastOverflowedUintDowncast(152, value);
}
return uint152(value);
}
/**
* @dev Returns the downcasted uint144 from uint256, reverting on
* overflow (when the input is greater than largest uint144).
*
* Counterpart to Solidity's `uint144` operator.
*
* Requirements:
*
* - input must fit into 144 bits
*/
function toUint144(uint256 value) internal pure returns (uint144) {
if (value > type(uint144).max) {
revert SafeCastOverflowedUintDowncast(144, value);
}
return uint144(value);
}
/**
* @dev Returns the downcasted uint136 from uint256, reverting on
* overflow (when the input is greater than largest uint136).
*
* Counterpart to Solidity's `uint136` operator.
*
* Requirements:
*
* - input must fit into 136 bits
*/
function toUint136(uint256 value) internal pure returns (uint136) {
if (value > type(uint136).max) {
revert SafeCastOverflowedUintDowncast(136, value);
}
return uint136(value);
}
/**
* @dev Returns the downcasted uint128 from uint256, reverting on
* overflow (when the input is greater than largest uint128).
*
* Counterpart to Solidity's `uint128` operator.
*
* Requirements:
*
* - input must fit into 128 bits
*/
function toUint128(uint256 value) internal pure returns (uint128) {
if (value > type(uint128).max) {
revert SafeCastOverflowedUintDowncast(128, value);
}
return uint128(value);
}
/**
* @dev Returns the downcasted uint120 from uint256, reverting on
* overflow (when the input is greater than largest uint120).
*
* Counterpart to Solidity's `uint120` operator.
*
* Requirements:
*
* - input must fit into 120 bits
*/
function toUint120(uint256 value) internal pure returns (uint120) {
if (value > type(uint120).max) {
revert SafeCastOverflowedUintDowncast(120, value);
}
return uint120(value);
}
/**
* @dev Returns the downcasted uint112 from uint256, reverting on
* overflow (when the input is greater than largest uint112).
*
* Counterpart to Solidity's `uint112` operator.
*
* Requirements:
*
* - input must fit into 112 bits
*/
function toUint112(uint256 value) internal pure returns (uint112) {
if (value > type(uint112).max) {
revert SafeCastOverflowedUintDowncast(112, value);
}
return uint112(value);
}
/**
* @dev Returns the downcasted uint104 from uint256, reverting on
* overflow (when the input is greater than largest uint104).
*
* Counterpart to Solidity's `uint104` operator.
*
* Requirements:
*
* - input must fit into 104 bits
*/
function toUint104(uint256 value) internal pure returns (uint104) {
if (value > type(uint104).max) {
revert SafeCastOverflowedUintDowncast(104, value);
}
return uint104(value);
}
/**
* @dev Returns the downcasted uint96 from uint256, reverting on
* overflow (when the input is greater than largest uint96).
*
* Counterpart to Solidity's `uint96` operator.
*
* Requirements:
*
* - input must fit into 96 bits
*/
function toUint96(uint256 value) internal pure returns (uint96) {
if (value > type(uint96).max) {
revert SafeCastOverflowedUintDowncast(96, value);
}
return uint96(value);
}
/**
* @dev Returns the downcasted uint88 from uint256, reverting on
* overflow (when the input is greater than largest uint88).
*
* Counterpart to Solidity's `uint88` operator.
*
* Requirements:
*
* - input must fit into 88 bits
*/
function toUint88(uint256 value) internal pure returns (uint88) {
if (value > type(uint88).max) {
revert SafeCastOverflowedUintDowncast(88, value);
}
return uint88(value);
}
/**
* @dev Returns the downcasted uint80 from uint256, reverting on
* overflow (when the input is greater than largest uint80).
*
* Counterpart to Solidity's `uint80` operator.
*
* Requirements:
*
* - input must fit into 80 bits
*/
function toUint80(uint256 value) internal pure returns (uint80) {
if (value > type(uint80).max) {
revert SafeCastOverflowedUintDowncast(80, value);
}
return uint80(value);
}
/**
* @dev Returns the downcasted uint72 from uint256, reverting on
* overflow (when the input is greater than largest uint72).
*
* Counterpart to Solidity's `uint72` operator.
*
* Requirements:
*
* - input must fit into 72 bits
*/
function toUint72(uint256 value) internal pure returns (uint72) {
if (value > type(uint72).max) {
revert SafeCastOverflowedUintDowncast(72, value);
}
return uint72(value);
}
/**
* @dev Returns the downcasted uint64 from uint256, reverting on
* overflow (when the input is greater than largest uint64).
*
* Counterpart to Solidity's `uint64` operator.
*
* Requirements:
*
* - input must fit into 64 bits
*/
function toUint64(uint256 value) internal pure returns (uint64) {
if (value > type(uint64).max) {
revert SafeCastOverflowedUintDowncast(64, value);
}
return uint64(value);
}
/**
* @dev Returns the downcasted uint56 from uint256, reverting on
* overflow (when the input is greater than largest uint56).
*
* Counterpart to Solidity's `uint56` operator.
*
* Requirements:
*
* - input must fit into 56 bits
*/
function toUint56(uint256 value) internal pure returns (uint56) {
if (value > type(uint56).max) {
revert SafeCastOverflowedUintDowncast(56, value);
}
return uint56(value);
}
/**
* @dev Returns the downcasted uint48 from uint256, reverting on
* overflow (when the input is greater than largest uint48).
*
* Counterpart to Solidity's `uint48` operator.
*
* Requirements:
*
* - input must fit into 48 bits
*/
function toUint48(uint256 value) internal pure returns (uint48) {
if (value > type(uint48).max) {
revert SafeCastOverflowedUintDowncast(48, value);
}
return uint48(value);
}
/**
* @dev Returns the downcasted uint40 from uint256, reverting on
* overflow (when the input is greater than largest uint40).
*
* Counterpart to Solidity's `uint40` operator.
*
* Requirements:
*
* - input must fit into 40 bits
*/
function toUint40(uint256 value) internal pure returns (uint40) {
if (value > type(uint40).max) {
revert SafeCastOverflowedUintDowncast(40, value);
}
return uint40(value);
}
/**
* @dev Returns the downcasted uint32 from uint256, reverting on
* overflow (when the input is greater than largest uint32).
*
* Counterpart to Solidity's `uint32` operator.
*
* Requirements:
*
* - input must fit into 32 bits
*/
function toUint32(uint256 value) internal pure returns (uint32) {
if (value > type(uint32).max) {
revert SafeCastOverflowedUintDowncast(32, value);
}
return uint32(value);
}
/**
* @dev Returns the downcasted uint24 from uint256, reverting on
* overflow (when the input is greater than largest uint24).
*
* Counterpart to Solidity's `uint24` operator.
*
* Requirements:
*
* - input must fit into 24 bits
*/
function toUint24(uint256 value) internal pure returns (uint24) {
if (value > type(uint24).max) {
revert SafeCastOverflowedUintDowncast(24, value);
}
return uint24(value);
}
/**
* @dev Returns the downcasted uint16 from uint256, reverting on
* overflow (when the input is greater than largest uint16).
*
* Counterpart to Solidity's `uint16` operator.
*
* Requirements:
*
* - input must fit into 16 bits
*/
function toUint16(uint256 value) internal pure returns (uint16) {
if (value > type(uint16).max) {
revert SafeCastOverflowedUintDowncast(16, value);
}
return uint16(value);
}
/**
* @dev Returns the downcasted uint8 from uint256, reverting on
* overflow (when the input is greater than largest uint8).
*
* Counterpart to Solidity's `uint8` operator.
*
* Requirements:
*
* - input must fit into 8 bits
*/
function toUint8(uint256 value) internal pure returns (uint8) {
if (value > type(uint8).max) {
revert SafeCastOverflowedUintDowncast(8, value);
}
return uint8(value);
}
/**
* @dev Converts a signed int256 into an unsigned uint256.
*
* Requirements:
*
* - input must be greater than or equal to 0.
*/
function toUint256(int256 value) internal pure returns (uint256) {
if (value < 0) {
revert SafeCastOverflowedIntToUint(value);
}
return uint256(value);
}
/**
* @dev Returns the downcasted int248 from int256, reverting on
* overflow (when the input is less than smallest int248 or
* greater than largest int248).
*
* Counterpart to Solidity's `int248` operator.
*
* Requirements:
*
* - input must fit into 248 bits
*/
function toInt248(int256 value) internal pure returns (int248 downcasted) {
downcasted = int248(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(248, value);
}
}
/**
* @dev Returns the downcasted int240 from int256, reverting on
* overflow (when the input is less than smallest int240 or
* greater than largest int240).
*
* Counterpart to Solidity's `int240` operator.
*
* Requirements:
*
* - input must fit into 240 bits
*/
function toInt240(int256 value) internal pure returns (int240 downcasted) {
downcasted = int240(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(240, value);
}
}
/**
* @dev Returns the downcasted int232 from int256, reverting on
* overflow (when the input is less than smallest int232 or
* greater than largest int232).
*
* Counterpart to Solidity's `int232` operator.
*
* Requirements:
*
* - input must fit into 232 bits
*/
function toInt232(int256 value) internal pure returns (int232 downcasted) {
downcasted = int232(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(232, value);
}
}
/**
* @dev Returns the downcasted int224 from int256, reverting on
* overflow (when the input is less than smallest int224 or
* greater than largest int224).
*
* Counterpart to Solidity's `int224` operator.
*
* Requirements:
*
* - input must fit into 224 bits
*/
function toInt224(int256 value) internal pure returns (int224 downcasted) {
downcasted = int224(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(224, value);
}
}
/**
* @dev Returns the downcasted int216 from int256, reverting on
* overflow (when the input is less than smallest int216 or
* greater than largest int216).
*
* Counterpart to Solidity's `int216` operator.
*
* Requirements:
*
* - input must fit into 216 bits
*/
function toInt216(int256 value) internal pure returns (int216 downcasted) {
downcasted = int216(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(216, value);
}
}
/**
* @dev Returns the downcasted int208 from int256, reverting on
* overflow (when the input is less than smallest int208 or
* greater than largest int208).
*
* Counterpart to Solidity's `int208` operator.
*
* Requirements:
*
* - input must fit into 208 bits
*/
function toInt208(int256 value) internal pure returns (int208 downcasted) {
downcasted = int208(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(208, value);
}
}
/**
* @dev Returns the downcasted int200 from int256, reverting on
* overflow (when the input is less than smallest int200 or
* greater than largest int200).
*
* Counterpart to Solidity's `int200` operator.
*
* Requirements:
*
* - input must fit into 200 bits
*/
function toInt200(int256 value) internal pure returns (int200 downcasted) {
downcasted = int200(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(200, value);
}
}
/**
* @dev Returns the downcasted int192 from int256, reverting on
* overflow (when the input is less than smallest int192 or
* greater than largest int192).
*
* Counterpart to Solidity's `int192` operator.
*
* Requirements:
*
* - input must fit into 192 bits
*/
function toInt192(int256 value) internal pure returns (int192 downcasted) {
downcasted = int192(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(192, value);
}
}
/**
* @dev Returns the downcasted int184 from int256, reverting on
* overflow (when the input is less than smallest int184 or
* greater than largest int184).
*
* Counterpart to Solidity's `int184` operator.
*
* Requirements:
*
* - input must fit into 184 bits
*/
function toInt184(int256 value) internal pure returns (int184 downcasted) {
downcasted = int184(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(184, value);
}
}
/**
* @dev Returns the downcasted int176 from int256, reverting on
* overflow (when the input is less than smallest int176 or
* greater than largest int176).
*
* Counterpart to Solidity's `int176` operator.
*
* Requirements:
*
* - input must fit into 176 bits
*/
function toInt176(int256 value) internal pure returns (int176 downcasted) {
downcasted = int176(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(176, value);
}
}
/**
* @dev Returns the downcasted int168 from int256, reverting on
* overflow (when the input is less than smallest int168 or
* greater than largest int168).
*
* Counterpart to Solidity's `int168` operator.
*
* Requirements:
*
* - input must fit into 168 bits
*/
function toInt168(int256 value) internal pure returns (int168 downcasted) {
downcasted = int168(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(168, value);
}
}
/**
* @dev Returns the downcasted int160 from int256, reverting on
* overflow (when the input is less than smallest int160 or
* greater than largest int160).
*
* Counterpart to Solidity's `int160` operator.
*
* Requirements:
*
* - input must fit into 160 bits
*/
function toInt160(int256 value) internal pure returns (int160 downcasted) {
downcasted = int160(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(160, value);
}
}
/**
* @dev Returns the downcasted int152 from int256, reverting on
* overflow (when the input is less than smallest int152 or
* greater than largest int152).
*
* Counterpart to Solidity's `int152` operator.
*
* Requirements:
*
* - input must fit into 152 bits
*/
function toInt152(int256 value) internal pure returns (int152 downcasted) {
downcasted = int152(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(152, value);
}
}
/**
* @dev Returns the downcasted int144 from int256, reverting on
* overflow (when the input is less than smallest int144 or
* greater than largest int144).
*
* Counterpart to Solidity's `int144` operator.
*
* Requirements:
*
* - input must fit into 144 bits
*/
function toInt144(int256 value) internal pure returns (int144 downcasted) {
downcasted = int144(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(144, value);
}
}
/**
* @dev Returns the downcasted int136 from int256, reverting on
* overflow (when the input is less than smallest int136 or
* greater than largest int136).
*
* Counterpart to Solidity's `int136` operator.
*
* Requirements:
*
* - input must fit into 136 bits
*/
function toInt136(int256 value) internal pure returns (int136 downcasted) {
downcasted = int136(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(136, value);
}
}
/**
* @dev Returns the downcasted int128 from int256, reverting on
* overflow (when the input is less than smallest int128 or
* greater than largest int128).
*
* Counterpart to Solidity's `int128` operator.
*
* Requirements:
*
* - input must fit into 128 bits
*/
function toInt128(int256 value) internal pure returns (int128 downcasted) {
downcasted = int128(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(128, value);
}
}
/**
* @dev Returns the downcasted int120 from int256, reverting on
* overflow (when the input is less than smallest int120 or
* greater than largest int120).
*
* Counterpart to Solidity's `int120` operator.
*
* Requirements:
*
* - input must fit into 120 bits
*/
function toInt120(int256 value) internal pure returns (int120 downcasted) {
downcasted = int120(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(120, value);
}
}
/**
* @dev Returns the downcasted int112 from int256, reverting on
* overflow (when the input is less than smallest int112 or
* greater than largest int112).
*
* Counterpart to Solidity's `int112` operator.
*
* Requirements:
*
* - input must fit into 112 bits
*/
function toInt112(int256 value) internal pure returns (int112 downcasted) {
downcasted = int112(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(112, value);
}
}
/**
* @dev Returns the downcasted int104 from int256, reverting on
* overflow (when the input is less than smallest int104 or
* greater than largest int104).
*
* Counterpart to Solidity's `int104` operator.
*
* Requirements:
*
* - input must fit into 104 bits
*/
function toInt104(int256 value) internal pure returns (int104 downcasted) {
downcasted = int104(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(104, value);
}
}
/**
* @dev Returns the downcasted int96 from int256, reverting on
* overflow (when the input is less than smallest int96 or
* greater than largest int96).
*
* Counterpart to Solidity's `int96` operator.
*
* Requirements:
*
* - input must fit into 96 bits
*/
function toInt96(int256 value) internal pure returns (int96 downcasted) {
downcasted = int96(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(96, value);
}
}
/**
* @dev Returns the downcasted int88 from int256, reverting on
* overflow (when the input is less than smallest int88 or
* greater than largest int88).
*
* Counterpart to Solidity's `int88` operator.
*
* Requirements:
*
* - input must fit into 88 bits
*/
function toInt88(int256 value) internal pure returns (int88 downcasted) {
downcasted = int88(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(88, value);
}
}
/**
* @dev Returns the downcasted int80 from int256, reverting on
* overflow (when the input is less than smallest int80 or
* greater than largest int80).
*
* Counterpart to Solidity's `int80` operator.
*
* Requirements:
*
* - input must fit into 80 bits
*/
function toInt80(int256 value) internal pure returns (int80 downcasted) {
downcasted = int80(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(80, value);
}
}
/**
* @dev Returns the downcasted int72 from int256, reverting on
* overflow (when the input is less than smallest int72 or
* greater than largest int72).
*
* Counterpart to Solidity's `int72` operator.
*
* Requirements:
*
* - input must fit into 72 bits
*/
function toInt72(int256 value) internal pure returns (int72 downcasted) {
downcasted = int72(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(72, value);
}
}
/**
* @dev Returns the downcasted int64 from int256, reverting on
* overflow (when the input is less than smallest int64 or
* greater than largest int64).
*
* Counterpart to Solidity's `int64` operator.
*
* Requirements:
*
* - input must fit into 64 bits
*/
function toInt64(int256 value) internal pure returns (int64 downcasted) {
downcasted = int64(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(64, value);
}
}
/**
* @dev Returns the downcasted int56 from int256, reverting on
* overflow (when the input is less than smallest int56 or
* greater than largest int56).
*
* Counterpart to Solidity's `int56` operator.
*
* Requirements:
*
* - input must fit into 56 bits
*/
function toInt56(int256 value) internal pure returns (int56 downcasted) {
downcasted = int56(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(56, value);
}
}
/**
* @dev Returns the downcasted int48 from int256, reverting on
* overflow (when the input is less than smallest int48 or
* greater than largest int48).
*
* Counterpart to Solidity's `int48` operator.
*
* Requirements:
*
* - input must fit into 48 bits
*/
function toInt48(int256 value) internal pure returns (int48 downcasted) {
downcasted = int48(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(48, value);
}
}
/**
* @dev Returns the downcasted int40 from int256, reverting on
* overflow (when the input is less than smallest int40 or
* greater than largest int40).
*
* Counterpart to Solidity's `int40` operator.
*
* Requirements:
*
* - input must fit into 40 bits
*/
function toInt40(int256 value) internal pure returns (int40 downcasted) {
downcasted = int40(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(40, value);
}
}
/**
* @dev Returns the downcasted int32 from int256, reverting on
* overflow (when the input is less than smallest int32 or
* greater than largest int32).
*
* Counterpart to Solidity's `int32` operator.
*
* Requirements:
*
* - input must fit into 32 bits
*/
function toInt32(int256 value) internal pure returns (int32 downcasted) {
downcasted = int32(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(32, value);
}
}
/**
* @dev Returns the downcasted int24 from int256, reverting on
* overflow (when the input is less than smallest int24 or
* greater than largest int24).
*
* Counterpart to Solidity's `int24` operator.
*
* Requirements:
*
* - input must fit into 24 bits
*/
function toInt24(int256 value) internal pure returns (int24 downcasted) {
downcasted = int24(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(24, value);
}
}
/**
* @dev Returns the downcasted int16 from int256, reverting on
* overflow (when the input is less than smallest int16 or
* greater than largest int16).
*
* Counterpart to Solidity's `int16` operator.
*
* Requirements:
*
* - input must fit into 16 bits
*/
function toInt16(int256 value) internal pure returns (int16 downcasted) {
downcasted = int16(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(16, value);
}
}
/**
* @dev Returns the downcasted int8 from int256, reverting on
* overflow (when the input is less than smallest int8 or
* greater than largest int8).
*
* Counterpart to Solidity's `int8` operator.
*
* Requirements:
*
* - input must fit into 8 bits
*/
function toInt8(int256 value) internal pure returns (int8 downcasted) {
downcasted = int8(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(8, value);
}
}
/**
* @dev Converts an unsigned uint256 into a signed int256.
*
* Requirements:
*
* - input must be less than or equal to maxInt256.
*/
function toInt256(uint256 value) internal pure returns (int256) {
// Note: Unsafe cast below is okay because `type(int256).max` is guaranteed to be positive
if (value > uint256(type(int256).max)) {
revert SafeCastOverflowedUintToInt(value);
}
return int256(value);
}
/**
* @dev Cast a boolean (false or true) to a uint256 (0 or 1) with no jump.
*/
function toUint(bool b) internal pure returns (uint256 u) {
assembly ("memory-safe") {
u := iszero(iszero(b))
}
}
}
@openzeppelin/contracts/utils/ReentrancyGuard.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.5.0) (utils/ReentrancyGuard.sol)
pragma solidity ^0.8.20;
import {StorageSlot} from "./StorageSlot.sol";
/**
* @dev Contract module that helps prevent reentrant calls to a function.
*
* Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier
* available, which can be applied to functions to make sure there are no nested
* (reentrant) calls to them.
*
* Note that because there is a single `nonReentrant` guard, functions marked as
* `nonReentrant` may not call one another. This can be worked around by making
* those functions `private`, and then adding `external` `nonReentrant` entry
* points to them.
*
* TIP: If EIP-1153 (transient storage) is available on the chain you're deploying at,
* consider using {ReentrancyGuardTransient} instead.
*
* TIP: If you would like to learn more about reentrancy and alternative ways
* to protect against it, check out our blog post
* https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].
*
* IMPORTANT: Deprecated. This storage-based reentrancy guard will be removed and replaced
* by the {ReentrancyGuardTransient} variant in v6.0.
*
* @custom:stateless
*/
abstract contract ReentrancyGuard {
using StorageSlot for bytes32;
// keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.ReentrancyGuard")) - 1)) & ~bytes32(uint256(0xff))
bytes32 private constant REENTRANCY_GUARD_STORAGE =
0x9b779b17422d0df92223018b32b4d1fa46e071723d6817e2486d003becc55f00;
// Booleans are more expensive than uint256 or any type that takes up a full
// word because each write operation emits an extra SLOAD to first read the
// slot's contents, replace the bits taken up by the boolean, and then write
// back. This is the compiler's defense against contract upgrades and
// pointer aliasing, and it cannot be disabled.
// The values being non-zero value makes deployment a bit more expensive,
// but in exchange the refund on every call to nonReentrant will be lower in
// amount. Since refunds are capped to a percentage of the total
// transaction's gas, it is best to keep them low in cases like this one, to
// increase the likelihood of the full refund coming into effect.
uint256 private constant NOT_ENTERED = 1;
uint256 private constant ENTERED = 2;
/**
* @dev Unauthorized reentrant call.
*/
error ReentrancyGuardReentrantCall();
constructor() {
_reentrancyGuardStorageSlot().getUint256Slot().value = NOT_ENTERED;
}
/**
* @dev Prevents a contract from calling itself, directly or indirectly.
* Calling a `nonReentrant` function from another `nonReentrant`
* function is not supported. It is possible to prevent this from happening
* by making the `nonReentrant` function external, and making it call a
* `private` function that does the actual work.
*/
modifier nonReentrant() {
_nonReentrantBefore();
_;
_nonReentrantAfter();
}
/**
* @dev A `view` only version of {nonReentrant}. Use to block view functions
* from being called, preventing reading from inconsistent contract state.
*
* CAUTION: This is a "view" modifier and does not change the reentrancy
* status. Use it only on view functions. For payable or non-payable functions,
* use the standard {nonReentrant} modifier instead.
*/
modifier nonReentrantView() {
_nonReentrantBeforeView();
_;
}
function _nonReentrantBeforeView() private view {
if (_reentrancyGuardEntered()) {
revert ReentrancyGuardReentrantCall();
}
}
function _nonReentrantBefore() private {
// On the first call to nonReentrant, _status will be NOT_ENTERED
_nonReentrantBeforeView();
// Any calls to nonReentrant after this point will fail
_reentrancyGuardStorageSlot().getUint256Slot().value = ENTERED;
}
function _nonReentrantAfter() private {
// By storing the original value once again, a refund is triggered (see
// https://eips.ethereum.org/EIPS/eip-2200)
_reentrancyGuardStorageSlot().getUint256Slot().value = NOT_ENTERED;
}
/**
* @dev Returns true if the reentrancy guard is currently set to "entered", which indicates there is a
* `nonReentrant` function in the call stack.
*/
function _reentrancyGuardEntered() internal view returns (bool) {
return _reentrancyGuardStorageSlot().getUint256Slot().value == ENTERED;
}
function _reentrancyGuardStorageSlot() internal pure virtual returns (bytes32) {
return REENTRANCY_GUARD_STORAGE;
}
}
@openzeppelin/contracts/utils/StorageSlot.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (utils/StorageSlot.sol)
// This file was procedurally generated from scripts/generate/templates/StorageSlot.js.
pragma solidity ^0.8.20;
/**
* @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 ERC-1967 implementation slot:
* ```solidity
* contract ERC1967 {
* // Define the slot. Alternatively, use the SlotDerivation library to derive the slot.
* bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;
*
* function _getImplementation() internal view returns (address) {
* return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;
* }
*
* function _setImplementation(address newImplementation) internal {
* require(newImplementation.code.length > 0);
* StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;
* }
* }
* ```
*
* TIP: Consider using this library along with {SlotDerivation}.
*/
library StorageSlot {
struct AddressSlot {
address value;
}
struct BooleanSlot {
bool value;
}
struct Bytes32Slot {
bytes32 value;
}
struct Uint256Slot {
uint256 value;
}
struct Int256Slot {
int256 value;
}
struct StringSlot {
string value;
}
struct BytesSlot {
bytes value;
}
/**
* @dev Returns an `AddressSlot` with member `value` located at `slot`.
*/
function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {
assembly ("memory-safe") {
r.slot := slot
}
}
/**
* @dev Returns a `BooleanSlot` with member `value` located at `slot`.
*/
function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {
assembly ("memory-safe") {
r.slot := slot
}
}
/**
* @dev Returns a `Bytes32Slot` with member `value` located at `slot`.
*/
function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {
assembly ("memory-safe") {
r.slot := slot
}
}
/**
* @dev Returns a `Uint256Slot` with member `value` located at `slot`.
*/
function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {
assembly ("memory-safe") {
r.slot := slot
}
}
/**
* @dev Returns a `Int256Slot` with member `value` located at `slot`.
*/
function getInt256Slot(bytes32 slot) internal pure returns (Int256Slot storage r) {
assembly ("memory-safe") {
r.slot := slot
}
}
/**
* @dev Returns a `StringSlot` with member `value` located at `slot`.
*/
function getStringSlot(bytes32 slot) internal pure returns (StringSlot storage r) {
assembly ("memory-safe") {
r.slot := slot
}
}
/**
* @dev Returns an `StringSlot` representation of the string storage pointer `store`.
*/
function getStringSlot(string storage store) internal pure returns (StringSlot storage r) {
assembly ("memory-safe") {
r.slot := store.slot
}
}
/**
* @dev Returns a `BytesSlot` with member `value` located at `slot`.
*/
function getBytesSlot(bytes32 slot) internal pure returns (BytesSlot storage r) {
assembly ("memory-safe") {
r.slot := slot
}
}
/**
* @dev Returns an `BytesSlot` representation of the bytes storage pointer `store`.
*/
function getBytesSlot(bytes storage store) internal pure returns (BytesSlot storage r) {
assembly ("memory-safe") {
r.slot := store.slot
}
}
}
@openzeppelin/contracts/interfaces/draft-IERC6093.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.5.0) (interfaces/draft-IERC6093.sol)
pragma solidity >=0.8.4;
/**
* @dev Standard ERC-20 Errors
* Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC-20 tokens.
*/
interface IERC20Errors {
/**
* @dev Indicates an error related to the current `balance` of a `sender`. Used in transfers.
* @param sender Address whose tokens are being transferred.
* @param balance Current balance for the interacting account.
* @param needed Minimum amount required to perform a transfer.
*/
error ERC20InsufficientBalance(address sender, uint256 balance, uint256 needed);
/**
* @dev Indicates a failure with the token `sender`. Used in transfers.
* @param sender Address whose tokens are being transferred.
*/
error ERC20InvalidSender(address sender);
/**
* @dev Indicates a failure with the token `receiver`. Used in transfers.
* @param receiver Address to which tokens are being transferred.
*/
error ERC20InvalidReceiver(address receiver);
/**
* @dev Indicates a failure with the `spender`’s `allowance`. Used in transfers.
* @param spender Address that may be allowed to operate on tokens without being their owner.
* @param allowance Amount of tokens a `spender` is allowed to operate with.
* @param needed Minimum amount required to perform a transfer.
*/
error ERC20InsufficientAllowance(address spender, uint256 allowance, uint256 needed);
/**
* @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.
* @param approver Address initiating an approval operation.
*/
error ERC20InvalidApprover(address approver);
/**
* @dev Indicates a failure with the `spender` to be approved. Used in approvals.
* @param spender Address that may be allowed to operate on tokens without being their owner.
*/
error ERC20InvalidSpender(address spender);
}
/**
* @dev Standard ERC-721 Errors
* Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC-721 tokens.
*/
interface IERC721Errors {
/**
* @dev Indicates that an address can't be an owner. For example, `address(0)` is a forbidden owner in ERC-721.
* Used in balance queries.
* @param owner Address of the current owner of a token.
*/
error ERC721InvalidOwner(address owner);
/**
* @dev Indicates a `tokenId` whose `owner` is the zero address.
* @param tokenId Identifier number of a token.
*/
error ERC721NonexistentToken(uint256 tokenId);
/**
* @dev Indicates an error related to the ownership over a particular token. Used in transfers.
* @param sender Address whose tokens are being transferred.
* @param tokenId Identifier number of a token.
* @param owner Address of the current owner of a token.
*/
error ERC721IncorrectOwner(address sender, uint256 tokenId, address owner);
/**
* @dev Indicates a failure with the token `sender`. Used in transfers.
* @param sender Address whose tokens are being transferred.
*/
error ERC721InvalidSender(address sender);
/**
* @dev Indicates a failure with the token `receiver`. Used in transfers.
* @param receiver Address to which tokens are being transferred.
*/
error ERC721InvalidReceiver(address receiver);
/**
* @dev Indicates a failure with the `operator`’s approval. Used in transfers.
* @param operator Address that may be allowed to operate on tokens without being their owner.
* @param tokenId Identifier number of a token.
*/
error ERC721InsufficientApproval(address operator, uint256 tokenId);
/**
* @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.
* @param approver Address initiating an approval operation.
*/
error ERC721InvalidApprover(address approver);
/**
* @dev Indicates a failure with the `operator` to be approved. Used in approvals.
* @param operator Address that may be allowed to operate on tokens without being their owner.
*/
error ERC721InvalidOperator(address operator);
}
/**
* @dev Standard ERC-1155 Errors
* Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC-1155 tokens.
*/
interface IERC1155Errors {
/**
* @dev Indicates an error related to the current `balance` of a `sender`. Used in transfers.
* @param sender Address whose tokens are being transferred.
* @param balance Current balance for the interacting account.
* @param needed Minimum amount required to perform a transfer.
* @param tokenId Identifier number of a token.
*/
error ERC1155InsufficientBalance(address sender, uint256 balance, uint256 needed, uint256 tokenId);
/**
* @dev Indicates a failure with the token `sender`. Used in transfers.
* @param sender Address whose tokens are being transferred.
*/
error ERC1155InvalidSender(address sender);
/**
* @dev Indicates a failure with the token `receiver`. Used in transfers.
* @param receiver Address to which tokens are being transferred.
*/
error ERC1155InvalidReceiver(address receiver);
/**
* @dev Indicates a failure with the `operator`’s approval. Used in transfers.
* @param operator Address that may be allowed to operate on tokens without being their owner.
* @param owner Address of the current owner of a token.
*/
error ERC1155MissingApprovalForAll(address operator, address owner);
/**
* @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.
* @param approver Address initiating an approval operation.
*/
error ERC1155InvalidApprover(address approver);
/**
* @dev Indicates a failure with the `operator` to be approved. Used in approvals.
* @param operator Address that may be allowed to operate on tokens without being their owner.
*/
error ERC1155InvalidOperator(address operator);
/**
* @dev Indicates an array length mismatch between ids and values in a safeBatchTransferFrom operation.
* Used in batch transfers.
* @param idsLength Length of the array of token identifiers
* @param valuesLength Length of the array of token amounts
*/
error ERC1155InvalidArrayLength(uint256 idsLength, uint256 valuesLength);
}
Compiler Settings
{"viaIR":false,"outputSelection":{"*":{"*":["abi","evm.bytecode","evm.deployedBytecode","evm.methodIdentifiers","metadata"],"":["ast"]}},"optimizer":{"runs":200,"enabled":true},"libraries":{},"evmVersion":"paris"}
Contract ABI
[{"type":"constructor","stateMutability":"nonpayable","inputs":[{"type":"address","name":"minter_","internalType":"address"},{"type":"address","name":"buyBurn_","internalType":"address"}]},{"type":"error","name":"CannotSendToProtocol","inputs":[]},{"type":"error","name":"CannotUnexclude","inputs":[]},{"type":"error","name":"CapExceeded","inputs":[]},{"type":"error","name":"ERC20InsufficientAllowance","inputs":[{"type":"address","name":"spender","internalType":"address"},{"type":"uint256","name":"allowance","internalType":"uint256"},{"type":"uint256","name":"needed","internalType":"uint256"}]},{"type":"error","name":"ERC20InsufficientBalance","inputs":[{"type":"address","name":"sender","internalType":"address"},{"type":"uint256","name":"balance","internalType":"uint256"},{"type":"uint256","name":"needed","internalType":"uint256"}]},{"type":"error","name":"ERC20InvalidApprover","inputs":[{"type":"address","name":"approver","internalType":"address"}]},{"type":"error","name":"ERC20InvalidReceiver","inputs":[{"type":"address","name":"receiver","internalType":"address"}]},{"type":"error","name":"ERC20InvalidSender","inputs":[{"type":"address","name":"sender","internalType":"address"}]},{"type":"error","name":"ERC20InvalidSpender","inputs":[{"type":"address","name":"spender","internalType":"address"}]},{"type":"error","name":"NoEligibleSupply","inputs":[]},{"type":"error","name":"NotMinter","inputs":[]},{"type":"error","name":"NotTheBurner","inputs":[]},{"type":"error","name":"NothingToClaim","inputs":[]},{"type":"error","name":"ReentrancyGuardReentrantCall","inputs":[]},{"type":"error","name":"SafeCastOverflowedUintToInt","inputs":[{"type":"uint256","name":"value","internalType":"uint256"}]},{"type":"error","name":"TransferFailed","inputs":[]},{"type":"event","name":"Approval","inputs":[{"type":"address","name":"owner","internalType":"address","indexed":true},{"type":"address","name":"spender","internalType":"address","indexed":true},{"type":"uint256","name":"value","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"Claimed","inputs":[{"type":"address","name":"account","internalType":"address","indexed":true},{"type":"uint256","name":"amount","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"Distributed","inputs":[{"type":"uint256","name":"amount","internalType":"uint256","indexed":false},{"type":"uint256","name":"perTokenAccrued","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"ExclusionSet","inputs":[{"type":"address","name":"account","internalType":"address","indexed":true},{"type":"bool","name":"excluded","internalType":"bool","indexed":false}],"anonymous":false},{"type":"event","name":"Transfer","inputs":[{"type":"address","name":"from","internalType":"address","indexed":true},{"type":"address","name":"to","internalType":"address","indexed":true},{"type":"uint256","name":"value","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"CAP","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"MIN_ELIGIBLE","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"accumulated","inputs":[{"type":"address","name":"account","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"allowance","inputs":[{"type":"address","name":"owner","internalType":"address"},{"type":"address","name":"spender","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"approve","inputs":[{"type":"address","name":"spender","internalType":"address"},{"type":"uint256","name":"value","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"balanceOf","inputs":[{"type":"address","name":"account","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"burnFrom","inputs":[{"type":"address","name":"account","internalType":"address"},{"type":"uint256","name":"amount","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"buyBurn","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"claim","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"claimable","inputs":[{"type":"address","name":"account","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint8","name":"","internalType":"uint8"}],"name":"decimals","inputs":[]},{"type":"function","stateMutability":"payable","outputs":[],"name":"distribute","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"eligibleSupply","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"excluded","inputs":[{"type":"address","name":"","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"mint","inputs":[{"type":"address","name":"to","internalType":"address"},{"type":"uint256","name":"amount","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"minter","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"string","name":"","internalType":"string"}],"name":"name","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"perTokenAccrued","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setExcluded","inputs":[{"type":"address","name":"account","internalType":"address"},{"type":"bool","name":"value","internalType":"bool"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"string","name":"","internalType":"string"}],"name":"symbol","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"totalDistributed","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"totalSupply","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"transfer","inputs":[{"type":"address","name":"to","internalType":"address"},{"type":"uint256","name":"value","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"transferFrom","inputs":[{"type":"address","name":"from","internalType":"address"},{"type":"address","name":"to","internalType":"address"},{"type":"uint256","name":"value","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"withdrawn","inputs":[{"type":"address","name":"","internalType":"address"}]},{"type":"receive","stateMutability":"payable"}]
Contract Creation Code
0x60c06040523480156200001157600080fd5b506040516200163d3803806200163d8339810160408190526200003491620000f3565b604080518082018252600380825262454b4760e81b602080840182905284518086019095528285528401529091906200006e8382620001d2565b5060046200007d8282620001d2565b50505060016200009962000096620000b260201b60201c565b90565b556001600160a01b039182166080521660a0526200029e565b7f9b779b17422d0df92223018b32b4d1fa46e071723d6817e2486d003becc55f0090565b80516001600160a01b0381168114620000ee57600080fd5b919050565b600080604083850312156200010757600080fd5b6200011283620000d6565b91506200012260208401620000d6565b90509250929050565b634e487b7160e01b600052604160045260246000fd5b600181811c908216806200015657607f821691505b6020821081036200017757634e487b7160e01b600052602260045260246000fd5b50919050565b601f821115620001cd576000816000526020600020601f850160051c81016020861015620001a85750805b601f850160051c820191505b81811015620001c957828155600101620001b4565b5050505b505050565b81516001600160401b03811115620001ee57620001ee6200012b565b6200020681620001ff845462000141565b846200017d565b602080601f8311600181146200023e5760008415620002255750858301515b600019600386901b1c1916600185901b178555620001c9565b600085815260208120601f198616915b828110156200026f578886015182559484019460019091019084016200024e565b50858210156200028e5787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b60805160a05161135d620002e0600039600081816103e201526109ee0152600081816101db015281816106b4015281816108320152610d63015261135d6000f3fe60806040526004361061016a5760003560e01c80634e71d92d116100d157806395d89b411161008a578063dd62ed3e11610064578063dd62ed3e14610479578063e4fc6b6d146104bf578063ec81b483146104c7578063efca2eed146104e757600080fd5b806395d89b4114610424578063a9059cbb14610439578063cc2153d11461045957600080fd5b80634e71d92d146103425780636ade07b0146103575780636ef610921461036d57806370a082311461039a57806370e08e61146103d057806379cc67901461040457600080fd5b806323b872dd1161012357806323b872dd146102765780632836be2414610296578063313ce567146102b6578063402914f5146102d257806340c10f19146102f2578063429cead11461031257600080fd5b806303ce9f901461017e57806306fdde03146101a757806307546172146101c9578063095ea7b31461021557806318160ddd1461024557806318a89fe11461025a57600080fd5b36610179576101776104fd565b005b600080fd5b34801561018a57600080fd5b5061019460055481565b6040519081526020015b60405180910390f35b3480156101b357600080fd5b506101bc6105d9565b60405161019e91906110ce565b3480156101d557600080fd5b506101fd7f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b03909116815260200161019e565b34801561022157600080fd5b50610235610230366004611139565b61066b565b604051901515815260200161019e565b34801561025157600080fd5b50600254610194565b34801561026657600080fd5b50610194670de0b6b3a764000081565b34801561028257600080fd5b50610235610291366004611163565b610685565b3480156102a257600080fd5b506101776102b136600461119f565b6106a9565b3480156102c257600080fd5b506040516012815260200161019e565b3480156102de57600080fd5b506101946102ed3660046111db565b6107df565b3480156102fe57600080fd5b5061017761030d366004611139565b610827565b34801561031e57600080fd5b5061023561032d3660046111db565b600a6020526000908152604090205460ff1681565b34801561034e57600080fd5b506101776108be565b34801561036357600080fd5b5061019460065481565b34801561037957600080fd5b506101946103883660046111db565b60096020526000908152604090205481565b3480156103a657600080fd5b506101946103b53660046111db565b6001600160a01b031660009081526020819052604090205490565b3480156103dc57600080fd5b506101fd7f000000000000000000000000000000000000000000000000000000000000000081565b34801561041057600080fd5b5061017761041f366004611139565b6109e3565b34801561043057600080fd5b506101bc610a41565b34801561044557600080fd5b50610235610454366004611139565b610a50565b34801561046557600080fd5b506101946104743660046111db565b610a5e565b34801561048557600080fd5b506101946104943660046111f6565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b610177610aea565b3480156104d357600080fd5b506101946b01313aca151562851100000081565b3480156104f357600080fd5b5061019460075481565b3460000361050757565b60065460000361052a5760405163a16645af60e01b815260040160405180910390fd5b6000670de0b6b3a7640000600654106105455760065461054f565b670de0b6b3a76400005b905080610560600160401b3461123f565b61056a9190611256565b6005600082825461057b9190611278565b9250508190555034600760008282546105949190611278565b90915550506005546040805134815260208101929092527f97791d3ac1343e05805a2f905fa80b249c2ca58cf9fef455d4fa7ec13ce58321910160405180910390a150565b6060600380546105e89061128b565b80601f01602080910402602001604051908101604052809291908181526020018280546106149061128b565b80156106615780601f1061063657610100808354040283529160200191610661565b820191906000526020600020905b81548152906001019060200180831161064457829003601f168201915b5050505050905090565b600033610679818585610af2565b60019150505b92915050565b600033610693858285610b04565b61069e858585610b88565b506001949350505050565b336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146106f257604051633e34a41b60e21b815260040160405180910390fd5b8061071057604051639fdb7da760e01b815260040160405180910390fd5b6001600160a01b0382166000908152600a602052604090205460ff1615610735575050565b6001600160a01b0382166000908152600a60209081526040808320805460ff19166001179055908290528120549050801561079b57806006600082825461077c91906112c5565b90915550506001600160a01b0383166000908152600860205260408120555b604051600181526001600160a01b038416907faf52feecf81343fee9ed3d93c2e2945736c55d9800211a4acb61222164c7d70d9060200160405180910390a2505050565b6000806107eb83610a5e565b6001600160a01b03841660009081526009602052604090205490915080821161081557600061081f565b61081f81836112c5565b949350505050565b336001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000161461087057604051633e34a41b60e21b815260040160405180910390fd5b6b01313aca15156285110000008161088760025490565b6108919190611278565b11156108b05760405163a4875a4960e01b815260040160405180910390fd5b6108ba8282610be7565b5050565b6108c6610c1d565b60006108d1336107df565b9050806000036108f4576040516312d37ee560e31b815260040160405180910390fd5b3360009081526009602052604081208054839290610913908490611278565b9091555050604051600090339083908381818185875af1925050503d806000811461095a576040519150601f19603f3d011682016040523d82523d6000602084013e61095f565b606091505b5050905080610981576040516312171d8360e31b815260040160405180910390fd5b60405182815233907fd8138f8a3f377c5259ca548e70e4c2de94f129f5a11036a15b69513cba2b426a9060200160405180910390a250506109e160017f9b779b17422d0df92223018b32b4d1fa46e071723d6817e2486d003becc55f0055565b565b336001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614610a2c576040516310a56f0f60e31b815260040160405180910390fd5b610a37823383610b04565b6108ba8282610c4b565b6060600480546105e89061128b565b600033610679818585610b88565b6001600160a01b0381166000908152600a602052604081205460ff1615610a8757506000919050565b6001600160a01b03821660009081526008602090815260408083205491839052822054600554610ab7919061123f565b610ac191906112d8565b90506000811215610ad55750600092915050565b610ae3600160401b82611256565b9392505050565b6109e16104fd565b610aff8383836001610c81565b505050565b6001600160a01b03838116600090815260016020908152604080832093861683529290522054600019811015610b825781811015610b7357604051637dc7a0d960e11b81526001600160a01b038416600482015260248101829052604481018390526064015b60405180910390fd5b610b8284848484036000610c81565b50505050565b6001600160a01b038316610bb257604051634b637e8f60e11b815260006004820152602401610b6a565b6001600160a01b038216610bdc5760405163ec442f0560e01b815260006004820152602401610b6a565b610aff838383610d56565b6001600160a01b038216610c115760405163ec442f0560e01b815260006004820152602401610b6a565b6108ba60008383610d56565b610c25610f31565b60027f9b779b17422d0df92223018b32b4d1fa46e071723d6817e2486d003becc55f0055565b6001600160a01b038216610c7557604051634b637e8f60e11b815260006004820152602401610b6a565b6108ba82600083610d56565b6001600160a01b038416610cab5760405163e602df0560e01b815260006004820152602401610b6a565b6001600160a01b038316610cd557604051634a1406b160e11b815260006004820152602401610b6a565b6001600160a01b0380851660009081526001602090815260408083209387168352929052208290558015610b8257826001600160a01b0316846001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92584604051610d4891815260200190565b60405180910390a350505050565b610d61838383610f73565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316826001600160a01b0316148015610daa57506001600160a01b03831615155b80610dbd57506001600160a01b03821630145b15610ddb57604051630e79246960e21b815260040160405180910390fd5b80600003610de857505050565b60006001600160a01b03841615801590610e1b57506001600160a01b0384166000908152600a602052604090205460ff16155b905060006001600160a01b03841615801590610e5057506001600160a01b0384166000908152600a602052604090205460ff16155b90506000610e6a84600554610e65919061123f565b61109d565b90508215610ea0576001600160a01b03861660009081526008602052604081208054839290610e9a9084906112d8565b90915550505b8115610ed4576001600160a01b03851660009081526008602052604081208054839290610ece908490611300565b90915550505b828015610edf575081155b15610f01578360066000828254610ef691906112c5565b90915550610f299050565b82158015610f0c5750815b15610f29578360066000828254610f239190611278565b90915550505b505050505050565b7f9b779b17422d0df92223018b32b4d1fa46e071723d6817e2486d003becc55f00546002036109e157604051633ee5aeb560e01b815260040160405180910390fd5b6001600160a01b038316610f9e578060026000828254610f939190611278565b909155506110109050565b6001600160a01b03831660009081526020819052604090205481811015610ff15760405163391434e360e21b81526001600160a01b03851660048201526024810182905260448101839052606401610b6a565b6001600160a01b03841660009081526020819052604090209082900390555b6001600160a01b03821661102c5760028054829003905561104b565b6001600160a01b03821660009081526020819052604090208054820190555b816001600160a01b0316836001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8360405161109091815260200190565b60405180910390a3505050565b60006001600160ff1b038211156110ca5760405163123baf0360e11b815260048101839052602401610b6a565b5090565b60006020808352835180602085015260005b818110156110fc578581018301518582016040015282016110e0565b506000604082860101526040601f19601f8301168501019250505092915050565b80356001600160a01b038116811461113457600080fd5b919050565b6000806040838503121561114c57600080fd5b6111558361111d565b946020939093013593505050565b60008060006060848603121561117857600080fd5b6111818461111d565b925061118f6020850161111d565b9150604084013590509250925092565b600080604083850312156111b257600080fd5b6111bb8361111d565b9150602083013580151581146111d057600080fd5b809150509250929050565b6000602082840312156111ed57600080fd5b610ae38261111d565b6000806040838503121561120957600080fd5b6112128361111d565b91506112206020840161111d565b90509250929050565b634e487b7160e01b600052601160045260246000fd5b808202811582820484141761067f5761067f611229565b60008261127357634e487b7160e01b600052601260045260246000fd5b500490565b8082018082111561067f5761067f611229565b600181811c9082168061129f57607f821691505b6020821081036112bf57634e487b7160e01b600052602260045260246000fd5b50919050565b8181038181111561067f5761067f611229565b80820182811260008312801582168215821617156112f8576112f8611229565b505092915050565b818103600083128015838313168383128216171561132057611320611229565b509291505056fea2646970667358221220ca4d18aabf8ec154d92bde179aa427c7edcd0b05d87d78cedb577220b34a0feb64736f6c63430008180033000000000000000000000000ad5c70588101d168b52577004a3a209ab90ab49a000000000000000000000000da5734cd1013359bfea1943ee4b109f87e916a89
Deployed ByteCode
0x60806040526004361061016a5760003560e01c80634e71d92d116100d157806395d89b411161008a578063dd62ed3e11610064578063dd62ed3e14610479578063e4fc6b6d146104bf578063ec81b483146104c7578063efca2eed146104e757600080fd5b806395d89b4114610424578063a9059cbb14610439578063cc2153d11461045957600080fd5b80634e71d92d146103425780636ade07b0146103575780636ef610921461036d57806370a082311461039a57806370e08e61146103d057806379cc67901461040457600080fd5b806323b872dd1161012357806323b872dd146102765780632836be2414610296578063313ce567146102b6578063402914f5146102d257806340c10f19146102f2578063429cead11461031257600080fd5b806303ce9f901461017e57806306fdde03146101a757806307546172146101c9578063095ea7b31461021557806318160ddd1461024557806318a89fe11461025a57600080fd5b36610179576101776104fd565b005b600080fd5b34801561018a57600080fd5b5061019460055481565b6040519081526020015b60405180910390f35b3480156101b357600080fd5b506101bc6105d9565b60405161019e91906110ce565b3480156101d557600080fd5b506101fd7f000000000000000000000000ad5c70588101d168b52577004a3a209ab90ab49a81565b6040516001600160a01b03909116815260200161019e565b34801561022157600080fd5b50610235610230366004611139565b61066b565b604051901515815260200161019e565b34801561025157600080fd5b50600254610194565b34801561026657600080fd5b50610194670de0b6b3a764000081565b34801561028257600080fd5b50610235610291366004611163565b610685565b3480156102a257600080fd5b506101776102b136600461119f565b6106a9565b3480156102c257600080fd5b506040516012815260200161019e565b3480156102de57600080fd5b506101946102ed3660046111db565b6107df565b3480156102fe57600080fd5b5061017761030d366004611139565b610827565b34801561031e57600080fd5b5061023561032d3660046111db565b600a6020526000908152604090205460ff1681565b34801561034e57600080fd5b506101776108be565b34801561036357600080fd5b5061019460065481565b34801561037957600080fd5b506101946103883660046111db565b60096020526000908152604090205481565b3480156103a657600080fd5b506101946103b53660046111db565b6001600160a01b031660009081526020819052604090205490565b3480156103dc57600080fd5b506101fd7f000000000000000000000000da5734cd1013359bfea1943ee4b109f87e916a8981565b34801561041057600080fd5b5061017761041f366004611139565b6109e3565b34801561043057600080fd5b506101bc610a41565b34801561044557600080fd5b50610235610454366004611139565b610a50565b34801561046557600080fd5b506101946104743660046111db565b610a5e565b34801561048557600080fd5b506101946104943660046111f6565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b610177610aea565b3480156104d357600080fd5b506101946b01313aca151562851100000081565b3480156104f357600080fd5b5061019460075481565b3460000361050757565b60065460000361052a5760405163a16645af60e01b815260040160405180910390fd5b6000670de0b6b3a7640000600654106105455760065461054f565b670de0b6b3a76400005b905080610560600160401b3461123f565b61056a9190611256565b6005600082825461057b9190611278565b9250508190555034600760008282546105949190611278565b90915550506005546040805134815260208101929092527f97791d3ac1343e05805a2f905fa80b249c2ca58cf9fef455d4fa7ec13ce58321910160405180910390a150565b6060600380546105e89061128b565b80601f01602080910402602001604051908101604052809291908181526020018280546106149061128b565b80156106615780601f1061063657610100808354040283529160200191610661565b820191906000526020600020905b81548152906001019060200180831161064457829003601f168201915b5050505050905090565b600033610679818585610af2565b60019150505b92915050565b600033610693858285610b04565b61069e858585610b88565b506001949350505050565b336001600160a01b037f000000000000000000000000ad5c70588101d168b52577004a3a209ab90ab49a16146106f257604051633e34a41b60e21b815260040160405180910390fd5b8061071057604051639fdb7da760e01b815260040160405180910390fd5b6001600160a01b0382166000908152600a602052604090205460ff1615610735575050565b6001600160a01b0382166000908152600a60209081526040808320805460ff19166001179055908290528120549050801561079b57806006600082825461077c91906112c5565b90915550506001600160a01b0383166000908152600860205260408120555b604051600181526001600160a01b038416907faf52feecf81343fee9ed3d93c2e2945736c55d9800211a4acb61222164c7d70d9060200160405180910390a2505050565b6000806107eb83610a5e565b6001600160a01b03841660009081526009602052604090205490915080821161081557600061081f565b61081f81836112c5565b949350505050565b336001600160a01b037f000000000000000000000000ad5c70588101d168b52577004a3a209ab90ab49a161461087057604051633e34a41b60e21b815260040160405180910390fd5b6b01313aca15156285110000008161088760025490565b6108919190611278565b11156108b05760405163a4875a4960e01b815260040160405180910390fd5b6108ba8282610be7565b5050565b6108c6610c1d565b60006108d1336107df565b9050806000036108f4576040516312d37ee560e31b815260040160405180910390fd5b3360009081526009602052604081208054839290610913908490611278565b9091555050604051600090339083908381818185875af1925050503d806000811461095a576040519150601f19603f3d011682016040523d82523d6000602084013e61095f565b606091505b5050905080610981576040516312171d8360e31b815260040160405180910390fd5b60405182815233907fd8138f8a3f377c5259ca548e70e4c2de94f129f5a11036a15b69513cba2b426a9060200160405180910390a250506109e160017f9b779b17422d0df92223018b32b4d1fa46e071723d6817e2486d003becc55f0055565b565b336001600160a01b037f000000000000000000000000da5734cd1013359bfea1943ee4b109f87e916a891614610a2c576040516310a56f0f60e31b815260040160405180910390fd5b610a37823383610b04565b6108ba8282610c4b565b6060600480546105e89061128b565b600033610679818585610b88565b6001600160a01b0381166000908152600a602052604081205460ff1615610a8757506000919050565b6001600160a01b03821660009081526008602090815260408083205491839052822054600554610ab7919061123f565b610ac191906112d8565b90506000811215610ad55750600092915050565b610ae3600160401b82611256565b9392505050565b6109e16104fd565b610aff8383836001610c81565b505050565b6001600160a01b03838116600090815260016020908152604080832093861683529290522054600019811015610b825781811015610b7357604051637dc7a0d960e11b81526001600160a01b038416600482015260248101829052604481018390526064015b60405180910390fd5b610b8284848484036000610c81565b50505050565b6001600160a01b038316610bb257604051634b637e8f60e11b815260006004820152602401610b6a565b6001600160a01b038216610bdc5760405163ec442f0560e01b815260006004820152602401610b6a565b610aff838383610d56565b6001600160a01b038216610c115760405163ec442f0560e01b815260006004820152602401610b6a565b6108ba60008383610d56565b610c25610f31565b60027f9b779b17422d0df92223018b32b4d1fa46e071723d6817e2486d003becc55f0055565b6001600160a01b038216610c7557604051634b637e8f60e11b815260006004820152602401610b6a565b6108ba82600083610d56565b6001600160a01b038416610cab5760405163e602df0560e01b815260006004820152602401610b6a565b6001600160a01b038316610cd557604051634a1406b160e11b815260006004820152602401610b6a565b6001600160a01b0380851660009081526001602090815260408083209387168352929052208290558015610b8257826001600160a01b0316846001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92584604051610d4891815260200190565b60405180910390a350505050565b610d61838383610f73565b7f000000000000000000000000ad5c70588101d168b52577004a3a209ab90ab49a6001600160a01b0316826001600160a01b0316148015610daa57506001600160a01b03831615155b80610dbd57506001600160a01b03821630145b15610ddb57604051630e79246960e21b815260040160405180910390fd5b80600003610de857505050565b60006001600160a01b03841615801590610e1b57506001600160a01b0384166000908152600a602052604090205460ff16155b905060006001600160a01b03841615801590610e5057506001600160a01b0384166000908152600a602052604090205460ff16155b90506000610e6a84600554610e65919061123f565b61109d565b90508215610ea0576001600160a01b03861660009081526008602052604081208054839290610e9a9084906112d8565b90915550505b8115610ed4576001600160a01b03851660009081526008602052604081208054839290610ece908490611300565b90915550505b828015610edf575081155b15610f01578360066000828254610ef691906112c5565b90915550610f299050565b82158015610f0c5750815b15610f29578360066000828254610f239190611278565b90915550505b505050505050565b7f9b779b17422d0df92223018b32b4d1fa46e071723d6817e2486d003becc55f00546002036109e157604051633ee5aeb560e01b815260040160405180910390fd5b6001600160a01b038316610f9e578060026000828254610f939190611278565b909155506110109050565b6001600160a01b03831660009081526020819052604090205481811015610ff15760405163391434e360e21b81526001600160a01b03851660048201526024810182905260448101839052606401610b6a565b6001600160a01b03841660009081526020819052604090209082900390555b6001600160a01b03821661102c5760028054829003905561104b565b6001600160a01b03821660009081526020819052604090208054820190555b816001600160a01b0316836001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8360405161109091815260200190565b60405180910390a3505050565b60006001600160ff1b038211156110ca5760405163123baf0360e11b815260048101839052602401610b6a565b5090565b60006020808352835180602085015260005b818110156110fc578581018301518582016040015282016110e0565b506000604082860101526040601f19601f8301168501019250505092915050565b80356001600160a01b038116811461113457600080fd5b919050565b6000806040838503121561114c57600080fd5b6111558361111d565b946020939093013593505050565b60008060006060848603121561117857600080fd5b6111818461111d565b925061118f6020850161111d565b9150604084013590509250925092565b600080604083850312156111b257600080fd5b6111bb8361111d565b9150602083013580151581146111d057600080fd5b809150509250929050565b6000602082840312156111ed57600080fd5b610ae38261111d565b6000806040838503121561120957600080fd5b6112128361111d565b91506112206020840161111d565b90509250929050565b634e487b7160e01b600052601160045260246000fd5b808202811582820484141761067f5761067f611229565b60008261127357634e487b7160e01b600052601260045260246000fd5b500490565b8082018082111561067f5761067f611229565b600181811c9082168061129f57607f821691505b6020821081036112bf57634e487b7160e01b600052602260045260246000fd5b50919050565b8181038181111561067f5761067f611229565b80820182811260008312801582168215821617156112f8576112f8611229565b505092915050565b818103600083128015838313168383128216171561132057611320611229565b509291505056fea2646970667358221220ca4d18aabf8ec154d92bde179aa427c7edcd0b05d87d78cedb577220b34a0feb64736f6c63430008180033