APE Price: $0.58 (-12.69%)

Contract

0xdbF86AA91620b4283d8905fDaA89aEA84045BCb6

Overview

APE Balance

Apechain LogoApechain LogoApechain Logo0 APE

APE Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To

There are no matching entries

Please try again later

Parent Transaction Hash Block From To
View All Internal Transactions

Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
ApePredictV2

Compiler Version
v0.8.28+commit.7893614a

Optimization Enabled:
Yes with 200 runs

Other Settings:
paris EvmVersion
File 1 of 12 : ApePredictV2.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/security/Pausable.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@pythnetwork/pyth-sdk-solidity/IPyth.sol";
import "@pythnetwork/pyth-sdk-solidity/PythStructs.sol";

/**
 * @title ApePredict
 */
contract ApePredictV2 is Ownable, Pausable, ReentrancyGuard {
    using SafeERC20 for IERC20;

    IPyth public oracle;
    bytes32 public priceId; // Pyth price feed identifier

    bool public genesisLockOnce = false;
    bool public genesisStartOnce = false;

    address public adminAddress;
    address public operatorAddress;

    uint256 public bufferSeconds;
    uint256 public intervalSeconds;

    uint256 public minBetAmount;
    uint256 public treasuryFee;
    uint256 public treasuryAmount;

    uint256 public currentEpoch;

    uint256 public oracleLatestRoundId;
    uint256 public oracleUpdateAllowance;

    uint256 public constant MAX_TREASURY_FEE = 1000; // 10%

    mapping(uint256 => mapping(address => BetInfo)) public ledger;
    mapping(uint256 => Round) public rounds;
    mapping(address => uint256[]) public userRounds;

    enum Position {
        Bull,
        Bear
    }

    struct Round {
        uint256 epoch;
        uint256 startTimestamp;
        uint256 lockTimestamp;
        uint256 closeTimestamp;
        int256 lockPrice;
        int256 closePrice;
        uint256 lockOracleId;
        uint256 closeOracleId;
        uint256 totalAmount;
        uint256 bullAmount;
        uint256 bearAmount;
        uint256 rewardBaseCalAmount;
        uint256 rewardAmount;
        bool oracleCalled;
    }

    struct BetInfo {
        Position position;
        uint256 amount;
        bool claimed;
    }

    event BetBear(address indexed sender, uint256 indexed epoch, uint256 amount);
    event BetBull(address indexed sender, uint256 indexed epoch, uint256 amount);
    event Claim(address indexed sender, uint256 indexed epoch, uint256 amount);
    event EndRound(uint256 indexed epoch, uint256 indexed roundId, int256 price);
    event LockRound(uint256 indexed epoch, uint256 indexed roundId, int256 price);
    event NewAdminAddress(address admin);
    event NewBufferAndIntervalSeconds(uint256 bufferSeconds, uint256 intervalSeconds);
    event NewMinBetAmount(uint256 indexed epoch, uint256 minBetAmount);
    event NewTreasuryFee(uint256 indexed epoch, uint256 treasuryFee);
    event NewOperatorAddress(address operator);
    event NewOracle(address oracle, bytes32 priceId);
    event NewOracleUpdateAllowance(uint256 oracleUpdateAllowance);
    event Pause(uint256 indexed epoch);
    event RewardsCalculated(
        uint256 indexed epoch,
        uint256 rewardBaseCalAmount,
        uint256 rewardAmount,
        uint256 treasuryAmount
    );
    event StartRound(uint256 indexed epoch);
    event TokenRecovery(address indexed token, uint256 amount);
    event TreasuryClaim(uint256 amount);
    event Unpause(uint256 indexed epoch);

    modifier onlyAdmin() {
        require(msg.sender == adminAddress, "Not admin");
        _;
    }

    modifier onlyAdminOrOperator() {
        require(msg.sender == adminAddress || msg.sender == operatorAddress, "Not operator/admin");
        _;
    }

    modifier onlyOperator() {
        require(msg.sender == operatorAddress, "Not operator");
        _;
    }

    modifier notContract() {
        require(!_isContract(msg.sender), "Contract not allowed");
        require(msg.sender == tx.origin, "Proxy contract not allowed");
        _;
    }

    constructor(
        address _oracleAddress,
        bytes32 _priceId,
        address _adminAddress,
        address _operatorAddress,
        uint256 _intervalSeconds,
        uint256 _bufferSeconds,
        uint256 _minBetAmount,
        uint256 _oracleUpdateAllowance,
        uint256 _treasuryFee
    ) {
        require(_treasuryFee <= MAX_TREASURY_FEE, "Treasury fee too high");

        oracle = IPyth(_oracleAddress);
        priceId = _priceId;
        adminAddress = _adminAddress;
        operatorAddress = _operatorAddress;
        intervalSeconds = _intervalSeconds;
        bufferSeconds = _bufferSeconds;
        minBetAmount = _minBetAmount;
        oracleUpdateAllowance = _oracleUpdateAllowance;
        treasuryFee = _treasuryFee;
    }

    function betBear(uint256 epoch) external payable whenNotPaused nonReentrant notContract {
        require(epoch == currentEpoch, "Bet is too early/late");
        require(_bettable(epoch), "Round not bettable");
        require(msg.value >= minBetAmount, "Bet amount must be greater than minBetAmount");
        require(ledger[epoch][msg.sender].amount == 0, "Can only bet once per round");

        uint256 amount = msg.value;
        Round storage round = rounds[epoch];
        round.totalAmount = round.totalAmount + amount;
        round.bearAmount = round.bearAmount + amount;

        BetInfo storage betInfo = ledger[epoch][msg.sender];
        betInfo.position = Position.Bear;
        betInfo.amount = amount;
        userRounds[msg.sender].push(epoch);

        emit BetBear(msg.sender, epoch, amount);
    }

    function betBull(uint256 epoch) external payable whenNotPaused nonReentrant notContract {
        require(epoch == currentEpoch, "Bet is too early/late");
        require(_bettable(epoch), "Round not bettable");
        require(msg.value >= minBetAmount, "Bet amount must be greater than minBetAmount");
        require(ledger[epoch][msg.sender].amount == 0, "Can only bet once per round");

        uint256 amount = msg.value;
        Round storage round = rounds[epoch];
        round.totalAmount = round.totalAmount + amount;
        round.bullAmount = round.bullAmount + amount;

        BetInfo storage betInfo = ledger[epoch][msg.sender];
        betInfo.position = Position.Bull;
        betInfo.amount = amount;
        userRounds[msg.sender].push(epoch);

        emit BetBull(msg.sender, epoch, amount);
    }

    function claim(uint256[] calldata epochs) external nonReentrant notContract {
        uint256 reward; // Initializes reward

        for (uint256 i = 0; i < epochs.length; i++) {
            require(rounds[epochs[i]].startTimestamp != 0, "Round has not started");
            require(block.timestamp > rounds[epochs[i]].closeTimestamp, "Round has not ended");

            uint256 addedReward = 0;

            // Round valid, claim rewards
            if (rounds[epochs[i]].oracleCalled) {
                require(claimable(epochs[i], msg.sender), "Not eligible for claim");
                Round memory round = rounds[epochs[i]];
                addedReward = (ledger[epochs[i]][msg.sender].amount * round.rewardAmount) / round.rewardBaseCalAmount;
            }
            // Round invalid, refund bet amount
            else {
                require(refundable(epochs[i], msg.sender), "Not eligible for refund");
                addedReward = ledger[epochs[i]][msg.sender].amount;
            }

            ledger[epochs[i]][msg.sender].claimed = true;
            reward += addedReward;

            emit Claim(msg.sender, epochs[i], addedReward);
        }

        if (reward > 0) {
            _safeTransferBNB(address(msg.sender), reward);
        }
    }

    function executeRound() external whenNotPaused onlyOperator {
        require(
            genesisStartOnce && genesisLockOnce,
            "Can only run after genesisStartRound and genesisLockRound is triggered"
        );

        (uint80 currentRoundId, int256 currentPrice) = _getPriceFromOracle();

        oracleLatestRoundId = uint256(currentRoundId);

        // CurrentEpoch refers to previous round (n-1)
        _safeLockRound(currentEpoch, currentRoundId, currentPrice);
        _safeEndRound(currentEpoch - 1, currentRoundId, currentPrice);
        _calculateRewards(currentEpoch - 1);

        // Increment currentEpoch to current round (n)
        currentEpoch = currentEpoch + 1;
        _safeStartRound(currentEpoch);
    }

    function getCurrentPrice() external view returns (uint80, int256) {
          (uint80 currentRoundId, int256 currentPrice) = _getPriceFromOracle();
          return (currentRoundId, currentPrice);
    }

    function genesisLockRound() external whenNotPaused onlyOperator {
        require(genesisStartOnce, "Can only run after genesisStartRound is triggered");
        require(!genesisLockOnce, "Can only run genesisLockRound once");

        (uint80 currentRoundId, int256 currentPrice) = _getPriceFromOracle();

        oracleLatestRoundId = uint256(currentRoundId);

        _safeLockRound(currentEpoch, currentRoundId, currentPrice);

        currentEpoch = currentEpoch + 1;
        _startRound(currentEpoch);
        genesisLockOnce = true;
    }

    function genesisStartRound() external whenNotPaused onlyOperator {
        require(!genesisStartOnce, "Can only run genesisStartRound once");

        currentEpoch = currentEpoch + 1;
        _startRound(currentEpoch);
        genesisStartOnce = true;
    }

    function pause() external whenNotPaused onlyAdminOrOperator {
        _pause();

        emit Pause(currentEpoch);
    }

    function unpause() external whenPaused onlyAdminOrOperator {
        genesisStartOnce = false;
        genesisLockOnce = false;
        _unpause();

        emit Unpause(currentEpoch);
    }

    function claimTreasury() external nonReentrant onlyAdmin {
        uint256 currentTreasuryAmount = treasuryAmount;
        treasuryAmount = 0;
        _safeTransferBNB(adminAddress, currentTreasuryAmount);

        emit TreasuryClaim(currentTreasuryAmount);
    }

    function setBufferAndIntervalSeconds(uint256 _bufferSeconds, uint256 _intervalSeconds)
        external
        whenPaused
        onlyAdmin
    {
        require(_bufferSeconds < _intervalSeconds, "bufferSeconds must be inferior to intervalSeconds");
        bufferSeconds = _bufferSeconds;
        intervalSeconds = _intervalSeconds;

        emit NewBufferAndIntervalSeconds(_bufferSeconds, _intervalSeconds);
    }

    function setMinBetAmount(uint256 _minBetAmount) external whenPaused onlyAdmin {
        require(_minBetAmount != 0, "Must be superior to 0");
        minBetAmount = _minBetAmount;

        emit NewMinBetAmount(currentEpoch, minBetAmount);
    }

    function setOperator(address _operatorAddress) external onlyAdmin {
        require(_operatorAddress != address(0), "Cannot be zero address");
        operatorAddress = _operatorAddress;

        emit NewOperatorAddress(_operatorAddress);
    }

    function setOracle(address _oracle, bytes32 _priceId) external whenPaused onlyAdmin {
        require(_oracle != address(0), "Cannot be zero address");
        oracle = IPyth(_oracle);
        priceId = _priceId;
        oracleLatestRoundId = 0;

        // Dummy check to make sure the interface works
        oracle.getPrice(priceId);

        emit NewOracle(_oracle, _priceId);
    }

    function setOracleUpdateAllowance(uint256 _oracleUpdateAllowance) external whenPaused onlyAdmin {
        oracleUpdateAllowance = _oracleUpdateAllowance;

        emit NewOracleUpdateAllowance(_oracleUpdateAllowance);
    }

    function setTreasuryFee(uint256 _treasuryFee) external whenPaused onlyAdmin {
        require(_treasuryFee <= MAX_TREASURY_FEE, "Treasury fee too high");
        treasuryFee = _treasuryFee;

        emit NewTreasuryFee(currentEpoch, treasuryFee);
    }

    function recoverToken(address _token, uint256 _amount) external onlyOwner {
        IERC20(_token).safeTransfer(address(msg.sender), _amount);

        emit TokenRecovery(_token, _amount);
    }

    function setAdmin(address _adminAddress) external onlyOwner {
        require(_adminAddress != address(0), "Cannot be zero address");
        adminAddress = _adminAddress;

        emit NewAdminAddress(_adminAddress);
    }

    function getUserRounds(
        address user,
        uint256 cursor,
        uint256 size
    )
        external
        view
        returns (
            uint256[] memory,
            BetInfo[] memory,
            uint256
        )
    {
        uint256 length = size;

        if (length > userRounds[user].length - cursor) {
            length = userRounds[user].length - cursor;
        }

        uint256[] memory values = new uint256[](length);
        BetInfo[] memory betInfo = new BetInfo[](length);

        for (uint256 i = 0; i < length; i++) {
            values[i] = userRounds[user][cursor + i];
            betInfo[i] = ledger[values[i]][user];
        }

        return (values, betInfo, cursor + length);
    }

    function getUserRoundsLength(address user) external view returns (uint256) {
        return userRounds[user].length;
    }

    function claimable(uint256 epoch, address user) public view returns (bool) {
        BetInfo memory betInfo = ledger[epoch][user];
        Round memory round = rounds[epoch];
        if (round.lockPrice == round.closePrice) {
            return false;
        }
        return
            round.oracleCalled &&
            betInfo.amount != 0 &&
            !betInfo.claimed &&
            ((round.closePrice > round.lockPrice && betInfo.position == Position.Bull) ||
                (round.closePrice < round.lockPrice && betInfo.position == Position.Bear));
    }

    function refundable(uint256 epoch, address user) public view returns (bool) {
        BetInfo memory betInfo = ledger[epoch][user];
        Round memory round = rounds[epoch];
        return
            !round.oracleCalled &&
            !betInfo.claimed &&
            block.timestamp > round.closeTimestamp + bufferSeconds &&
            betInfo.amount != 0;
    }

    function _calculateRewards(uint256 epoch) internal {
        require(rounds[epoch].rewardBaseCalAmount == 0 && rounds[epoch].rewardAmount == 0, "Rewards calculated");
        Round storage round = rounds[epoch];
        uint256 rewardBaseCalAmount;
        uint256 treasuryAmt;
        uint256 rewardAmount;

        // Bull wins
        if (round.closePrice > round.lockPrice) {
            rewardBaseCalAmount = round.bullAmount;
            treasuryAmt = (round.totalAmount * treasuryFee) / 10000;
            rewardAmount = round.totalAmount - treasuryAmt;
        }
        // Bear wins
        else if (round.closePrice < round.lockPrice) {
            rewardBaseCalAmount = round.bearAmount;
            treasuryAmt = (round.totalAmount * treasuryFee) / 10000;
            rewardAmount = round.totalAmount - treasuryAmt;
        }
        // House wins
        else {
            rewardBaseCalAmount = 0;
            rewardAmount = 0;
            treasuryAmt = round.totalAmount;
        }
        round.rewardBaseCalAmount = rewardBaseCalAmount;
        round.rewardAmount = rewardAmount;

        // Add to treasury
        treasuryAmount += treasuryAmt;

        emit RewardsCalculated(epoch, rewardBaseCalAmount, rewardAmount, treasuryAmt);
    }

    function _safeEndRound(
        uint256 epoch,
        uint256 roundId,
        int256 price
    ) internal {
        require(rounds[epoch].lockTimestamp != 0, "Can only end round after round has locked");
        require(block.timestamp >= rounds[epoch].closeTimestamp, "Can only end round after closeTimestamp");
        require(
            block.timestamp <= rounds[epoch].closeTimestamp + bufferSeconds,
            "Can only end round within bufferSeconds"
        );
        Round storage round = rounds[epoch];
        round.closePrice = price;
        round.closeOracleId = roundId;
        round.oracleCalled = true;

        emit EndRound(epoch, roundId, round.closePrice);
    }

    function _safeLockRound(
        uint256 epoch,
        uint256 roundId,
        int256 price
    ) internal {
        require(rounds[epoch].startTimestamp != 0, "Can only lock round after round has started");
        require(block.timestamp >= rounds[epoch].lockTimestamp, "Can only lock round after lockTimestamp");
        require(
            block.timestamp <= rounds[epoch].lockTimestamp + bufferSeconds,
            "Can only lock round within bufferSeconds"
        );
        Round storage round = rounds[epoch];
        round.closeTimestamp = block.timestamp + intervalSeconds;
        round.lockPrice = price;
        round.lockOracleId = roundId;

        emit LockRound(epoch, roundId, round.lockPrice);
    }

    function _safeStartRound(uint256 epoch) internal {
        require(genesisStartOnce, "Can only run after genesisStartRound is triggered");
        require(rounds[epoch - 2].closeTimestamp != 0, "Can only start round after round n-2 has ended");
        require(
            block.timestamp >= rounds[epoch - 2].closeTimestamp,
            "Can only start new round after round n-2 closeTimestamp"
        );
        _startRound(epoch);
    }

    function _safeTransferBNB(address to, uint256 value) internal {
        (bool success, ) = to.call{value: value}("");
        require(success, "TransferHelper: BNB_TRANSFER_FAILED");
    }

    function _startRound(uint256 epoch) internal {
        Round storage round = rounds[epoch];
        round.startTimestamp = block.timestamp;
        round.lockTimestamp = block.timestamp + intervalSeconds;
        round.closeTimestamp = block.timestamp + (2 * intervalSeconds);
        round.epoch = epoch;
        round.totalAmount = 0;

        emit StartRound(epoch);
    }

    function _bettable(uint256 epoch) internal view returns (bool) {
        return
            rounds[epoch].startTimestamp != 0 &&
            rounds[epoch].lockTimestamp != 0 &&
            block.timestamp > rounds[epoch].startTimestamp &&
            block.timestamp < rounds[epoch].lockTimestamp;
    }

    function _getPriceFromOracle() internal view returns (uint80, int256) {
        PythStructs.Price memory price = oracle.getPriceNoOlderThan(
            priceId,
            oracleUpdateAllowance
        );
        
        // Check price is not from the future
        require(
            uint256(price.publishTime) <= block.timestamp,
            "Oracle price timestamp is from the future"
        );
        
        require(
            uint256(price.publishTime) > oracleLatestRoundId,
            "Oracle update roundId must be larger than oracleLatestRoundId"
        );
        
        return (uint80(price.publishTime), price.price);
    }

    function _isContract(address account) internal view returns (bool) {
        uint256 size;
        assembly {
            size := extcodesize(account)
        }
        return size > 0;
    }
}

