Contract 0xa9573492295da5edc32fcd26638a1376a0482063

Contract Overview

Balance:
0 MATIC

Token:
Txn Hash Method
Block
From
To
Value [Txn Fee]
0xeb9374030646c80cbcc46ac47f48f7ce767f983f3167b9afb6c23771b19cddbfTransfer With Au...295042542022-12-05 15:43:056 hrs 45 mins ago0x42b6fe942b8a564b7e16a40add4782a3cc5be691 IN  0xa9573492295da5edc32fcd26638a1376a04820630 MATIC0.000221629092.614352163
0xd92baa984495f789b2751a21c2655c861a6ac31b2900498ebed52a42d0e29568Buy For295042492022-12-05 15:42:406 hrs 46 mins ago0x2f78d0d1e26b871b78cb543ec607829a47a51ebc IN  0xa9573492295da5edc32fcd26638a1376a04820630 MATIC0.0007517709133.123074647
0xf7d0c14004903f06f3497b0b590c1e8c038ab3980d658d1fd49b98bbfd60630eTransfer With Au...295042452022-12-05 15:42:206 hrs 46 mins ago0x1091da8a0b1b08c595de6d14ad8bba76d85e6514 IN  0xa9573492295da5edc32fcd26638a1376a04820630 MATIC0.0002566868553.027895999
0x633d09e70c7a93cfade7e88abca4d329ee48c0e42316877b5de04d68c9edbf61Buy For295042422022-12-05 15:42:056 hrs 46 mins ago0x1091da8a0b1b08c595de6d14ad8bba76d85e6514 IN  0xa9573492295da5edc32fcd26638a1376a04820630 MATIC0.0007460990693.099512159
0x17f3075f422ba6471aa7623641ff2e14d868947033c3ef0d1dad6d283c96b1a3Transfer295042402022-12-05 15:41:556 hrs 46 mins ago0x1091da8a0b1b08c595de6d14ad8bba76d85e6514 IN  0xa9573492295da5edc32fcd26638a1376a04820630 MATIC0.0001716226293.186043956
0x365893f024af11aae036a2beb8e6d65df9e11d337553579a488380edee0f213dBuy For295042382022-12-05 15:41:456 hrs 46 mins ago0x1091da8a0b1b08c595de6d14ad8bba76d85e6514 IN  0xa9573492295da5edc32fcd26638a1376a04820630 MATIC0.0007112959473.132979265
0x494d585273eee2de29771362229b45c15573e2194c874a4fc05a8be89e2ddbe7Buy For295042352022-12-05 15:41:306 hrs 47 mins ago0x1091da8a0b1b08c595de6d14ad8bba76d85e6514 IN  0xa9573492295da5edc32fcd26638a1376a04820630 MATIC0.0007203322982.99246951
0xf9be0b23f50866de8397549731e0dac2a202c32fc9fe97ced6922ff5016e2806Buy For295042312022-12-05 15:41:106 hrs 47 mins ago0x5ce3d72af3df617e2663a94b88a7d7e030735d81 IN  0xa9573492295da5edc32fcd26638a1376a04820630 MATIC0.0006949955042.887213111
0xe287d4172630fa207edc833009d89a4041f2fd4cbf4682ea86266458cc33c405Transfer With Au...295042272022-12-05 15:40:506 hrs 47 mins ago0x99d139b688a18415a83fe6292dd5179fa2674a46 IN  0xa9573492295da5edc32fcd26638a1376a04820630 MATIC0.0002118230492.49867942
0x85ecbe48b4c6c5a072f3edb96a5a553643b87bf3aa181cb30406933e70bce48cTransfer295042242022-12-05 15:40:356 hrs 48 mins ago0x5ce3d72af3df617e2663a94b88a7d7e030735d81 IN  0xa9573492295da5edc32fcd26638a1376a04820630 MATIC0.0000951538412.588022992
0x7df6d01ab9793c8902b7d129137f2f437a12ed8e27a03b3738593118d3a71985Transfer295042222022-12-05 15:40:256 hrs 48 mins ago0x5ce3d72af3df617e2663a94b88a7d7e030735d81 IN  0xa9573492295da5edc32fcd26638a1376a04820630 MATIC0.0001408989692.615682514
0xd17aae4ef363e10c79d5cf7655dcc8c5a56f438c1a53a26a198d8fd4560c1addBuy For295042202022-12-05 15:40:156 hrs 48 mins ago0x5ce3d72af3df617e2663a94b88a7d7e030735d81 IN  0xa9573492295da5edc32fcd26638a1376a04820630 MATIC0.0006176880232.720673127
0xde80d37715779a19180b9ac18983523edf9663973d7703dc58a0530f6faa982eTransfer With Au...295042172022-12-05 15:40:006 hrs 48 mins ago0xc95304583575b990e5e3cbf1d7c7d999c41189d8 IN  0xa9573492295da5edc32fcd26638a1376a04820630 MATIC0.000191883142.263466868
0xe048849c6f86a158f9ff3aa1facb543bfdeeeec28a65214390730c280d5926e6Transfer295041902022-12-05 15:37:446 hrs 51 mins ago0x5ce3d72af3df617e2663a94b88a7d7e030735d81 IN  0xa9573492295da5edc32fcd26638a1376a04820630 MATIC0.0001304710892.42209683
0xf9fb375637ff6ccd11ffac328d241ed6f9203bdaa038e04cec045c6883c6ee60Buy For295041882022-12-05 15:37:346 hrs 51 mins ago0x5ce3d72af3df617e2663a94b88a7d7e030735d81 IN  0xa9573492295da5edc32fcd26638a1376a04820630 MATIC0.0005422050732.388200383
0x2b8dfec9b8c13b74dc5308d4514f5965a298f64e98d5b14e1081653f812e5f11Transfer295041852022-12-05 15:37:196 hrs 51 mins ago0x5ce3d72af3df617e2663a94b88a7d7e030735d81 IN  0xa9573492295da5edc32fcd26638a1376a04820630 MATIC0.0001385305052.571713764
0xa9f0995009fbe865119c1ef7cab35491c3800a1058a86b1e2367cd490bf6b8fbTransfer295041832022-12-05 15:37:096 hrs 51 mins ago0x5ce3d72af3df617e2663a94b88a7d7e030735d81 IN  0xa9573492295da5edc32fcd26638a1376a04820630 MATIC0.0001374564012.551773842
0x872d2279b83e8d6a6b901a2a2096a250b27088ee8ec9bd40753e836144e63bdaBuy For295041812022-12-05 15:36:596 hrs 51 mins ago0x5ce3d72af3df617e2663a94b88a7d7e030735d81 IN  0xa9573492295da5edc32fcd26638a1376a04820630 MATIC0.0006115431762.693607489
0x7be157d108e7e711e8aa4ef7fccb2fef3bd8d5d17af0a42b7c5791b0a0158295Transfer295041782022-12-05 15:36:446 hrs 52 mins ago0x5ce3d72af3df617e2663a94b88a7d7e030735d81 IN  0xa9573492295da5edc32fcd26638a1376a04820630 MATIC0.000148103392.74942712
0x1774039aafb439f59d9aca220d252c09daefe00bb6923497b7005fd5ee046217Buy For295041762022-12-05 15:36:346 hrs 52 mins ago0x5ce3d72af3df617e2663a94b88a7d7e030735d81 IN  0xa9573492295da5edc32fcd26638a1376a04820630 MATIC0.0006651038182.929521081
0x6dda9fbf8514f72d82a063c029e6bd71d8e507445eb481f071592adb6f70966dTransfer295041732022-12-05 15:36:196 hrs 52 mins ago0x5ce3d72af3df617e2663a94b88a7d7e030735d81 IN  0xa9573492295da5edc32fcd26638a1376a04820630 MATIC0.0001523247042.827792612
0x768bb1111b2e45fa2861f8e8b70368752f6588931d9f34642ea02896c54b2b30Buy For295041712022-12-05 15:36:096 hrs 52 mins ago0x5ce3d72af3df617e2663a94b88a7d7e030735d81 IN  0xa9573492295da5edc32fcd26638a1376a04820630 MATIC0.0006638309122.92391443
0xd9967ae35bac0d47b0acf03e4aa771d52e37009d7ec38e89b8e9c1528100c6eeTransfer295041682022-12-05 15:35:546 hrs 52 mins ago0x5ce3d72af3df617e2663a94b88a7d7e030735d81 IN  0xa9573492295da5edc32fcd26638a1376a04820630 MATIC0.0001560152482.896304753
0x2be7a4a5e6d035fe7b4c3981ca7231ceaf6a945ab385d5e19560fe08344bd618Buy For295041662022-12-05 15:35:446 hrs 53 mins ago0x5ce3d72af3df617e2663a94b88a7d7e030735d81 IN  0xa9573492295da5edc32fcd26638a1376a04820630 MATIC0.0006761262922.978070751
0x7c0285c3a29b161a10be5c7d2eb4a470b0396e2be80a29cfa1706131ba679591Transfer With Au...295041632022-12-05 15:35:296 hrs 53 mins ago0x90352c23352504e960f0afbbacb257d3fae4fd8a IN  0xa9573492295da5edc32fcd26638a1376a04820630 MATIC0.0002309568032.888331996
[ Download CSV Export 
Parent Txn Hash Block From To Value
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
Quarters

Compiler Version
v0.8.0+commit.c7dfd78e

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion

Contract Source Code (Solidity Standard Json-Input format)

File 1 of 15 : Quarters.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import "./token/ERC20/ERC20.sol";
import "./token/ERC20/extensions/ERC20Authorization.sol";
import "./access/Ownable.sol";
import "./utils/math/SafeMath.sol";
import "./ISwap.sol";
import "./IQ2.sol";

contract Quarters is ERC20Authorization, Ownable {
    using SafeMath for uint256;
    string public TokenName = "Quarters";
    string public TokenSymbol = "Q";

    uint256 public usdtRate = 571;

    uint256 private royaltyBasisPoints = 1500; // royalties in Basis Points

    uint256 public MAX_BASISPOINTS = 10000; //Max Value

    uint256 public USDT_DECIMAL_POINT = 10**6;

    // for now we are using six 0xef82b1c6a550e730d8283e1edd4977cd01faf435
    // once we create liquidity pool we will place actual q2 address
    address public q2;

    // List of developers
    // address -> status
    mapping(address => bool) public developers;

    bool public pauseTransfer = false;

    // token used to buy quarters
    // for mainnet 0xceE8FAF64bB97a73bb51E115Aa89C17FfA8dD167
    ERC20 public usdt;

    address public swapAddress;

    string internal constant ZERO_ADDRESS_ERROR =
        "Address Cannot be Zero Address";
    string internal constant INSUFFICIENT_BALANCE_ERROR =
        "Address Doesn't Have Sufficient Balance";
    string internal constant CONTRACT_PAUSED_ERROR = "Contract is Paused";

    // events

    // usdt rate changed
    event USDTRateChanged(uint256 currentRate, uint256 newRate);

    event ChangedQ2(address indexed oldQ2, address indexed newQ2);
    event DeveloperStatusChanged(address indexed developer, bool status);
    event USDTChanged(
        address indexed oldUSDTAddress,
        address indexed newUSDTAddress
    );
    event DecimalPointChanged(uint256 oldDecimalPoint, uint256 newDecimalPoint);
    event SwapAddressChanged(
        address indexed oldAddress,
        address indexed newAddress
    );

    event QuartersOrdered(
        address indexed sender,
        uint256 usdtValue,
        uint256 tokens
    );

    event Withdraw(address indexed developer, uint256 value);

    constructor(
        address _q2,
        address _swapAddress,
        address _usdt
    ) ERC20(TokenName, TokenSymbol) ERC20Authorization(TokenName) {
        q2 = _q2;
        swapAddress = _swapAddress;
        usdt = ERC20(_usdt);
    }

    // developer modifier
    modifier onlyActiveDeveloper() {
        require(
            developers[msg.sender] == true,
            "Quarters: Not An Active Developer"
        );
        _;
    }

    function changeDecimalPoint(uint256 newDecimalPoint) public onlyOwner {
        uint256 oldDecimalPoint = USDT_DECIMAL_POINT;
        USDT_DECIMAL_POINT = newDecimalPoint;
        emit DecimalPointChanged(oldDecimalPoint, USDT_DECIMAL_POINT);
    }

    function changeSwapAddress(address newSwapAddress) public onlyOwner {
        address oldSwapAddress = swapAddress;
        swapAddress = newSwapAddress;
        emit SwapAddressChanged(oldSwapAddress, newSwapAddress);
    }

    function changeTransferState() public onlyOwner {
        pauseTransfer = !pauseTransfer;
    }

    function setUsdtRate(uint256 rate) public onlyOwner {
        // Quarters token to be provided for 1 usdt
        require(rate > 0, "Quarters: Rate must be greater or equal to 1");
        usdtRate = rate;
        emit USDTRateChanged(usdtRate, rate);
    }

    function changeQ2(address _q2) public onlyOwner {
        address oldQ2 = q2;
        q2 = _q2;
        emit ChangedQ2(oldQ2, _q2);
    }

    function transferFrom(
        address _from,
        address _to,
        uint256 _value
    ) public override returns (bool success) {
        require(!pauseTransfer, CONTRACT_PAUSED_ERROR);
        return super.transferFrom(_from, _to, _value);
    }

    function transfer(address _to, uint256 _value)
        public
        override
        returns (bool success)
    {
        require(!pauseTransfer, CONTRACT_PAUSED_ERROR);
        return super.transfer(_to, _value);
    }

    function receiveWithAuthorization(
        address from,
        address to,
        uint256 value,
        uint256 validAfter,
        uint256 validBefore,
        bytes32 nonce,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) public virtual override {
        require(!pauseTransfer, CONTRACT_PAUSED_ERROR);
        super.receiveWithAuthorization(
            from,
            to,
            value,
            validAfter,
            validBefore,
            nonce,
            v,
            r,
            s
        );
    }

    function transferWithAuthorization(
        address from,
        address to,
        uint256 value,
        uint256 validAfter,
        uint256 validBefore,
        bytes32 nonce,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) public virtual override {
        require(!pauseTransfer, CONTRACT_PAUSED_ERROR);
        super.transferWithAuthorization(
            from,
            to,
            value,
            validAfter,
            validBefore,
            nonce,
            v,
            r,
            s
        );
    }

    /**
     * Change usdt Address if required so that we dont have to redeploy contract
     */
    function changeusdt(address usdtAddress) public onlyOwner {
        require(address(0) != usdtAddress, ZERO_ADDRESS_ERROR);
        address oldUSDT = address(usdt);
        usdt = ERC20(usdtAddress);
        emit USDTChanged(oldUSDT, address(usdt));
    }

    /**
     * Developer status
     */
    function setDeveloperStatus(address _address, bool status)
        public
        onlyOwner
    {
        developers[_address] = status;
        emit DeveloperStatusChanged(_address, status);
    }

    /**
     * Buy quarters by sending usdt based upon usdtRate to contract address default : 571
     * @param usdtAmount total usdt amount
     */

    function buy(uint256 usdtAmount) public {
        _buy(msg.sender, usdtAmount);
    }

    /**
     * Buy quarters for specific address and take approval to spend by spender by sending kusdt based upon kusdtRate to contract address default : 571
     * @param buyer address to send quarters
     * @param usdtAmount total kusdt amount to spend
     */

    function buyFor(address buyer, uint256 usdtAmount) public payable {
        uint256 _value = _buy(buyer, usdtAmount);
        emit Approval(buyer, msg.sender, _value);
    }

    // returns number of quarters buyer got
    function _buy(address buyer, uint256 usdtAmount)
        internal
        returns (uint256)
    {
        require(
            usdt.balanceOf(msg.sender) >= usdtAmount,
            INSUFFICIENT_BALANCE_ERROR
        );
        require(buyer != address(0), ZERO_ADDRESS_ERROR);
        usdt.transferFrom(msg.sender, address(this), usdtAmount);
        uint256 nq = usdtAmount.mul(usdtRate).div(USDT_DECIMAL_POINT);

        _mint(buyer, nq);

        emit QuartersOrdered(buyer, usdtAmount, nq);
        uint256 Q2BurnAmount = usdtAmount.mul(royaltyBasisPoints).div(
            MAX_BASISPOINTS
        );

        usdt.approve(swapAddress, Q2BurnAmount);
        ISwap(swapAddress).exchange(address(usdt), q2, Q2BurnAmount);
        IQ2(q2)._burn(address(this), ERC20(q2).balanceOf(address(this)));
        return nq;
    }

    function withdraw(uint256 value) public onlyActiveDeveloper {
        require(balanceOf(msg.sender) >= value, "Insufficient Value");

        uint256 unitEarning = usdt.balanceOf(address(this)).div(totalSupply());

        _burn(msg.sender, value);

        // earning for developers
        usdt.transfer(msg.sender, unitEarning.mul(value));

        emit Withdraw(msg.sender, unitEarning.mul(value));
    }

    function emergencyExit() public onlyOwner {
        usdt.transfer(msg.sender, usdt.balanceOf(address(this)));
    }
}

File 2 of 15 : ISwap.sol
// SPDX-License-Identifier: SEE LICENSE IN LICENSE
pragma solidity 0.8.0;

interface ISwap {
    /**
     * @param tokenA the address of token we are spending
     * @param tokenB the address of token we want
     * @param amountIn amount of tokenA we want to spend
     */
    function exchange(
        address tokenA,
        address tokenB,
        uint amountIn
    ) external;
}

File 3 of 15 : IQ2.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC20 standard as defined in the EIP.
 */
interface IQ2 {
    function _burn(address account, uint256 amount) external;
}

File 4 of 15 : Ownable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)

