Contract 0xCA49EcF7e7bb9bBc9D1d295384663F6BA5c0e366 10

Txn Hash Method
Block
From
To
Value [Txn Fee]
0x1ed052f332a7f3bdae31ae86a04a1a3a928ac28031614c7f4ba253501482a35dBuy Public Offer143303252022-04-13 21:23:3833 days 8 hrs ago0xf8ae41b251be35f572a77ea1a84a5547bcf48897 IN 0xca49ecf7e7bb9bbc9d1d295384663f6ba5c0e3660 HT0.00029451375 2.25
0x7fd1132ae35b64f8261cd149c727a3bf7519f7cf8cc8d13c6926ff8ceb47e83fBuy Public Offer143302662022-04-13 21:20:4133 days 8 hrs ago0xf8ae41b251be35f572a77ea1a84a5547bcf48897 IN 0xca49ecf7e7bb9bbc9d1d295384663f6ba5c0e3660 HT0.00029451375 2.25
0x220cc1990672c2379d62aab96ae0a1e5795bf2318831c1689b98a708717bb973Set Factory100000402021-11-14 12:49:12183 days 16 hrs ago0x5befa2d163e40e148df83921e1cc59e044df5471 IN 0xca49ecf7e7bb9bbc9d1d295384663f6ba5c0e3660 HT0.000099420752.25
0xfc27736ce8d13e608ff5998806d013c76ca4e5143c8fc1ef22ed4150cbdcf60e0x60806040100000332021-11-14 12:48:51183 days 16 hrs ago0x5befa2d163e40e148df83921e1cc59e044df5471 IN  Create: Shop0 HT0.0070498262.25
[ Download CSV Export 
Latest 2 internal transactions
Parent Txn Hash Block From To Value
0x95e3a358a5a1b3f580608268b5b2180af7a76f2de56809525fd42af59f434c8e107070782021-12-09 2:01:06159 days 3 hrs ago 0xca49ecf7e7bb9bbc9d1d295384663f6ba5c0e366  Contract Creation0 HT
0x66e4643c5d9099c63ebdc63def83a4158feccb36f4306a491294f3f0f54e54ed100591032021-11-16 14:02:21181 days 15 hrs ago 0xca49ecf7e7bb9bbc9d1d295384663f6ba5c0e366  Contract Creation0 HT
[ Download CSV Export 
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
Shop

Compiler Version
v0.8.6+commit.11564f7e

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion

Contract Source Code (Solidity Standard Json-Input format)

File 1 of 17 : Shop.sol
/*
██   ██ ██████   █████   ██████      ███████ ██   ██  ██████  ██████  
 ██ ██  ██   ██ ██   ██ ██    ██     ██      ██   ██ ██    ██ ██   ██ 
  ███   ██   ██ ███████ ██    ██     ███████ ███████ ██    ██ ██████  
 ██ ██  ██   ██ ██   ██ ██    ██          ██ ██   ██ ██    ██ ██      
██   ██ ██████  ██   ██  ██████      ███████ ██   ██  ██████  ██      
*/
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity ^0.8.6;

import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";

import "./LP.sol";

import "../interfaces/IFactory.sol";
import "../interfaces/IDao.sol";
import "../interfaces/ILP.sol";

contract Shop is ReentrancyGuard {
    using SafeERC20 for IERC20;

    address public factory = address(0);

    mapping(address => bool) public lps;

    struct PublicOffer {
        bool isActive;
        address currency;
        uint256 rate; // lpAmount = currencyAmount / rate. For example: 1 LP = 100 USDT. 530 USDT -> 530/100 = 5.3 LP
    }

    mapping(address => PublicOffer) public publicOffers; // publicOffers[dao]

    struct PrivateOffer {
        bool isActive;
        address recipient;
        address currency;
        uint256 currencyAmount;
        uint256 lpAmount;
    }

    mapping(address => mapping(uint256 => PrivateOffer)) public privateOffers; // privateOffers[dao][offerId]
    mapping(address => uint256) public numberOfPrivateOffers;

    event LpCreated(address indexed lp);

    modifier onlyDaoWithLp() {
        require(
            IFactory(factory).containsDao(msg.sender) &&
                IDao(msg.sender).lp() != address(0),
            "Shop: this function is only for DAO with LP"
        );
        _;
    }

    function setFactory(address _factory) external returns (bool) {
        require(
            factory == address(0),
            "Shop: factory address has already been set"
        );

        factory = _factory;

        return true;
    }

    function createLp(string memory _lpName, string memory _lpSymbol)
        external
        nonReentrant
        returns (bool)
    {
        require(
            IFactory(factory).containsDao(msg.sender),
            "Shop: only DAO can deploy LP"
        );

        LP lp = new LP(_lpName, _lpSymbol, msg.sender);

        lps[address(lp)] = true;

        emit LpCreated(address(lp));

        bool b = IDao(msg.sender).setLp(address(lp));

        require(b, "Shop: LP setting error");

        return true;
    }

    // DAO can use this to create/enable/disable/changeCurrency/changeRate
    function initPublicOffer(
        bool _isActive,
        address _currency,
        uint256 _rate
    ) external onlyDaoWithLp returns (bool) {
        publicOffers[msg.sender] = PublicOffer({
            isActive: _isActive,
            currency: _currency,
            rate: _rate
        });

        return true;
    }

    function createPrivateOffer(
        address _recipient,
        address _currency,
        uint256 _currencyAmount,
        uint256 _lpAmount
    ) external onlyDaoWithLp returns (bool) {
        privateOffers[msg.sender][
            numberOfPrivateOffers[msg.sender]
        ] = PrivateOffer({
            isActive: true,
            recipient: _recipient,
            currency: _currency,
            currencyAmount: _currencyAmount,
            lpAmount: _lpAmount
        });

        numberOfPrivateOffers[msg.sender]++;

        return true;
    }

    function disablePrivateOffer(uint256 _id)
        external
        onlyDaoWithLp
        returns (bool)
    {
        privateOffers[msg.sender][_id].isActive = false;

        return true;
    }

    function buyPublicOffer(address _dao, uint256 _lpAmount)
        external
        nonReentrant
        returns (bool)
    {
        require(
            IFactory(factory).containsDao(_dao),
            "Shop: only DAO can sell LPs"
        );

        PublicOffer memory publicOffer = publicOffers[_dao];

        require(publicOffer.isActive, "Shop: this offer is disabled");

        IERC20(publicOffer.currency).safeTransferFrom(
            msg.sender,
            _dao,
            (_lpAmount * publicOffer.rate) / 1e18
        );

        address lp = IDao(_dao).lp();

        bool b = ILP(lp).mint(msg.sender, _lpAmount);

        require(b, "Shop: mint error");

        return true;
    }

    function buyPrivateOffer(address _dao, uint256 _id)
        external
        nonReentrant
        returns (bool)
    {
        require(
            IFactory(factory).containsDao(_dao),
            "Shop: only DAO can sell LPs"
        );

        PrivateOffer storage offer = privateOffers[_dao][_id];

        require(offer.isActive, "Shop: this offer is disabled");

        offer.isActive = false;

        require(offer.recipient == msg.sender, "Shop: wrong recipient");

        IERC20(offer.currency).safeTransferFrom(
            msg.sender,
            _dao,
            offer.currencyAmount
        );

        address lp = IDao(_dao).lp();

        bool b = ILP(lp).mint(msg.sender, offer.lpAmount);

        require(b, "Shop: mint error");

        return true;
    }
}

File 2 of 17 : IERC20.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC20 standard as defined in the EIP.
 */
interface IERC20 {
    /**
     * @dev Returns the amount of tokens in existence.
     */
    function totalSupply() external view returns (uint256);

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

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

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

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

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

    /**
     * @dev Emitted when `value` tokens are moved from one account (`from`) to
     * another (`to`).
     *
     * Note that `value` may be zero.
     */
    event Transfer(address indexed from, address indexed to, uint256 value);

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

File 3 of 17 : SafeERC20.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "../IERC20.sol";
import "../../../utils/Address.sol";

/**
 * @title SafeERC20
 * @dev Wrappers around ERC20 operations that throw on failure (when the token
 * contract returns false). Tokens that return no value (and instead revert or
 * throw on failure) are also supported, non-reverting calls are assumed to be
 * successful.
 * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,
 * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
 */
library SafeERC20 {
    using Address for address;

    function safeTransfer(
        IERC20 token,
        address to,
        uint256 value
    ) internal {
        _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
    }

    function safeTransferFrom(
        IERC20 token,
        address from,
        address to,
        uint256 value
    ) internal {
        _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
    }

    /**
     * @dev Deprecated. This function has issues similar to the ones found in
     * {IERC20-approve}, and its usage is discouraged.
     *
     * Whenever possible, use {safeIncreaseAllowance} and
     * {safeDecreaseAllowance} instead.
     */
    function safeApprove(
        IERC20 token,
        address spender,
        uint256 value
    ) internal {
        // safeApprove should only be called when setting an initial allowance,
        // or when resetting it to zero. To increase and decrease it, use
        // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'
        require(
            (value == 0) || (token.allowance(address(this), spender) == 0),
            "SafeERC20: approve from non-zero to non-zero allowance"
        );
        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
    }

    function safeIncreaseAllowance(
        IERC20 token,
        address spender,
        uint256 value
    ) internal {
        uint256 newAllowance = token.allowance(address(this), spender) + value;
        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
    }

    function safeDecreaseAllowance(
        IERC20 token,
        address spender,
        uint256 value
    ) internal {
        unchecked {
            uint256 oldAllowance = token.allowance(address(this), spender);
            require(oldAllowance >= value, "SafeERC20: decreased allowance below zero");
            uint256 newAllowance = oldAllowance - value;
            _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
        }
    }

    /**
     * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
     * on the return value: the return value is optional (but if data is returned, it must not be false).
     * @param token The token targeted by the call.
     * @param data The call data (encoded using abi.encode or one of its variants).
     */
    function _callOptionalReturn(IERC20 token, bytes memory data) private {
        // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
        // we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that
        // the target address contains contract code and also asserts for success in the low-level call.

        bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed");
        if (returndata.length > 0) {
            // Return data is optional
            require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
        }
    }
}

File 4 of 17 : ReentrancyGuard.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

/**
 * @dev Contract module that helps prevent reentrant calls to a function.
 *
 * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier
 * available, which can be applied to functions to make sure there are no nested
 * (reentrant) calls to them.
 *
 * Note that because there is a single `nonReentrant` guard, functions marked as
 * `nonReentrant` may not call one another. This can be worked around by making
 * those functions `private`, and then adding `external` `nonReentrant` entry
 * points to them.
 *
 * TIP: If you would like to learn more about reentrancy and alternative ways
 * to protect against it, check out our blog post
 * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].
 */
abstract contract ReentrancyGuard {
    // Booleans are more expensive than uint256 or any type that takes up a full
    // word because each write operation emits an extra SLOAD to first read the
    // slot's contents, replace the bits taken up by the boolean, and then write
    // back. This is the compiler's defense against contract upgrades and
    // pointer aliasing, and it cannot be disabled.

    // The values being non-zero value makes deployment a bit more expensive,
    // but in exchange the refund on every call to nonReentrant will be lower in
    // amount. Since refunds are capped to a percentage of the total
    // transaction's gas, it is best to keep them low in cases like this one, to
    // increase the likelihood of the full refund coming into effect.
    uint256 private constant _NOT_ENTERED = 1;
    uint256 private constant _ENTERED = 2;

    uint256 private _status;

    constructor() {
        _status = _NOT_ENTERED;
    }

    /**
     * @dev Prevents a contract from calling itself, directly or indirectly.
     * Calling a `nonReentrant` function from another `nonReentrant`
     * function is not supported. It is possible to prevent this from happening
     * by making the `nonReentrant` function external, and make it call a
     * `private` function that does the actual work.
     */
    modifier nonReentrant() {
        // On the first call to nonReentrant, _notEntered will be true
        require(_status != _ENTERED, "ReentrancyGuard: reentrant call");

        // Any calls to nonReentrant after this point will fail
        _status = _ENTERED;

        _;

        // By storing the original value once again, a refund is triggered (see
        // https://eips.ethereum.org/EIPS/eip-2200)
        _status = _NOT_ENTERED;
    }
}

File 5 of 17 : LP.sol
/*
██   ██ ██████   █████   ██████      ██      ██████  
 ██ ██  ██   ██ ██   ██ ██    ██     ██      ██   ██ 
  ███   ██   ██ ███████ ██    ██     ██      ██████  
 ██ ██  ██   ██ ██   ██ ██    ██     ██      ██      
██   ██ ██████  ██   ██  ██████      ███████ ██      
*/
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity ^0.8.6;

import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/token/ERC20/extensions/draft-ERC20Permit.sol";

import "@openzeppelin/contracts/security/ReentrancyGuard.sol";

import "../interfaces/IDao.sol";

contract LP is ReentrancyGuard, ERC20, ERC20Permit {
    address public immutable dao;

    address public immutable shop;

    bool public mintable = true;
    bool public burnable = true;
    bool public mintableStatusFrozen = false;
    bool public burnableStatusFrozen = false;

    constructor(
        string memory _name,
        string memory _symbol,
        address _dao
    ) ERC20(_name, _symbol) ERC20Permit(_name) {
        dao = _dao;
        shop = msg.sender;
    }

    modifier onlyDao() {
        require(msg.sender == dao, "LP: caller is not the dao");
        _;
    }

    modifier onlyShop() {
        require(msg.sender == shop, "LP: caller is not the shop");
        _;
    }

    function mint(address _to, uint256 _amount)
        external
        onlyShop
        returns (bool)
    {
        require(mintable, "LP: minting is disabled");
        _mint(_to, _amount);
        return true;
    }

    function burn(
        uint256 _amount,
        address[] memory _tokens,
        address[] memory _adapters,
        address[] memory _pools
    ) external nonReentrant returns (bool) {
        require(burnable, "LP: burning is disabled");
        require(msg.sender != dao, "LP: DAO can't burn LP");
        require(_amount <= balanceOf(msg.sender), "LP: insufficient balance");
        require(totalSupply() > 0, "LP: Zero share");

        uint256 _share = (1e18 * _amount) / (totalSupply());

        _burn(msg.sender, _amount);

        bool b = IDao(dao).burnLp(
            msg.sender,
            _share,
            _tokens,
            _adapters,
            _pools
        );

        require(b, "LP: burning error");

        return true;
    }

    function changeMintable(bool _mintable) external onlyDao returns (bool) {
        require(!mintableStatusFrozen, "LP: minting status is frozen");
        mintable = _mintable;
        return true;
    }

    function changeBurnable(bool _burnable) external onlyDao returns (bool) {
        require(!burnableStatusFrozen, "LP: burnable status is frozen");
        burnable = _burnable;
        return true;
    }

    function freezeMintingStatus() external onlyDao returns (bool) {
        mintableStatusFrozen = true;
        return true;
    }

    function freezeBurningStatus() external onlyDao returns (bool) {
        burnableStatusFrozen = true;
        return true;
    }
}

File 6 of 17 : IFactory.sol
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.6;

interface IFactory {
    function getDaos() external view returns (address[] memory);

    function shop() external view returns (address);

    function monthlyCost() external view returns (uint256);

    function subscriptions(address _dao) external view returns (uint256);

    function containsDao(address _dao) external view returns (bool);
}

File 7 of 17 : IDao.sol
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.6;

interface IDao {
    function name() external view returns (string memory);

    function symbol() external view returns (string memory);

    function lp() external view returns (address);

    function burnLp(
        address _recipient,
        uint256 _share,
        address[] memory _tokens,
        address[] memory _adapters,
        address[] memory _pools
    ) external returns (bool);

    function setLp(address _lp) external returns (bool);

    function quorum() external view returns (uint8);

    function executedTx(bytes32 _txHash) external view returns (bool);

    function mintable() external view returns (bool);

    function burnable() external view returns (bool);

    function numberOfPermitted() external view returns (uint256);

    function numberOfAdapters() external view returns (uint256);
}

File 8 of 17 : ILP.sol
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.6;

interface ILP {
    function name() external view returns (string memory);

    function symbol() external view returns (string memory);

    function burn(address _to, uint256 _amount) external returns (bool);

    function mint(address _to, uint256 _amount) external returns (bool);

    function mintable() external view returns (bool);

    function burnable() external view returns (bool);

    function mintableStatusFrozen() external view returns (bool);

    function burnableStatusFrozen() external view returns (bool);
}

File 9 of 17 : Address.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

/**
 * @dev Collection of functions related to the address type
 */
library Address {
    /**
     * @dev Returns true if `account` is a contract.
     *
     * [IMPORTANT]
     * ====
     * It is unsafe to assume that an address for which this function returns
     * false is an externally-owned account (EOA) and not a contract.
     *
     * Among others, `isContract` will return false for the following
     * types of addresses:
     *
     *  - an externally-owned account
     *  - a contract in construction
     *  - an address where a contract will be created
     *  - an address where a contract lived, but was destroyed
     * ====
     */
    function isContract(address account) internal view returns (bool) {
        // This method relies on extcodesize, which returns 0 for contracts in
        // construction, since the code is only stored at the end of the
        // constructor execution.

        uint256 size;
        assembly {
            size := extcodesize(account)
        }
        return size > 0;
    }

    /**
     * @dev Replacement for Solidity's `transfer`: sends `amount` wei to
     * `recipient`, forwarding all available gas and reverting on errors.
     *
     * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
     * of certain opcodes, possibly making contracts go over the 2300 gas limit
     * imposed by `transfer`, making them unable to receive funds via
     * `transfer`. {sendValue} removes this limitation.
     *
     * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
     *
     * IMPORTANT: because control is transferred to `recipient`, care must be
     * taken to not create reentrancy vulnerabilities. Consider using
     * {ReentrancyGuard} or the
     * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
     */
    function sendValue(address payable recipient, uint256 amount) internal {
        require(address(this).balance >= amount, "Address: insufficient balance");

        (bool success, ) = recipient.call{value: amount}("");
        require(success, "Address: unable to send value, recipient may have reverted");
    }

    /**
     * @dev Performs a Solidity function call using a low level `call`. A
     * plain `call` is an unsafe replacement for a function call: use this
     * function instead.
     *
     * If `target` reverts with a revert reason, it is bubbled up by this
     * function (like regular Solidity function calls).
     *
     * Returns the raw returned data. To convert to the expected return value,
     * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
     *
     * Requirements:
     *
     * - `target` must be a contract.
     * - calling `target` with `data` must not revert.
     *
     * _Available since v3.1._
     */
    function functionCall(address target, bytes memory data) internal returns (bytes memory) {
        return functionCall(target, data, "Address: low-level call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
     * `errorMessage` as a fallback revert reason when `target` reverts.
     *
     * _Available since v3.1._
     */
    function functionCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal returns (bytes memory) {
        return functionCallWithValue(target, data, 0, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but also transferring `value` wei to `target`.
     *
     * Requirements:
     *
     * - the calling contract must have an ETH balance of at least `value`.
     * - the called Solidity function must be `payable`.
     *
     * _Available since v3.1._
     */
    function functionCallWithValue(
        address target,
        bytes memory data,
        uint256 value
    ) internal returns (bytes memory) {
        return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
    }

    /**
     * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
     * with `errorMessage` as a fallback revert reason when `target` reverts.
     *
     * _Available since v3.1._
     */
    function functionCallWithValue(
        address target,
        bytes memory data,
        uint256 value,
        string memory errorMessage
    ) internal returns (bytes memory) {
        require(address(this).balance >= value, "Address: insufficient balance for call");
        require(isContract(target), "Address: call to non-contract");

        (bool success, bytes memory returndata) = target.call{value: value}(data);
        return _verifyCallResult(success, returndata, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but performing a static call.
     *
     * _Available since v3.3._
     */
    function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
        return functionStaticCall(target, data, "Address: low-level static call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
     * but performing a static call.
     *
     * _Available since v3.3._
     */
    function functionStaticCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal view returns (bytes memory) {
        require(isContract(target), "Address: static call to non-contract");

        (bool success, bytes memory returndata) = target.staticcall(data);
        return _verifyCallResult(success, returndata, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but performing a delegate call.
     *
     * _Available since v3.4._
     */
    function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
        return functionDelegateCall(target, data, "Address: low-level delegate call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
     * but performing a delegate call.
     *
     * _Available since v3.4._
     */
    function functionDelegateCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal returns (bytes memory) {
        require(isContract(target), "Address: delegate call to non-contract");

        (bool success, bytes memory returndata) = target.delegatecall(data);
        return _verifyCallResult(success, returndata, errorMessage);
    }

    function _verifyCallResult(
        bool success,
        bytes memory returndata,
        string memory errorMessage
    ) private pure returns (bytes memory) {
        if (success) {
            return returndata;
        } else {
            // Look for revert reason and bubble it up if present
            if (returndata.length > 0) {
                // The easiest way to bubble the revert reason is using memory via assembly

                assembly {
                    let returndata_size := mload(returndata)
                    revert(add(32, returndata), returndata_size)
                }
            } else {
                revert(errorMessage);
            }
        }
    }
}

File 10 of 17 : ERC20.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

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

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

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

    uint256 private _totalSupply;

    string private _name;
    string private _symbol;

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

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

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

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

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

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

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

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

    /**
     * @dev See {IERC20-approve}.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     */
    function approve(address spender, uint256 amount) public virtual override returns (bool) {
        _approve(_msgSender(), spender, amount);
        return true;
    }

    /**
     * @dev See {IERC20-transferFrom}.
     *
     * Emits an {Approval} event indicating the updated allowance. This is not
     * required by the EIP. See the note at the beginning of {ERC20}.
     *
     * Requirements:
     *
     * - `sender` and `recipient` cannot be the zero address.
     * - `sender` must have a balance of at least `amount`.
     * - the caller must have allowance for ``sender``'s tokens of at least
     * `amount`.
     */
    function transferFrom(
        address sender,
        address recipient,
        uint256 amount
    ) public virtual override returns (bool) {
        _transfer(sender, recipient, amount);

        uint256 currentAllowance = _allowances[sender][_msgSender()];
        require(currentAllowance >= amount, "ERC20: transfer amount exceeds allowance");
        unchecked {
            _approve(sender, _msgSender(), currentAllowance - amount);
        }

        return true;
    }

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

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

        return true;
    }

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

        _beforeTokenTransfer(sender, recipient, amount);

        uint256 senderBalance = _balances[sender];
        require(senderBalance >= amount, "ERC20: transfer amount exceeds balance");
        unchecked {
            _balances[sender] = senderBalance - amount;
        }
        _balances[recipient] += amount;

        emit Transfer(sender, recipient, amount);

        _afterTokenTransfer(sender, recipient, amount);
    }

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

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

        _totalSupply += amount;
        _balances[account] += amount;
        emit Transfer(address(0), account, amount);

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

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

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

        uint256 accountBalance = _balances[account];
        require(accountBalance >= amount, "ERC20: burn amount exceeds balance");
        unchecked {
            _balances[account] = accountBalance - amount;
        }
        _totalSupply -= amount;

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

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

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

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

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

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

File 11 of 17 : draft-ERC20Permit.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "./draft-IERC20Permit.sol";
import "../ERC20.sol";
import "../../../utils/cryptography/draft-EIP712.sol";
import "../../../utils/cryptography/ECDSA.sol";
import "../../../utils/Counters.sol";

/**
 * @dev Implementation of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in
 * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].
 *
 * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by
 * presenting a message signed by the account. By not relying on `{IERC20-approve}`, the token holder account doesn't
 * need to send a transaction, and thus is not required to hold Ether at all.
 *
 * _Available since v3.4._
 */
abstract contract ERC20Permit is ERC20, IERC20Permit, EIP712 {
    using Counters for Counters.Counter;

    mapping(address => Counters.Counter) private _nonces;

    // solhint-disable-next-line var-name-mixedcase
    bytes32 private immutable _PERMIT_TYPEHASH =
        keccak256("Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)");

    /**
     * @dev Initializes the {EIP712} domain separator using the `name` parameter, and setting `version` to `"1"`.
     *
     * It's a good idea to use the same `name` that is defined as the ERC20 token name.
     */
    constructor(string memory name) EIP712(name, "1") {}

    /**
     * @dev See {IERC20Permit-permit}.
     */
    function permit(
        address owner,
        address spender,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) public virtual override {
        require(block.timestamp <= deadline, "ERC20Permit: expired deadline");

        bytes32 structHash = keccak256(abi.encode(_PERMIT_TYPEHASH, owner, spender, value, _useNonce(owner), deadline));

        bytes32 hash = _hashTypedDataV4(structHash);

        address signer = ECDSA.recover(hash, v, r, s);
        require(signer == owner, "ERC20Permit: invalid signature");

        _approve(owner, spender, value);
    }

    /**
     * @dev See {IERC20Permit-nonces}.
     */
    function nonces(address owner) public view virtual override returns (uint256) {
        return _nonces[owner].current();
    }

    /**
     * @dev See {IERC20Permit-DOMAIN_SEPARATOR}.
     */
    // solhint-disable-next-line func-name-mixedcase
    function DOMAIN_SEPARATOR() external view override returns (bytes32) {
        return _domainSeparatorV4();
    }

    /**
     * @dev "Consume a nonce": return the current value and increment.
     *
     * _Available since v4.1._
     */
    function _useNonce(address owner) internal virtual returns (uint256 current) {
        Counters.Counter storage nonce = _nonces[owner];
        current = nonce.current();
        nonce.increment();
    }
}

File 12 of 17 : IERC20Metadata.sol
// SPDX-License-Identifier: MIT

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 13 of 17 : Context.sol
// SPDX-License-Identifier: MIT

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 14 of 17 : draft-IERC20Permit.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in
 * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].
 *
 * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by
 * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't
 * need to send a transaction, and thus is not required to hold Ether at all.
 */
interface IERC20Permit {
    /**
     * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,
     * given ``owner``'s signed approval.
     *
     * IMPORTANT: The same issues {IERC20-approve} has related to transaction
     * ordering also apply here.
     *
     * Emits an {Approval} event.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     * - `deadline` must be a timestamp in the future.
     * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`
     * over the EIP712-formatted function arguments.
     * - the signature must use ``owner``'s current nonce (see {nonces}).
     *
     * For more information on the signature format, see the
     * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP
     * section].
     */
    function permit(
        address owner,
        address spender,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) external;

    /**
     * @dev Returns the current nonce for `owner`. This value must be
     * included whenever a signature is generated for {permit}.
     *
     * Every successful call to {permit} increases ``owner``'s nonce by one. This
     * prevents a signature from being used multiple times.
     */
    function nonces(address owner) external view returns (uint256);

    /**
     * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.
     */
    // solhint-disable-next-line func-name-mixedcase
    function DOMAIN_SEPARATOR() external view returns (bytes32);
}

File 15 of 17 : draft-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;

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

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

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

    /**
     * @dev Returns the domain separator for the current chain.
     */
    function _domainSeparatorV4() internal view returns (bytes32) {
        if (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 16 of 17 : ECDSA.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

/**
 * @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 {
    /**
     * @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.
     *
     * Documentation for signature generation:
     * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js]
     * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers]
     */
    function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {
        // Check the signature length
        // - case 65: r,s,v signature (standard)
        // - case 64: r,vs signature (cf https://eips.ethereum.org/EIPS/eip-2098) _Available since v4.1._
        if (signature.length == 65) {
            bytes32 r;
            bytes32 s;
            uint8 v;
            // ecrecover takes the signature parameters, and the only way to get them
            // currently is to use assembly.
            assembly {
                r := mload(add(signature, 0x20))
                s := mload(add(signature, 0x40))
                v := byte(0, mload(add(signature, 0x60)))
            }
            return recover(hash, v, r, s);
        } else if (signature.length == 64) {
            bytes32 r;
            bytes32 vs;
            // ecrecover takes the signature parameters, and the only way to get them
            // currently is to use assembly.
            assembly {
                r := mload(add(signature, 0x20))
                vs := mload(add(signature, 0x40))
            }
            return recover(hash, r, vs);
        } else {
            revert("ECDSA: invalid signature length");
        }
    }

    /**
     * @dev Overload of {ECDSA-recover} 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.2._
     */
    function recover(
        bytes32 hash,
        bytes32 r,
        bytes32 vs
    ) internal pure returns (address) {
        bytes32 s;
        uint8 v;
        assembly {
            s := and(vs, 0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff)
            v := add(shr(255, vs), 27)
        }
        return recover(hash, v, r, s);
    }

    /**
     * @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) {
        // 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 (281): 0 < s < secp256k1n ÷ 2 + 1, and for v in (282): 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.
        require(
            uint256(s) <= 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0,
            "ECDSA: invalid signature 's' value"
        );
        require(v == 27 || v == 28, "ECDSA: invalid signature 'v' value");

        // If the signature is valid (and not malleable), return the signer address
        address signer = ecrecover(hash, v, r, s);
        require(signer != address(0), "ECDSA: invalid signature");

        return signer;
    }

    /**
     * @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 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 17 of 17 : Counters.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

/**
 * @title Counters
 * @author Matt Condon (@shrugs)
 * @dev Provides counters that can only be incremented, decremented or reset. This can be used e.g. to track the number
 * of elements in a mapping, issuing ERC721 ids, or counting request ids.
 *
 * Include with `using Counters for Counters.Counter;`
 */
library Counters {
    struct Counter {
        // This variable should never be directly accessed by users of the library: interactions must be restricted to
        // the library's function. As of Solidity v0.5.2, this cannot be enforced, though there is a proposal to add
        // this feature: see https://github.com/ethereum/solidity/issues/4637
        uint256 _value; // default: 0
    }

    function current(Counter storage counter) internal view returns (uint256) {
        return counter._value;
    }

    function increment(Counter storage counter) internal {
        unchecked {
            counter._value += 1;
        }
    }

    function decrement(Counter storage counter) internal {
        uint256 value = counter._value;
        require(value > 0, "Counter: decrement overflow");
        unchecked {
            counter._value = value - 1;
        }
    }

    function reset(Counter storage counter) internal {
        counter._value = 0;
    }
}

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

Contract Security Audit

Contract ABI

[{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"lp","type":"address"}],"name":"LpCreated","type":"event"},{"inputs":[{"internalType":"address","name":"_dao","type":"address"},{"internalType":"uint256","name":"_id","type":"uint256"}],"name":"buyPrivateOffer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_dao","type":"address"},{"internalType":"uint256","name":"_lpAmount","type":"uint256"}],"name":"buyPublicOffer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"_lpName","type":"string"},{"internalType":"string","name":"_lpSymbol","type":"string"}],"name":"createLp","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_recipient","type":"address"},{"internalType":"address","name":"_currency","type":"address"},{"internalType":"uint256","name":"_currencyAmount","type":"uint256"},{"internalType":"uint256","name":"_lpAmount","type":"uint256"}],"name":"createPrivateOffer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_id","type":"uint256"}],"name":"disablePrivateOffer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"factory","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bool","name":"_isActive","type":"bool"},{"internalType":"address","name":"_currency","type":"address"},{"internalType":"uint256","name":"_rate","type":"uint256"}],"name":"initPublicOffer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"lps","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"numberOfPrivateOffers","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"privateOffers","outputs":[{"internalType":"bool","name":"isActive","type":"bool"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"address","name":"currency","type":"address"},{"internalType":"uint256","name":"currencyAmount","type":"uint256"},{"internalType":"uint256","name":"lpAmount","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"publicOffers","outputs":[{"internalType":"bool","name":"isActive","type":"bool"},{"internalType":"address","name":"currency","type":"address"},{"internalType":"uint256","name":"rate","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_factory","type":"address"}],"name":"setFactory","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"}]

6080604052600180546001600160a01b031916905534801561002057600080fd5b506001600055613775806100356000396000f3fe60806040523480156200001157600080fd5b5060043610620000c35760003560e01c8063bfd98dc1116200007a578063bfd98dc114620001fc578063c45a01551462000213578063d12e73321462000240578063d249a9781462000266578063d2ea985314620002ca578063e8bbc83614620002e157600080fd5b80631f20b10214620000c85780633c0f968d14620000f45780634e5bfe06146200012657806356819c80146200013d5780635bb478081462000154578063b8923429146200016b575b600080fd5b620000df620000d936600462001491565b620002f8565b60405190151581526020015b60405180910390f35b620001176200010536600462001451565b60056020526000908152604090205481565b604051908152602001620000eb565b620000df6200013736600462001571565b6200050f565b620000df6200014e3660046200152b565b62000771565b620000df6200016536600462001451565b62000917565b620001c56200017c366004620014dc565b6004602090815260009283526040808420909152908252902080546001820154600283015460039093015460ff8316936101009093046001600160a01b03908116939216919085565b6040805195151586526001600160a01b03948516602087015292909316918401919091526060830152608082015260a001620000eb565b620000df6200020d366004620015dc565b620009ac565b60015462000227906001600160a01b031681565b6040516001600160a01b039091168152602001620000eb565b620000df6200025136600462001451565b60026020526000908152604090205460ff1681565b620002a46200027736600462001451565b6003602052600090815260409020805460019091015460ff82169161010090046001600160a01b03169083565b6040805193151584526001600160a01b03909216602084015290820152606001620000eb565b620000df620002db366004620014dc565b62000b06565b620000df620002f2366004620014dc565b62000e38565b6001546040516396d054e560e01b81523360048201526000916001600160a01b0316906396d054e59060240160206040518083038186803b1580156200033d57600080fd5b505afa15801562000352573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200037891906200150b565b80156200040c575060006001600160a01b0316336001600160a01b031663313c06a06040518163ffffffff1660e01b815260040160206040518083038186803b158015620003c557600080fd5b505afa158015620003da573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000400919062001471565b6001600160a01b031614155b620004345760405162461bcd60e51b81526004016200042b90620016d0565b60405180910390fd5b6040805160a08101825260018082526001600160a01b038881166020808501918252898316858701908152606086018a8152608087018a8152336000818152600486528a812060058088528c8320805484529188529b82209a518b5498516001600160a81b0319909916901515610100600160a81b03191617610100988a1698909802979097178a55935197890180546001600160a01b0319169890971697909717909555516002870155925160039095019490945591815292909152805491620004ff836200178f565b9091555060019695505050505050565b600060026000541415620005375760405162461bcd60e51b81526004016200042b9062001699565b60026000556001546040516396d054e560e01b81523360048201526001600160a01b03909116906396d054e59060240160206040518083038186803b1580156200058057600080fd5b505afa15801562000595573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620005bb91906200150b565b620006095760405162461bcd60e51b815260206004820152601c60248201527f53686f703a206f6e6c792044414f2063616e206465706c6f79204c500000000060448201526064016200042b565b60008383336040516200061c90620013ae565b6200062a9392919062001657565b604051809103906000f08015801562000647573d6000803e3d6000fd5b506001600160a01b038116600081815260026020526040808220805460ff191660011790555192935090917fac4bd1fef3edbe329718924027e53821b2496a5710d5ffd3afb2b3789e746d629190a260405163f4c2baa960e01b81526001600160a01b0382166004820152600090339063f4c2baa990602401602060405180830381600087803b158015620006db57600080fd5b505af1158015620006f0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200071691906200150b565b905080620007605760405162461bcd60e51b815260206004820152601660248201527529b437b81d1026281039b2ba3a34b7339032b93937b960511b60448201526064016200042b565b600192505050600160005592915050565b6001546040516396d054e560e01b81523360048201526000916001600160a01b0316906396d054e59060240160206040518083038186803b158015620007b657600080fd5b505afa158015620007cb573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620007f191906200150b565b801562000885575060006001600160a01b0316336001600160a01b031663313c06a06040518163ffffffff1660e01b815260040160206040518083038186803b1580156200083e57600080fd5b505afa15801562000853573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000879919062001471565b6001600160a01b031614155b620008a45760405162461bcd60e51b81526004016200042b90620016d0565b506040805160608101825284151581526001600160a01b03848116602080840191825283850186815233600090815260039092529490209251835491516001600160a81b0319909216901515610100600160a81b03191617610100919092160217815590516001918201555b9392505050565b6001546000906001600160a01b031615620009885760405162461bcd60e51b815260206004820152602a60248201527f53686f703a20666163746f727920616464726573732068617320616c726561646044820152691e481899595b881cd95d60b21b60648201526084016200042b565b50600180546001600160a01b0319166001600160a01b039290921691909117815590565b6001546040516396d054e560e01b81523360048201526000916001600160a01b0316906396d054e59060240160206040518083038186803b158015620009f157600080fd5b505afa15801562000a06573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000a2c91906200150b565b801562000ac0575060006001600160a01b0316336001600160a01b031663313c06a06040518163ffffffff1660e01b815260040160206040518083038186803b15801562000a7957600080fd5b505afa15801562000a8e573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000ab4919062001471565b6001600160a01b031614155b62000adf5760405162461bcd60e51b81526004016200042b90620016d0565b5033600090815260046020908152604080832093835292905220805460ff19169055600190565b60006002600054141562000b2e5760405162461bcd60e51b81526004016200042b9062001699565b60026000556001546040516396d054e560e01b81526001600160a01b038581166004830152909116906396d054e59060240160206040518083038186803b15801562000b7957600080fd5b505afa15801562000b8e573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000bb491906200150b565b62000c025760405162461bcd60e51b815260206004820152601b60248201527f53686f703a206f6e6c792044414f2063616e2073656c6c204c5073000000000060448201526064016200042b565b6001600160a01b038084166000908152600360209081526040918290208251606081018452815460ff811615158083526101009091049095169281019290925260010154918101919091529062000c9c5760405162461bcd60e51b815260206004820152601c60248201527f53686f703a2074686973206f666665722069732064697361626c65640000000060448201526064016200042b565b62000ce03385670de0b6b3a764000084604001518762000cbd91906200173e565b62000cc991906200171b565b60208501516001600160a01b0316929190620010e5565b6000846001600160a01b031663313c06a06040518163ffffffff1660e01b815260040160206040518083038186803b15801562000d1c57600080fd5b505afa15801562000d31573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000d57919062001471565b6040516340c10f1960e01b8152336004820152602481018690529091506000906001600160a01b038316906340c10f19906044015b602060405180830381600087803b15801562000da757600080fd5b505af115801562000dbc573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000de291906200150b565b90508062000e265760405162461bcd60e51b815260206004820152601060248201526f29b437b81d1036b4b73a1032b93937b960811b60448201526064016200042b565b60019350505050600160005592915050565b60006002600054141562000e605760405162461bcd60e51b81526004016200042b9062001699565b60026000556001546040516396d054e560e01b81526001600160a01b038581166004830152909116906396d054e59060240160206040518083038186803b15801562000eab57600080fd5b505afa15801562000ec0573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000ee691906200150b565b62000f345760405162461bcd60e51b815260206004820152601b60248201527f53686f703a206f6e6c792044414f2063616e2073656c6c204c5073000000000060448201526064016200042b565b6001600160a01b03831660009081526004602090815260408083208584529091529020805460ff1662000faa5760405162461bcd60e51b815260206004820152601c60248201527f53686f703a2074686973206f666665722069732064697361626c65640000000060448201526064016200042b565b805460ff191680825561010090046001600160a01b03163314620010095760405162461bcd60e51b815260206004820152601560248201527414da1bdc0e881ddc9bdb99c81c9958da5c1a595b9d605a1b60448201526064016200042b565b600281015460018201546200102e916001600160a01b039091169033908790620010e5565b6000846001600160a01b031663313c06a06040518163ffffffff1660e01b815260040160206040518083038186803b1580156200106a57600080fd5b505afa1580156200107f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620010a5919062001471565b60038301546040516340c10f1960e01b815233600482015260248101919091529091506000906001600160a01b038316906340c10f199060440162000d8c565b604080516001600160a01b0385811660248301528416604482015260648082018490528251808303909101815260849091019091526020810180516001600160e01b03166323b872dd60e01b1790526200114190859062001147565b50505050565b60006200119e826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316620012259092919063ffffffff16565b805190915015620012205780806020019051810190620011bf91906200150b565b620012205760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084016200042b565b505050565b60606200123684846000856200123e565b949350505050565b606082471015620012a15760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b60648201526084016200042b565b843b620012f15760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016200042b565b600080866001600160a01b031685876040516200130f919062001624565b60006040518083038185875af1925050503d80600081146200134e576040519150601f19603f3d011682016040523d82523d6000602084013e62001353565b606091505b50915091506200136582828662001370565b979650505050505050565b606083156200138157508162000910565b825115620013925782518084602001fd5b8160405162461bcd60e51b81526004016200042b919062001642565b611f3e806200180283390190565b600082601f830112620013ce57600080fd5b813567ffffffffffffffff80821115620013ec57620013ec620017c3565b604051601f8301601f19908116603f01168101908282118183101715620014175762001417620017c3565b816040528381528660208588010111156200143157600080fd5b836020870160208301376000602085830101528094505050505092915050565b6000602082840312156200146457600080fd5b81356200091081620017d9565b6000602082840312156200148457600080fd5b81516200091081620017d9565b60008060008060808587031215620014a857600080fd5b8435620014b581620017d9565b93506020850135620014c781620017d9565b93969395505050506040820135916060013590565b60008060408385031215620014f057600080fd5b8235620014fd81620017d9565b946020939093013593505050565b6000602082840312156200151e57600080fd5b81516200091081620017f2565b6000806000606084860312156200154157600080fd5b83356200154e81620017f2565b925060208401356200156081620017d9565b929592945050506040919091013590565b600080604083850312156200158557600080fd5b823567ffffffffffffffff808211156200159e57600080fd5b620015ac86838701620013bc565b93506020850135915080821115620015c357600080fd5b50620015d285828601620013bc565b9150509250929050565b600060208284031215620015ef57600080fd5b5035919050565b600081518084526200161081602086016020860162001760565b601f01601f19169290920160200192915050565b600082516200163881846020870162001760565b9190910192915050565b602081526000620009106020830184620015f6565b6060815260006200166c6060830186620015f6565b8281036020840152620016808186620015f6565b91505060018060a01b0383166040830152949350505050565b6020808252601f908201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604082015260600190565b6020808252602b908201527f53686f703a20746869732066756e6374696f6e206973206f6e6c7920666f722060408201526a044414f2077697468204c560ac1b606082015260800190565b6000826200173957634e487b7160e01b600052601260045260246000fd5b500490565b60008160001904831182151516156200175b576200175b620017ad565b500290565b60005b838110156200177d57818101518382015260200162001763565b83811115620011415750506000910152565b6000600019821415620017a657620017a6620017ad565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b0381168114620017ef57600080fd5b50565b8015158114620017ef57600080fdfe6101806040527f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c9610120526007805463ffffffff19166101011790553480156200004857600080fd5b5060405162001f3e38038062001f3e8339810160408190526200006b91620002c9565b8280604051806040016040528060018152602001603160f81b815250858560016000819055508160049080519060200190620000a99291906200016c565b508051620000bf9060059060208401906200016c565b5050825160209384012082519284019290922060c083815260e08290524660a0818152604080517f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f818a018190528183019890985260608082019690965260808082019490945230818401528151808203909301835290930190925281519190950120909352506101005291821b6001600160601b031916610140525033901b6101605250620003a99050565b8280546200017a9062000356565b90600052602060002090601f0160209004810192826200019e5760008555620001e9565b82601f10620001b957805160ff1916838001178555620001e9565b82800160010185558215620001e9579182015b82811115620001e9578251825591602001919060010190620001cc565b50620001f7929150620001fb565b5090565b5b80821115620001f75760008155600101620001fc565b600082601f8301126200022457600080fd5b81516001600160401b038082111562000241576200024162000393565b604051601f8301601f19908116603f011681019082821181831017156200026c576200026c62000393565b816040528381526020925086838588010111156200028957600080fd5b600091505b83821015620002ad57858201830151818301840152908201906200028e565b83821115620002bf5760008385830101525b9695505050505050565b600080600060608486031215620002df57600080fd5b83516001600160401b0380821115620002f757600080fd5b620003058783880162000212565b945060208601519150808211156200031c57600080fd5b506200032b8682870162000212565b604086015190935090506001600160a01b03811681146200034b57600080fd5b809150509250925092565b600181811c908216806200036b57607f821691505b602082108114156200038d57634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052604160045260246000fd5b60805160a05160c05160e05161010051610120516101405160601c6101605160601c611af862000446600039600081816101b601526105f701526000818161029501528181610498015281816106cd0152818161085c01528181610b3001528181610c8b0152610d7d015260006109640152600061111d0152600061116c01526000611147015260006110cb015260006110f40152611af86000f3fe608060405234801561001057600080fd5b506004361061018e5760003560e01c80634bf365df116100de578063a9059cbb11610097578063dd62ed3e11610071578063dd62ed3e1461037b578063ec5a4bdd146103b4578063f7dab517146103c7578063f85ca187146103db57600080fd5b8063a9059cbb14610340578063c91f2ef914610353578063d505accf1461036657600080fd5b80634bf365df146102ca57806370a08231146102d75780637ecebe001461030057806395d89b4114610313578063a07c7ce41461031b578063a457c2d71461032d57600080fd5b806323b872dd1161014b5780633950935111610125578063395093511461026a57806340c10f191461027d5780634162169f146102905780634779b82e146102b757600080fd5b806323b872dd14610240578063313ce567146102535780633644e5151461026257600080fd5b806306fdde03146101935780630881fa0d146101b1578063095ea7b3146101f057806315ba0e651461021357806318160ddd1461022657806322bec6b814610238575b600080fd5b61019b6103e3565b6040516101a89190611954565b60405180910390f35b6101d87f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020016101a8565b6102036101fe3660046117c1565b610475565b60405190151581526020016101a8565b6007546102039062010000900460ff1681565b6003545b6040519081526020016101a8565b61020361048b565b61020361024e366004611712565b6104f5565b604051601281526020016101a8565b61022a61059f565b6102036102783660046117c1565b6105ae565b61020361028b3660046117c1565b6105ea565b6101d87f000000000000000000000000000000000000000000000000000000000000000081565b6102036102c53660046117eb565b6106c0565b6007546102039060ff1681565b61022a6102e53660046116bd565b6001600160a01b031660009081526001602052604090205490565b61022a61030e3660046116bd565b61077a565b61019b61079a565b60075461020390610100900460ff1681565b61020361033b3660046117c1565b6107a9565b61020361034e3660046117c1565b610842565b6102036103613660046117eb565b61084f565b61037961037436600461174e565b610910565b005b61022a6103893660046116df565b6001600160a01b03918216600090815260026020908152604080832093909416825291909152205490565b6102036103c2366004611825565b610a74565b600754610203906301000000900460ff1681565b610203610d70565b6060600480546103f290611a50565b80601f016020809104026020016040519081016040528092919081815260200182805461041e90611a50565b801561046b5780601f106104405761010080835404028352916020019161046b565b820191906000526020600020905b81548152906001019060200180831161044e57829003601f168201915b5050505050905090565b6000610482338484610dd3565b50600192915050565b6000336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146104de5760405162461bcd60e51b81526004016104d5906119a9565b60405180910390fd5b506007805462ff0000191662010000179055600190565b6000610502848484610ef8565b6001600160a01b0384166000908152600260209081526040808320338452909152902054828110156105875760405162461bcd60e51b815260206004820152602860248201527f45524332303a207472616e7366657220616d6f756e74206578636565647320616044820152676c6c6f77616e636560c01b60648201526084016104d5565b6105948533858403610dd3565b506001949350505050565b60006105a96110c7565b905090565b3360008181526002602090815260408083206001600160a01b038716845290915281205490916104829185906105e59086906119e0565b610dd3565b6000336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146106645760405162461bcd60e51b815260206004820152601a60248201527f4c503a2063616c6c6572206973206e6f74207468652073686f7000000000000060448201526064016104d5565b60075460ff166106b65760405162461bcd60e51b815260206004820152601760248201527f4c503a206d696e74696e672069732064697361626c656400000000000000000060448201526064016104d5565b61048283836111ba565b6000336001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000161461070a5760405162461bcd60e51b81526004016104d5906119a9565b60075462010000900460ff16156107635760405162461bcd60e51b815260206004820152601c60248201527f4c503a206d696e74696e67207374617475732069732066726f7a656e0000000060448201526064016104d5565b506007805460ff191682151517905560015b919050565b6001600160a01b0381166000908152600660205260408120545b92915050565b6060600580546103f290611a50565b3360009081526002602090815260408083206001600160a01b03861684529091528120548281101561082b5760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f77604482015264207a65726f60d81b60648201526084016104d5565b6108383385858403610dd3565b5060019392505050565b6000610482338484610ef8565b6000336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146108995760405162461bcd60e51b81526004016104d5906119a9565b6007546301000000900460ff16156108f35760405162461bcd60e51b815260206004820152601d60248201527f4c503a206275726e61626c65207374617475732069732066726f7a656e00000060448201526064016104d5565b50600780548215156101000261ff00199091161790556001919050565b834211156109605760405162461bcd60e51b815260206004820152601d60248201527f45524332305065726d69743a206578706972656420646561646c696e6500000060448201526064016104d5565b60007f000000000000000000000000000000000000000000000000000000000000000088888861098f8c611299565b6040805160208101969096526001600160a01b0394851690860152929091166060840152608083015260a082015260c0810186905260e00160405160208183030381529060405280519060200120905060006109ea826112c1565b905060006109fa8287878761130f565b9050896001600160a01b0316816001600160a01b031614610a5d5760405162461bcd60e51b815260206004820152601e60248201527f45524332305065726d69743a20696e76616c6964207369676e6174757265000060448201526064016104d5565b610a688a8a8a610dd3565b50505050505050505050565b600060026000541415610ac95760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016104d5565b6002600055600754610100900460ff16610b255760405162461bcd60e51b815260206004820152601760248201527f4c503a206275726e696e672069732064697361626c656400000000000000000060448201526064016104d5565b336001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000161415610b965760405162461bcd60e51b815260206004820152601560248201527404c503a2044414f2063616e2774206275726e204c5605c1b60448201526064016104d5565b33600090815260016020526040902054851115610bf55760405162461bcd60e51b815260206004820152601860248201527f4c503a20696e73756666696369656e742062616c616e6365000000000000000060448201526064016104d5565b6000610c0060035490565b11610c3e5760405162461bcd60e51b815260206004820152600e60248201526d4c503a205a65726f20736861726560901b60448201526064016104d5565b6000610c4960035490565b610c5b87670de0b6b3a7640000611a1a565b610c6591906119f8565b9050610c7133876114b8565b604051637dd2731760e11b81526000906001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063fba4e62e90610cc890339086908b908b908b906004016118fb565b602060405180830381600087803b158015610ce257600080fd5b505af1158015610cf6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d1a9190611808565b905080610d5d5760405162461bcd60e51b815260206004820152601160248201527026281d10313ab93734b7339032b93937b960791b60448201526064016104d5565b6001925050506001600055949350505050565b6000336001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614610dba5760405162461bcd60e51b81526004016104d5906119a9565b506007805463ff00000019166301000000179055600190565b6001600160a01b038316610e355760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016104d5565b6001600160a01b038216610e965760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016104d5565b6001600160a01b0383811660008181526002602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591015b60405180910390a3505050565b6001600160a01b038316610f5c5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016104d5565b6001600160a01b038216610fbe5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016104d5565b6001600160a01b038316600090815260016020526040902054818110156110365760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e7420657863656564732062604482015265616c616e636560d01b60648201526084016104d5565b6001600160a01b0380851660009081526001602052604080822085850390559185168152908120805484929061106d9084906119e0565b92505081905550826001600160a01b0316846001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040516110b991815260200190565b60405180910390a350505050565b60007f000000000000000000000000000000000000000000000000000000000000000046141561111657507f000000000000000000000000000000000000000000000000000000000000000090565b50604080517f00000000000000000000000000000000000000000000000000000000000000006020808301919091527f0000000000000000000000000000000000000000000000000000000000000000828401527f000000000000000000000000000000000000000000000000000000000000000060608301524660808301523060a0808401919091528351808403909101815260c0909201909252805191012090565b6001600160a01b0382166112105760405162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f20616464726573730060448201526064016104d5565b806003600082825461122291906119e0565b90915550506001600160a01b0382166000908152600160205260408120805483929061124f9084906119e0565b90915550506040518181526001600160a01b038316906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9060200160405180910390a35050565b6001600160a01b03811660009081526006602052604090208054600181018255905b50919050565b60006107946112ce6110c7565b8360405161190160f01b6020820152602281018390526042810182905260009060620160405160208183030381529060405280519060200120905092915050565b60007f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a082111561138c5760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604482015261756560f01b60648201526084016104d5565b8360ff16601b14806113a157508360ff16601c145b6113f85760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202776272076616c604482015261756560f01b60648201526084016104d5565b6040805160008082526020820180845288905260ff871692820192909252606081018590526080810184905260019060a0016020604051602081039080840390855afa15801561144c573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b0381166114af5760405162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e6174757265000000000000000060448201526064016104d5565b95945050505050565b6001600160a01b0382166115185760405162461bcd60e51b815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f206164647265736044820152607360f81b60648201526084016104d5565b6001600160a01b0382166000908152600160205260409020548181101561158c5760405162461bcd60e51b815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e604482015261636560f01b60648201526084016104d5565b6001600160a01b03831660009081526001602052604081208383039055600380548492906115bb908490611a39565b90915550506040518281526000906001600160a01b038516907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef90602001610eeb565b80356001600160a01b038116811461077557600080fd5b600082601f83011261162657600080fd5b8135602067ffffffffffffffff8083111561164357611643611a9b565b8260051b604051601f19603f8301168101818110848211171561166857611668611a9b565b6040528481528381019250868401828801850189101561168757600080fd5b600092505b858310156116b15761169d816115fe565b84529284019260019290920191840161168c565b50979650505050505050565b6000602082840312156116cf57600080fd5b6116d8826115fe565b9392505050565b600080604083850312156116f257600080fd5b6116fb836115fe565b9150611709602084016115fe565b90509250929050565b60008060006060848603121561172757600080fd5b611730846115fe565b925061173e602085016115fe565b9150604084013590509250925092565b600080600080600080600060e0888a03121561176957600080fd5b611772886115fe565b9650611780602089016115fe565b95506040880135945060608801359350608088013560ff811681146117a457600080fd5b9699959850939692959460a0840135945060c09093013592915050565b600080604083850312156117d457600080fd5b6117dd836115fe565b946020939093013593505050565b6000602082840312156117fd57600080fd5b81356116d881611ab1565b60006020828403121561181a57600080fd5b81516116d881611ab1565b6000806000806080858703121561183b57600080fd5b84359350602085013567ffffffffffffffff8082111561185a57600080fd5b61186688838901611615565b9450604087013591508082111561187c57600080fd5b61188888838901611615565b9350606087013591508082111561189e57600080fd5b506118ab87828801611615565b91505092959194509250565b600081518084526020808501945080840160005b838110156118f05781516001600160a01b0316875295820195908201906001016118cb565b509495945050505050565b60018060a01b038616815284602082015260a06040820152600061192260a08301866118b7565b828103606084015261193481866118b7565b9050828103608084015261194881856118b7565b98975050505050505050565b600060208083528351808285015260005b8181101561198157858101830151858201604001528201611965565b81811115611993576000604083870101525b50601f01601f1916929092016040019392505050565b60208082526019908201527f4c503a2063616c6c6572206973206e6f74207468652064616f00000000000000604082015260600190565b600082198211156119f3576119f3611a85565b500190565b600082611a1557634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615611a3457611a34611a85565b500290565b600082821015611a4b57611a4b611a85565b500390565b600181811c90821680611a6457607f821691505b602082108114156112bb57634e487b7160e01b600052602260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b8015158114611abf57600080fd5b5056fea2646970667358221220102e4291f0f65221b4afd70ff306fd890d3bf16ceec1984d6e73599798b1901764736f6c63430008060033a26469706673582212209a5e973753c0c5292baf57a3349a55f51e3ad4dc2cd358ab71279d9cff87d10664736f6c63430008060033

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