File 2 of 12 : Ownable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.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. Can only be called by the current owner.
     *
     * NOTE: Renouncing ownership will leave the contract without an owner,
     * thereby disabling any functionality that is only available to the owner.
     */
    function renounceOwnership() public virtual onlyOwner {
        _transferOwnership(address(0));
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Can only be called by the current owner.
     */
    function transferOwnership(address newOwner) public virtual onlyOwner {
        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 3 of 12 : Pausable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (security/Pausable.sol)

pragma solidity ^0.8.0;

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

/**
 * @dev Contract module which allows children to implement an emergency stop
 * mechanism that can be triggered by an authorized account.
 *
 * This module is used through inheritance. It will make available the
 * modifiers `whenNotPaused` and `whenPaused`, which can be applied to
 * the functions of your contract. Note that they will not be pausable by
 * simply including this module, only once the modifiers are put in place.
 */
abstract contract Pausable is Context {
    /**
     * @dev Emitted when the pause is triggered by `account`.
     */
    event Paused(address account);

    /**
     * @dev Emitted when the pause is lifted by `account`.
     */
    event Unpaused(address account);

    bool private _paused;

    /**
     * @dev Initializes the contract in unpaused state.
     */
    constructor() {
        _paused = false;
    }

    /**
     * @dev Modifier to make a function callable only when the contract is not paused.
     *
     * Requirements:
     *
     * - The contract must not be paused.
     */
    modifier whenNotPaused() {
        _requireNotPaused();
        _;
    }

    /**
     * @dev Modifier to make a function callable only when the contract is paused.
     *
     * Requirements:
     *
     * - The contract must be paused.
     */
    modifier whenPaused() {
        _requirePaused();
        _;
    }

    /**
     * @dev Returns true if the contract is paused, and false otherwise.
     */
    function paused() public view virtual returns (bool) {
        return _paused;
    }

    /**
     * @dev Throws if the contract is paused.
     */
    function _requireNotPaused() internal view virtual {
        require(!paused(), "Pausable: paused");
    }

    /**
     * @dev Throws if the contract is not paused.
     */
    function _requirePaused() internal view virtual {
        require(paused(), "Pausable: not paused");
    }

    /**
     * @dev Triggers stopped state.
     *
     * Requirements:
     *
     * - The contract must not be paused.
     */
    function _pause() internal virtual whenNotPaused {
        _paused = true;
        emit Paused(_msgSender());
    }

    /**
     * @dev Returns to normal state.
     *
     * Requirements:
     *
     * - The contract must be paused.
     */
    function _unpause() internal virtual whenPaused {
        _paused = false;
        emit Unpaused(_msgSender());
    }
}

File 4 of 12 : ReentrancyGuard.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (security/ReentrancyGuard.sol)

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 making it call a
     * `private` function that does the actual work.
     */
    modifier nonReentrant() {
        _nonReentrantBefore();
        _;
        _nonReentrantAfter();
    }

    function _nonReentrantBefore() private {
        // On the first call to nonReentrant, _status will be _NOT_ENTERED
        require(_status != _ENTERED, "ReentrancyGuard: reentrant call");

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

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

    /**
     * @dev Returns true if the reentrancy guard is currently set to "entered", which indicates there is a
     * `nonReentrant` function in the call stack.
     */
    function _reentrancyGuardEntered() internal view returns (bool) {
        return _status == _ENTERED;
    }
}

File 5 of 12 : IERC20Permit.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.4) (token/ERC20/extensions/IERC20Permit.sol)

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.
 *
 * ==== Security Considerations
 *
 * There are two important considerations concerning the use of `permit`. The first is that a valid permit signature
 * expresses an allowance, and it should not be assumed to convey additional meaning. In particular, it should not be
 * considered as an intention to spend the allowance in any specific way. The second is that because permits have
 * built-in replay protection and can be submitted by anyone, they can be frontrun. A protocol that uses permits should
 * take this into consideration and allow a `permit` call to fail. Combining these two aspects, a pattern that may be
 * generally recommended is:
 *
 * ```solidity
 * function doThingWithPermit(..., uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) public {
 *     try token.permit(msg.sender, address(this), value, deadline, v, r, s) {} catch {}
 *     doThing(..., value);
 * }
 *
 * function doThing(..., uint256 value) public {
 *     token.safeTransferFrom(msg.sender, address(this), value);
 *     ...
 * }
 * ```
 *
 * Observe that: 1) `msg.sender` is used as the owner, leaving no ambiguity as to the signer intent, and 2) the use of
 * `try/catch` allows the permit to fail and makes the code tolerant to frontrunning. (See also
 * {SafeERC20-safeTransferFrom}).
 *
 * Additionally, note that smart contract wallets (such as Argent or Safe) are not able to produce permit signatures, so
 * contracts should have entry points that don't rely on permit.
 */
interface IERC20Permit {
    /**
     * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,
     * given ``owner``'s signed approval.
     *
     * IMPORTANT: The same issues {IERC20-approve} has related to transaction
     * ordering also apply here.
     *
     * Emits an {Approval} event.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     * - `deadline` must be a timestamp in the future.
     * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`
     * over the EIP712-formatted function arguments.
     * - the signature must use ``owner``'s current nonce (see {nonces}).
     *
     * For more information on the signature format, see the
     * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP
     * section].
     *
     * CAUTION: See Security Considerations above.
     */
    function permit(
        address owner,
        address spender,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) external;

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

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

File 6 of 12 : IERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.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 7 of 12 : SafeERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.3) (token/ERC20/utils/SafeERC20.sol)

pragma solidity ^0.8.0;