pragma solidity ^0.8.0;

import "../utils/Context.sol";

/**
 * @dev Contract module which provides a basic access control mechanism, where
 * there is an account (an owner) that can be granted exclusive access to
 * specific functions.
 *
 * By default, the owner account will be the one that deploys the contract. This
 * can later be changed with {transferOwnership}.
 *
 * This module is used through inheritance. It will make available the modifier
 * `onlyOwner`, which can be applied to your functions to restrict their use to
 * the owner.
 */
abstract contract Ownable is Context {
    address private _owner;

    event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);

    /**
     * @dev Initializes the contract setting the deployer as the initial owner.
     */
    constructor() {
        _transferOwnership(_msgSender());
    }

    /**
     * @dev Throws if called by any account other than the owner.
     */
    modifier onlyOwner() {
        _checkOwner();
        _;
    }

    /**
     * @dev Returns the address of the current owner.
     */
    function owner() public view virtual returns (address) {
        return _owner;
    }

    /**
     * @dev Throws if the sender is not the owner.
     */
    function _checkOwner() internal view virtual {
        require(owner() == _msgSender(), "Ownable: caller is not the owner");
    }

    /**
     * @dev Leaves the contract without owner. It will not be possible to call
     * `onlyOwner` functions anymore. Can only be called by the current owner.
     *
     * NOTE: Renouncing ownership will leave the contract without an owner,
     * thereby removing any functionality that is only available to the owner.
     */
    function renounceOwnership() public virtual onlyOwner {
        _transferOwnership(address(0));
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Can only be called by the current owner.
     */
    function transferOwnership(address newOwner) public virtual onlyOwner {
        require(newOwner != address(0), "Ownable: new owner is the zero address");
        _transferOwnership(newOwner);
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Internal function without access restriction.
     */
    function _transferOwnership(address newOwner) internal virtual {
        address oldOwner = _owner;
        _owner = newOwner;
        emit OwnershipTransferred(oldOwner, newOwner);
    }
}

File 5 of 15 : ERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC20/ERC20.sol)

pragma solidity ^0.8.0;

import "./IERC20.sol";
import "./IERC20Metadata.sol";
import "../../utils/Context.sol";

/**
 * @dev Implementation of the {IERC20} interface.
 *
 * This implementation is agnostic to the way tokens are created. This means
 * that a supply mechanism has to be added in a derived contract using {_mint}.
 * For a generic mechanism see {ERC20PresetMinterPauser}.
 *
 * TIP: For a detailed writeup see our guide
 * https://forum.openzeppelin.com/t/how-to-implement-erc20-supply-mechanisms/226[How
 * to implement supply mechanisms].
 *
 * We have followed general OpenZeppelin Contracts guidelines: functions revert
 * instead returning `false` on failure. This behavior is nonetheless
 * conventional and does not conflict with the expectations of ERC20
 * applications.
 *
 * Additionally, an {Approval} event is emitted on calls to {transferFrom}.
 * This allows applications to reconstruct the allowance for all accounts just
 * by listening to said events. Other implementations of the EIP may not emit
 * these events, as it isn't required by the specification.
 *
 * Finally, the non-standard {decreaseAllowance} and {increaseAllowance}
 * functions have been added to mitigate the well-known issues around setting
 * allowances. See {IERC20-approve}.
 */
contract ERC20 is Context, IERC20, IERC20Metadata {
    mapping(address => uint256) private _balances;

    mapping(address => mapping(address => uint256)) private _allowances;

    uint256 private _totalSupply;

    string private _name;
    string private _symbol;

    /**
     * @dev Sets the values for {name} and {symbol}.
     *
     * The default value of {decimals} is 18. To select a different value for
     * {decimals} you should overload it.
     *
     * All two of these values are immutable: they can only be set once during
     * construction.
     */
    constructor(string memory name_, string memory symbol_) {
        _name = name_;
        _symbol = symbol_;
    }

    /**
     * @dev Returns the name of the token.
     */
    function name() public view virtual override returns (string memory) {
        return _name;
    }

    /**
     * @dev Returns the symbol of the token, usually a shorter version of the
     * name.
     */
    function symbol() public view virtual override returns (string memory) {
        return _symbol;
    }

    /**
     * @dev Returns the number of decimals used to get its user representation.
     * For example, if `decimals` equals `2`, a balance of `505` tokens should
     * be displayed to a user as `5.05` (`505 / 10 ** 2`).
     *
     * Tokens usually opt for a value of 18, imitating the relationship between
     * Ether and Wei. This is the value {ERC20} uses, unless this function is
     * overridden;
     *
     * NOTE: This information is only used for _display_ purposes: it in
     * no way affects any of the arithmetic of the contract, including
     * {IERC20-balanceOf} and {IERC20-transfer}.
     */
    function decimals() public view virtual override returns (uint8) {
        return 0;
    }

    /**
     * @dev See {IERC20-totalSupply}.
     */
    function totalSupply() public view virtual override returns (uint256) {
        return _totalSupply;
    }

    /**
     * @dev See {IERC20-balanceOf}.
     */
    function balanceOf(address account)
        public
        view
        virtual
        override
        returns (uint256)
    {
        return _balances[account];
    }

    /**
     * @dev See {IERC20-transfer}.
     *
     * Requirements:
     *
     * - `to` cannot be the zero address.
     * - the caller must have a balance of at least `amount`.
     */
    function transfer(address to, uint256 amount)
        public
        virtual
        override
        returns (bool)
    {
        address owner = _msgSender();
        _transfer(owner, to, amount);
        return true;
    }

    /**
     * @dev See {IERC20-allowance}.
     */
    function allowance(address owner, address spender)
        public
        view
        virtual
        override
        returns (uint256)
    {
        return _allowances[owner][spender];
    }

    /**
     * @dev See {IERC20-approve}.
     *
     * NOTE: If `amount` is the maximum `uint256`, the allowance is not updated on
     * `transferFrom`. This is semantically equivalent to an infinite approval.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     */
    function approve(address spender, uint256 amount)
        public
        virtual
        override
        returns (bool)
    {
        address owner = _msgSender();
        _approve(owner, spender, amount);
        return true;
    }

    /**
     * @dev See {IERC20-transferFrom}.
     *
     * Emits an {Approval} event indicating the updated allowance. This is not
     * required by the EIP. See the note at the beginning of {ERC20}.
     *
     * NOTE: Does not update the allowance if the current allowance
     * is the maximum `uint256`.
     *
     * Requirements:
     *
     * - `from` and `to` cannot be the zero address.
     * - `from` must have a balance of at least `amount`.
     * - the caller must have allowance for ``from``'s tokens of at least
     * `amount`.
     */
    function transferFrom(
        address from,
        address to,
        uint256 amount
    ) public virtual override returns (bool) {
        address spender = _msgSender();
        _spendAllowance(from, spender, amount);
        _transfer(from, to, amount);
        return true;
    }

    /**
     * @dev Atomically increases the allowance granted to `spender` by the caller.
     *
     * This is an alternative to {approve} that can be used as a mitigation for
     * problems described in {IERC20-approve}.
     *
     * Emits an {Approval} event indicating the updated allowance.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     */
    function increaseAllowance(address spender, uint256 addedValue)
        public
        virtual
        returns (bool)
    {
        address owner = _msgSender();
        _approve(owner, spender, allowance(owner, spender) + addedValue);
        return true;
    }

    /**
     * @dev Atomically decreases the allowance granted to `spender` by the caller.
     *
     * This is an alternative to {approve} that can be used as a mitigation for
     * problems described in {IERC20-approve}.
     *
     * Emits an {Approval} event indicating the updated allowance.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     * - `spender` must have allowance for the caller of at least
     * `subtractedValue`.
     */
    function decreaseAllowance(address spender, uint256 subtractedValue)
        public
        virtual
        returns (bool)
    {
        address owner = _msgSender();
        uint256 currentAllowance = allowance(owner, spender);
        require(
            currentAllowance >= subtractedValue,
            "ERC20: decreased allowance below zero"
        );
        unchecked {
            _approve(owner, spender, currentAllowance - subtractedValue);
        }

        return true;
    }

    /**
     * @dev Moves `amount` of tokens from `from` to `to`.
     *
     * This internal function is equivalent to {transfer}, and can be used to
     * e.g. implement automatic token fees, slashing mechanisms, etc.
     *
     * Emits a {Transfer} event.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `from` must have a balance of at least `amount`.
     */
    function _transfer(
        address from,
        address to,
        uint256 amount
    ) internal virtual {
        require(from != address(0), "ERC20: transfer from the zero address");
        require(to != address(0), "ERC20: transfer to the zero address");

        _beforeTokenTransfer(from, to, amount);

        uint256 fromBalance = _balances[from];
        require(
            fromBalance >= amount,
            "ERC20: transfer amount exceeds balance"
        );
        unchecked {
            _balances[from] = fromBalance - amount;
            // Overflow not possible: the sum of all balances is capped by totalSupply, and the sum is preserved by
            // decrementing then incrementing.
            _balances[to] += amount;
        }

        emit Transfer(from, to, amount);

        _afterTokenTransfer(from, to, amount);
    }

    /** @dev Creates `amount` tokens and assigns them to `account`, increasing
     * the total supply.
     *
     * Emits a {Transfer} event with `from` set to the zero address.
     *
     * Requirements:
     *
     * - `account` cannot be the zero address.
     */
    function _mint(address account, uint256 amount) internal virtual {
        require(account != address(0), "ERC20: mint to the zero address");

        _beforeTokenTransfer(address(0), account, amount);

        _totalSupply += amount;
        unchecked {
            // Overflow not possible: balance + amount is at most totalSupply + amount, which is checked above.
            _balances[account] += amount;
        }
        emit Transfer(address(0), account, amount);

        _afterTokenTransfer(address(0), account, amount);
    }

    /**
     * @dev Destroys `amount` tokens from `account`, reducing the
     * total supply.
     *
     * Emits a {Transfer} event with `to` set to the zero address.
     *
     * Requirements:
     *
     * - `account` cannot be the zero address.
     * - `account` must have at least `amount` tokens.
     */
    function _burn(address account, uint256 amount) internal virtual {
        require(account != address(0), "ERC20: burn from the zero address");

        _beforeTokenTransfer(account, address(0), amount);

        uint256 accountBalance = _balances[account];
        require(accountBalance >= amount, "ERC20: burn amount exceeds balance");
        unchecked {
            _balances[account] = accountBalance - amount;
            // Overflow not possible: amount <= accountBalance <= totalSupply.
            _totalSupply -= amount;
        }

        emit Transfer(account, address(0), amount);

        _afterTokenTransfer(account, address(0), amount);
    }

    /**
     * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.
     *
     * This internal function is equivalent to `approve`, and can be used to
     * e.g. set automatic allowances for certain subsystems, etc.
     *
     * Emits an {Approval} event.
     *
     * Requirements:
     *
     * - `owner` cannot be the zero address.
     * - `spender` cannot be the zero address.
     */
    function _approve(
        address owner,
        address spender,
        uint256 amount
    ) internal virtual {
        require(owner != address(0), "ERC20: approve from the zero address");
        require(spender != address(0), "ERC20: approve to the zero address");

        _allowances[owner][spender] = amount;
        emit Approval(owner, spender, amount);
    }

    /**
     * @dev Updates `owner` s allowance for `spender` based on spent `amount`.
     *
     * Does not update the allowance amount in case of infinite allowance.
     * Revert if not enough allowance is available.
     *
     * Might emit an {Approval} event.
     */
    function _spendAllowance(
        address owner,
        address spender,
        uint256 amount
    ) internal virtual {
        uint256 currentAllowance = allowance(owner, spender);
        if (currentAllowance != type(uint256).max) {
            require(
                currentAllowance >= amount,
                "ERC20: insufficient allowance"
            );
            unchecked {
                _approve(owner, spender, currentAllowance - amount);
            }
        }
    }

    /**
     * @dev Hook that is called before any transfer of tokens. This includes
     * minting and burning.
     *
     * Calling conditions:
     *
     * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
     * will be transferred to `to`.
     * - when `from` is zero, `amount` tokens will be minted for `to`.
     * - when `to` is zero, `amount` of ``from``'s tokens will be burned.
     * - `from` and `to` are never both zero.
     *
     * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
     */
    function _beforeTokenTransfer(
        address from,
        address to,
        uint256 amount
    ) internal virtual {}

    /**
     * @dev Hook that is called after any transfer of tokens. This includes
     * minting and burning.
     *
     * Calling conditions:
     *
     * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
     * has been transferred to `to`.
     * - when `from` is zero, `amount` tokens have been minted for `to`.
     * - when `to` is zero, `amount` of ``from``'s tokens have been burned.
     * - `from` and `to` are never both zero.
     *
     * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
     */
    function _afterTokenTransfer(
        address from,
        address to,
        uint256 amount
    ) internal virtual {}
}

File 6 of 15 : SafeMath.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (utils/math/SafeMath.sol)

pragma solidity ^0.8.0;

// CAUTION
// This version of SafeMath should only be used with Solidity 0.8 or later,
// because it relies on the compiler's built in overflow checks.

/**
 * @dev Wrappers over Solidity's arithmetic operations.
 *
 * NOTE: `SafeMath` is generally not needed starting with Solidity 0.8, since the compiler
 * now has built in overflow checking.
 */