import "../IERC20.sol";
import "../extensions/IERC20Permit.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;

    /**
     * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,
     * non-reverting calls are assumed to be successful.
     */
    function safeTransfer(IERC20 token, address to, uint256 value) internal {
        _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
    }

    /**
     * @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the
     * calling contract. If `token` returns no value, non-reverting calls are assumed to be successful.
     */
    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));
    }

    /**
     * @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value,
     * non-reverting calls are assumed to be successful.
     */
    function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {
        uint256 oldAllowance = token.allowance(address(this), spender);
        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance + value));
    }

    /**
     * @dev Decrease the calling contract's allowance toward `spender` by `value`. If `token` returns no value,
     * non-reverting calls are assumed to be successful.
     */
    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");
            _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance - value));
        }
    }

    /**
     * @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value,
     * non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval
     * to be set to zero before setting it to a non-zero value, such as USDT.
     */
    function forceApprove(IERC20 token, address spender, uint256 value) internal {
        bytes memory approvalCall = abi.encodeWithSelector(token.approve.selector, spender, value);

        if (!_callOptionalReturnBool(token, approvalCall)) {
            _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, 0));
            _callOptionalReturn(token, approvalCall);
        }
    }

    /**
     * @dev Use a ERC-2612 signature to set the `owner` approval toward `spender` on `token`.
     * Revert on invalid signature.
     */
    function safePermit(
        IERC20Permit token,
        address owner,
        address spender,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) internal {
        uint256 nonceBefore = token.nonces(owner);
        token.permit(owner, spender, value, deadline, v, r, s);
        uint256 nonceAfter = token.nonces(owner);
        require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed");
    }

    /**
     * @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");
        require(returndata.length == 0 || abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
    }

    /**
     * @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).
     *
     * This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead.
     */
    function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {
        // 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 cannot use {Address-functionCall} here since this should return false
        // and not revert is the subcall reverts.

        (bool success, bytes memory returndata) = address(token).call(data);
        return
            success && (returndata.length == 0 || abi.decode(returndata, (bool))) && Address.isContract(address(token));
    }
}

File 8 of 12 : Address.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol)

pragma solidity ^0.8.1;

/**
 * @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
     *
     * Furthermore, `isContract` will also return true if the target contract within
     * the same transaction is already scheduled for destruction by `SELFDESTRUCT`,
     * which only has an effect at the end of a transaction.
     * ====
     *
     * [IMPORTANT]
     * ====
     * You shouldn't rely on `isContract` to protect against flash loan attacks!
     *
     * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets
     * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract
     * constructor.
     * ====
     */
    function isContract(address account) internal view returns (bool) {
        // This method relies on extcodesize/address.code.length, which returns 0
        // for contracts in construction, since the code is only stored at the end
        // of the constructor execution.

        return account.code.length > 0;
    }

    /**
     * @dev Replacement for Solidity's `transfer`: sends `amount` wei to
     * `recipient`, forwarding all available gas and reverting on errors.
     *
     * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
     * of certain opcodes, possibly making contracts go over the 2300 gas limit
     * imposed by `transfer`, making them unable to receive funds via
     * `transfer`. {sendValue} removes this limitation.
     *
     * https://consensys.net/diligence/blog/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.8.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
     */
    function sendValue(address payable recipient, uint256 amount) internal {
        require(address(this).balance >= amount, "Address: insufficient balance");

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

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

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

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

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

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

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
     * but performing a static call.
     *
     * _Available since v3.3._
     */
    function functionStaticCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal view returns (bytes memory) {
        (bool success, bytes memory returndata) = target.staticcall(data);
        return verifyCallResultFromTarget(target, success, returndata, errorMessage);
    }

    /**
     * @dev 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) {
        (bool success, bytes memory returndata) = target.delegatecall(data);
        return verifyCallResultFromTarget(target, success, returndata, errorMessage);
    }

    /**
     * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling
     * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.
     *
     * _Available since v4.8._
     */
    function verifyCallResultFromTarget(
        address target,
        bool success,
        bytes memory returndata,
        string memory errorMessage
    ) internal view returns (bytes memory) {
        if (success) {
            if (returndata.length == 0) {
                // only check isContract if the call was successful and the return data is empty
                // otherwise we already know that it was a contract
                require(isContract(target), "Address: call to non-contract");
            }
            return returndata;
        } else {
            _revert(returndata, errorMessage);
        }
    }

    /**
     * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the
     * revert reason or using the provided one.
     *
     * _Available since v4.3._
     */
    function verifyCallResult(
        bool success,
        bytes memory returndata,
        string memory errorMessage
    ) internal pure returns (bytes memory) {
        if (success) {
            return returndata;
        } else {
            _revert(returndata, errorMessage);
        }
    }

    function _revert(bytes memory returndata, string memory errorMessage) private pure {
        // Look for revert reason and bubble it up if present
        if (returndata.length > 0) {
            // The easiest way to bubble the revert reason is using memory via assembly
            /// @solidity memory-safe-assembly
            assembly {
                let returndata_size := mload(returndata)
                revert(add(32, returndata), returndata_size)
            }
        } else {
            revert(errorMessage);
        }
    }
}

File 9 of 12 : Context.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.4) (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;
    }

    function _contextSuffixLength() internal view virtual returns (uint256) {
        return 0;
    }
}

File 10 of 12 : IPyth.sol
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.0;

import "./PythStructs.sol";
import "./IPythEvents.sol";

/// @title Consume prices from the Pyth Network (https://pyth.network/).
/// @dev Please refer to the guidance at https://docs.pyth.network/documentation/pythnet-price-feeds/best-practices for how to consume prices safely.
/// @author Pyth Data Association
interface IPyth is IPythEvents {
    /// @notice Returns the period (in seconds) that a price feed is considered valid since its publish time
    function getValidTimePeriod() external view returns (uint validTimePeriod);

    /// @notice Returns the price and confidence interval.
    /// @dev Reverts if the price has not been updated within the last `getValidTimePeriod()` seconds.
    /// @param id The Pyth Price Feed ID of which to fetch the price and confidence interval.
    /// @return price - please read the documentation of PythStructs.Price to understand how to use this safely.
    function getPrice(
        bytes32 id
    ) external view returns (PythStructs.Price memory price);

    /// @notice Returns the exponentially-weighted moving average price and confidence interval.
    /// @dev Reverts if the EMA price is not available.
    /// @param id The Pyth Price Feed ID of which to fetch the EMA price and confidence interval.
    /// @return price - please read the documentation of PythStructs.Price to understand how to use this safely.
    function getEmaPrice(
        bytes32 id
    ) external view returns (PythStructs.Price memory price);

    /// @notice Returns the price of a price feed without any sanity checks.
    /// @dev This function returns the most recent price update in this contract without any recency checks.
    /// This function is unsafe as the returned price update may be arbitrarily far in the past.
    ///
    /// Users of this function should check the `publishTime` in the price to ensure that the returned price is
    /// sufficiently recent for their application. If you are considering using this function, it may be
    /// safer / easier to use either `getPrice` or `getPriceNoOlderThan`.
    /// @return price - please read the documentation of PythStructs.Price to understand how to use this safely.
    function getPriceUnsafe(
        bytes32 id
    ) external view returns (PythStructs.Price memory price);

    /// @notice Returns the price that is no older than `age` seconds of the current time.
    /// @dev This function is a sanity-checked version of `getPriceUnsafe` which is useful in
    /// applications that require a sufficiently-recent price. Reverts if the price wasn't updated sufficiently
    /// recently.
    /// @return price - please read the documentation of PythStructs.Price to understand how to use this safely.
    function getPriceNoOlderThan(
        bytes32 id,
        uint age
    ) external view returns (PythStructs.Price memory price);

    /// @notice Returns the exponentially-weighted moving average price of a price feed without any sanity checks.
    /// @dev This function returns the same price as `getEmaPrice` in the case where the price is available.
    /// However, if the price is not recent this function returns the latest available price.
    ///
    /// The returned price can be from arbitrarily far in the past; this function makes no guarantees that
    /// the returned price is recent or useful for any particular application.
    ///
    /// Users of this function should check the `publishTime` in the price to ensure that the returned price is
    /// sufficiently recent for their application. If you are considering using this function, it may be
    /// safer / easier to use either `getEmaPrice` or `getEmaPriceNoOlderThan`.
    /// @return price - please read the documentation of PythStructs.Price to understand how to use this safely.
    function getEmaPriceUnsafe(
        bytes32 id
    ) external view returns (PythStructs.Price memory price);

    /// @notice Returns the exponentially-weighted moving average price that is no older than `age` seconds
    /// of the current time.
    /// @dev This function is a sanity-checked version of `getEmaPriceUnsafe` which is useful in
    /// applications that require a sufficiently-recent price. Reverts if the price wasn't updated sufficiently
    /// recently.
    /// @return price - please read the documentation of PythStructs.Price to understand how to use this safely.
    function getEmaPriceNoOlderThan(
        bytes32 id,
        uint age
    ) external view returns (PythStructs.Price memory price);

    /// @notice Update price feeds with given update messages.
    /// This method requires the caller to pay a fee in wei; the required fee can be computed by calling
    /// `getUpdateFee` with the length of the `updateData` array.
    /// Prices will be updated if they are more recent than the current stored prices.
    /// The call will succeed even if the update is not the most recent.
    /// @dev Reverts if the transferred fee is not sufficient or the updateData is invalid.
    /// @param updateData Array of price update data.
    function updatePriceFeeds(bytes[] calldata updateData) external payable;

    /// @notice Wrapper around updatePriceFeeds that rejects fast if a price update is not necessary. A price update is
    /// necessary if the current on-chain publishTime is older than the given publishTime. It relies solely on the
    /// given `publishTimes` for the price feeds and does not read the actual price update publish time within `updateData`.
    ///
    /// This method requires the caller to pay a fee in wei; the required fee can be computed by calling
    /// `getUpdateFee` with the length of the `updateData` array.
    ///
    /// `priceIds` and `publishTimes` are two arrays with the same size that correspond to senders known publishTime
    /// of each priceId when calling this method. If all of price feeds within `priceIds` have updated and have
    /// a newer or equal publish time than the given publish time, it will reject the transaction to save gas.
    /// Otherwise, it calls updatePriceFeeds method to update the prices.
    ///
    /// @dev Reverts if update is not needed or the transferred fee is not sufficient or the updateData is invalid.
    /// @param updateData Array of price update data.
    /// @param priceIds Array of price ids.
    /// @param publishTimes Array of publishTimes. `publishTimes[i]` corresponds to known `publishTime` of `priceIds[i]`
    function updatePriceFeedsIfNecessary(
        bytes[] calldata updateData,
        bytes32[] calldata priceIds,
        uint64[] calldata publishTimes
    ) external payable;

    /// @notice Returns the required fee to update an array of price updates.
    /// @param updateData Array of price update data.
    /// @return feeAmount The required fee in Wei.
    function getUpdateFee(
        bytes[] calldata updateData
    ) external view returns (uint feeAmount);

    /// @notice Parse `updateData` and return price feeds of the given `priceIds` if they are all published
    /// within `minPublishTime` and `maxPublishTime`.
    ///
    /// You can use this method if you want to use a Pyth price at a fixed time and not the most recent price;
    /// otherwise, please consider using `updatePriceFeeds`. This method may store the price updates on-chain, if they
    /// are more recent than the current stored prices.
    ///
    /// This method requires the caller to pay a fee in wei; the required fee can be computed by calling
    /// `getUpdateFee` with the length of the `updateData` array.
    ///
    ///
    /// @dev Reverts if the transferred fee is not sufficient or the updateData is invalid or there is
    /// no update for any of the given `priceIds` within the given time range.
    /// @param updateData Array of price update data.
    /// @param priceIds Array of price ids.
    /// @param minPublishTime minimum acceptable publishTime for the given `priceIds`.
    /// @param maxPublishTime maximum acceptable publishTime for the given `priceIds`.
    /// @return priceFeeds Array of the price feeds corresponding to the given `priceIds` (with the same order).
    function parsePriceFeedUpdates(
        bytes[] calldata updateData,
        bytes32[] calldata priceIds,
        uint64 minPublishTime,
        uint64 maxPublishTime
    ) external payable returns (PythStructs.PriceFeed[] memory priceFeeds);

    /// @notice Similar to `parsePriceFeedUpdates` but ensures the updates returned are
    /// the first updates published in minPublishTime. That is, if there are multiple updates for a given timestamp,
    /// this method will return the first update. This method may store the price updates on-chain, if they
    /// are more recent than the current stored prices.
    ///
    ///
    /// @dev Reverts if the transferred fee is not sufficient or the updateData is invalid or there is
    /// no update for any of the given `priceIds` within the given time range and uniqueness condition.
    /// @param updateData Array of price update data.
    /// @param priceIds Array of price ids.
    /// @param minPublishTime minimum acceptable publishTime for the given `priceIds`.
    /// @param maxPublishTime maximum acceptable publishTime for the given `priceIds`.
    /// @return priceFeeds Array of the price feeds corresponding to the given `priceIds` (with the same order).
    function parsePriceFeedUpdatesUnique(
        bytes[] calldata updateData,
        bytes32[] calldata priceIds,
        uint64 minPublishTime,
        uint64 maxPublishTime
    ) external payable returns (PythStructs.PriceFeed[] memory priceFeeds);
}