library SafeMath {
    /**
     * @dev Returns the addition of two unsigned integers, with an overflow flag.
     *
     * _Available since v3.4._
     */
    function tryAdd(uint256 a, uint256 b)
        internal
        pure
        returns (bool, uint256)
    {
        unchecked {
            uint256 c = a + b;
            if (c < a) return (false, 0);
            return (true, c);
        }
    }

    /**
     * @dev Returns the subtraction of two unsigned integers, with an overflow flag.
     *
     * _Available since v3.4._
     */
    function trySub(uint256 a, uint256 b)
        internal
        pure
        returns (bool, uint256)
    {
        unchecked {
            if (b > a) return (false, 0);
            return (true, a - b);
        }
    }

    /**
     * @dev Returns the multiplication of two unsigned integers, with an overflow flag.
     *
     * _Available since v3.4._
     */
    function tryMul(uint256 a, uint256 b)
        internal
        pure
        returns (bool, uint256)
    {
        unchecked {
            // Gas optimization: this is cheaper than requiring 'a' not being zero, but the
            // benefit is lost if 'b' is also tested.
            // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
            if (a == 0) return (true, 0);
            uint256 c = a * b;
            if (c / a != b) return (false, 0);
            return (true, c);
        }
    }

    /**
     * @dev Returns the division of two unsigned integers, with a division by zero flag.
     *
     * _Available since v3.4._
     */
    function tryDiv(uint256 a, uint256 b)
        internal
        pure
        returns (bool, uint256)
    {
        unchecked {
            if (b == 0) return (false, 0);
            return (true, a / b);
        }
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.
     *
     * _Available since v3.4._
     */
    function tryMod(uint256 a, uint256 b)
        internal
        pure
        returns (bool, uint256)
    {
        unchecked {
            if (b == 0) return (false, 0);
            return (true, a % b);
        }
    }

    /**
     * @dev Returns the addition of two unsigned integers, reverting on
     * overflow.
     *
     * Counterpart to Solidity's `+` operator.
     *
     * Requirements:
     *
     * - Addition cannot overflow.
     */
    function add(uint256 a, uint256 b) internal pure returns (uint256) {
        return a + b;
    }

    /**
     * @dev Returns the subtraction of two unsigned integers, reverting on
     * overflow (when the result is negative).
     *
     * Counterpart to Solidity's `-` operator.
     *
     * Requirements:
     *
     * - Subtraction cannot overflow.
     */
    function sub(uint256 a, uint256 b) internal pure returns (uint256) {
        return a - b;
    }

    /**
     * @dev Returns the multiplication of two unsigned integers, reverting on
     * overflow.
     *
     * Counterpart to Solidity's `*` operator.
     *
     * Requirements:
     *
     * - Multiplication cannot overflow.
     */
    function mul(uint256 a, uint256 b) internal pure returns (uint256) {
        return a * b;
    }

    /**
     * @dev Returns the integer division of two unsigned integers, reverting on
     * division by zero. The result is rounded towards zero.
     *
     * Counterpart to Solidity's `/` operator.
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function div(uint256 a, uint256 b) internal pure returns (uint256) {
        return a / b;
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
     * reverting when dividing by zero.
     *
     * Counterpart to Solidity's `%` operator. This function uses a `revert`
     * opcode (which leaves remaining gas untouched) while Solidity uses an
     * invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function mod(uint256 a, uint256 b) internal pure returns (uint256) {
        return a % b;
    }

    /**
     * @dev Returns the subtraction of two unsigned integers, reverting with custom message on
     * overflow (when the result is negative).
     *
     * CAUTION: This function is deprecated because it requires allocating memory for the error
     * message unnecessarily. For custom revert reasons use {trySub}.
     *
     * Counterpart to Solidity's `-` operator.
     *
     * Requirements:
     *
     * - Subtraction cannot overflow.
     */
    function sub(
        uint256 a,
        uint256 b,
        string memory errorMessage
    ) internal pure returns (uint256) {
        unchecked {
            require(b <= a, errorMessage);
            return a - b;
        }
    }

    /**
     * @dev Returns the integer division of two unsigned integers, reverting with custom message on
     * division by zero. The result is rounded towards zero.
     *
     * Counterpart to Solidity's `/` operator. Note: this function uses a
     * `revert` opcode (which leaves remaining gas untouched) while Solidity
     * uses an invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function div(
        uint256 a,
        uint256 b,
        string memory errorMessage
    ) internal pure returns (uint256) {
        unchecked {
            require(b > 0, errorMessage);
            return a / b;
        }
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
     * reverting with custom message when dividing by zero.
     *
     * CAUTION: This function is deprecated because it requires allocating memory for the error
     * message unnecessarily. For custom revert reasons use {tryMod}.
     *
     * Counterpart to Solidity's `%` operator. This function uses a `revert`
     * opcode (which leaves remaining gas untouched) while Solidity uses an
     * invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function mod(
        uint256 a,
        uint256 b,
        string memory errorMessage
    ) internal pure returns (uint256) {
        unchecked {
            require(b > 0, errorMessage);
            return a % b;
        }
    }
}

File 7 of 15 : ERC20Authorization.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "../../ERC20/ERC20.sol";
import "./IEIP3009.sol";
import "../../../utils/cryptography/EIP712.sol";

abstract contract ERC20Authorization is ERC20, IEIP3009, EIP712 {
    // keccak256("TransferWithAuthorization(address from,address to,uint256 value,uint256 validAfter,uint256 validBefore,bytes32 nonce)")
    bytes32 public constant TRANSFER_WITH_AUTHORIZATION_TYPEHASH =
        0x7c7c6cdb67a18743f49ec6fa9b35f50d52ed05cbed4cc592e13b44501c1a2267;

    // keccak256("ReceiveWithAuthorization(address from,address to,uint256 value,uint256 validAfter,uint256 validBefore,bytes32 nonce)")
    bytes32 public constant RECEIVE_WITH_AUTHORIZATION_TYPEHASH =
        0xd099cc98ef71107a616c4f0f941f04c322d8e254fe26b3c6668db87aae413de8;

    // keccak256("CancelAuthorization(address authorizer,bytes32 nonce)")
    bytes32 public constant CANCEL_AUTHORIZATION_TYPEHASH =
        0x158b0a9edf7a828aad02f63cd515c68ef2f50ba807396f6d12842833a1597429;

    string internal constant AUTHORIZATION_USED_ERROR =
        "EIP3009: authorization is used";

    /**
     * @dev authorizer address => signature => state (true = used / false = unused)
     */
    mapping(address => mapping(bytes32 => bool)) internal _authorizationStates;

    /**
     * @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") {}

    /**
     * @notice Returns the state of an authorization
     * @param authorizer    Authorizer's address
     * @param signature         signature of the authorization
     * @return True if the signature is used
     */
    function authorizationState(address authorizer, bytes32 signature)
        external
        view
        returns (bool)
    {
        return _authorizationStates[authorizer][signature];
    }

    /**
     * @notice Execute a transfer with a signed authorization
     * @param from          Payer's address (Authorizer)
     * @param to            Payee's address
     * @param value         Amount to be transferred
     * @param validAfter    The time after which this is valid (unix time)
     * @param validBefore   The time before which this is valid (unix time)
     * @param nonce         nonce
     * @param v             v of the signature
     * @param r             r of the signature
     * @param s             s of the signature
     */
    function transferWithAuthorization(
        address from,
        address to,
        uint256 value,
        uint256 validAfter,
        uint256 validBefore,
        bytes32 nonce,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) public virtual override {
        _transferWithAuthorization(
            TRANSFER_WITH_AUTHORIZATION_TYPEHASH,
            from,
            to,
            value,
            validAfter,
            validBefore,
            nonce,
            v,
            r,
            s
        );
    }

    /**
     * @notice Receive a transfer with a signed authorization from the payer
     * @dev This has an additional check to ensure that the payee's address matches
     * the caller of this function to prevent front-running attacks. (See security
     * considerations)
     * @param from          Payer's address (Authorizer)
     * @param to            Payee's address
     * @param value         Amount to be transferred
     * @param validAfter    The time after which this is valid (unix time)
     * @param validBefore   The time before which this is valid (unix time)
     * @param nonce         nonce
     * @param v             v of the signature
     * @param r             r of the signature
     * @param s             s of the signature
     */
    function receiveWithAuthorization(
        address from,
        address to,
        uint256 value,
        uint256 validAfter,
        uint256 validBefore,
        bytes32 nonce,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) public virtual override {
        require(to == msg.sender, "EIP3009: caller must be the payee");
        _transferWithAuthorization(
            RECEIVE_WITH_AUTHORIZATION_TYPEHASH,
            from,
            to,
            value,
            validAfter,
            validBefore,
            nonce,
            v,
            r,
            s
        );
    }

    function convert(uint256 n) public pure returns (bytes32) {
        return bytes32(n);
    }

    function _transferWithAuthorization(
        bytes32 typeHash,
        address from,
        address to,
        uint256 value,
        uint256 validAfter,
        uint256 validBefore,
        bytes32 nonce,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) internal {
        require(
            block.timestamp > validAfter,
            "EIP3009: authorization is not yet valid"
        );
        require(
            block.timestamp < validBefore,
            "EIP3009: authorization is expired"
        );
        bytes32 structHash = keccak256(
            abi.encode(
                typeHash,
                from,
                to,
                value,
                validAfter,
                validBefore,
                nonce
            )
        );
        bytes32 hash = _hashTypedDataV4(structHash);

        require(!_authorizationStates[from][hash], AUTHORIZATION_USED_ERROR);
        address signer = ECDSA.recover(hash, v, r, s);
        require(signer == from, "ERC20Authorization: invalid signature");
        _authorizationStates[from][hash] = true;
        emit AuthorizationUsed(from, nonce);
        _transfer(from, to, value);
    }
}

File 8 of 15 : Context.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)

pragma solidity ^0.8.0;

/**
 * @dev Provides information about the current execution context, including the
 * sender of the transaction and its data. While these are generally available
 * via msg.sender and msg.data, they should not be accessed in such a direct
 * manner, since when dealing with meta-transactions the account sending and
 * paying for execution may not be the actual sender (as far as an application
 * is concerned).
 *
 * This contract is only required for intermediate, library-like contracts.
 */
abstract contract Context {
    function _msgSender() internal view virtual returns (address) {
        return msg.sender;
    }

    function _msgData() internal view virtual returns (bytes calldata) {
        return msg.data;
    }
}

File 9 of 15 : IERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC20 standard as defined in the EIP.
 */
interface IERC20 {
    /**
     * @dev Emitted when `value` tokens are moved from one account (`from`) to
     * another (`to`).
     *
     * Note that `value` may be zero.
     */
    event Transfer(address indexed from, address indexed to, uint256 value);

    /**
     * @dev Emitted when the allowance of a `spender` for an `owner` is set by
     * a call to {approve}. `value` is the new allowance.
     */
    event Approval(
        address indexed owner,
        address indexed spender,
        uint256 value
    );

    /**
     * @dev Returns the amount of tokens in existence.
     */
    function totalSupply() external view returns (uint256);

    /**
     * @dev Returns the amount of tokens owned by `account`.
     */
    function balanceOf(address account) external view returns (uint256);

    /**
     * @dev Moves `amount` tokens from the caller's account to `to`.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transfer(address to, uint256 amount) external returns (bool);

    /**
     * @dev Returns the remaining number of tokens that `spender` will be
     * allowed to spend on behalf of `owner` through {transferFrom}. This is
     * zero by default.
     *
     * This value changes when {approve} or {transferFrom} are called.
     */
    function allowance(address owner, address spender)
        external
        view
        returns (uint256);

    /**
     * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * IMPORTANT: Beware that changing an allowance with this method brings the risk
     * that someone may use both the old and the new allowance by unfortunate
     * transaction ordering. One possible solution to mitigate this race
     * condition is to first reduce the spender's allowance to 0 and set the
     * desired value afterwards:
     * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
     *
     * Emits an {Approval} event.
     */
    function approve(address spender, uint256 amount) external returns (bool);

    /**
     * @dev Moves `amount` tokens from `from` to `to` using the
     * allowance mechanism. `amount` is then deducted from the caller's
     * allowance.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transferFrom(
        address from,
        address to,
        uint256 amount
    ) external returns (bool);
}

File 10 of 15 : IERC20Metadata.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)

pragma solidity ^0.8.0;

import "./IERC20.sol";

/**
 * @dev Interface for the optional metadata functions from the ERC20 standard.
 *
 * _Available since v4.1._
 */
interface IERC20Metadata is IERC20 {
    /**
     * @dev Returns the name of the token.
     */
    function name() external view returns (string memory);

    /**
     * @dev Returns the symbol of the token.
     */
    function symbol() external view returns (string memory);

    /**
     * @dev Returns the decimals places of the token.
     */
    function decimals() external view returns (uint8);
}

File 11 of 15 : EIP712.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "./ECDSA.sol";

/**
 * @dev https://eips.ethereum.org/EIPS/eip-712[EIP 712] is a standard for hashing and signing of typed structured data.
 *
 * The encoding specified in the EIP is very generic, and such a generic implementation in Solidity is not feasible,
 * thus this contract does not implement the encoding itself. Protocols need to implement the type-specific encoding
 * they need in their contracts using a combination of `abi.encode` and `keccak256`.
 *
 * This contract implements the EIP 712 domain separator ({_domainSeparatorV4}) that is used as part of the encoding
 * scheme, and the final step of the encoding to obtain the message digest that is then signed via ECDSA
 * ({_hashTypedDataV4}).
 *
 * The implementation of the domain separator was designed to be as efficient as possible while still properly updating
 * the chain id to protect against replay attacks on an eventual fork of the chain.
 *
 * NOTE: This contract implements the version of the encoding known as "v4", as implemented by the JSON RPC method
 * https://docs.metamask.io/guide/signing-data.html[`eth_signTypedDataV4` in MetaMask].
 *
 * _Available since v3.4._
 */
abstract contract EIP712 {
    /* solhint-disable var-name-mixedcase */
    // Cache the domain separator as an immutable value, but also store the chain id that it corresponds to, in order to
    // invalidate the cached domain separator if the chain id changes.
    bytes32 private immutable _CACHED_DOMAIN_SEPARATOR;
    uint256 private immutable _CACHED_CHAIN_ID;
    address private immutable _CACHED_THIS;

    bytes32 private immutable _HASHED_NAME;
    bytes32 private immutable _HASHED_VERSION;
    bytes32 private immutable _TYPE_HASH;

    bytes32 public DOMAIN_SEPARATOR;

    /* solhint-enable var-name-mixedcase */

    /**
     * @dev Initializes the domain separator and parameter caches.
     *
     * The meaning of `name` and `version` is specified in
     * https://eips.ethereum.org/EIPS/eip-712#definition-of-domainseparator[EIP 712]:
     *
     * - `name`: the user readable name of the signing domain, i.e. the name of the DApp or the protocol.
     * - `version`: the current major version of the signing domain.
     *
     * NOTE: These parameters cannot be changed except through a xref:learn::upgrading-smart-contracts.adoc[smart
     * contract upgrade].
     */
    constructor(string memory name, string memory version) {
        bytes32 hashedName = keccak256(bytes(name));
        bytes32 hashedVersion = keccak256(bytes(version));
        bytes32 typeHash = keccak256(
            "EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)"
        );
        _HASHED_NAME = hashedName;
        _HASHED_VERSION = hashedVersion;
        _CACHED_CHAIN_ID = block.chainid;
        _CACHED_DOMAIN_SEPARATOR = _buildDomainSeparator(
            typeHash,
            hashedName,
            hashedVersion
        );
        _CACHED_THIS = address(this);
        _TYPE_HASH = typeHash;
        DOMAIN_SEPARATOR = _buildDomainSeparator(
            typeHash,
            hashedName,
            hashedVersion
        );
    }

    /**
     * @dev Returns the domain separator for the current chain.
     */
    function _domainSeparatorV4() internal view returns (bytes32) {
        if (
            address(this) == _CACHED_THIS && block.chainid == _CACHED_CHAIN_ID
        ) {
            return _CACHED_DOMAIN_SEPARATOR;
        } else {
            return
                _buildDomainSeparator(
                    _TYPE_HASH,
                    _HASHED_NAME,
                    _HASHED_VERSION
                );
        }
    }

    function _buildDomainSeparator(
        bytes32 typeHash,
        bytes32 nameHash,
        bytes32 versionHash
    ) private view returns (bytes32) {
        return
            keccak256(
                abi.encode(
                    typeHash,
                    nameHash,
                    versionHash,
                    block.chainid,
                    address(this)
                )
            );
    }

    /**
     * @dev Given an already https://eips.ethereum.org/EIPS/eip-712#definition-of-hashstruct[hashed struct], this
     * function returns the hash of the fully encoded EIP712 message for this domain.
     *
     * This hash can be used together with {ECDSA-recover} to obtain the signer of a message. For example:
     *
     * ```solidity
     * bytes32 digest = _hashTypedDataV4(keccak256(abi.encode(
     *     keccak256("Mail(address to,string contents)"),
     *     mailTo,
     *     keccak256(bytes(mailContents))
     * )));
     * address signer = ECDSA.recover(digest, signature);
     * ```
     */
    function _hashTypedDataV4(bytes32 structHash)
        internal
        view
        virtual
        returns (bytes32)
    {
        return ECDSA.toTypedDataHash(_domainSeparatorV4(), structHash);
    }
}

File 12 of 15 : IEIP3009.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC20 standard as defined in the EIP.
 */
interface IEIP3009 {
    event AuthorizationUsed(address indexed authorizer, bytes32 indexed nonce);

    /**
     * @notice Execute a transfer with a signed authorization
     * @param from          Payer's address (Authorizer)
     * @param to            Payee's address
     * @param value         Amount to be transferred
     * @param validAfter    The time after which this is valid (unix time)
     * @param validBefore   The time before which this is valid (unix time)
     * @param nonce         Unique nonce
     * @param v             v of the signature
     * @param r             r of the signature
     * @param s             s of the signature
     */
    function transferWithAuthorization(
        address from,
        address to,
        uint256 value,
        uint256 validAfter,
        uint256 validBefore,
        bytes32 nonce,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) external;

    /**
     * @notice Receive a transfer with a signed authorization from the payer
     * @dev This has an additional check to ensure that the payee's address matches
     * the caller of this function to prevent front-running attacks. (See security
     * considerations)
     * @param from          Payer's address (Authorizer)
     * @param to            Payee's address
     * @param value         Amount to be transferred
     * @param validAfter    The time after which this is valid (unix time)
     * @param validBefore   The time before which this is valid (unix time)
     * @param nonce         Unique nonce
     * @param v             v of the signature
     * @param r             r of the signature
     * @param s             s of the signature
     */
    function receiveWithAuthorization(
        address from,
        address to,
        uint256 value,
        uint256 validAfter,
        uint256 validBefore,
        bytes32 nonce,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) external;
}

File 13 of 15 : ECDSA.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (utils/cryptography/ECDSA.sol)

pragma solidity ^0.8.0;

import "../Strings.sol";

/**
 * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations.
 *
 * These functions can be used to verify that a message was signed by the holder
 * of the private keys of a given address.
 */
library ECDSA {
    enum RecoverError {
        NoError,
        InvalidSignature,
        InvalidSignatureLength,
        InvalidSignatureS,
        InvalidSignatureV // Deprecated in v4.8
    }

    function _throwError(RecoverError error) private pure {
        if (error == RecoverError.NoError) {
            return; // no error: do nothing
        } else if (error == RecoverError.InvalidSignature) {
            revert("ECDSA: invalid signature");
        } else if (error == RecoverError.InvalidSignatureLength) {
            revert("ECDSA: invalid signature length");
        } else if (error == RecoverError.InvalidSignatureS) {
            revert("ECDSA: invalid signature 's' value");
        }
    }

    /**
     * @dev Returns the address that signed a hashed message (`hash`) with
     * `signature` or error string. This address can then be used for verification purposes.
     *
     * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:
     * this function rejects them by requiring the `s` value to be in the lower
     * half order, and the `v` value to be either 27 or 28.
     *
     * IMPORTANT: `hash` _must_ be the result of a hash operation for the
     * verification to be secure: it is possible to craft signatures that
     * recover to arbitrary addresses for non-hashed data. A safe way to ensure
     * this is by receiving a hash of the original message (which may otherwise
     * be too long), and then calling {toEthSignedMessageHash} on it.
     *
     * Documentation for signature generation:
     * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js]
     * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers]
     *
     * _Available since v4.3._
     */
    function tryRecover(bytes32 hash, bytes memory signature)
        internal
        pure
        returns (address, RecoverError)
    {
        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);
        }
    }

    /**
     * @dev Returns the address that signed a hashed message (`hash`) with
     * `signature`. This address can then be used for verification purposes.
     *
     * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:
     * this function rejects them by requiring the `s` value to be in the lower
     * half order, and the `v` value to be either 27 or 28.
     *
     * IMPORTANT: `hash` _must_ be the result of a hash operation for the
     * verification to be secure: it is possible to craft signatures that
     * recover to arbitrary addresses for non-hashed data. A safe way to ensure
     * this is by receiving a hash of the original message (which may otherwise
     * be too long), and then calling {toEthSignedMessageHash} on it.
     */
    function recover(bytes32 hash, bytes memory signature)
        internal
        pure
        returns (address)
    {
        (address recovered, RecoverError error) = tryRecover(hash, signature);
        _throwError(error);
        return recovered;
    }

    /**
     * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately.
     *
     * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures]
     *
     * _Available since v4.3._
     */
    function tryRecover(
        bytes32 hash,
        bytes32 r,
        bytes32 vs
    ) internal pure returns (address, RecoverError) {
        bytes32 s = vs &
            bytes32(
                0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
            );
        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.
     *
     * _Available since v4.2._
     */
    function recover(
        bytes32 hash,
        bytes32 r,
        bytes32 vs
    ) internal pure returns (address) {
        (address recovered, RecoverError error) = tryRecover(hash, r, vs);
        _throwError(error);
        return recovered;
    }

    /**
     * @dev Overload of {ECDSA-tryRecover} that receives the `v`,
     * `r` and `s` signature fields separately.
     *
     * _Available since v4.3._
     */
    function tryRecover(
        bytes32 hash,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) internal pure returns (address, RecoverError) {
        // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature
        // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines
        // the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most
        // signatures from current libraries generate a unique signature with an s-value in the lower half order.
        //
        // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value
        // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or
        // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept
        // these malleable signatures as well.
        if (
            uint256(s) >
            0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0
        ) {
            return (address(0), RecoverError.InvalidSignatureS);
        }

        // If the signature is valid (and not malleable), return the signer address
        address signer = ecrecover(hash, v, r, s);
        if (signer == address(0)) {
            return (address(0), RecoverError.InvalidSignature);
        }

        return (signer, RecoverError.NoError);
    }

    /**
     * @dev Overload of {ECDSA-recover} that receives the `v`,
     * `r` and `s` signature fields separately.
     */
    function recover(
        bytes32 hash,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) internal pure returns (address) {
        (address recovered, RecoverError error) = tryRecover(hash, v, r, s);
        _throwError(error);
        return recovered;
    }

    /**
     * @dev Returns an Ethereum Signed Message, created from a `hash`. This
     * produces hash corresponding to the one signed with the
     * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]
     * JSON-RPC method as part of EIP-191.
     *
     * See {recover}.
     */
    function toEthSignedMessageHash(bytes32 hash)
        internal
        pure
        returns (bytes32)
    {
        // 32 is the length in bytes of hash,
        // enforced by the type signature above
        return
            keccak256(
                abi.encodePacked("\x19Ethereum Signed Message:\n32", hash)
            );
    }

    /**
     * @dev Returns an Ethereum Signed Message, created from `s`. This
     * produces hash corresponding to the one signed with the
     * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]
     * JSON-RPC method as part of EIP-191.
     *
     * See {recover}.
     */
    function toEthSignedMessageHash(bytes memory s)
        internal
        pure
        returns (bytes32)
    {
        return
            keccak256(
                abi.encodePacked(
                    "\x19Ethereum Signed Message:\n",
                    Strings.toString(s.length),
                    s
                )
            );
    }

    /**
     * @dev Returns an Ethereum Signed Typed Data, created from a
     * `domainSeparator` and a `structHash`. This produces hash corresponding
     * to the one signed with the
     * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`]
     * JSON-RPC method as part of EIP-712.
     *
     * See {recover}.
     */
    function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash)
        internal
        pure
        returns (bytes32)
    {
        return
            keccak256(
                abi.encodePacked("\x19\x01", domainSeparator, structHash)
            );
    }
}

File 14 of 15 : Strings.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (utils/Strings.sol)

pragma solidity ^0.8.0;

import "./math/Math.sol";

/**
 * @dev String operations.
 */