File 11 of 12 : IPythEvents.sol
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.0;

/// @title IPythEvents contains the events that Pyth contract emits.
/// @dev This interface can be used for listening to the updates for off-chain and testing purposes.
interface IPythEvents {
    /// @dev Emitted when the price feed with `id` has received a fresh update.
    /// @param id The Pyth Price Feed ID.
    /// @param publishTime Publish time of the given price update.
    /// @param price Price of the given price update.
    /// @param conf Confidence interval of the given price update.
    event PriceFeedUpdate(
        bytes32 indexed id,
        uint64 publishTime,
        int64 price,
        uint64 conf
    );

    /// @dev Emitted when a batch price update is processed successfully.
    /// @param chainId ID of the source chain that the batch price update comes from.
    /// @param sequenceNumber Sequence number of the batch price update.
    event BatchPriceFeedUpdate(uint16 chainId, uint64 sequenceNumber);
}

File 12 of 12 : PythStructs.sol
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.0;

contract PythStructs {
    // A price with a degree of uncertainty, represented as a price +- a confidence interval.
    //
    // The confidence interval roughly corresponds to the standard error of a normal distribution.
    // Both the price and confidence are stored in a fixed-point numeric representation,
    // `x * (10^expo)`, where `expo` is the exponent.
    //
    // Please refer to the documentation at https://docs.pyth.network/documentation/pythnet-price-feeds/best-practices for how
    // to how this price safely.
    struct Price {
        // Price
        int64 price;
        // Confidence interval around the price
        uint64 conf;
        // Price exponent
        int32 expo;
        // Unix timestamp describing when the price was published
        uint publishTime;
    }

    // PriceFeed represents a current aggregate price from pyth publisher feeds.
    struct PriceFeed {
        // The price ID.
        bytes32 id;
        // Latest available price
        Price price;
        // Latest available exponentially-weighted moving average price
        Price emaPrice;
    }
}

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

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"address","name":"_oracleAddress","type":"address"},{"internalType":"bytes32","name":"_priceId","type":"bytes32"},{"internalType":"address","name":"_adminAddress","type":"address"},{"internalType":"address","name":"_operatorAddress","type":"address"},{"internalType":"uint256","name":"_intervalSeconds","type":"uint256"},{"internalType":"uint256","name":"_bufferSeconds","type":"uint256"},{"internalType":"uint256","name":"_minBetAmount","type":"uint256"},{"internalType":"uint256","name":"_oracleUpdateAllowance","type":"uint256"},{"internalType":"uint256","name":"_treasuryFee","type":"uint256"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":true,"internalType":"uint256","name":"epoch","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"BetBear","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":true,"internalType":"uint256","name":"epoch","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"BetBull","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":true,"internalType":"uint256","name":"epoch","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Claim","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"epoch","type":"uint256"},{"indexed":true,"internalType":"uint256","name":"roundId","type":"uint256"},{"indexed":false,"internalType":"int256","name":"price","type":"int256"}],"name":"EndRound","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"epoch","type":"uint256"},{"indexed":true,"internalType":"uint256","name":"roundId","type":"uint256"},{"indexed":false,"internalType":"int256","name":"price","type":"int256"}],"name":"LockRound","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"admin","type":"address"}],"name":"NewAdminAddress","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"bufferSeconds","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"intervalSeconds","type":"uint256"}],"name":"NewBufferAndIntervalSeconds","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"epoch","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"minBetAmount","type":"uint256"}],"name":"NewMinBetAmount","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"operator","type":"address"}],"name":"NewOperatorAddress","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"oracle","type":"address"},{"indexed":false,"internalType":"bytes32","name":"priceId","type":"bytes32"}],"name":"NewOracle","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"oracleUpdateAllowance","type":"uint256"}],"name":"NewOracleUpdateAllowance","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"epoch","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"treasuryFee","type":"uint256"}],"name":"NewTreasuryFee","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":"uint256","name":"epoch","type":"uint256"}],"name":"Pause","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"epoch","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"rewardBaseCalAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"rewardAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"treasuryAmount","type":"uint256"}],"name":"RewardsCalculated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"epoch","type":"uint256"}],"name":"StartRound","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"TokenRecovery","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"TreasuryClaim","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"epoch","type":"uint256"}],"name":"Unpause","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"inputs":[],"name":"MAX_TREASURY_FEE","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"adminAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"epoch","type":"uint256"}],"name":"betBear","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"epoch","type":"uint256"}],"name":"betBull","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"bufferSeconds","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"epochs","type":"uint256[]"}],"name":"claim","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"claimTreasury","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"epoch","type":"uint256"},{"internalType":"address","name":"user","type":"address"}],"name":"claimable","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"currentEpoch","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"executeRound","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"genesisLockOnce","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"genesisLockRound","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"genesisStartOnce","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"genesisStartRound","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"getCurrentPrice","outputs":[{"internalType":"uint80","name":"","type":"uint80"},{"internalType":"int256","name":"","type":"int256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"},{"internalType":"uint256","name":"cursor","type":"uint256"},{"internalType":"uint256","name":"size","type":"uint256"}],"name":"getUserRounds","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"},{"components":[{"internalType":"enum ApePredictV2.Position","name":"position","type":"uint8"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"bool","name":"claimed","type":"bool"}],"internalType":"struct ApePredictV2.BetInfo[]","name":"","type":"tuple[]"},{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"}],"name":"getUserRoundsLength","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"intervalSeconds","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"address","name":"","type":"address"}],"name":"ledger","outputs":[{"internalType":"enum ApePredictV2.Position","name":"position","type":"uint8"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"bool","name":"claimed","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"minBetAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"operatorAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"oracle","outputs":[{"internalType":"contract IPyth","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"oracleLatestRoundId","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"oracleUpdateAllowance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"priceId","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"recoverToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"epoch","type":"uint256"},{"internalType":"address","name":"user","type":"address"}],"name":"refundable","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"rounds","outputs":[{"internalType":"uint256","name":"epoch","type":"uint256"},{"internalType":"uint256","name":"startTimestamp","type":"uint256"},{"internalType":"uint256","name":"lockTimestamp","type":"uint256"},{"internalType":"uint256","name":"closeTimestamp","type":"uint256"},{"internalType":"int256","name":"lockPrice","type":"int256"},{"internalType":"int256","name":"closePrice","type":"int256"},{"internalType":"uint256","name":"lockOracleId","type":"uint256"},{"internalType":"uint256","name":"closeOracleId","type":"uint256"},{"internalType":"uint256","name":"totalAmount","type":"uint256"},{"internalType":"uint256","name":"bullAmount","type":"uint256"},{"internalType":"uint256","name":"bearAmount","type":"uint256"},{"internalType":"uint256","name":"rewardBaseCalAmount","type":"uint256"},{"internalType":"uint256","name":"rewardAmount","type":"uint256"},{"internalType":"bool","name":"oracleCalled","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_adminAddress","type":"address"}],"name":"setAdmin","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_bufferSeconds","type":"uint256"},{"internalType":"uint256","name":"_intervalSeconds","type":"uint256"}],"name":"setBufferAndIntervalSeconds","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_minBetAmount","type":"uint256"}],"name":"setMinBetAmount","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_operatorAddress","type":"address"}],"name":"setOperator","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_oracle","type":"address"},{"internalType":"bytes32","name":"_priceId","type":"bytes32"}],"name":"setOracle","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_oracleUpdateAllowance","type":"uint256"}],"name":"setOracleUpdateAllowance","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_treasuryFee","type":"uint256"}],"name":"setTreasuryFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"treasuryAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"treasuryFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"unpause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"userRounds","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"}]