library Strings {
    bytes16 private constant _SYMBOLS = "0123456789abcdef";
    uint8 private constant _ADDRESS_LENGTH = 20;

    /**
     * @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), _SYMBOLS))
                }
                value /= 10;
                if (value == 0) break;
            }
            return buffer;
        }
    }

    /**
     * @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)
    {
        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] = _SYMBOLS[value & 0xf];
            value >>= 4;
        }
        require(value == 0, "Strings: hex length insufficient");
        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);
    }
}

File 15 of 15 : Math.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (utils/math/Math.sol)

pragma solidity ^0.8.0;

/**
 * @dev Standard math utilities missing in the Solidity language.
 */
library Math {
    enum Rounding {
        Down, // Toward negative infinity
        Up, // Toward infinity
        Zero // Toward zero
    }

    /**
     * @dev Returns the largest of two numbers.
     */
    function max(uint256 a, uint256 b) internal pure returns (uint256) {
        return a > b ? a : b;
    }

    /**
     * @dev Returns the smallest of two numbers.
     */
    function min(uint256 a, uint256 b) internal pure returns (uint256) {
        return a < b ? a : b;
    }

    /**
     * @dev Returns the average of two numbers. The result is rounded towards
     * zero.
     */
    function average(uint256 a, uint256 b) internal pure returns (uint256) {
        // (a + b) / 2 can overflow.
        return (a & b) + (a ^ b) / 2;
    }

    /**
     * @dev Returns the ceiling of the division of two numbers.
     *
     * This differs from standard division with `/` in that it rounds up instead
     * of rounding down.
     */
    function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {
        // (a + b - 1) / b can overflow on addition, so we distribute.
        return a == 0 ? 0 : (a - 1) / b + 1;
    }

    /**
     * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0
     * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)
     * with further edits by Uniswap Labs also under MIT license.
     */
    function mulDiv(
        uint256 x,
        uint256 y,
        uint256 denominator
    ) internal pure returns (uint256 result) {
        unchecked {
            // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use
            // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256
            // variables such that product = prod1 * 2^256 + prod0.
            uint256 prod0; // Least significant 256 bits of the product
            uint256 prod1; // Most significant 256 bits of the product
            assembly {
                let mm := mulmod(x, y, not(0))
                prod0 := mul(x, y)
                prod1 := sub(sub(mm, prod0), lt(mm, prod0))
            }

            // Handle non-overflow cases, 256 by 256 division.
            if (prod1 == 0) {
                return prod0 / denominator;
            }

            // Make sure the result is less than 2^256. Also prevents denominator == 0.
            require(denominator > prod1);

            ///////////////////////////////////////////////
            // 512 by 256 division.
            ///////////////////////////////////////////////

            // Make division exact by subtracting the remainder from [prod1 prod0].
            uint256 remainder;
            assembly {
                // Compute remainder using mulmod.
                remainder := mulmod(x, y, denominator)

                // Subtract 256 bit number from 512 bit number.
                prod1 := sub(prod1, gt(remainder, prod0))
                prod0 := sub(prod0, remainder)
            }

            // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.
            // See https://cs.stackexchange.com/q/138556/92363.

            // Does not overflow because the denominator cannot be zero at this stage in the function.
            uint256 twos = denominator & (~denominator + 1);
            assembly {
                // Divide denominator by twos.
                denominator := div(denominator, twos)

                // Divide [prod1 prod0] by twos.
                prod0 := div(prod0, twos)

                // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.
                twos := add(div(sub(0, twos), twos), 1)
            }

            // Shift in bits from prod1 into prod0.
            prod0 |= prod1 * twos;

            // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such
            // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for
            // four bits. That is, denominator * inv = 1 mod 2^4.
            uint256 inverse = (3 * denominator) ^ 2;

            // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works
            // in modular arithmetic, doubling the correct bits in each step.
            inverse *= 2 - denominator * inverse; // inverse mod 2^8
            inverse *= 2 - denominator * inverse; // inverse mod 2^16
            inverse *= 2 - denominator * inverse; // inverse mod 2^32
            inverse *= 2 - denominator * inverse; // inverse mod 2^64
            inverse *= 2 - denominator * inverse; // inverse mod 2^128
            inverse *= 2 - denominator * inverse; // inverse mod 2^256

            // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.
            // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is
            // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1
            // is no longer required.
            result = prod0 * inverse;
            return result;
        }
    }

    /**
     * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.
     */
    function mulDiv(
        uint256 x,
        uint256 y,
        uint256 denominator,
        Rounding rounding
    ) internal pure returns (uint256) {
        uint256 result = mulDiv(x, y, denominator);
        if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {
            result += 1;
        }
        return result;
    }

    /**
     * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.
     *
     * Inspired by Henry S. Warren, Jr.'s "Hacker's Delight" (Chapter 11).
     */
    function sqrt(uint256 a) internal pure returns (uint256) {
        if (a == 0) {
            return 0;
        }

        // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.
        //
        // We know that the "msb" (most significant bit) of our target number `a` is a power of 2 such that we have
        // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.
        //
        // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`
        // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`
        // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`
        //
        // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.
        uint256 result = 1 << (log2(a) >> 1);

        // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,
        // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at
        // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision
        // into the expected uint128 result.
        unchecked {
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            return min(result, a / result);
        }
    }

    /**
     * @notice Calculates sqrt(a), following the selected rounding direction.
     */
    function sqrt(uint256 a, Rounding rounding)
        internal
        pure
        returns (uint256)
    {
        unchecked {
            uint256 result = sqrt(a);
            return
                result +
                (rounding == Rounding.Up && result * result < a ? 1 : 0);
        }
    }

    /**
     * @dev Return the log in base 2, rounded down, of a positive value.
     * Returns 0 if given 0.
     */
    function log2(uint256 value) internal pure returns (uint256) {
        uint256 result = 0;
        unchecked {
            if (value >> 128 > 0) {
                value >>= 128;
                result += 128;
            }
            if (value >> 64 > 0) {
                value >>= 64;
                result += 64;
            }
            if (value >> 32 > 0) {
                value >>= 32;
                result += 32;
            }
            if (value >> 16 > 0) {
                value >>= 16;
                result += 16;
            }
            if (value >> 8 > 0) {
                value >>= 8;
                result += 8;
            }
            if (value >> 4 > 0) {
                value >>= 4;
                result += 4;
            }
            if (value >> 2 > 0) {
                value >>= 2;
                result += 2;
            }
            if (value >> 1 > 0) {
                result += 1;
            }
        }
        return result;
    }

    /**
     * @dev Return the log in base 2, following the selected rounding direction, of a positive value.
     * Returns 0 if given 0.
     */
    function log2(uint256 value, Rounding rounding)
        internal
        pure
        returns (uint256)
    {
        unchecked {
            uint256 result = log2(value);
            return
                result +
                (rounding == Rounding.Up && 1 << result < value ? 1 : 0);
        }
    }

    /**
     * @dev Return the log in base 10, rounded down, of a positive value.
     * Returns 0 if given 0.
     */
    function log10(uint256 value) internal pure returns (uint256) {
        uint256 result = 0;
        unchecked {
            if (value >= 10**64) {
                value /= 10**64;
                result += 64;
            }
            if (value >= 10**32) {
                value /= 10**32;
                result += 32;
            }
            if (value >= 10**16) {
                value /= 10**16;
                result += 16;
            }
            if (value >= 10**8) {
                value /= 10**8;
                result += 8;
            }
            if (value >= 10**4) {
                value /= 10**4;
                result += 4;
            }
            if (value >= 10**2) {
                value /= 10**2;
                result += 2;
            }
            if (value >= 10**1) {
                result += 1;
            }
        }
        return result;
    }

    /**
     * @dev Return the log in base 10, following the selected rounding direction, of a positive value.
     * Returns 0 if given 0.
     */
    function log10(uint256 value, Rounding rounding)
        internal
        pure
        returns (uint256)
    {
        unchecked {
            uint256 result = log10(value);
            return
                result +
                (rounding == Rounding.Up && 10**result < value ? 1 : 0);
        }
    }

    /**
     * @dev Return the log in base 256, rounded down, of a positive value.
     * Returns 0 if given 0.
     *
     * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.
     */
    function log256(uint256 value) internal pure returns (uint256) {
        uint256 result = 0;
        unchecked {
            if (value >> 128 > 0) {
                value >>= 128;
                result += 16;
            }
            if (value >> 64 > 0) {
                value >>= 64;
                result += 8;
            }
            if (value >> 32 > 0) {
                value >>= 32;
                result += 4;
            }
            if (value >> 16 > 0) {
                value >>= 16;
                result += 2;
            }
            if (value >> 8 > 0) {
                result += 1;
            }
        }
        return result;
    }

    /**
     * @dev Return the log in base 10, following the selected rounding direction, of a positive value.
     * Returns 0 if given 0.
     */
    function log256(uint256 value, Rounding rounding)
        internal
        pure
        returns (uint256)
    {
        unchecked {
            uint256 result = log256(value);
            return
                result +
                (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0);
        }
    }
}

Settings
{
  "optimizer": {
    "enabled": true,
    "runs": 200
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  },
  "libraries": {}
}

Contract ABI

[{"inputs":[{"internalType":"address","name":"_q2","type":"address"},{"internalType":"address","name":"_swapAddress","type":"address"},{"internalType":"address","name":"_usdt","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"spender","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"authorizer","type":"address"},{"indexed":true,"internalType":"bytes32","name":"nonce","type":"bytes32"}],"name":"AuthorizationUsed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"oldQ2","type":"address"},{"indexed":true,"internalType":"address","name":"newQ2","type":"address"}],"name":"ChangedQ2","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"oldDecimalPoint","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newDecimalPoint","type":"uint256"}],"name":"DecimalPointChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"developer","type":"address"},{"indexed":false,"internalType":"bool","name":"status","type":"bool"}],"name":"DeveloperStatusChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":false,"internalType":"uint256","name":"usdtValue","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"tokens","type":"uint256"}],"name":"QuartersOrdered","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"oldAddress","type":"address"},{"indexed":true,"internalType":"address","name":"newAddress","type":"address"}],"name":"SwapAddressChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"oldUSDTAddress","type":"address"},{"indexed":true,"internalType":"address","name":"newUSDTAddress","type":"address"}],"name":"USDTChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"currentRate","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newRate","type":"uint256"}],"name":"USDTRateChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"developer","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Withdraw","type":"event"},{"inputs":[],"name":"CANCEL_AUTHORIZATION_TYPEHASH","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"DOMAIN_SEPARATOR","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MAX_BASISPOINTS","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"RECEIVE_WITH_AUTHORIZATION_TYPEHASH","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"TRANSFER_WITH_AUTHORIZATION_TYPEHASH","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"TokenName","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"TokenSymbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"USDT_DECIMAL_POINT","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"spender","type":"address"}],"name":"allowance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"approve","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"authorizer","type":"address"},{"internalType":"bytes32","name":"signature","type":"bytes32"}],"name":"authorizationState","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"usdtAmount","type":"uint256"}],"name":"buy","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"buyer","type":"address"},{"internalType":"uint256","name":"usdtAmount","type":"uint256"}],"name":"buyFor","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"newDecimalPoint","type":"uint256"}],"name":"changeDecimalPoint","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_q2","type":"address"}],"name":"changeQ2","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newSwapAddress","type":"address"}],"name":"changeSwapAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"changeTransferState","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"usdtAddress","type":"address"}],"name":"changeusdt","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"n","type":"uint256"}],"name":"convert","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"subtractedValue","type":"uint256"}],"name":"decreaseAllowance","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"developers","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"emergencyExit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"addedValue","type":"uint256"}],"name":"increaseAllowance","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pauseTransfer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"q2","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"uint256","name":"validAfter","type":"uint256"},{"internalType":"uint256","name":"validBefore","type":"uint256"},{"internalType":"bytes32","name":"nonce","type":"bytes32"},{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"}],"name":"receiveWithAuthorization","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_address","type":"address"},{"internalType":"bool","name":"status","type":"bool"}],"name":"setDeveloperStatus","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"rate","type":"uint256"}],"name":"setUsdtRate","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"swapAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_to","type":"address"},{"internalType":"uint256","name":"_value","type":"uint256"}],"name":"transfer","outputs":[{"internalType":"bool","name":"success","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_from","type":"address"},{"internalType":"address","name":"_to","type":"address"},{"internalType":"uint256","name":"_value","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"success","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"uint256","name":"validAfter","type":"uint256"},{"internalType":"uint256","name":"validBefore","type":"uint256"},{"internalType":"bytes32","name":"nonce","type":"bytes32"},{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"}],"name":"transferWithAuthorization","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"usdt","outputs":[{"internalType":"contract ERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"usdtRate","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"value","type":"uint256"}],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"}]

610180604052600861014081905267517561727465727360c01b6101609081526200002c91908162000422565b50604080518082019091526001808252605160f81b6020909201918252620000579160099162000422565b5061023b600a556105dc600b55612710600c55620f4240600d556010805460ff191690553480156200008857600080fd5b5060405162002fe538038062002fe5833981016040819052620000ab91620004e5565b60088054620000ba906200055a565b80601f0160208091040260200160405190810160405280929190818152602001828054620000e8906200055a565b8015620001395780601f106200010d5761010080835404028352916020019162000139565b820191906000526020600020905b8154815290600101906020018083116200011b57829003601f168201915b505050505080604051806040016040528060018152602001603160f81b8152506008805462000168906200055a565b80601f016020809104026020016040519081016040528092919081815260200182805462000196906200055a565b8015620001e75780601f10620001bb57610100808354040283529160200191620001e7565b820191906000526020600020905b815481529060010190602001808311620001c957829003601f168201915b505050505060098054620001fb906200055a565b80601f016020809104026020016040519081016040528092919081815260200182805462000229906200055a565b80156200027a5780601f106200024e576101008083540402835291602001916200027a565b820191906000526020600020905b8154815290600101906020018083116200025c57829003601f168201915b505084516200029493506003925060208601915062000422565b508051620002aa90600490602084019062000422565b5050825160208085019190912083519184019190912060e08290526101008190524660a0529091507f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f6200030081848462000390565b6080523060601b60c0526101208190526200031d81848462000390565b600555506200033d945062000337935050620003cc915050565b620003d0565b600e80546001600160a01b039485166001600160a01b031991821617909155601180549385169390911692909217909155601080549190921661010002610100600160a81b031990911617905562000597565b60008383834630604051602001620003ad9594939291906200052e565b6040516020818303038152906040528051906020012090509392505050565b3390565b600780546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b82805462000430906200055a565b90600052602060002090601f0160209004810192826200045457600085556200049f565b82601f106200046f57805160ff19168380011785556200049f565b828001600101855582156200049f579182015b828111156200049f57825182559160200191906001019062000482565b50620004ad929150620004b1565b5090565b5b80821115620004ad5760008155600101620004b2565b80516001600160a01b0381168114620004e057600080fd5b919050565b600080600060608486031215620004fa578283fd5b6200050584620004c8565b92506200051560208501620004c8565b91506200052560408501620004c8565b90509250925092565b9485526020850193909352604084019190915260608301526001600160a01b0316608082015260a00190565b6002810460018216806200056f57607f821691505b602082108114156200059157634e487b7160e01b600052602260045260246000fd5b50919050565b60805160a05160c05160601c60e05161010051610120516129fb620005ea6000396000611daa01526000611dec01526000611dcb01526000611d2d01526000611d5701526000611d8101526129fb6000f3fe60806040526004361061025b5760003560e01c8063715018a611610144578063b020961a116100b6578063e3ee160e1161007a578063e3ee160e1461066e578063e94a01021461068e578063ef55bec6146106ae578063f2fde38b146106ce578063f510e97f146106ee578063f6148bf7146107035761025b565b8063b020961a146105e4578063b6d7855a14610604578063d916948714610619578063d96a094a1461062e578063dd62ed3e1461064e5761025b565b806395d89b411161010857806395d89b4114610545578063a0cc6a681461055a578063a2bbd1aa1461056f578063a3908e1b14610584578063a457c2d7146105a4578063a9059cbb146105c45761025b565b8063715018a6146104dc5780637f2eecc3146104f157806380f6d782146105065780638da5cb5b1461051b57806390a70139146105305761025b565b80632f48ab7d116101dd5780634c7f3fc2116101a15780634c7f3fc2146104325780635615f415146104525780635641ec03146104675780635a19c2011461047c57806361fd5c201461049c57806370a08231146104bc5761025b565b80632f48ab7d14610399578063313ce567146103bb5780633644e515146103dd57806336b6350e146103f257806339509351146104125761025b565b80630f544fb9116102245780630f544fb91461030257806318160ddd146103245780631e1dd56b1461033957806323b872dd146103595780632e1a7d4d146103795761025b565b8062c8fbd414610260578063061d1fba1461028b57806306501a6a146102ad57806306fdde03146102c0578063095ea7b3146102d5575b600080fd5b34801561026c57600080fd5b50610275610718565b60405161028291906122fd565b60405180910390f35b34801561029757600080fd5b506102ab6102a636600461203f565b6107a6565b005b6102ab6102bb366004612182565b610800565b3480156102cc57600080fd5b5061027561085e565b3480156102e157600080fd5b506102f56102f0366004612182565b6108f1565b6040516102829190612263565b34801561030e57600080fd5b50610317610913565b604051610282919061226e565b34801561033057600080fd5b50610317610919565b34801561034557600080fd5b506102ab61035436600461203f565b61091f565b34801561036557600080fd5b506102f561037436600461208b565b6109eb565b34801561038557600080fd5b506102ab6103943660046121c7565b610a4f565b3480156103a557600080fd5b506103ae610c24565b6040516102829190612212565b3480156103c757600080fd5b506103d0610c38565b60405161028291906128da565b3480156103e957600080fd5b50610317610c3d565b3480156103fe57600080fd5b506102ab61040d36600461203f565b610c43565b34801561041e57600080fd5b506102f561042d366004612182565b610c9d565b34801561043e57600080fd5b506102ab61044d3660046121c7565b610cc9565b34801561045e57600080fd5b506103ae610d17565b34801561047357600080fd5b506102ab610d26565b34801561048857600080fd5b506102ab61049736600461214c565b610e2e565b3480156104a857600080fd5b506102f56104b736600461203f565b610e8a565b3480156104c857600080fd5b506103176104d736600461203f565b610e9f565b3480156104e857600080fd5b506102ab610ebe565b3480156104fd57600080fd5b50610317610ed2565b34801561051257600080fd5b506103ae610ef6565b34801561052757600080fd5b506103ae610f05565b34801561053c57600080fd5b506102f5610f14565b34801561055157600080fd5b50610275610f1d565b34801561056657600080fd5b50610317610f2c565b34801561057b57600080fd5b506102ab610f50565b34801561059057600080fd5b5061031761059f3660046121c7565b6108ee565b3480156105b057600080fd5b506102f56105bf366004612182565b610f6c565b3480156105d057600080fd5b506102f56105df366004612182565b610fbf565b3480156105f057600080fd5b506102ab6105ff3660046121c7565b611021565b34801561061057600080fd5b5061027561108b565b34801561062557600080fd5b50610317611098565b34801561063a57600080fd5b506102ab6106493660046121c7565b6110bc565b34801561065a57600080fd5b50610317610669366004612059565b6110ca565b34801561067a57600080fd5b506102ab6106893660046120c6565b6110f5565b34801561069a57600080fd5b506102f56106a9366004612182565b611160565b3480156106ba57600080fd5b506102ab6106c93660046120c6565b61118b565b3480156106da57600080fd5b506102ab6106e936600461203f565b6111eb565b3480156106fa57600080fd5b50610317611222565b34801561070f57600080fd5b50610317611228565b600980546107259061293f565b80601f01602080910402602001604051908101604052809291908181526020018280546107519061293f565b801561079e5780601f106107735761010080835404028352916020019161079e565b820191906000526020600020905b81548152906001019060200180831161078157829003601f168201915b505050505081565b6107ae61122e565b601180546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f7b7508195051aec9cd41a8f5e52441401a58810be077ffce5fa39f95b811921990600090a35050565b600061080c838361126d565b9050336001600160a01b0316836001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92583604051610851919061226e565b60405180910390a3505050565b60606003805461086d9061293f565b80601f01602080910402602001604051908101604052809291908181526020018280546108999061293f565b80156108e65780601f106108bb576101008083540402835291602001916108e6565b820191906000526020600020905b8154815290600101906020018083116108c957829003601f168201915b505050505090505b90565b6000806108fc611686565b905061090981858561168a565b5060019392505050565b600d5481565b60025490565b61092761122e565b60408051808201909152601e81527f416464726573732043616e6e6f74206265205a65726f2041646472657373000060208201526001600160a01b03821661098b5760405162461bcd60e51b815260040161098291906122fd565b60405180910390fd5b50601080546001600160a01b03838116610100908102610100600160a81b0319841617938490556040519281900482169304169082907ff49f89d6459443023115f98f941ee1addd55bc43085e975ad530e3298326c00490600090a35050565b60105460408051808201909152601281527110dbdb9d1c9858dd081a5cc814185d5cd95960721b602082015260009160ff1615610a3b5760405162461bcd60e51b815260040161098291906122fd565b50610a47848484611731565b949350505050565b336000908152600f602052604090205460ff161515600114610a835760405162461bcd60e51b815260040161098290612648565b80610a8d33610e9f565b1015610aab5760405162461bcd60e51b815260040161098290612595565b6000610b42610ab8610919565b6010546040516370a0823160e01b81526101009091046001600160a01b0316906370a0823190610aec903090600401612212565b60206040518083038186803b158015610b0457600080fd5b505afa158015610b18573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b3c91906121df565b90611754565b9050610b4e3383611760565b60105461010090046001600160a01b031663a9059cbb33610b6f8486611838565b6040518363ffffffff1660e01b8152600401610b8c92919061224a565b602060405180830381600087803b158015610ba657600080fd5b505af1158015610bba573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bde91906121ab565b50337f884edad9ce6fa2440d8a54cc123490eb96d2768479d49ff9c7366125a9424364610c0b8385611838565b604051610c18919061226e565b60405180910390a25050565b60105461010090046001600160a01b031681565b600090565b60055481565b610c4b61122e565b600e80546001600160a01b038381166001600160a01b0319831681179093556040519116919082907fcef6ad732de51d4c7f69ed6fc9a53bc7da4db85a119a49cd6d2be1fb58d3382d90600090a35050565b600080610ca8611686565b9050610909818585610cba85896110ca565b610cc491906128e8565b61168a565b610cd161122e565b600d8054908290556040517fce7a5252384dfc41433aaac48133e27d3715758b30202df788c4d5510cb5efe890610d0b90839085906128cc565b60405180910390a15050565b600e546001600160a01b031681565b610d2e61122e565b6010546040516370a0823160e01b81526101009091046001600160a01b03169063a9059cbb90339083906370a0823190610d6c903090600401612212565b60206040518083038186803b158015610d8457600080fd5b505afa158015610d98573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610dbc91906121df565b6040518363ffffffff1660e01b8152600401610dd992919061224a565b602060405180830381600087803b158015610df357600080fd5b505af1158015610e07573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e2b91906121ab565b50565b610e3661122e565b6001600160a01b0382166000818152600f602052604090819020805460ff1916841515179055517f4906ed4e26b9109b402e1202233b2cbcdedabfacc21c59732ba778fa8512115a90610c18908490612263565b600f6020526000908152604090205460ff1681565b6001600160a01b0381166000908152602081905260409020545b919050565b610ec661122e565b610ed06000611844565b565b7fd099cc98ef71107a616c4f0f941f04c322d8e254fe26b3c6668db87aae413de881565b6011546001600160a01b031681565b6007546001600160a01b031690565b60105460ff1681565b60606004805461086d9061293f565b7f7c7c6cdb67a18743f49ec6fa9b35f50d52ed05cbed4cc592e13b44501c1a226781565b610f5861122e565b6010805460ff19811660ff90911615179055565b600080610f77611686565b90506000610f8582866110ca565b905083811015610fa75760405162461bcd60e51b815260040161098290612850565b610fb4828686840361168a565b506001949350505050565b60105460408051808201909152601281527110dbdb9d1c9858dd081a5cc814185d5cd95960721b602082015260009160ff161561100f5760405162461bcd60e51b815260040161098291906122fd565b5061101a8383611896565b9392505050565b61102961122e565b600081116110495760405162461bcd60e51b8152600401610982906123ca565b600a8190556040517f3fa21de5bae99fb7a9bbafaa9899615927dce4b513083960c015568b5cc14deb9061108090839081906128cc565b60405180910390a150565b600880546107259061293f565b7f158b0a9edf7a828aad02f63cd515c68ef2f50ba807396f6d12842833a159742981565b6110c6338261126d565b5050565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b60105460408051808201909152601281527110dbdb9d1c9858dd081a5cc814185d5cd95960721b60208201529060ff16156111435760405162461bcd60e51b815260040161098291906122fd565b506111558989898989898989896118ae565b505050505050505050565b6001600160a01b03919091166000908152600660209081526040808320938352929052205460ff1690565b60105460408051808201909152601281527110dbdb9d1c9858dd081a5cc814185d5cd95960721b60208201529060ff16156111d95760405162461bcd60e51b815260040161098291906122fd565b506111558989898989898989896118e0565b6111f361122e565b6001600160a01b0381166112195760405162461bcd60e51b81526004016109829061248f565b610e2b81611844565b600c5481565b600a5481565b611236611686565b6001600160a01b0316611247610f05565b6001600160a01b031614610ed05760405162461bcd60e51b8152600401610982906126cb565b6010546040516370a0823160e01b815260009183916101009091046001600160a01b0316906370a08231906112a6903390600401612212565b60206040518083038186803b1580156112be57600080fd5b505afa1580156112d2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112f691906121df565b101560405180606001604052806027815260200161299f602791399061132f5760405162461bcd60e51b815260040161098291906122fd565b5060408051808201909152601e81527f416464726573732043616e6e6f74206265205a65726f2041646472657373000060208201526001600160a01b03841661138b5760405162461bcd60e51b815260040161098291906122fd565b506010546040516323b872dd60e01b81526101009091046001600160a01b0316906323b872dd906113c490339030908790600401612226565b602060405180830381600087803b1580156113de57600080fd5b505af11580156113f2573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061141691906121ab565b506000611434600d54610b3c600a548661183890919063ffffffff16565b9050611440848261193a565b836001600160a01b03167fd110004d49ab61d41368db81cb67143ec29f042aa234ce4593b9267bea7a9abb848360405161147b9291906128cc565b60405180910390a260006114a0600c54610b3c600b548761183890919063ffffffff16565b60105460115460405163095ea7b360e01b81529293506001600160a01b0361010090920482169263095ea7b3926114dd921690859060040161224a565b602060405180830381600087803b1580156114f757600080fd5b505af115801561150b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061152f91906121ab565b50601154601054600e54604051634b4f1bab60e11b81526001600160a01b039384169363969e375693611572936101009091048216929116908690600401612226565b600060405180830381600087803b15801561158c57600080fd5b505af11580156115a0573d6000803e3d6000fd5b5050600e546040516370a0823160e01b81526001600160a01b039091169250636161eb189150309083906370a08231906115de908490600401612212565b60206040518083038186803b1580156115f657600080fd5b505afa15801561160a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061162e91906121df565b6040518363ffffffff1660e01b815260040161164b92919061224a565b600060405180830381600087803b15801561166557600080fd5b505af1158015611679573d6000803e3d6000fd5b5093979650505050505050565b3390565b6001600160a01b0383166116b05760405162461bcd60e51b8152600401610982906127cb565b6001600160a01b0382166116d65760405162461bcd60e51b8152600401610982906124d5565b6001600160a01b0380841660008181526001602090815260408083209487168084529490915290819020849055517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259061085190859061226e565b60008061173c611686565b90506117498582856119e4565b610fb4858585611a2e565b600061101a8284612900565b6001600160a01b0382166117865760405162461bcd60e51b815260040161098290612700565b61179282600083611833565b6001600160a01b038216600090815260208190526040902054818110156117cb5760405162461bcd60e51b815260040161098290612416565b6001600160a01b0383166000818152602081905260408082208585039055600280548690039055519091907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9061182390869061226e565b60405180910390a3611833836000845b505050565b600061101a8284612920565b600780546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6000806118a1611686565b9050610909818585611a2e565b6111557f7c7c6cdb67a18743f49ec6fa9b35f50d52ed05cbed4cc592e13b44501c1a22678a8a8a8a8a8a8a8a8a611b2f565b6001600160a01b03881633146119085760405162461bcd60e51b8152600401610982906125c1565b6111557fd099cc98ef71107a616c4f0f941f04c322d8e254fe26b3c6668db87aae413de88a8a8a8a8a8a8a8a8a611b2f565b6001600160a01b0382166119605760405162461bcd60e51b815260040161098290612895565b61196c60008383611833565b806002600082825461197e91906128e8565b90915550506001600160a01b038216600081815260208190526040808220805485019055517fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef906119d090859061226e565b60405180910390a36110c660008383611833565b60006119f084846110ca565b90506000198114611a285781811015611a1b5760405162461bcd60e51b81526004016109829061255e565b611a28848484840361168a565b50505050565b6001600160a01b038316611a545760405162461bcd60e51b815260040161098290612741565b6001600160a01b038216611a7a5760405162461bcd60e51b815260040161098290612387565b611a85838383611833565b6001600160a01b03831660009081526020819052604090205481811015611abe5760405162461bcd60e51b815260040161098290612602565b6001600160a01b0380851660008181526020819052604080822086860390559286168082529083902080548601905591517fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef90611b1c90869061226e565b60405180910390a3611a28848484611833565b854211611b4e5760405162461bcd60e51b815260040161098290612517565b844210611b6d5760405162461bcd60e51b81526004016109829061280f565b60008a8a8a8a8a8a8a604051602001611b8c9796959493929190612277565b6040516020818303038152906040528051906020012090506000611baf82611cdf565b6001600160a01b038c166000908152600660209081526040808320848452825291829020548251808401909352601e83527f454950333030393a20617574686f72697a6174696f6e20697320757365640000918301919091529192509060ff1615611c2d5760405162461bcd60e51b815260040161098291906122fd565b506000611c3c82878787611cf8565b90508b6001600160a01b0316816001600160a01b031614611c6f5760405162461bcd60e51b815260040161098290612786565b6001600160a01b038c166000818152600660209081526040808320868452909152808220805460ff19166001179055518992917f98de503528ee59b575ef0c0a2576a82497bfc029a5685b209e9ec333479b10a591a3611cd08c8c8c611a2e565b50505050505050505050505050565b6000611cf2611cec611d20565b83611e17565b92915050565b6000806000611d0987878787611e4a565b91509150611d1681611f01565b5095945050505050565b6000306001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016148015611d7957507f000000000000000000000000000000000000000000000000000000000000000046145b15611da557507f00000000000000000000000000000000000000000000000000000000000000006108ee565b611e107f00000000000000000000000000000000000000000000000000000000000000007f00000000000000000000000000000000000000000000000000000000000000007f0000000000000000000000000000000000000000000000000000000000000000611fee565b90506108ee565b60008282604051602001611e2c9291906121f7565b60405160208183030381529060405280519060200120905092915050565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0831115611e815750600090506003611ef8565b600060018787878760405160008152602001604052604051611ea694939291906122df565b6020604051602081039080840390855afa158015611ec8573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b038116611ef157600060019250925050611ef8565b9150600090505b94509492505050565b6000816004811115611f2357634e487b7160e01b600052602160045260246000fd5b1415611f2e57610e2b565b6001816004811115611f5057634e487b7160e01b600052602160045260246000fd5b1415611f6e5760405162461bcd60e51b815260040161098290612350565b6002816004811115611f9057634e487b7160e01b600052602160045260246000fd5b1415611fae5760405162461bcd60e51b815260040161098290612458565b6003816004811115611fd057634e487b7160e01b600052602160045260246000fd5b1415610e2b5760405162461bcd60e51b815260040161098290612689565b600083838346306040516020016120099594939291906122b3565b6040516020818303038152906040528051906020012090509392505050565b80356001600160a01b0381168114610eb957600080fd5b600060208284031215612050578081fd5b61101a82612028565b6000806040838503121561206b578081fd5b61207483612028565b915061208260208401612028565b90509250929050565b60008060006060848603121561209f578081fd5b6120a884612028565b92506120b660208501612028565b9150604084013590509250925092565b60008060008060008060008060006101208a8c0312156120e4578485fd5b6120ed8a612028565b98506120fb60208b01612028565b975060408a0135965060608a0135955060808a0135945060a08a0135935060c08a013560ff8116811461212c578384fd5b8093505060e08a013591506101008a013590509295985092959850929598565b6000806040838503121561215e578182fd5b61216783612028565b9150602083013561217781612990565b809150509250929050565b60008060408385031215612194578182fd5b61219d83612028565b946020939093013593505050565b6000602082840312156121bc578081fd5b815161101a81612990565b6000602082840312156121d8578081fd5b5035919050565b6000602082840312156121f0578081fd5b5051919050565b61190160f01b81526002810192909252602282015260420190565b6001600160a01b0391909116815260200190565b6001600160a01b039384168152919092166020820152604081019190915260600190565b6001600160a01b03929092168252602082015260400190565b901515815260200190565b90815260200190565b9687526001600160a01b0395861660208801529390941660408601526060850191909152608084015260a083019190915260c082015260e00190565b9485526020850193909352604084019190915260608301526001600160a01b0316608082015260a00190565b93845260ff9290921660208401526040830152606082015260800190565b6000602080835283518082850152825b818110156123295785810183015185820160400152820161230d565b8181111561233a5783604083870101525b50601f01601f1916929092016040019392505050565b60208082526018908201527f45434453413a20696e76616c6964207369676e61747572650000000000000000604082015260600190565b60208082526023908201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260408201526265737360e81b606082015260800190565b6020808252602c908201527f51756172746572733a2052617465206d7573742062652067726561746572206f60408201526b7220657175616c20746f203160a01b606082015260800190565b60208082526022908201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e604082015261636560f01b606082015260800190565b6020808252601f908201527f45434453413a20696e76616c6964207369676e6174757265206c656e67746800604082015260600190565b60208082526026908201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160408201526564647265737360d01b606082015260800190565b60208082526022908201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604082015261737360f01b606082015260800190565b60208082526027908201527f454950333030393a20617574686f72697a6174696f6e206973206e6f742079656040820152661d081d985b1a5960ca1b606082015260800190565b6020808252601d908201527f45524332303a20696e73756666696369656e7420616c6c6f77616e6365000000604082015260600190565b602080825260129082015271496e73756666696369656e742056616c756560701b604082015260600190565b60208082526021908201527f454950333030393a2063616c6c6572206d7573742062652074686520706179656040820152606560f81b606082015260800190565b60208082526026908201527f45524332303a207472616e7366657220616d6f756e7420657863656564732062604082015265616c616e636560d01b606082015260800190565b60208082526021908201527f51756172746572733a204e6f7420416e2041637469766520446576656c6f70656040820152603960f91b606082015260800190565b60208082526022908201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604082015261756560f01b606082015260800190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b60208082526021908201527f45524332303a206275726e2066726f6d20746865207a65726f206164647265736040820152607360f81b606082015260800190565b60208082526025908201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604082015264647265737360d81b606082015260800190565b60208082526025908201527f4552433230417574686f72697a6174696f6e3a20696e76616c6964207369676e604082015264617475726560d81b606082015260800190565b60208082526024908201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646040820152637265737360e01b606082015260800190565b60208082526021908201527f454950333030393a20617574686f72697a6174696f6e206973206578706972656040820152601960fa1b606082015260800190565b60208082526025908201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f77604082015264207a65726f60d81b606082015260800190565b6020808252601f908201527f45524332303a206d696e7420746f20746865207a65726f206164647265737300604082015260600190565b918252602082015260400190565b60ff91909116815260200190565b600082198211156128fb576128fb61297a565b500190565b60008261291b57634e487b7160e01b81526012600452602481fd5b500490565b600081600019048311821515161561293a5761293a61297a565b500290565b60028104600182168061295357607f821691505b6020821081141561297457634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052601160045260246000fd5b8015158114610e2b57600080fdfe4164647265737320446f65736e277420486176652053756666696369656e742042616c616e6365a264697066735822122081cba29b3ac899b57e12784f9e23694e3937a30c145d1ce17a7c4b7d646f50a864736f6c63430008000033000000000000000000000000121017ca57f62d89c6c602fe55383f41306b76950000000000000000000000008c1a10285e4559f146b3d02b8011a9d6af6e0e83000000000000000000000000b514c45fb2861ad6591c85c93641711d5821ea40

Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)

000000000000000000000000121017ca57f62d89c6c602fe55383f41306b76950000000000000000000000008c1a10285e4559f146b3d02b8011a9d6af6e0e83000000000000000000000000b514c45fb2861ad6591c85c93641711d5821ea40

-----Decoded View---------------
Arg [0] : _q2 (address): 0x121017ca57f62d89c6c602fe55383f41306b7695
Arg [1] : _swapAddress (address): 0x8c1a10285e4559f146b3d02b8011a9d6af6e0e83
Arg [2] : _usdt (address): 0xb514c45fb2861ad6591c85c93641711d5821ea40

-----Encoded View---------------
3 Constructor Arguments found :
Arg [0] : 000000000000000000000000121017ca57f62d89c6c602fe55383f41306b7695
Arg [1] : 0000000000000000000000008c1a10285e4559f146b3d02b8011a9d6af6e0e83
Arg [2] : 000000000000000000000000b514c45fb2861ad6591c85c93641711d5821ea40


Block Transaction Gas Used Reward
Age Block Fee Address BC Fee Address Voting Power Jailed Incoming
Block Uncle Number Difficulty Gas Used Reward
Loading