60803461019f57601f61303c38819003918201601f19168301916001600160401b038311848410176101a4578084926101209460405283398101031261019f57610048816101ba565b9060208101519161005b604083016101ba565b90610068606084016101ba565b60808401519060a08501519260c08601519461010060e08801519701519760005492604051933360018060a01b0382167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0600080a36001600160a81b0319163360ff60a01b19161760005560018055600454936103e88b1161015d5750600280546001600160a01b03199081166001600160a01b03938416179091556003929092556001600160b01b031990931660109290921b62010000600160b01b0316919091176004556005805490911692909116919091179055600755600655600855600d55600955604051612e6d90816101cf8239f35b62461bcd60e51b815260206004820152601560248201527f54726561737572792066656520746f6f206869676800000000000000000000006044820152606490fd5b600080fd5b634e487b7160e01b600052604160045260246000fd5b51906001600160a01b038216820361019f5756fe6080604052600436101561001257600080fd5b60003560e01c80623bdc7414611ed95780630f74174f14611eb6578063127effb214611e8d5780631975f05914611d89578063273867d414611d4f5780633118933414611d31578063368acb0914611d135780633f4ba83a14611c52578063452fd75a14611b9a57806357fb096f14611a7c5780635c975abb14611a565780636055401114611a385780636ba4c1381461163d5780636c18859314611592578063704b6c0214611508578063715018a6146114af5780637285c58b14611443578063766718081461142557806377e741c7146113775780637b3205f514610e3f5780637bf4125414610e195780637d1cd04f14610dfb5780637dc0d1d014610dd25780638456cb5914610d10578063890dc76614610c385780638c65c81f14610b745780638da5cb5b14610b4b578063951fd600146108de578063a0c7f71c146108ae578063aa6b873a14610789578063b29a814014610620578063b3ab15fb1461059d578063cc32d1761461057f578063cf2f50391461051b578063d9d55eac14610421578063dd1f7596146103c8578063eaba2361146103aa578063eb91d37e14610377578063ec32470314610359578063f2b3c8091461033c578063f2fde38b14610275578063f7fdec281461024f578063fa968eea146102315763fc6f9468146101ff57600080fd5b3461022c57600036600319011261022c5760045460405160109190911c6001600160a01b03168152602090f35b600080fd5b3461022c57600036600319011261022c576020600854604051908152f35b3461022c57600036600319011261022c57602060ff60045460081c166040519015158152f35b3461022c57602036600319011261022c5761028e611f50565b610296612a06565b6001600160a01b031680156102e857600080546001600160a01b03198116831782556001600160a01b0316907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09080a3005b60405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608490fd5b3461022c57600036600319011261022c5760206040516103e88152f35b3461022c57600036600319011261022c576020600c54604051908152f35b3461022c57600036600319011261022c576040610392612a5e565b69ffffffffffffffffffff8351921682526020820152f35b3461022c57600036600319011261022c576020600654604051908152f35b3461022c57604036600319011261022c576103e1611f50565b6001600160a01b031660009081526010602052604090208054602435919082101561022c5760209161041291611f89565b90549060031b1c604051908152f35b3461022c57600036600319011261022c5761043a6128ca565b61044f60018060a01b03600554163314612179565b60ff600454610462828260081c16612718565b166104cb5761048b69ffffffffffffffffffff61047d612a5e565b911680600c55600b54612bb8565b600b54600181018091116104b557806104a691600b55612911565b6004805460ff19166001179055005b634e487b7160e01b600052601160045260246000fd5b60405162461bcd60e51b815260206004820152602260248201527f43616e206f6e6c792072756e2067656e657369734c6f636b526f756e64206f6e604482015261636560f01b6064820152608490fd5b3461022c57602036600319011261022c577f93ccaceac092ffb842c46b8718667a13a80e9058dcd0bd403d0b47215b30da07602060043561055a61287e565b61057260018060a01b0360045460101c163314611fb7565b80600d55604051908152a1005b3461022c57600036600319011261022c576020600954604051908152f35b3461022c57602036600319011261022c577fc47d127c07bdd56c5ccba00463ce3bd3c1bca71b4670eea6e5d0c02e4aa156e260206105d9611f50565b6105f160018060a01b0360045460101c163314611fb7565b6001600160a01b0316610605811515611fef565b600580546001600160a01b03191682179055604051908152a1005b3461022c57604036600319011261022c57610639611f50565b60243590610645612a06565b60018060a01b0316906040516106d0602082019163a9059cbb60e01b83523360248201528360448201526044815261067e606482612083565b6000806040948551936106918786612083565b602085527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65646020860152519082895af16106c96127d4565b9086612d67565b8051908115918215610766575b505015610710577f14f11966a996e0629572e51064726d2057a80fbd34efc066682c06a71dbb6e989160209151908152a2005b5162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608490fd5b819250906020918101031261022c5760200151801515810361022c5784806106dd565b602036600319011261022c576004356107a06128ca565b6107a861277e565b6107b3333b156121c1565b6107be323314612204565b6107cb600b548214612250565b6107dc6107d78261298c565b612294565b6107ea6008543410156122d5565b6000818152600e602090815260408083203384529091529020600101546108119015612336565b80600052600f602052600a6040600020600881016108303482546121b4565b90550161083e3482546121b4565b90556000818152600e602090815260408083203384528252808320805460ff191660019081178255349101556010909152902061087c908290612382565b6040513481527f0d8c1fe3e67ab767116a81f122b83c2557a8c2564019cb7c4f83de1aeb1f1f0d60203392a360018055005b3461022c57604036600319011261022c5760206108d46108cc611f66565b600435612563565b6040519015158152f35b3461022c57606036600319011261022c576108f7611f50565b6001600160a01b031660008181526010602052604090205460243591604435916109229084906123df565b8211610b2b575b61093282612537565b916109406040519384612083565b80835261094c81612537565b602084019490601f190136863761096282612537565b926109706040519485612083565b828452601f1961097f84612537565b0160005b818110610aff57505060005b838110610a3e575050906109a2916121b4565b604051926060840190606085525180915260808401949060005b818110610a285750505082840360208401526020808351958681520192016000945b8086106109f357505082935060408301520390f35b90926020606060019260408751610a0b838251611f7c565b8481015185840152015115156040820152019401950194906109de565b82518752602096870196909201916001016109bc565b816000526010602052610a5f6040600020610a5983866121b4565b90611f89565b90549060031b1c610a70828861254f565b52610a7b818761254f565b51600052600e6020526040806000206000908482526020522090604051610aa181612067565b60ff835416926002841015610ae957600260ff91600195845285810154602085015201541615156040820152610ad7828861254f565b52610ae2818761254f565b500161098f565b634e487b7160e01b600052602160045260246000fd5b602090604051610b0e81612067565b600081526000838201526000604082015282828901015201610983565b8091506000526010602052610b45826040600020546123df565b90610929565b3461022c57600036600319011261022c576000546040516001600160a01b039091168152602090f35b3461022c57602036600319011261022c57600435600052600f6020526101c0604060002080549060018101549060028101546003820154600483015460058401546006850154600786015490600887015492600988015494600a89015496600b8a01549860ff600d600c8d01549c0154169b60206040519e8f908152015260408d015260608c015260808b015260a08a015260c089015260e088015261010087015261012086015261014085015261016084015261018083015215156101a0820152f35b3461022c57604036600319011261022c57600435602435610c5761287e565b610c6f60018060a01b0360045460101c163314611fb7565b80821015610cb157816040917fe60149e0431fec12df63dfab5fce2a9cefe9a4d3df5f41cb626f579ae1f2b91a936006558060075582519182526020820152a1005b60405162461bcd60e51b815260206004820152603160248201527f6275666665725365636f6e6473206d75737420626520696e666572696f7220746044820152706f20696e74657276616c5365636f6e647360781b6064820152608490fd5b3461022c57600036600319011261022c57610d296128ca565b6004543360109190911c6001600160a01b0316148015610dbe575b610d4d90612138565b610d556128ca565b6000805460ff60a01b1916600160a01b1790556040513381527f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a25890602090a1600b547f68b095021b1f40fe513109f513c66692f0b3219aee674a69f4efc57badb8201d600080a2005b506005546001600160a01b03163314610d44565b3461022c57600036600319011261022c576002546040516001600160a01b039091168152602090f35b3461022c57600036600319011261022c576020600754604051908152f35b3461022c57604036600319011261022c5760206108d4610e37611f66565b6004356123ec565b3461022c57600036600319011261022c57610e586128ca565b610e6d60018060a01b03600554163314612179565b60045460ff8160081c16908161136c575b50156112f25769ffffffffffffffffffff610e97612a5e565b91169081600c55610eab8183600b54612bb8565b600b546000198101919082116104b55781600052600f6020526002604060002001541561129b5781600052600f60205260036040600020015442106112465781600052600f602052610f08600360406000200154600654906121b4565b42116111f15760207fb6ff1fe915db84788cbbbc017f0d2bef9485fad9fd0bd8ce9340fde0d8410dd89183600052600f8252600d604060002082600582015586600782015501600160ff19825416179055604051908152a3600b5460001981019081116104b55780600052600f602052600b6040600020015415806111d8575b1561119e5780600052600f6020527f6dfdfcb09c8804d0058826cd2539f1acfbe3cb887c9be03d928035bce0f1a58d606060406000206000600582015460048301549081811360001461115e57505050600981015490600c600882015491611000612710610ff8600954866123cc565b0480946123df565b9182915b85600b820155015561101882600a546121b4565b600a5560405192835260208301526040820152a2600b5460018101908181116104b55781600b5561105060ff60045460081c16612718565b60001901908082116104b55781600052600f60205260036040600020015415611102576000918252600f602052600360408320015442106110975761109490612911565b80f35b60405162461bcd60e51b815260206004820152603760248201527f43616e206f6e6c79207374617274206e657720726f756e64206166746572207260448201527f6f756e64206e2d3220636c6f736554696d657374616d700000000000000000006064820152608490fd5b60405162461bcd60e51b815260206004820152602e60248201527f43616e206f6e6c7920737461727420726f756e6420616674657220726f756e6460448201526d081b8b4c881a185cc8195b99195960921b6064820152608490fd5b121561118d5750600a81015490600c600882015491611185612710610ff8600954866123cc565b918291611004565b90600080600c600884015493611004565b60405162461bcd60e51b815260206004820152601260248201527114995dd85c991cc818d85b18dd5b185d195960721b6044820152606490fd5b5080600052600f602052600c6040600020015415610f88565b60405162461bcd60e51b815260206004820152602760248201527f43616e206f6e6c7920656e6420726f756e642077697468696e206275666665726044820152665365636f6e647360c81b6064820152608490fd5b60405162461bcd60e51b815260206004820152602760248201527f43616e206f6e6c7920656e6420726f756e6420616674657220636c6f7365546960448201526606d657374616d760cc1b6064820152608490fd5b60405162461bcd60e51b815260206004820152602960248201527f43616e206f6e6c7920656e6420726f756e6420616674657220726f756e642068604482015268185cc81b1bd8dad95960ba1b6064820152608490fd5b60405162461bcd60e51b815260206004820152604660248201527f43616e206f6e6c792072756e2061667465722067656e6573697353746172745260448201527f6f756e6420616e642067656e657369734c6f636b526f756e642069732074726960648201526519d9d95c995960d21b608482015260a490fd5b60ff91501681610e7e565b3461022c57602036600319011261022c5760043561139361287e565b6113ab60018060a01b0360045460101c163314611fb7565b6103e881116113e857806009557fb1c4ee38d35556741133da7ff9b6f7ab0fa88d0406133126ff128f635490a8576020600b5492604051908152a2005b60405162461bcd60e51b81526020600482015260156024820152740a8e4cac2e6eae4f240cccaca40e8dede40d0d2ced605b1b6044820152606490fd5b3461022c57600036600319011261022c576020600b54604051908152f35b3461022c57604036600319011261022c5760606040611460611f66565b600435600052600e6020528160002060009160018060a01b031682526020522060ff8154169060ff6002600183015492015416906114a16040518094611f7c565b602083015215156040820152f35b3461022c57600036600319011261022c576114c8612a06565b600080546001600160a01b0319811682556001600160a01b03167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08280a3005b3461022c57602036600319011261022c577f137b621413925496477d46e5055ac0d56178bdd724ba8bf843afceef18268ba36020611544611f50565b61154c612a06565b6001600160a01b03811690611562821515611fef565b6004805462010000600160b01b03191660109290921b62010000600160b01b0316919091179055604051908152a1005b3461022c57602036600319011261022c576004356115ae61287e565b6115c660018060a01b0360045460101c163314611fb7565b801561160057806008557f90eb87c560a0213754ceb3a7fa3012f01acab0a35602c1e1995adf69dabc9d506020600b5492604051908152a2005b60405162461bcd60e51b815260206004820152601560248201527404d757374206265207375706572696f7220746f203605c1b6044820152606490fd5b3461022c57602036600319011261022c5760043567ffffffffffffffff811161022c573660238201121561022c57806004013567ffffffffffffffff811161022c576024820191602436918360051b01011161022c5761169b61277e565b6116a6333b156121c1565b6116b1323314612204565b6000913390835b8381106116dc5784806116cc575b60018055005b6116d69033612814565b806116c6565b6116e78185846123bc565b35600052600f602052600160406000200154156119fb576117098185846123bc565b35600052600f6020526003604060002001544211156119c057600061172f8286856123bc565b358152600f60205260408120600d015460ff1615611931575061175d336117578387866123bc565b35612563565b156118f35761176d8185846123bc565b35600052600f60205260406000206118516040519161178b83612034565b8054835260018101546020840152600281015460408401526003810154606084015260048101546080840152600581015460a0840152600681015460c0840152600781015460e084015260088101546101008401526009810154610120840152600a810154610140840152600b8101549261016081019384526101a060ff600d600c850154946101808501958652015416151591015261182c8488876123bc565b35600052600e60205260016040806000206000908982526020522001549051906123cc565b905190600082156118df57506001929161189f910480975b6118748489886123bc565b35600052600e60205260026040806000206000908a825260205220018560ff198254161790556121b4565b956118ab8287866123bc565b35906040519081527f34fcbac0073d7c3d388e51312faf357774904998eeb8fca628b9e6f65ee1cbf760203392a3016116b8565b634e487b7160e01b81526012600452602490fd5b60405162461bcd60e51b81526020600482015260166024820152754e6f7420656c696769626c6520666f7220636c61696d60501b6044820152606490fd5b90611947336119418388876123bc565b356123ec565b1561197b5761189f600160408194611960858a896123bc565b358152600e6020528181208882526020522001548097611869565b60405162461bcd60e51b815260206004820152601760248201527f4e6f7420656c696769626c6520666f7220726566756e640000000000000000006044820152606490fd5b60405162461bcd60e51b8152602060048201526013602482015272149bdd5b99081a185cc81b9bdd08195b991959606a1b6044820152606490fd5b60405162461bcd60e51b8152602060048201526015602482015274149bdd5b99081a185cc81b9bdd081cdd185c9d1959605a1b6044820152606490fd5b3461022c57600036600319011261022c576020600d54604051908152f35b3461022c57600036600319011261022c57602060ff60005460a01c166040519015158152f35b602036600319011261022c57600435611a936128ca565b611a9b61277e565b611aa6333b156121c1565b611ab1323314612204565b611abe600b548214612250565b611aca6107d78261298c565b611ad86008543410156122d5565b6000818152600e60209081526040808320338452909152902060010154611aff9015612336565b80600052600f6020526009604060002060088101611b1e3482546121b4565b905501611b2c3482546121b4565b90556000818152600e602090815260408083203384528252808320805460ff191681553460019091015560109091529020611b68908290612382565b6040513481527f438122d8cff518d18388099a5181f0d17a12b4f1b55faedf6e4a6acee0060c1260203392a360018055005b3461022c57600036600319011261022c57611bb36128ca565b611bc860018060a01b03600554163314612179565b60ff60045460081c16611c0157600b54600181018091116104b55780611bf091600b55612911565b6004805461ff001916610100179055005b60405162461bcd60e51b815260206004820152602360248201527f43616e206f6e6c792072756e2067656e657369735374617274526f756e64206f6044820152626e636560e81b6064820152608490fd5b3461022c57600036600319011261022c57611c6b61287e565b60045433601082901c6001600160a01b0316148015611cff575b611c8e90612138565b61ffff1916600455611c9e61287e565b60ff60a01b19600054166000557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa6020604051338152a1600b547faaa520fdd7d2c83061d632fa017b0432407e798818af63ea908589fceda39ab7600080a2005b506005546001600160a01b03163314611c85565b3461022c57600036600319011261022c576020600a54604051908152f35b3461022c57600036600319011261022c576020600354604051908152f35b3461022c57602036600319011261022c576001600160a01b03611d70611f50565b1660005260106020526020604060002054604051908152f35b3461022c57604036600319011261022c57611da2611f50565b60243590611dae61287e565b611dc660018060a01b0360045460101c163314611fb7565b6001600160a01b031690611ddb821515611fef565b600280546001600160a01b0319168317905560038190556000600c556040516331d98b3f60e01b81526004810182905291608083602481845afa918215611e81577ffe2deee4fd77d1a02c8c3a0f0bf4a3954722c1a30fefc67a6890092c5947add593604093611e54575b5082519182526020820152a1005b611e759060803d608011611e7a575b611e6d8183612083565b8101906120a5565b611e46565b503d611e63565b6040513d6000823e3d90fd5b3461022c57600036600319011261022c576005546040516001600160a01b039091168152602090f35b3461022c57600036600319011261022c57602060ff600454166040519015158152f35b3461022c57600036600319011261022c57611ef261277e565b6004547fb9197c6b8e21274bd1e2d9c956a88af5cfee510f630fab3f046300f88b4223619060209060101c6001600160a01b0316611f31338214611fb7565b611f43600a5480926000600a55612814565b604051908152a160018055005b600435906001600160a01b038216820361022c57565b602435906001600160a01b038216820361022c57565b906002821015610ae95752565b8054821015611fa15760005260206000200190600090565b634e487b7160e01b600052603260045260246000fd5b15611fbe57565b60405162461bcd60e51b81526020600482015260096024820152682737ba1030b236b4b760b91b6044820152606490fd5b15611ff657565b60405162461bcd60e51b815260206004820152601660248201527543616e6e6f74206265207a65726f206164647265737360501b6044820152606490fd5b6101c0810190811067ffffffffffffffff82111761205157604052565b634e487b7160e01b600052604160045260246000fd5b6060810190811067ffffffffffffffff82111761205157604052565b90601f8019910116810190811067ffffffffffffffff82111761205157604052565b9081608091031261022c576040519060006080830167ffffffffffffffff8111848210176121245760405281518060070b8103612120578352602082015167ffffffffffffffff811681036121205760208401526040820151908160030b820361211d57509060609160408401520151606082015290565b80fd5b5080fd5b634e487b7160e01b82526041600452602482fd5b1561213f57565b60405162461bcd60e51b81526020600482015260126024820152712737ba1037b832b930ba37b917b0b236b4b760711b6044820152606490fd5b1561218057565b60405162461bcd60e51b815260206004820152600c60248201526b2737ba1037b832b930ba37b960a11b6044820152606490fd5b919082018092116104b557565b156121c857565b60405162461bcd60e51b815260206004820152601460248201527310dbdb9d1c9858dd081b9bdd08185b1b1bddd95960621b6044820152606490fd5b1561220b57565b60405162461bcd60e51b815260206004820152601a60248201527f50726f787920636f6e7472616374206e6f7420616c6c6f7765640000000000006044820152606490fd5b1561225757565b60405162461bcd60e51b815260206004820152601560248201527442657420697320746f6f206561726c792f6c61746560581b6044820152606490fd5b1561229b57565b60405162461bcd60e51b8152602060048201526012602482015271526f756e64206e6f74206265747461626c6560701b6044820152606490fd5b156122dc57565b60405162461bcd60e51b815260206004820152602c60248201527f42657420616d6f756e74206d7573742062652067726561746572207468616e2060448201526b1b5a5b90995d105b5bdd5b9d60a21b6064820152608490fd5b1561233d57565b60405162461bcd60e51b815260206004820152601b60248201527f43616e206f6e6c7920626574206f6e63652070657220726f756e6400000000006044820152606490fd5b805468010000000000000000811015612051576123a491600182018155611f89565b819291549060031b91821b91600019901b1916179055565b9190811015611fa15760051b0190565b818102929181159184041417156104b557565b919082039182116104b557565b9060409082600052600e6020528160002060009160018060a01b03168252602052206040519161241b83612067565b60ff8254166002811015610ae9578352604060ff60026001850154946020870195865201541693019215158352600052600f60205260406000206040519261246284612034565b81548452600182015460208501526002820154604085015260ff600d60038401549384606088015260048101546080880152600581015460a0880152600681015460c0880152600781015460e088015260088101546101008801526009810154610120880152600a810154610140880152600b810154610160880152600c81015461018088015201541615936101a085159101528361252d575b5082612515575b508161250d575090565b905051151590565b612524919250600654906121b4565b42119038612503565b51159250386124fc565b67ffffffffffffffff81116120515760051b60200190565b8051821015611fa15760209160051b010190565b6000818152600e602090815260408083206001600160a01b039095168352939052829020915161259281612067565b60ff835416926002841015610ae9576101a093825260ff60026001830154926020850193845201541692604083019315158452600052600f6020526040600020926040516125df81612034565b84548152600185015460208201526002850154604082015260038501546060820152600485015491608082019383855260058701549260ff600d60a0830199868b52600681015460c0850152600781015460e085015260088101546101008501526009810154610120850152600a810154610140850152600b810154610160850152600c8101546101808501520154161515988991015282841461270b5787612700575b50866126f6575b5085612699575b505050505090565b1393509091836126e2575b83156126b8575b5050503880808080612691565b519051139150816126cd575b503880806126ab565b9050516002811015610ae957600114386126c4565b925081516002811015610ae95715926126a4565b511595503861268a565b511515965038612683565b5050505050505050600090565b1561271f57565b60405162461bcd60e51b815260206004820152603160248201527f43616e206f6e6c792072756e2061667465722067656e657369735374617274526044820152701bdd5b99081a5cc81d1c9a59d9d95c9959607a1b6064820152608490fd5b60026001541461278f576002600155565b60405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606490fd5b3d1561280f573d9067ffffffffffffffff82116120515760405191612803601f8201601f191660200184612083565b82523d6000602084013e565b606090565b600080809381935af16128256127d4565b501561282d57565b60405162461bcd60e51b815260206004820152602360248201527f5472616e7366657248656c7065723a20424e425f5452414e534645525f46414960448201526213115160ea1b6064820152608490fd5b60ff60005460a01c161561288e57565b60405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b6044820152606490fd5b60ff60005460a01c166128d957565b60405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b6044820152606490fd5b80600052600f6020526040600020426001820155612931600754426121b4565b60028201556007546001600160ff1b03811681036104b55760009161295b60089260011b426121b4565b600382015583815501557f939f42374aa9bf1d8d8cd56d8a9110cb040cd8dfeae44080c6fcf2645e51b452600080a2565b80600052600f602052600160406000200154151590816129ea575b816129ce575b816129b6575090565b9050600052600f602052600260406000200154421090565b809150600052600f6020526001604060002001544211906129ad565b809150600052600f6020526002604060002001541515906129a7565b6000546001600160a01b03163303612a1a57565b606460405162461bcd60e51b815260206004820152602060248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152fd5b600254600354600d5460405163052571af60e51b8152600481019290925260248201529190608090839060449082906001600160a01b03165afa918215611e8157600092612b97575b506060820180514210612b40578051600c541015612ad55769ffffffffffffffffffff905116915160070b90565b60405162461bcd60e51b815260206004820152603d60248201527f4f7261636c652075706461746520726f756e644964206d757374206265206c6160448201527f72676572207468616e206f7261636c654c6174657374526f756e6449640000006064820152608490fd5b60405162461bcd60e51b815260206004820152602960248201527f4f7261636c652070726963652074696d657374616d702069732066726f6d207460448201526868652066757475726560b81b6064820152608490fd5b612bb191925060803d608011611e7a57611e6d8183612083565b9038612aa7565b909181600052600f60205260016040600020015415612d0e5781600052600f6020526002604060002001544210612cb95781600052600f602052612c07600260406000200154600654906121b4565b4211612c635760207f482e76a65b448a42deef26e99e58fb20c85e26f075defff8df6aa80459b390069183600052600f82528460066040600020612c4d600754426121b4565b60038201558360048201550155604051908152a3565b60405162461bcd60e51b815260206004820152602860248201527f43616e206f6e6c79206c6f636b20726f756e642077697468696e206275666665604482015267725365636f6e647360c01b6064820152608490fd5b60405162461bcd60e51b815260206004820152602760248201527f43616e206f6e6c79206c6f636b20726f756e64206166746572206c6f636b546960448201526606d657374616d760cc1b6064820152608490fd5b60405162461bcd60e51b815260206004820152602b60248201527f43616e206f6e6c79206c6f636b20726f756e6420616674657220726f756e642060448201526a1a185cc81cdd185c9d195960aa1b6064820152608490fd5b91929015612dc95750815115612d7b575090565b3b15612d845790565b60405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606490fd5b825190915015612ddc5750805190602001fd5b6040519062461bcd60e51b8252602060048301528181519182602483015260005b838110612e1f5750508160006044809484010152601f80199101168101030190fd5b60208282018101516044878401015285935001612dfd56fea264697066735822122023a43e0cc38c34836d61df3c75fa02d2a0275f4b48cabbb0911fc1f242bf103b64736f6c634300081c00330000000000000000000000002880ab155794e7179c9ee2e38200202908c17b4315add95022ae13563a11992e727c91bdb6b55bc183d9d747436c80a483d8c8640000000000000000000000007493fdf8de3b37b92281fe777894c740fcfe3841000000000000000000000000129c15ca41b1367a5e9e675b27db43162995d3ae000000000000000000000000000000000000000000000000000000000000012c000000000000000000000000000000000000000000000000000000000000001e000000000000000000000000000000000000000000000000016345785d8a0000000000000000000000000000000000000000000000000000000000000000003c0000000000000000000000000000000000000000000000000000000000000258

Deployed Bytecode

0x6080604052600436101561001257600080fd5b60003560e01c80623bdc7414611ed95780630f74174f14611eb6578063127effb214611e8d5780631975f05914611d89578063273867d414611d4f5780633118933414611d31578063368acb0914611d135780633f4ba83a14611c52578063452fd75a14611b9a57806357fb096f14611a7c5780635c975abb14611a565780636055401114611a385780636ba4c1381461163d5780636c18859314611592578063704b6c0214611508578063715018a6146114af5780637285c58b14611443578063766718081461142557806377e741c7146113775780637b3205f514610e3f5780637bf4125414610e195780637d1cd04f14610dfb5780637dc0d1d014610dd25780638456cb5914610d10578063890dc76614610c385780638c65c81f14610b745780638da5cb5b14610b4b578063951fd600146108de578063a0c7f71c146108ae578063aa6b873a14610789578063b29a814014610620578063b3ab15fb1461059d578063cc32d1761461057f578063cf2f50391461051b578063d9d55eac14610421578063dd1f7596146103c8578063eaba2361146103aa578063eb91d37e14610377578063ec32470314610359578063f2b3c8091461033c578063f2fde38b14610275578063f7fdec281461024f578063fa968eea146102315763fc6f9468146101ff57600080fd5b3461022c57600036600319011261022c5760045460405160109190911c6001600160a01b03168152602090f35b600080fd5b3461022c57600036600319011261022c576020600854604051908152f35b3461022c57600036600319011261022c57602060ff60045460081c166040519015158152f35b3461022c57602036600319011261022c5761028e611f50565b610296612a06565b6001600160a01b031680156102e857600080546001600160a01b03198116831782556001600160a01b0316907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09080a3005b60405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608490fd5b3461022c57600036600319011261022c5760206040516103e88152f35b3461022c57600036600319011261022c576020600c54604051908152f35b3461022c57600036600319011261022c576040610392612a5e565b69ffffffffffffffffffff8351921682526020820152f35b3461022c57600036600319011261022c576020600654604051908152f35b3461022c57604036600319011261022c576103e1611f50565b6001600160a01b031660009081526010602052604090208054602435919082101561022c5760209161041291611f89565b90549060031b1c604051908152f35b3461022c57600036600319011261022c5761043a6128ca565b61044f60018060a01b03600554163314612179565b60ff600454610462828260081c16612718565b166104cb5761048b69ffffffffffffffffffff61047d612a5e565b911680600c55600b54612bb8565b600b54600181018091116104b557806104a691600b55612911565b6004805460ff19166001179055005b634e487b7160e01b600052601160045260246000fd5b60405162461bcd60e51b815260206004820152602260248201527f43616e206f6e6c792072756e2067656e657369734c6f636b526f756e64206f6e604482015261636560f01b6064820152608490fd5b3461022c57602036600319011261022c577f93ccaceac092ffb842c46b8718667a13a80e9058dcd0bd403d0b47215b30da07602060043561055a61287e565b61057260018060a01b0360045460101c163314611fb7565b80600d55604051908152a1005b3461022c57600036600319011261022c576020600954604051908152f35b3461022c57602036600319011261022c577fc47d127c07bdd56c5ccba00463ce3bd3c1bca71b4670eea6e5d0c02e4aa156e260206105d9611f50565b6105f160018060a01b0360045460101c163314611fb7565b6001600160a01b0316610605811515611fef565b600580546001600160a01b03191682179055604051908152a1005b3461022c57604036600319011261022c57610639611f50565b60243590610645612a06565b60018060a01b0316906040516106d0602082019163a9059cbb60e01b83523360248201528360448201526044815261067e606482612083565b6000806040948551936106918786612083565b602085527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65646020860152519082895af16106c96127d4565b9086612d67565b8051908115918215610766575b505015610710577f14f11966a996e0629572e51064726d2057a80fbd34efc066682c06a71dbb6e989160209151908152a2005b5162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608490fd5b819250906020918101031261022c5760200151801515810361022c5784806106dd565b602036600319011261022c576004356107a06128ca565b6107a861277e565b6107b3333b156121c1565b6107be323314612204565b6107cb600b548214612250565b6107dc6107d78261298c565b612294565b6107ea6008543410156122d5565b6000818152600e602090815260408083203384529091529020600101546108119015612336565b80600052600f602052600a6040600020600881016108303482546121b4565b90550161083e3482546121b4565b90556000818152600e602090815260408083203384528252808320805460ff191660019081178255349101556010909152902061087c908290612382565b6040513481527f0d8c1fe3e67ab767116a81f122b83c2557a8c2564019cb7c4f83de1aeb1f1f0d60203392a360018055005b3461022c57604036600319011261022c5760206108d46108cc611f66565b600435612563565b6040519015158152f35b3461022c57606036600319011261022c576108f7611f50565b6001600160a01b031660008181526010602052604090205460243591604435916109229084906123df565b8211610b2b575b61093282612537565b916109406040519384612083565b80835261094c81612537565b602084019490601f190136863761096282612537565b926109706040519485612083565b828452601f1961097f84612537565b0160005b818110610aff57505060005b838110610a3e575050906109a2916121b4565b604051926060840190606085525180915260808401949060005b818110610a285750505082840360208401526020808351958681520192016000945b8086106109f357505082935060408301520390f35b90926020606060019260408751610a0b838251611f7c565b8481015185840152015115156040820152019401950194906109de565b82518752602096870196909201916001016109bc565b816000526010602052610a5f6040600020610a5983866121b4565b90611f89565b90549060031b1c610a70828861254f565b52610a7b818761254f565b51600052600e6020526040806000206000908482526020522090604051610aa181612067565b60ff835416926002841015610ae957600260ff91600195845285810154602085015201541615156040820152610ad7828861254f565b52610ae2818761254f565b500161098f565b634e487b7160e01b600052602160045260246000fd5b602090604051610b0e81612067565b600081526000838201526000604082015282828901015201610983565b8091506000526010602052610b45826040600020546123df565b90610929565b3461022c57600036600319011261022c576000546040516001600160a01b039091168152602090f35b3461022c57602036600319011261022c57600435600052600f6020526101c0604060002080549060018101549060028101546003820154600483015460058401546006850154600786015490600887015492600988015494600a89015496600b8a01549860ff600d600c8d01549c0154169b60206040519e8f908152015260408d015260608c015260808b015260a08a015260c089015260e088015261010087015261012086015261014085015261016084015261018083015215156101a0820152f35b3461022c57604036600319011261022c57600435602435610c5761287e565b610c6f60018060a01b0360045460101c163314611fb7565b80821015610cb157816040917fe60149e0431fec12df63dfab5fce2a9cefe9a4d3df5f41cb626f579ae1f2b91a936006558060075582519182526020820152a1005b60405162461bcd60e51b815260206004820152603160248201527f6275666665725365636f6e6473206d75737420626520696e666572696f7220746044820152706f20696e74657276616c5365636f6e647360781b6064820152608490fd5b3461022c57600036600319011261022c57610d296128ca565b6004543360109190911c6001600160a01b0316148015610dbe575b610d4d90612138565b610d556128ca565b6000805460ff60a01b1916600160a01b1790556040513381527f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a25890602090a1600b547f68b095021b1f40fe513109f513c66692f0b3219aee674a69f4efc57badb8201d600080a2005b506005546001600160a01b03163314610d44565b3461022c57600036600319011261022c576002546040516001600160a01b039091168152602090f35b3461022c57600036600319011261022c576020600754604051908152f35b3461022c57604036600319011261022c5760206108d4610e37611f66565b6004356123ec565b3461022c57600036600319011261022c57610e586128ca565b610e6d60018060a01b03600554163314612179565b60045460ff8160081c16908161136c575b50156112f25769ffffffffffffffffffff610e97612a5e565b91169081600c55610eab8183600b54612bb8565b600b546000198101919082116104b55781600052600f6020526002604060002001541561129b5781600052600f60205260036040600020015442106112465781600052600f602052610f08600360406000200154600654906121b4565b42116111f15760207fb6ff1fe915db84788cbbbc017f0d2bef9485fad9fd0bd8ce9340fde0d8410dd89183600052600f8252600d604060002082600582015586600782015501600160ff19825416179055604051908152a3600b5460001981019081116104b55780600052600f602052600b6040600020015415806111d8575b1561119e5780600052600f6020527f6dfdfcb09c8804d0058826cd2539f1acfbe3cb887c9be03d928035bce0f1a58d606060406000206000600582015460048301549081811360001461115e57505050600981015490600c600882015491611000612710610ff8600954866123cc565b0480946123df565b9182915b85600b820155015561101882600a546121b4565b600a5560405192835260208301526040820152a2600b5460018101908181116104b55781600b5561105060ff60045460081c16612718565b60001901908082116104b55781600052600f60205260036040600020015415611102576000918252600f602052600360408320015442106110975761109490612911565b80f35b60405162461bcd60e51b815260206004820152603760248201527f43616e206f6e6c79207374617274206e657720726f756e64206166746572207260448201527f6f756e64206e2d3220636c6f736554696d657374616d700000000000000000006064820152608490fd5b60405162461bcd60e51b815260206004820152602e60248201527f43616e206f6e6c7920737461727420726f756e6420616674657220726f756e6460448201526d081b8b4c881a185cc8195b99195960921b6064820152608490fd5b121561118d5750600a81015490600c600882015491611185612710610ff8600954866123cc565b918291611004565b90600080600c600884015493611004565b60405162461bcd60e51b815260206004820152601260248201527114995dd85c991cc818d85b18dd5b185d195960721b6044820152606490fd5b5080600052600f602052600c6040600020015415610f88565b60405162461bcd60e51b815260206004820152602760248201527f43616e206f6e6c7920656e6420726f756e642077697468696e206275666665726044820152665365636f6e647360c81b6064820152608490fd5b60405162461bcd60e51b815260206004820152602760248201527f43616e206f6e6c7920656e6420726f756e6420616674657220636c6f7365546960448201526606d657374616d760cc1b6064820152608490fd5b60405162461bcd60e51b815260206004820152602960248201527f43616e206f6e6c7920656e6420726f756e6420616674657220726f756e642068604482015268185cc81b1bd8dad95960ba1b6064820152608490fd5b60405162461bcd60e51b815260206004820152604660248201527f43616e206f6e6c792072756e2061667465722067656e6573697353746172745260448201527f6f756e6420616e642067656e657369734c6f636b526f756e642069732074726960648201526519d9d95c995960d21b608482015260a490fd5b60ff91501681610e7e565b3461022c57602036600319011261022c5760043561139361287e565b6113ab60018060a01b0360045460101c163314611fb7565b6103e881116113e857806009557fb1c4ee38d35556741133da7ff9b6f7ab0fa88d0406133126ff128f635490a8576020600b5492604051908152a2005b60405162461bcd60e51b81526020600482015260156024820152740a8e4cac2e6eae4f240cccaca40e8dede40d0d2ced605b1b6044820152606490fd5b3461022c57600036600319011261022c576020600b54604051908152f35b3461022c57604036600319011261022c5760606040611460611f66565b600435600052600e6020528160002060009160018060a01b031682526020522060ff8154169060ff6002600183015492015416906114a16040518094611f7c565b602083015215156040820152f35b3461022c57600036600319011261022c576114c8612a06565b600080546001600160a01b0319811682556001600160a01b03167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08280a3005b3461022c57602036600319011261022c577f137b621413925496477d46e5055ac0d56178bdd724ba8bf843afceef18268ba36020611544611f50565b61154c612a06565b6001600160a01b03811690611562821515611fef565b6004805462010000600160b01b03191660109290921b62010000600160b01b0316919091179055604051908152a1005b3461022c57602036600319011261022c576004356115ae61287e565b6115c660018060a01b0360045460101c163314611fb7565b801561160057806008557f90eb87c560a0213754ceb3a7fa3012f01acab0a35602c1e1995adf69dabc9d506020600b5492604051908152a2005b60405162461bcd60e51b815260206004820152601560248201527404d757374206265207375706572696f7220746f203605c1b6044820152606490fd5b3461022c57602036600319011261022c5760043567ffffffffffffffff811161022c573660238201121561022c57806004013567ffffffffffffffff811161022c576024820191602436918360051b01011161022c5761169b61277e565b6116a6333b156121c1565b6116b1323314612204565b6000913390835b8381106116dc5784806116cc575b60018055005b6116d69033612814565b806116c6565b6116e78185846123bc565b35600052600f602052600160406000200154156119fb576117098185846123bc565b35600052600f6020526003604060002001544211156119c057600061172f8286856123bc565b358152600f60205260408120600d015460ff1615611931575061175d336117578387866123bc565b35612563565b156118f35761176d8185846123bc565b35600052600f60205260406000206118516040519161178b83612034565b8054835260018101546020840152600281015460408401526003810154606084015260048101546080840152600581015460a0840152600681015460c0840152600781015460e084015260088101546101008401526009810154610120840152600a810154610140840152600b8101549261016081019384526101a060ff600d600c850154946101808501958652015416151591015261182c8488876123bc565b35600052600e60205260016040806000206000908982526020522001549051906123cc565b905190600082156118df57506001929161189f910480975b6118748489886123bc565b35600052600e60205260026040806000206000908a825260205220018560ff198254161790556121b4565b956118ab8287866123bc565b35906040519081527f34fcbac0073d7c3d388e51312faf357774904998eeb8fca628b9e6f65ee1cbf760203392a3016116b8565b634e487b7160e01b81526012600452602490fd5b60405162461bcd60e51b81526020600482015260166024820152754e6f7420656c696769626c6520666f7220636c61696d60501b6044820152606490fd5b90611947336119418388876123bc565b356123ec565b1561197b5761189f600160408194611960858a896123bc565b358152600e6020528181208882526020522001548097611869565b60405162461bcd60e51b815260206004820152601760248201527f4e6f7420656c696769626c6520666f7220726566756e640000000000000000006044820152606490fd5b60405162461bcd60e51b8152602060048201526013602482015272149bdd5b99081a185cc81b9bdd08195b991959606a1b6044820152606490fd5b60405162461bcd60e51b8152602060048201526015602482015274149bdd5b99081a185cc81b9bdd081cdd185c9d1959605a1b6044820152606490fd5b3461022c57600036600319011261022c576020600d54604051908152f35b3461022c57600036600319011261022c57602060ff60005460a01c166040519015158152f35b602036600319011261022c57600435611a936128ca565b611a9b61277e565b611aa6333b156121c1565b611ab1323314612204565b611abe600b548214612250565b611aca6107d78261298c565b611ad86008543410156122d5565b6000818152600e60209081526040808320338452909152902060010154611aff9015612336565b80600052600f6020526009604060002060088101611b1e3482546121b4565b905501611b2c3482546121b4565b90556000818152600e602090815260408083203384528252808320805460ff191681553460019091015560109091529020611b68908290612382565b6040513481527f438122d8cff518d18388099a5181f0d17a12b4f1b55faedf6e4a6acee0060c1260203392a360018055005b3461022c57600036600319011261022c57611bb36128ca565b611bc860018060a01b03600554163314612179565b60ff60045460081c16611c0157600b54600181018091116104b55780611bf091600b55612911565b6004805461ff001916610100179055005b60405162461bcd60e51b815260206004820152602360248201527f43616e206f6e6c792072756e2067656e657369735374617274526f756e64206f6044820152626e636560e81b6064820152608490fd5b3461022c57600036600319011261022c57611c6b61287e565b60045433601082901c6001600160a01b0316148015611cff575b611c8e90612138565b61ffff1916600455611c9e61287e565b60ff60a01b19600054166000557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa6020604051338152a1600b547faaa520fdd7d2c83061d632fa017b0432407e798818af63ea908589fceda39ab7600080a2005b506005546001600160a01b03163314611c85565b3461022c57600036600319011261022c576020600a54604051908152f35b3461022c57600036600319011261022c576020600354604051908152f35b3461022c57602036600319011261022c576001600160a01b03611d70611f50565b1660005260106020526020604060002054604051908152f35b3461022c57604036600319011261022c57611da2611f50565b60243590611dae61287e565b611dc660018060a01b0360045460101c163314611fb7565b6001600160a01b031690611ddb821515611fef565b600280546001600160a01b0319168317905560038190556000600c556040516331d98b3f60e01b81526004810182905291608083602481845afa918215611e81577ffe2deee4fd77d1a02c8c3a0f0bf4a3954722c1a30fefc67a6890092c5947add593604093611e54575b5082519182526020820152a1005b611e759060803d608011611e7a575b611e6d8183612083565b8101906120a5565b611e46565b503d611e63565b6040513d6000823e3d90fd5b3461022c57600036600319011261022c576005546040516001600160a01b039091168152602090f35b3461022c57600036600319011261022c57602060ff600454166040519015158152f35b3461022c57600036600319011261022c57611ef261277e565b6004547fb9197c6b8e21274bd1e2d9c956a88af5cfee510f630fab3f046300f88b4223619060209060101c6001600160a01b0316611f31338214611fb7565b611f43600a5480926000600a55612814565b604051908152a160018055005b600435906001600160a01b038216820361022c57565b602435906001600160a01b038216820361022c57565b906002821015610ae95752565b8054821015611fa15760005260206000200190600090565b634e487b7160e01b600052603260045260246000fd5b15611fbe57565b60405162461bcd60e51b81526020600482015260096024820152682737ba1030b236b4b760b91b6044820152606490fd5b15611ff657565b60405162461bcd60e51b815260206004820152601660248201527543616e6e6f74206265207a65726f206164647265737360501b6044820152606490fd5b6101c0810190811067ffffffffffffffff82111761205157604052565b634e487b7160e01b600052604160045260246000fd5b6060810190811067ffffffffffffffff82111761205157604052565b90601f8019910116810190811067ffffffffffffffff82111761205157604052565b9081608091031261022c576040519060006080830167ffffffffffffffff8111848210176121245760405281518060070b8103612120578352602082015167ffffffffffffffff811681036121205760208401526040820151908160030b820361211d57509060609160408401520151606082015290565b80fd5b5080fd5b634e487b7160e01b82526041600452602482fd5b1561213f57565b60405162461bcd60e51b81526020600482015260126024820152712737ba1037b832b930ba37b917b0b236b4b760711b6044820152606490fd5b1561218057565b60405162461bcd60e51b815260206004820152600c60248201526b2737ba1037b832b930ba37b960a11b6044820152606490fd5b919082018092116104b557565b156121c857565b60405162461bcd60e51b815260206004820152601460248201527310dbdb9d1c9858dd081b9bdd08185b1b1bddd95960621b6044820152606490fd5b1561220b57565b60405162461bcd60e51b815260206004820152601a60248201527f50726f787920636f6e7472616374206e6f7420616c6c6f7765640000000000006044820152606490fd5b1561225757565b60405162461bcd60e51b815260206004820152601560248201527442657420697320746f6f206561726c792f6c61746560581b6044820152606490fd5b1561229b57565b60405162461bcd60e51b8152602060048201526012602482015271526f756e64206e6f74206265747461626c6560701b6044820152606490fd5b156122dc57565b60405162461bcd60e51b815260206004820152602c60248201527f42657420616d6f756e74206d7573742062652067726561746572207468616e2060448201526b1b5a5b90995d105b5bdd5b9d60a21b6064820152608490fd5b1561233d57565b60405162461bcd60e51b815260206004820152601b60248201527f43616e206f6e6c7920626574206f6e63652070657220726f756e6400000000006044820152606490fd5b805468010000000000000000811015612051576123a491600182018155611f89565b819291549060031b91821b91600019901b1916179055565b9190811015611fa15760051b0190565b818102929181159184041417156104b557565b919082039182116104b557565b9060409082600052600e6020528160002060009160018060a01b03168252602052206040519161241b83612067565b60ff8254166002811015610ae9578352604060ff60026001850154946020870195865201541693019215158352600052600f60205260406000206040519261246284612034565b81548452600182015460208501526002820154604085015260ff600d60038401549384606088015260048101546080880152600581015460a0880152600681015460c0880152600781015460e088015260088101546101008801526009810154610120880152600a810154610140880152600b810154610160880152600c81015461018088015201541615936101a085159101528361252d575b5082612515575b508161250d575090565b905051151590565b612524919250600654906121b4565b42119038612503565b51159250386124fc565b67ffffffffffffffff81116120515760051b60200190565b8051821015611fa15760209160051b010190565b6000818152600e602090815260408083206001600160a01b039095168352939052829020915161259281612067565b60ff835416926002841015610ae9576101a093825260ff60026001830154926020850193845201541692604083019315158452600052600f6020526040600020926040516125df81612034565b84548152600185015460208201526002850154604082015260038501546060820152600485015491608082019383855260058701549260ff600d60a0830199868b52600681015460c0850152600781015460e085015260088101546101008501526009810154610120850152600a810154610140850152600b810154610160850152600c8101546101808501520154161515988991015282841461270b5787612700575b50866126f6575b5085612699575b505050505090565b1393509091836126e2575b83156126b8575b5050503880808080612691565b519051139150816126cd575b503880806126ab565b9050516002811015610ae957600114386126c4565b925081516002811015610ae95715926126a4565b511595503861268a565b511515965038612683565b5050505050505050600090565b1561271f57565b60405162461bcd60e51b815260206004820152603160248201527f43616e206f6e6c792072756e2061667465722067656e657369735374617274526044820152701bdd5b99081a5cc81d1c9a59d9d95c9959607a1b6064820152608490fd5b60026001541461278f576002600155565b60405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606490fd5b3d1561280f573d9067ffffffffffffffff82116120515760405191612803601f8201601f191660200184612083565b82523d6000602084013e565b606090565b600080809381935af16128256127d4565b501561282d57565b60405162461bcd60e51b815260206004820152602360248201527f5472616e7366657248656c7065723a20424e425f5452414e534645525f46414960448201526213115160ea1b6064820152608490fd5b60ff60005460a01c161561288e57565b60405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b6044820152606490fd5b60ff60005460a01c166128d957565b60405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b6044820152606490fd5b80600052600f6020526040600020426001820155612931600754426121b4565b60028201556007546001600160ff1b03811681036104b55760009161295b60089260011b426121b4565b600382015583815501557f939f42374aa9bf1d8d8cd56d8a9110cb040cd8dfeae44080c6fcf2645e51b452600080a2565b80600052600f602052600160406000200154151590816129ea575b816129ce575b816129b6575090565b9050600052600f602052600260406000200154421090565b809150600052600f6020526001604060002001544211906129ad565b809150600052600f6020526002604060002001541515906129a7565b6000546001600160a01b03163303612a1a57565b606460405162461bcd60e51b815260206004820152602060248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152fd5b600254600354600d5460405163052571af60e51b8152600481019290925260248201529190608090839060449082906001600160a01b03165afa918215611e8157600092612b97575b506060820180514210612b40578051600c541015612ad55769ffffffffffffffffffff905116915160070b90565b60405162461bcd60e51b815260206004820152603d60248201527f4f7261636c652075706461746520726f756e644964206d757374206265206c6160448201527f72676572207468616e206f7261636c654c6174657374526f756e6449640000006064820152608490fd5b60405162461bcd60e51b815260206004820152602960248201527f4f7261636c652070726963652074696d657374616d702069732066726f6d207460448201526868652066757475726560b81b6064820152608490fd5b612bb191925060803d608011611e7a57611e6d8183612083565b9038612aa7565b909181600052600f60205260016040600020015415612d0e5781600052600f6020526002604060002001544210612cb95781600052600f602052612c07600260406000200154600654906121b4565b4211612c635760207f482e76a65b448a42deef26e99e58fb20c85e26f075defff8df6aa80459b390069183600052600f82528460066040600020612c4d600754426121b4565b60038201558360048201550155604051908152a3565b60405162461bcd60e51b815260206004820152602860248201527f43616e206f6e6c79206c6f636b20726f756e642077697468696e206275666665604482015267725365636f6e647360c01b6064820152608490fd5b60405162461bcd60e51b815260206004820152602760248201527f43616e206f6e6c79206c6f636b20726f756e64206166746572206c6f636b546960448201526606d657374616d760cc1b6064820152608490fd5b60405162461bcd60e51b815260206004820152602b60248201527f43616e206f6e6c79206c6f636b20726f756e6420616674657220726f756e642060448201526a1a185cc81cdd185c9d195960aa1b6064820152608490fd5b91929015612dc95750815115612d7b575090565b3b15612d845790565b60405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606490fd5b825190915015612ddc5750805190602001fd5b6040519062461bcd60e51b8252602060048301528181519182602483015260005b838110612e1f5750508160006044809484010152601f80199101168101030190fd5b60208282018101516044878401015285935001612dfd56fea264697066735822122023a43e0cc38c34836d61df3c75fa02d2a0275f4b48cabbb0911fc1f242bf103b64736f6c634300081c0033

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

0000000000000000000000002880ab155794e7179c9ee2e38200202908c17b4315add95022ae13563a11992e727c91bdb6b55bc183d9d747436c80a483d8c8640000000000000000000000007493fdf8de3b37b92281fe777894c740fcfe3841000000000000000000000000129c15ca41b1367a5e9e675b27db43162995d3ae000000000000000000000000000000000000000000000000000000000000012c000000000000000000000000000000000000000000000000000000000000001e000000000000000000000000000000000000000000000000016345785d8a0000000000000000000000000000000000000000000000000000000000000000003c0000000000000000000000000000000000000000000000000000000000000258

-----Decoded View---------------
Arg [0] : _oracleAddress (address): 0x2880aB155794e7179c9eE2e38200202908C17B43
Arg [1] : _priceId (bytes32): 0x15add95022ae13563a11992e727c91bdb6b55bc183d9d747436c80a483d8c864
Arg [2] : _adminAddress (address): 0x7493fdF8dE3b37b92281Fe777894c740Fcfe3841
Arg [3] : _operatorAddress (address): 0x129c15ca41B1367A5e9E675b27db43162995d3AE
Arg [4] : _intervalSeconds (uint256): 300
Arg [5] : _bufferSeconds (uint256): 30
Arg [6] : _minBetAmount (uint256): 100000000000000000
Arg [7] : _oracleUpdateAllowance (uint256): 60
Arg [8] : _treasuryFee (uint256): 600

-----Encoded View---------------
9 Constructor Arguments found :
Arg [0] : 0000000000000000000000002880ab155794e7179c9ee2e38200202908c17b43
Arg [1] : 15add95022ae13563a11992e727c91bdb6b55bc183d9d747436c80a483d8c864
Arg [2] : 0000000000000000000000007493fdf8de3b37b92281fe777894c740fcfe3841
Arg [3] : 000000000000000000000000129c15ca41b1367a5e9e675b27db43162995d3ae
Arg [4] : 000000000000000000000000000000000000000000000000000000000000012c
Arg [5] : 000000000000000000000000000000000000000000000000000000000000001e
Arg [6] : 000000000000000000000000000000000000000000000000016345785d8a0000
Arg [7] : 000000000000000000000000000000000000000000000000000000000000003c
Arg [8] : 0000000000000000000000000000000000000000000000000000000000000258


Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

Block Uncle Number Difficulty Gas Used Reward
View All Uncles
Loading...
Loading
Loading...
Loading

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits

A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.