ETH Price: $1,979.63 (-3.89%)

Contract

0x84e2D94814D933EaE4D2603A5f96Cc1aDd3ca6ae
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

More Info

Private Name Tags

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Set Transaction ...244694902026-02-16 12:50:1118 days ago1771246211IN
0x84e2D948...aDd3ca6ae
0 ETH0.000001520.05870594
Set Bankx Max Sl...244694892026-02-16 12:49:5918 days ago1771246199IN
0x84e2D948...aDd3ca6ae
0 ETH0.000001220.04730211

Advanced mode:
Parent Transaction Hash Method Block
From
To
View All Internal Transactions
Loading...
Loading
Loading...
Loading
Cross-Chain Transactions

Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
RulesEngine

Compiler Version
v0.8.20+commit.a1b79de6

Optimization Enabled:
Yes with 200 runs

Other Settings:
paris EvmVersion
File 1 of 9 : RulesEngine.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;

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 "../Oracle/ChainlinkETHUSDPriceConsumer.sol";
import "../Oracle/ChainlinkXAGUSDPriceConsumer.sol";

interface ITreasuryPool {
    function withdrawETHForFunction(uint256 amount) external returns (bool);
    function updateLastExecutionTimestamp(uint256 timestamp) external;
    function receiveETH(uint256 amount) external payable;
    function receiveXSD(uint256 amount) external;
}

interface IPIDController {
    function xsd_updated_price() external view returns (uint256);
    function bankx_updated_price() external view returns (uint256);
    function global_collateral_ratio() external view returns (uint256);
    function bucket1() external view returns (bool);
    function bucket2() external view returns (bool);
    function diff1() external view returns (uint);
    function diff2() external view returns (uint);
    function amountpaid1() external view returns (uint);
    function amountpaid2() external view returns (uint);
    function systemCalculations() external;
}

interface IRouter {
    function swapETHForXSD(uint256 amountOutMin, uint256 deadline) external payable;
    function userAddLiquidityETH(address pool, uint256 deadline) external payable;
    function swapETHForBankX(uint256 amountOutMin, uint256 deadline) external payable;
}

interface IXSDWETHPool {
    function getReserves() external view returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast);
}

interface IBankXWETHPool {
    function getReserves() external view returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast);
}

interface IRewardManager {
    function userProvideXSDLiquidity(address to) external;
    function userProvideBankXLiquidity(address to) external;
}

interface IBankX {
    function burn(uint256 amount) external;
    function balanceOf(address account) external view returns (uint256);
}

contract RulesEngine is Ownable, Pausable, ReentrancyGuard {
    address public treasuryPool;
    address public ethUsdFeed;
    address public silverUsdFeed;
    address public bankxPidController;
    address public rewardManager;
    address public router;
    address public xsdWethPool;
    address public bankxWethPool;
    address public xsdToken;
    address public bankxToken;
    
    uint256 public lastExecutionTimestamp;
    
    // XSD Purchase parameters
    bool public pidRunCompleted;
    uint256 public lastPidCalculationTimestamp;
    uint256 public minTimeBetweenSteps = 10; // 10 seconds
    uint256 public pegThreshold = 500; // 5% (basis points)
    uint256 public purchaseAmountUsd = 10000000; // $10 with 6 decimals
    uint256 public maxSlippage = 150; // In tenths of a percent (15.0%)
    uint256 public gasCostBuffer = 1000000000000000; // 0.001 ETH
    uint256 public transactionDeadlineWindow = 300; // 5 minutes
    
    // Liquidity Sell parameters
    bool public liquidityPidRunCompleted;
    uint256 public lastLiquidityPidCalculationTimestamp;
    
    // BankX Buy and Burn parameters
    uint256 public bankxPurchaseAmountUsd = 10000000; // $10 with 6 decimals
    uint256 public bankxMaxSlippage = 200; // In tenths of a percent (20.0%)
    uint256 public unburnedBankXBalance;
    bool public bankxPidRunCompleted;
    uint256 public lastBankxPidCalculationTimestamp;
    uint256 public lastBankxBurnTimestamp;
    uint256 public burnCooldown = 86400; // 24 hours
    
    // New tracking variables
    uint256 public totalBankXPurchased;
    uint256 public totalBankXBurned;

    uint256 private constant PRICE_PRECISION = 1e18; // Increased from 1e6 to 1e18
    uint256 private constant BASIS_POINTS = 10000; // Remain at 10000 for basis points
    uint256 private constant HIGH_PRECISION = 1e18; // Added for high precision calculations
    
    event RulesEngineExecuted(uint256 timestamp);
    event PIDCalculationCompleted(uint256 timestamp, bool success);
    event XSDBought(uint256 ethAmount, uint256 xsdAmount, uint256 timestamp);
    event BuyFailed(string reason, uint256 timestamp);
    event XSDTransferredToTreasury(uint256 amount, uint256 timestamp);
    event LiquidityPidCalculationCompleted(uint256 timestamp, bool success);
    event LiquiditySellInitiated(uint256 availableCapacity, uint256 timestamp);
    event LiquiditySold(uint256 ethAmount, uint256 timestamp);
    event LiquiditySellFailed(string reason, uint256 timestamp);
    event ETHWithdrawnForLiquidity(uint256 amount, uint256 timestamp);
    event DeficitValidated(uint256 capacity, uint256 timestamp);
    event BankXPidCalculationCompleted(uint256 timestamp, bool success);
    event BankXBuyInitiated(uint256 ethAmount, uint256 timestamp);
    event BankXBought(uint256 ethAmount, uint256 bankxAmount, uint256 timestamp);
    event SlippageValidated(uint256 slippage, uint256 maxSlippage, uint256 timestamp);
    event ETHWithdrawnForBankX(uint256 amount, uint256 timestamp);
    event BankXBurnAttempted(uint256 amount, uint256 timestamp);
    event BankXBurned(uint256 amount, uint256 timestamp);
    event BankXBurnFailed(string reason, uint256 amount, uint256 timestamp);
    event NumericalCheck(string operation, uint256 value1, uint256 value2, bool passed);

    constructor(
        address _ethUsdFeed,
        address _silverUsdFeed,
        address _treasuryPool,
        address _bankxPidController,
        address _router,
        address _xsdWethPool,
        address _bankxWethPool,
        address _xsdToken,
        address _bankxToken,
        address _rewardManager
    ) Ownable() {
        require(
            _ethUsdFeed != address(0) &&
            _silverUsdFeed != address(0) &&
            _treasuryPool != address(0) &&
            _bankxPidController != address(0) &&
            _router != address(0) &&
            _xsdWethPool != address(0) &&
            _bankxWethPool != address(0) &&
            _xsdToken != address(0) &&
            _bankxToken != address(0) &&
            _rewardManager != address(0),
            "Rules Engine: Zero address detected"
        );
        
        ethUsdFeed = _ethUsdFeed;
        silverUsdFeed = _silverUsdFeed;
        treasuryPool = _treasuryPool;
        bankxPidController = _bankxPidController;
        router = _router;
        xsdWethPool = _xsdWethPool;
        bankxWethPool = _bankxWethPool;
        xsdToken = _xsdToken;
        bankxToken = _bankxToken;
        rewardManager = _rewardManager;
        
        lastExecutionTimestamp = block.timestamp;
    }

    function executeRules() external nonReentrant whenNotPaused returns (bool) {
        uint256 currentTimestamp = block.timestamp;
        
        // Priority 1: XSD below peg
        if (_checkXsdBelowPeg()) {
            if (pidRunCompleted) {
                if (block.timestamp >= lastPidCalculationTimestamp + minTimeBetweenSteps) {
                    _executeXsdBuyAfterPidRun();
                }
            } else {
                _initiateXsdPurchasePidRun();
            }
        }
        // Priority 2: Liquidity selling
        else if (_checkXsdAtPeg() && _canSellLiquidity()) {
            if (liquidityPidRunCompleted) {
                if (block.timestamp >= lastLiquidityPidCalculationTimestamp + minTimeBetweenSteps) {
                    _executeXsdLiquiditySell();
                }
            } else {
                _initiateLiquidityPidRun();
            }
        }
        // Priority 3: BankX buy and burn
        else if (_checkXsdAtPeg() && _canBuyAndBurnBankX()) {
            if (bankxPidRunCompleted) {
                if (block.timestamp >= lastBankxPidCalculationTimestamp + minTimeBetweenSteps) {
                    _executeBankxBuyAfterPidRun();
                }
            } else {
                _initiateBankxPurchasePidRun();
            }
        }
        
        lastExecutionTimestamp = currentTimestamp;
        ITreasuryPool(treasuryPool).updateLastExecutionTimestamp(currentTimestamp);
        
        // Check for BankX burn opportunity
        _attemptBankXBurn();
        
        emit RulesEngineExecuted(currentTimestamp);
        return true;
    }

    function getNativeTokenPrice() public view returns (uint256) {
        (int256 price) = ChainlinkETHUSDPriceConsumer(ethUsdFeed).getLatestPrice();
        require(price > 0, "Rules Engine: Invalid ETH/USD price");
        uint8 decimals = ChainlinkETHUSDPriceConsumer(ethUsdFeed).getDecimals();
        
        // Convert to HIGH_PRECISION for maximum precision
        uint256 priceWithPrecision;
        if (decimals < 18) {
            priceWithPrecision = uint256(price) * (10 ** (18 - decimals));
        } else {
            priceWithPrecision = uint256(price) / (10 ** (decimals - 18));
        }
        
        // Add safety check for unusually low values
        require(priceWithPrecision > 0, "Rules Engine: Price converted to zero");
        
        return priceWithPrecision;
    }

    function getSilverPrice() public view returns (uint256) {
        (int256 price) = ChainlinkXAGUSDPriceConsumer(silverUsdFeed).getLatestPrice();
        require(price > 0, "Rules Engine: Invalid Silver/USD price");
        uint8 decimals = ChainlinkXAGUSDPriceConsumer(silverUsdFeed).getDecimals();
        
        // Convert to HIGH_PRECISION for maximum precision
        uint256 priceWithPrecision;
        if (decimals < 18) {
            priceWithPrecision = uint256(price) * (10 ** (18 - decimals));
        } else {
            priceWithPrecision = uint256(price) / (10 ** (decimals - 18));
        }
        
        // Add safety check for unusually low values
        require(priceWithPrecision > 0, "Rules Engine: Price converted to zero");
        uint256 pricePerGram = (priceWithPrecision * 10000) / 311035;
        return pricePerGram;
    }

    function getBankXBalance() public view returns (uint256) {
        return IBankX(bankxToken).balanceOf(address(this)) + unburnedBankXBalance;
    }

    function _checkXsdBelowPeg() private returns (bool) {
        uint256 xsdPrice = IPIDController(bankxPidController).xsd_updated_price();
        // Convert the price to high precision
        xsdPrice = xsdPrice * (PRICE_PRECISION / 1e6);
        
        uint256 silverPrice = getSilverPrice();
        uint256 thresholdPrice = (silverPrice * (BASIS_POINTS - pegThreshold)) / BASIS_POINTS;
        
        emit NumericalCheck("XSD below peg check", xsdPrice, thresholdPrice, xsdPrice < thresholdPrice);
        
        return xsdPrice < thresholdPrice;
    }

    function _checkXsdAtPeg() private returns (bool) {
        uint256 xsdPrice = IPIDController(bankxPidController).xsd_updated_price();
        // Convert the price to high precision
        xsdPrice = xsdPrice * (PRICE_PRECISION / 1e6);
        
        uint256 silverPrice = getSilverPrice();
        uint256 lowerBound = (silverPrice * (BASIS_POINTS - pegThreshold)) / BASIS_POINTS;
        uint256 upperBound = (silverPrice * (BASIS_POINTS + pegThreshold)) / BASIS_POINTS;
        
        bool inRange = (xsdPrice >= lowerBound && xsdPrice <= upperBound);
        emit NumericalCheck("XSD at peg check", xsdPrice, silverPrice, inRange);
        
        return inRange;
    }

    function _initiateXsdPurchasePidRun() private {
        IPIDController(bankxPidController).systemCalculations();
        pidRunCompleted = true;
        lastPidCalculationTimestamp = block.timestamp;
        emit PIDCalculationCompleted(block.timestamp, true);
    }

    function _executeXsdBuyAfterPidRun() private {
        if (!_checkXsdBelowPeg()) {
            emit BuyFailed("XSD not below peg", block.timestamp);
            return;
        }

        // Get high precision ETH price
        uint256 ethUsdPrice = getNativeTokenPrice();
        
        // FIX 3: Simplified ETH amount calculation
        // purchaseAmountUsd has 6 decimals, ethUsdPrice has 18 decimals
        // To get ETH (18 decimals): (USD_6 * 1e18) / price_18 = (USD * 1e24) / price_18 = ETH_18
        uint256 ethAmount = (purchaseAmountUsd * 1e30) / ethUsdPrice;
        
        if (ethAmount == 0) {
            emit BuyFailed("ETH amount calculated as zero", block.timestamp);
            return;
        }
        emit NumericalCheck("ETH amount calculation", ethAmount, gasCostBuffer, ethAmount > 0);
        
        uint256 totalEthNeeded = ethAmount + gasCostBuffer;

        (uint112 xsdReserve, uint112 wethReserve) = _getPoolData();
        if (xsdReserve == 0 || wethReserve == 0) {
            emit BuyFailed("Pool reserves are zero", block.timestamp);
            return;
        }

        address payable treasuryPoolPayable = payable(treasuryPool);
        if (treasuryPoolPayable.balance < totalEthNeeded) {
            emit BuyFailed("Insufficient ETH", block.timestamp);
            return;
        }

        bool withdrawSuccess = ITreasuryPool(treasuryPool).withdrawETHForFunction(totalEthNeeded);
        if (!withdrawSuccess) {
            emit BuyFailed("ETH withdrawal failed", block.timestamp);
            return;
        }
        
        // FIX 3: Use pool reserves for expected output calculation
        uint256 expectedXsdOut = (ethAmount * uint256(xsdReserve)) / uint256(wethReserve);
        
        if (expectedXsdOut == 0) {
            emit BuyFailed("Expected XSD output is zero", block.timestamp);
            _returnETHToTreasury(ethAmount);
            return;
        }
        
        // Convert admin-set slippage (in tenths of percent) to basis points
        uint256 slippageBasisPoints = maxSlippage * 10;
        uint256 minXsdOut = (expectedXsdOut * (BASIS_POINTS - slippageBasisPoints)) / BASIS_POINTS;
        uint256 deadline = block.timestamp + transactionDeadlineWindow;

        // FIX 1: Removed unnecessary approval
        // FIX 2: Track XSD balance before and after swap
        uint256 xsdBalanceBefore = IERC20(xsdToken).balanceOf(address(this));
        IRouter(router).swapETHForXSD{value: ethAmount}(minXsdOut, deadline);
        uint256 xsdBalanceAfter = IERC20(xsdToken).balanceOf(address(this));
        uint256 xsdReceived = xsdBalanceAfter - xsdBalanceBefore;

        // Need to approve Treasury Pool to take the XSD via transferFrom
        IERC20(xsdToken).approve(treasuryPool, xsdReceived);
        ITreasuryPool(treasuryPool).receiveXSD(xsdReceived);
        emit XSDTransferredToTreasury(xsdReceived, block.timestamp);

        pidRunCompleted = false;
        emit XSDBought(ethAmount, xsdReceived, block.timestamp);
    }

    function _canSellLiquidity() private view returns (bool) {
        bool inDeficit = IPIDController(bankxPidController).bucket1();
        if (!inDeficit) {
            return false;
        }
        
        uint256 deficit = IPIDController(bankxPidController).diff1();
        uint256 amountPaid = IPIDController(bankxPidController).amountpaid1();
        
        if (deficit <= amountPaid) {
            return false;
        }
        
        return true;
    }

    function _initiateLiquidityPidRun() private {
        IPIDController(bankxPidController).systemCalculations();
        liquidityPidRunCompleted = true;
        lastLiquidityPidCalculationTimestamp = block.timestamp;
        emit LiquidityPidCalculationCompleted(block.timestamp, true);
    }

    function _executeXsdLiquiditySell() private {
        uint256 deficit = IPIDController(bankxPidController).diff1();
        uint256 amountPaid = IPIDController(bankxPidController).amountpaid1();
        
        uint256 availableCapacity = deficit - amountPaid;
        emit DeficitValidated(availableCapacity, block.timestamp);
        emit LiquiditySellInitiated(availableCapacity, block.timestamp);
        
        address payable treasuryPoolPayable = payable(treasuryPool);
        
        // First, ensure we have enough for gas buffer
        if (treasuryPoolPayable.balance <= gasCostBuffer) {
            emit LiquiditySellFailed("Insufficient ETH for gas", block.timestamp);
            return;
        }
        
        // Calculate max ETH after reserving gas buffer
        uint256 maxEthAmount = ((treasuryPoolPayable.balance - gasCostBuffer) * 95) / 100;
        
        // Get high precision ETH price
        uint256 ethUsdPrice = getNativeTokenPrice();
        
        // Convert with higher precision
        uint256 availableCapacityHighPrecision = availableCapacity * (PRICE_PRECISION / 1e6);
        uint256 capacityInEth = (availableCapacityHighPrecision * PRICE_PRECISION) / ethUsdPrice;
        uint256 ethAmount = maxEthAmount < capacityInEth ? maxEthAmount : capacityInEth;
        
        if (ethAmount == 0) {
            emit LiquiditySellFailed("Calculated ETH amount is zero", block.timestamp);
            return;
        }
        emit NumericalCheck("Liquidity sell ETH amount", ethAmount, availableCapacity, ethAmount > 0);
        
        // Now totalEthNeeded is guaranteed to be <= treasuryPoolPayable.balance
        uint256 totalEthNeeded = ethAmount + gasCostBuffer;
        
        bool success = ITreasuryPool(treasuryPool).withdrawETHForFunction(totalEthNeeded);
        if (!success) {
            emit LiquiditySellFailed("Failed to withdraw ETH from Treasury Pool", block.timestamp);
            return;
        }
        emit ETHWithdrawnForLiquidity(totalEthNeeded, block.timestamp);
        
        uint256 deadline = block.timestamp + transactionDeadlineWindow;
        
        IRouter(router).userAddLiquidityETH{value: ethAmount}(xsdWethPool, deadline);
        emit LiquiditySold(ethAmount, block.timestamp);
        
        liquidityPidRunCompleted = false;
    }

    function _initiateBankxPurchasePidRun() private {
        IPIDController(bankxPidController).systemCalculations();
        bankxPidRunCompleted = true;
        lastBankxPidCalculationTimestamp = block.timestamp;
        emit BankXPidCalculationCompleted(block.timestamp, true);
    }

    function _executeBankxBuyAfterPidRun() private {
        if (!_checkXsdAtPeg()) {
            emit BankXBurnFailed("XSD not at peg", 0, block.timestamp);
            return;
        }

        if (_canSellLiquidity()) {
            emit BankXBurnFailed("Liquidity capacity available", 0, block.timestamp);
            return;
        }

       // CHECK RESERVES FIRST - BEFORE ANY ETH OPERATIONS
        (uint112 bankxReserve, uint112 wethReserve) = _getBankxPoolData();
        if (bankxReserve == 0 || wethReserve == 0) {
        emit BankXBurnFailed("Pool reserves are zero", 0, block.timestamp);
        return;
        }

        // Get high precision ETH price
        uint256 ethUsdPrice = getNativeTokenPrice();
        
        // Use same calculation as XSD
        uint256 ethAmount = (bankxPurchaseAmountUsd * 1e30) / ethUsdPrice;
        
        if (ethAmount == 0) {
            emit BankXBurnFailed("ETH amount calculated as zero", 0, block.timestamp);
            return;
        }
        emit NumericalCheck("BankX ETH amount calculation", ethAmount, bankxPurchaseAmountUsd, ethAmount > 0);
        
        uint256 totalEthNeeded = ethAmount + gasCostBuffer;

        address payable treasuryPoolPayable = payable(treasuryPool);
        if (treasuryPoolPayable.balance < totalEthNeeded) {
            emit BankXBurnFailed("Insufficient ETH", 0, block.timestamp);
            return;
        }

        bool withdrawSuccess = ITreasuryPool(treasuryPool).withdrawETHForFunction(totalEthNeeded);
        if (!withdrawSuccess) {
            emit BankXBurnFailed("ETH withdrawal failed", 0, block.timestamp);
            return;
        }
        emit ETHWithdrawnForBankX(totalEthNeeded, block.timestamp);
        
        // Use same calculation as XSD
        uint256 expectedBankxOut = (ethAmount * uint256(bankxReserve)) / uint256(wethReserve);

        // Convert admin-set slippage (in tenths of percent) to basis points
        uint256 slippageBasisPoints = bankxMaxSlippage * 10;
        emit SlippageValidated(slippageBasisPoints, bankxMaxSlippage, block.timestamp);

        if (expectedBankxOut == 0) {
            emit BankXBurnFailed("Expected BankX output is zero", 0, block.timestamp);
            _returnETHToTreasury(totalEthNeeded);
            return;
        }

        uint256 minBankxOut = (expectedBankxOut * (BASIS_POINTS - slippageBasisPoints)) / BASIS_POINTS;
        uint256 deadline = block.timestamp + transactionDeadlineWindow;

        // FIX 4: Track BankX balance before and after swap
        uint256 bankxBalanceBefore = IERC20(bankxToken).balanceOf(address(this));
        
        // FIX 1: Execute swap without expecting return value
        IRouter(router).swapETHForBankX{value: ethAmount}(minBankxOut, deadline);
        
        // FIX 4: Calculate received amount
        uint256 bankxBalanceAfter = IERC20(bankxToken).balanceOf(address(this));
        uint256 bankxReceived = bankxBalanceAfter - bankxBalanceBefore;
        
        totalBankXPurchased += bankxReceived;
        
        emit BankXBought(ethAmount, bankxReceived, block.timestamp);

        bankxPidRunCompleted = false;
    }

    function _attemptBankXBurn() private {
        if (block.timestamp < lastBankxBurnTimestamp + burnCooldown) {
            return;
        }

        uint256 bankxBalance = IBankX(bankxToken).balanceOf(address(this));
        bankxBalance += unburnedBankXBalance;
        
        if (bankxBalance == 0) {
            return;
        }
        
        emit BankXBurnAttempted(bankxBalance, block.timestamp);
        
        // Store current balance before burn attempt
        uint256 balanceBefore = IBankX(bankxToken).balanceOf(address(this));
        
        // Attempt to burn
        IBankX(bankxToken).burn(bankxBalance);
        
        // Check if burn was successful by comparing balances
        uint256 balanceAfter = IBankX(bankxToken).balanceOf(address(this));
        
        if (balanceBefore > balanceAfter) {
            // Burn was successful (at least partially)
            uint256 burnedAmount = balanceBefore - balanceAfter;
            unburnedBankXBalance = bankxBalance - burnedAmount;
            lastBankxBurnTimestamp = block.timestamp;
            totalBankXBurned += burnedAmount;
            emit BankXBurned(burnedAmount, block.timestamp);
        } else {
            // Burn failed completely
            unburnedBankXBalance = bankxBalance;
            emit BankXBurnFailed("Burn operation failed", bankxBalance, block.timestamp);
        }
    }

    function _getPoolData() private view returns (uint112 xsdReserve, uint112 wethReserve) {
        (xsdReserve, wethReserve, ) = IXSDWETHPool(xsdWethPool).getReserves();
        return (xsdReserve, wethReserve);
    }

    function _getBankxPoolData() private view returns (uint112 bankxReserve, uint112 wethReserve) {
        (bankxReserve, wethReserve, ) = IBankXWETHPool(bankxWethPool).getReserves();
        return (bankxReserve, wethReserve);
    }

    function _canBuyAndBurnBankX() private returns (bool) {
        address payable treasuryPoolPayable = payable(treasuryPool);
        
        // Get high precision ETH price
        uint256 ethUsdPrice = getNativeTokenPrice();
        
        // Calculate minimum ETH amount with same pattern as XSD
        uint256 minBankxPurchaseUsd = 5000000; // $5 with 6 decimals (lower threshold)
        uint256 minEthAmount = (minBankxPurchaseUsd * 1e30) / ethUsdPrice;
        
        // Add buffer to minimum required amount
        uint256 minRequiredAmount = minEthAmount + gasCostBuffer;
        
        bool hasEnoughETH = treasuryPoolPayable.balance > minRequiredAmount;
        emit NumericalCheck("BankX purchase check", treasuryPoolPayable.balance, minRequiredAmount, hasEnoughETH);
        
        return hasEnoughETH;
    }

    function _returnETHToTreasury(uint256 amount) private {
        ITreasuryPool(treasuryPool).receiveETH{value: amount}(amount);
    }

    // Helper function to extract error message from revert reason bytes
    function _extractErrorMessage(bytes memory reason) private pure returns (string memory) {
        if (reason.length > 0) {
            // Try to extract error message if it's a standard revert reason
            // This works for standard revert("message") style errors
            if (reason.length > 4 && reason[0] == 0x08 && reason[1] == 0xc3 && 
                reason[2] == 0x79 && reason[3] == 0xa0) {
                // Standard revert
                uint256 strLength;
                assembly {
                    strLength := mload(add(reason, 36))
                }
                
                bytes memory strBytes = new bytes(strLength);
                for (uint256 i = 0; i < strLength; i++) {
                    strBytes[i] = reason[i + 68];
                }
                
                return string(strBytes);
            }
            return "Unknown error";
        }
        return "Empty error reason";
    }

    function pause() external onlyOwner {
        _pause();
    }

    function unpause() external onlyOwner {
        _unpause();
    }

    function resetPidRunState() external onlyOwner {
        pidRunCompleted = false;
        lastPidCalculationTimestamp = 0;
        liquidityPidRunCompleted = false;
        lastLiquidityPidCalculationTimestamp = 0;
        bankxPidRunCompleted = false;
        lastBankxPidCalculationTimestamp = 0;
    }

    function setPurchaseAmountUsd(uint256 _purchaseAmountUsd) external onlyOwner {
        require(_purchaseAmountUsd > 0, "Purchase amount must be > 0");
        purchaseAmountUsd = _purchaseAmountUsd;
    }

    function setBankxPurchaseAmountUsd(uint256 _bankxPurchaseAmountUsd) external onlyOwner {
        require(_bankxPurchaseAmountUsd > 0, "Purchase amount must be > 0");
        bankxPurchaseAmountUsd = _bankxPurchaseAmountUsd;
    }

    function setPegThreshold(uint256 _pegThreshold) external onlyOwner {
        require(_pegThreshold > 0 && _pegThreshold <= 1500, "Invalid peg threshold");
        pegThreshold = _pegThreshold;
    }

    function setMaxSlippage(uint256 _maxSlippage) external onlyOwner {
        require(_maxSlippage > 0 && _maxSlippage <= 500, "Invalid max slippage (0.1%-50%)");
        maxSlippage = _maxSlippage;
    }

    function setBankxMaxSlippage(uint256 _bankxMaxSlippage) external onlyOwner {
        require(_bankxMaxSlippage > 0 && _bankxMaxSlippage <= 500, "Invalid max slippage (0.1%-50%)");
        bankxMaxSlippage = _bankxMaxSlippage;
    }

    function setGasCostBuffer(uint256 _gasCostBuffer) external onlyOwner {
        require(_gasCostBuffer > 0, "Gas cost buffer must be > 0");
        gasCostBuffer = _gasCostBuffer;
    }

    function setTransactionDeadlineWindow(uint256 _transactionDeadlineWindow) external onlyOwner {
        require(_transactionDeadlineWindow > 0, "Transaction deadline window must be > 0");
        transactionDeadlineWindow = _transactionDeadlineWindow;
    }

    function setMinTimeBetweenSteps(uint256 _minTimeBetweenSteps) external onlyOwner {
        require(_minTimeBetweenSteps > 0, "Min time between steps must be > 0");
        minTimeBetweenSteps = _minTimeBetweenSteps;
    }

    function setTreasuryPool(address _treasuryPool) external onlyOwner {
        require(_treasuryPool != address(0), "Treasury Pool cannot be zero address");
        treasuryPool = _treasuryPool;
    }

    function setRewardManager(address _rewardManager) external onlyOwner {
        require(_rewardManager != address(0), "Reward Manager cannot be zero address");
        rewardManager = _rewardManager;
    }

    function setRouterAddress(address _router) external onlyOwner{
        require(_router != address(0), "Router address cannot be zero address");
        router = _router;
    }

    function flushBankX(address to) external onlyOwner {
        require(to != address(0), "Cannot flush to zero address");
        uint256 balance = IBankX(bankxToken).balanceOf(address(this));
        balance += unburnedBankXBalance;
        if (balance > 0) {
            IERC20(bankxToken).transfer(to, balance);
            unburnedBankXBalance = 0;
        }
    }

    function flushXSD(address to) external onlyOwner {
        require(to != address(0), "Cannot flush to zero address");
        uint256 balance = IERC20(xsdToken).balanceOf(address(this));
        if (balance > 0) {
            IERC20(xsdToken).transfer(to, balance);
        }
    }

    function recoverETH(address to) external onlyOwner {
        require(to != address(0), "Cannot recover to zero address");
        uint256 balance = address(this).balance;
        if (balance > 0) {
            (bool success, ) = payable(to).call{value: balance}("");
            require(success, "ETH transfer failed");
        }
    }

    receive() external payable {}
}

// 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);
    }
}

// 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());
    }
}

// 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;
    }
}

// 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);
}

// 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;
    }
}

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

interface AggregatorV3Interface {

  function decimals() external view returns (uint8);
  function description() external view returns (string memory);
  function version() external view returns (uint256);

  // getRoundData and latestRoundData should both raise "No data present"
  // if they do not have data to report, instead of returning unset values
  // which could be misinterpreted as actual reported values.
  function getRoundData(uint80 _roundId)
    external
    view
    returns (
      uint80 roundId,
      int256 answer,
      uint256 startedAt,
      uint256 updatedAt,
      uint80 answeredInRound
    );
  function latestRoundData()
    external
    view
    returns (
      uint80 roundId,
      int256 answer,
      uint256 startedAt,
      uint256 updatedAt,
      uint80 answeredInRound
    );

}

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import "./AggregatorV3Interface.sol";

contract ChainlinkETHUSDPriceConsumer {

    AggregatorV3Interface internal priceFeed;
    //Arbitrum: 0x639Fe6ab55C921f74e7fac1ee960C0B6293ba612
    //Ethereum: 0x5f4eC3Df9cbd43714FE2740f5E3616155c5b8419
    //Polygon: 0xAB594600376Ec9fD91F8e885dADF0CE036862dE0
    //Optimism: 0x13e3Ee699D1909E989722E753853AE30b17e08c5
    //Avalanche: 0x0A77230d17318075983913bC2145DB16C7366156
    //Fantom: 0xf4766552D15AE4d256Ad41B6cf2933482B0680dc
    constructor() {
        priceFeed = AggregatorV3Interface(0x5f4eC3Df9cbd43714FE2740f5E3616155c5b8419);
    }

    /**
     * Returns the latest price
     */
    function getLatestPrice() public view returns (int) {
        (
            uint80 roundID
            , 
            int price,
            ,
            ,
            uint80 answeredInRound
        ) = priceFeed.latestRoundData();
        require(answeredInRound >= roundID);
        return price;
    }
    
    function getDecimals() public view returns (uint8) {
        return priceFeed.decimals();
    }
}

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import "./AggregatorV3Interface.sol";

contract ChainlinkXAGUSDPriceConsumer {

    AggregatorV3Interface priceFeed;
    //Arbitrum: 0xC56765f04B248394CF1619D20dB8082Edbfa75b1
    //Ethereum: 0x379589227b15F1a12195D3f2d90bBc9F31f95235
    //Polygon: 0x461c7B8D370a240DdB46B402748381C3210136b3
    //Optimism:0x290dd71254874f0d4356443607cb8234958DEe49
    //Avalanche:0x4305FB66699C3B2702D4d05CF36551390A4c69C6
    constructor() {
        priceFeed = AggregatorV3Interface(0x379589227b15F1a12195D3f2d90bBc9F31f95235);
    }

    /**
     * Returns the latest price
     */
    function getLatestPrice() public view returns (int) {
        (
            uint80 roundID
            , 
            int price,
            ,
            ,
            uint80 answeredInRound
        ) = priceFeed.latestRoundData();
        require(answeredInRound >= roundID);
        return price;
    }
    
    function getDecimals() public view returns (uint8) {
        return priceFeed.decimals();
    }
}

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

Contract Security Audit

Contract ABI

API
[{"inputs":[{"internalType":"address","name":"_ethUsdFeed","type":"address"},{"internalType":"address","name":"_silverUsdFeed","type":"address"},{"internalType":"address","name":"_treasuryPool","type":"address"},{"internalType":"address","name":"_bankxPidController","type":"address"},{"internalType":"address","name":"_router","type":"address"},{"internalType":"address","name":"_xsdWethPool","type":"address"},{"internalType":"address","name":"_bankxWethPool","type":"address"},{"internalType":"address","name":"_xsdToken","type":"address"},{"internalType":"address","name":"_bankxToken","type":"address"},{"internalType":"address","name":"_rewardManager","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"ethAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"bankxAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"timestamp","type":"uint256"}],"name":"BankXBought","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"timestamp","type":"uint256"}],"name":"BankXBurnAttempted","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"string","name":"reason","type":"string"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"timestamp","type":"uint256"}],"name":"BankXBurnFailed","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"timestamp","type":"uint256"}],"name":"BankXBurned","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"ethAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"timestamp","type":"uint256"}],"name":"BankXBuyInitiated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"timestamp","type":"uint256"},{"indexed":false,"internalType":"bool","name":"success","type":"bool"}],"name":"BankXPidCalculationCompleted","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"string","name":"reason","type":"string"},{"indexed":false,"internalType":"uint256","name":"timestamp","type":"uint256"}],"name":"BuyFailed","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"capacity","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"timestamp","type":"uint256"}],"name":"DeficitValidated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"timestamp","type":"uint256"}],"name":"ETHWithdrawnForBankX","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"timestamp","type":"uint256"}],"name":"ETHWithdrawnForLiquidity","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"timestamp","type":"uint256"},{"indexed":false,"internalType":"bool","name":"success","type":"bool"}],"name":"LiquidityPidCalculationCompleted","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"string","name":"reason","type":"string"},{"indexed":false,"internalType":"uint256","name":"timestamp","type":"uint256"}],"name":"LiquiditySellFailed","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"availableCapacity","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"timestamp","type":"uint256"}],"name":"LiquiditySellInitiated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"ethAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"timestamp","type":"uint256"}],"name":"LiquiditySold","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"string","name":"operation","type":"string"},{"indexed":false,"internalType":"uint256","name":"value1","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"value2","type":"uint256"},{"indexed":false,"internalType":"bool","name":"passed","type":"bool"}],"name":"NumericalCheck","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":false,"internalType":"uint256","name":"timestamp","type":"uint256"},{"indexed":false,"internalType":"bool","name":"success","type":"bool"}],"name":"PIDCalculationCompleted","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"timestamp","type":"uint256"}],"name":"RulesEngineExecuted","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"slippage","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"maxSlippage","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"timestamp","type":"uint256"}],"name":"SlippageValidated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"ethAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"xsdAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"timestamp","type":"uint256"}],"name":"XSDBought","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"timestamp","type":"uint256"}],"name":"XSDTransferredToTreasury","type":"event"},{"inputs":[],"name":"bankxMaxSlippage","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"bankxPidController","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"bankxPidRunCompleted","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"bankxPurchaseAmountUsd","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"bankxToken","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"bankxWethPool","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"burnCooldown","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"ethUsdFeed","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"executeRules","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"}],"name":"flushBankX","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"}],"name":"flushXSD","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"gasCostBuffer","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getBankXBalance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getNativeTokenPrice","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getSilverPrice","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lastBankxBurnTimestamp","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lastBankxPidCalculationTimestamp","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lastExecutionTimestamp","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lastLiquidityPidCalculationTimestamp","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lastPidCalculationTimestamp","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"liquidityPidRunCompleted","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxSlippage","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"minTimeBetweenSteps","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":"pegThreshold","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pidRunCompleted","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"purchaseAmountUsd","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"}],"name":"recoverETH","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"resetPidRunState","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"rewardManager","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"router","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_bankxMaxSlippage","type":"uint256"}],"name":"setBankxMaxSlippage","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_bankxPurchaseAmountUsd","type":"uint256"}],"name":"setBankxPurchaseAmountUsd","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_gasCostBuffer","type":"uint256"}],"name":"setGasCostBuffer","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_maxSlippage","type":"uint256"}],"name":"setMaxSlippage","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_minTimeBetweenSteps","type":"uint256"}],"name":"setMinTimeBetweenSteps","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_pegThreshold","type":"uint256"}],"name":"setPegThreshold","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_purchaseAmountUsd","type":"uint256"}],"name":"setPurchaseAmountUsd","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_rewardManager","type":"address"}],"name":"setRewardManager","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_router","type":"address"}],"name":"setRouterAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_transactionDeadlineWindow","type":"uint256"}],"name":"setTransactionDeadlineWindow","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_treasuryPool","type":"address"}],"name":"setTreasuryPool","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"silverUsdFeed","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalBankXBurned","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalBankXPurchased","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"transactionDeadlineWindow","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"treasuryPool","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"unburnedBankXBalance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"unpause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"xsdToken","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"xsdWethPool","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"stateMutability":"payable","type":"receive"}]

6080604052600a600f556101f460105562989680601155609660125566038d7ea4c6800060135561012c6014556298968060175560c860185562015180601d553480156200004c57600080fd5b506040516200409a3803806200409a8339810160408190526200006f91620002d3565b6200007a3362000266565b6000805460ff60a01b19169055600180556001600160a01b038a1615801590620000ac57506001600160a01b03891615155b8015620000c157506001600160a01b03881615155b8015620000d657506001600160a01b03871615155b8015620000eb57506001600160a01b03861615155b80156200010057506001600160a01b03851615155b80156200011557506001600160a01b03841615155b80156200012a57506001600160a01b03831615155b80156200013f57506001600160a01b03821615155b80156200015457506001600160a01b03811615155b620001b15760405162461bcd60e51b815260206004820152602360248201527f52756c657320456e67696e653a205a65726f20616464726573732064657465636044820152621d195960ea1b606482015260840160405180910390fd5b600380546001600160a01b03199081166001600160a01b039c8d16179091556004805482169a8c169a909a17909955600280548a16988b1698909817909755600580548916968a16969096179095556007805488169489169490941790935560088054871692881692909217909155600980548616918716919091179055600a80548516918616919091179055600b8054841691851691909117905560068054909216921691909117905542600c55620003a2565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b80516001600160a01b0381168114620002ce57600080fd5b919050565b6000806000806000806000806000806101408b8d031215620002f457600080fd5b620002ff8b620002b6565b99506200030f60208c01620002b6565b98506200031f60408c01620002b6565b97506200032f60608c01620002b6565b96506200033f60808c01620002b6565b95506200034f60a08c01620002b6565b94506200035f60c08c01620002b6565b93506200036f60e08c01620002b6565b9250620003806101008c01620002b6565b9150620003916101208c01620002b6565b90509295989b9194979a5092959850565b613ce880620003b26000396000f3fe6080604052600436106103545760003560e01c806382cc696d116101c6578063b5a3acf9116100f7578063dd76b54d11610095578063eadac2fd1161006f578063eadac2fd146108fb578063f2fde38b14610911578063f887ea4014610931578063fce8f8931461095157600080fd5b8063dd76b54d146108a5578063e1f83d89146108c5578063e48d2100146108db57600080fd5b8063c597e802116100d1578063c597e80214610836578063c6f7599014610856578063cb967dc614610876578063d5d5aa651461088b57600080fd5b8063b5a3acf9146107e0578063bfc45a1614610800578063c4144af31461082057600080fd5b80638fdf7c8211610164578063a37f94f61161013e578063a37f94f614610770578063a588fc1e14610790578063aa507202146107b0578063ae909538146107ca57600080fd5b80638fdf7c821461072f57806394c77638146107455780639fd2f75b1461075a57600080fd5b8063898622e8116101a0578063898622e8146106cf5780638ae6ee2e146106e55780638c04166f146106fb5780638da5cb5b1461071157600080fd5b806382cc696d1461067a5780638327700a1461069a5780638456cb59146106ba57600080fd5b80633f4ba83a116102a05780635c975abb1161023e578063715018a611610218578063715018a61461060f57806371e07e84146106245780637fdeae651461063a5780638009b7bd1461065a57600080fd5b80635c975abb146105c4578063634b5948146105e357806363dc80ab146105f957600080fd5b806343f68a491161027a57806343f68a491461054f57806348df58291461056f5780634e279b791461058f57806355fb0b83146105a457600080fd5b80633f4ba83a146104fa57806341cb87fc1461050f578063425170e21461052f57600080fd5b80632115594b1161030d57806332ea099a116102e757806332ea099a1461049957806333579c10146104ae578063337247fa146104c4578063358d1fc6146104e457600080fd5b80632115594b1461044d57806323396d07146104635780632f0ded811461048357600080fd5b806306c2d5e51461036057806306cdb51a1461039d5780630f4ef8a6146103c7578063134dfcd8146103e7578063153ee554146104095780631cd6b20e1461042957600080fd5b3661035b57005b600080fd5b34801561036c57600080fd5b50600854610380906001600160a01b031681565b6040516001600160a01b0390911681526020015b60405180910390f35b3480156103a957600080fd5b50601a546103b79060ff1681565b6040519015158152602001610394565b3480156103d357600080fd5b50600654610380906001600160a01b031681565b3480156103f357600080fd5b506104076104023660046137ac565b610966565b005b34801561041557600080fd5b506104076104243660046137ac565b610a6f565b34801561043557600080fd5b5061043f60195481565b604051908152602001610394565b34801561045957600080fd5b5061043f601c5481565b34801561046f57600080fd5b5061040761047e3660046137ac565b610afd565b34801561048f57600080fd5b5061043f60115481565b3480156104a557600080fd5b5061043f610b89565b3480156104ba57600080fd5b5061043f60175481565b3480156104d057600080fd5b50600454610380906001600160a01b031681565b3480156104f057600080fd5b5061043f600c5481565b34801561050657600080fd5b50610407610c09565b34801561051b57600080fd5b5061040761052a3660046137ac565b610c1b565b34801561053b57600080fd5b5061040761054a3660046137ac565b610ca9565b34801561055b57600080fd5b5061040761056a3660046137d5565b610df3565b34801561057b57600080fd5b50600254610380906001600160a01b031681565b34801561059b57600080fd5b5061043f610e5e565b3480156105b057600080fd5b50600a54610380906001600160a01b031681565b3480156105d057600080fd5b50600054600160a01b900460ff166103b7565b3480156105ef57600080fd5b5061043f601e5481565b34801561060557600080fd5b5061043f601d5481565b34801561061b57600080fd5b50610407611044565b34801561063057600080fd5b5061043f60185481565b34801561064657600080fd5b506104076106553660046137d5565b611056565b34801561066657600080fd5b50600354610380906001600160a01b031681565b34801561068657600080fd5b506104076106953660046137d5565b6110b9565b3480156106a657600080fd5b50600554610380906001600160a01b031681565b3480156106c657600080fd5b50610407611116565b3480156106db57600080fd5b5061043f60135481565b3480156106f157600080fd5b5061043f600e5481565b34801561070757600080fd5b5061043f60125481565b34801561071d57600080fd5b506000546001600160a01b0316610380565b34801561073b57600080fd5b5061043f60105481565b34801561075157600080fd5b5061043f611126565b34801561076657600080fd5b5061043f601b5481565b34801561077c57600080fd5b5061040761078b3660046137d5565b6112ed565b34801561079c57600080fd5b50600954610380906001600160a01b031681565b3480156107bc57600080fd5b506015546103b79060ff1681565b3480156107d657600080fd5b5061043f601f5481565b3480156107ec57600080fd5b506104076107fb3660046137d5565b61135a565b34801561080c57600080fd5b5061040761081b3660046137d5565b6113c5565b34801561082c57600080fd5b5061043f60145481565b34801561084257600080fd5b50600b54610380906001600160a01b031681565b34801561086257600080fd5b506104076108713660046137d5565b611422565b34801561088257600080fd5b5061040761148a565b34801561089757600080fd5b50600d546103b79060ff1681565b3480156108b157600080fd5b506104076108c03660046137ac565b6114c2565b3480156108d157600080fd5b5061043f600f5481565b3480156108e757600080fd5b506104076108f63660046137d5565b611626565b34801561090757600080fd5b5061043f60165481565b34801561091d57600080fd5b5061040761092c3660046137ac565b611683565b34801561093d57600080fd5b50600754610380906001600160a01b031681565b34801561095d57600080fd5b506103b76116fc565b61096e611894565b6001600160a01b0381166109c95760405162461bcd60e51b815260206004820152601e60248201527f43616e6e6f74207265636f76657220746f207a65726f2061646472657373000060448201526064015b60405180910390fd5b478015610a6b576000826001600160a01b03168260405160006040518083038185875af1925050503d8060008114610a1d576040519150601f19603f3d011682016040523d82523d6000602084013e610a22565b606091505b5050905080610a695760405162461bcd60e51b8152602060048201526013602482015272115512081d1c985b9cd9995c8819985a5b1959606a1b60448201526064016109c0565b505b5050565b610a77611894565b6001600160a01b038116610adb5760405162461bcd60e51b815260206004820152602560248201527f526577617264204d616e616765722063616e6e6f74206265207a65726f206164604482015264647265737360d81b60648201526084016109c0565b600680546001600160a01b0319166001600160a01b0392909216919091179055565b610b05611894565b6001600160a01b038116610b675760405162461bcd60e51b8152602060048201526024808201527f547265617375727920506f6f6c2063616e6e6f74206265207a65726f206164646044820152637265737360e01b60648201526084016109c0565b600280546001600160a01b0319166001600160a01b0392909216919091179055565b601954600b546040516370a0823160e01b8152306004820152600092916001600160a01b0316906370a0823190602401602060405180830381865afa158015610bd6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bfa91906137ee565b610c04919061381d565b905090565b610c11611894565b610c196118ee565b565b610c23611894565b6001600160a01b038116610c875760405162461bcd60e51b815260206004820152602560248201527f526f7574657220616464726573732063616e6e6f74206265207a65726f206164604482015264647265737360d81b60648201526084016109c0565b600780546001600160a01b0319166001600160a01b0392909216919091179055565b610cb1611894565b6001600160a01b038116610d075760405162461bcd60e51b815260206004820152601c60248201527f43616e6e6f7420666c75736820746f207a65726f20616464726573730000000060448201526064016109c0565b600a546040516370a0823160e01b81523060048201526000916001600160a01b0316906370a0823190602401602060405180830381865afa158015610d50573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d7491906137ee565b90508015610a6b57600a5460405163a9059cbb60e01b81526001600160a01b038481166004830152602482018490529091169063a9059cbb906044016020604051808303816000875af1158015610dcf573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a699190613836565b610dfb611894565b600081118015610e0d57506101f48111155b610e595760405162461bcd60e51b815260206004820152601f60248201527f496e76616c6964206d617820736c6970706167652028302e31252d353025290060448201526064016109c0565b601255565b6004805460408051638e15f47360e01b8152905160009384936001600160a01b031692638e15f47392818301926020928290030181865afa158015610ea7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ecb91906137ee565b905060008113610f2c5760405162461bcd60e51b815260206004820152602660248201527f52756c657320456e67696e653a20496e76616c69642053696c7665722f55534460448201526520707269636560d01b60648201526084016109c0565b6000600460009054906101000a90046001600160a01b03166001600160a01b031663f0141d846040518163ffffffff1660e01b8152600401602060405180830381865afa158015610f81573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610fa59190613858565b9050600060128260ff161015610fdc57610fc082601261387b565b610fcb90600a613978565b610fd59084613987565b9050610fff565b610fe760128361387b565b610ff290600a613978565b610ffc908461399e565b90505b6000811161101f5760405162461bcd60e51b81526004016109c0906139c0565b60006204befb61103183612710613987565b61103b919061399e565b95945050505050565b61104c611894565b610c196000611944565b61105e611894565b60008111801561107057506105dc8111155b6110b45760405162461bcd60e51b8152602060048201526015602482015274125b9d985b1a59081c1959c81d1a1c995cda1bdb19605a1b60448201526064016109c0565b601055565b6110c1611894565b600081116111115760405162461bcd60e51b815260206004820152601b60248201527f47617320636f737420627566666572206d757374206265203e2030000000000060448201526064016109c0565b601355565b61111e611894565b610c19611994565b600080600360009054906101000a90046001600160a01b03166001600160a01b0316638e15f4736040518163ffffffff1660e01b8152600401602060405180830381865afa15801561117c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111a091906137ee565b9050600081136111fe5760405162461bcd60e51b815260206004820152602360248201527f52756c657320456e67696e653a20496e76616c6964204554482f55534420707260448201526269636560e81b60648201526084016109c0565b60035460408051633c05076160e21b815290516000926001600160a01b03169163f0141d849160048083019260209291908290030181865afa158015611248573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061126c9190613858565b9050600060128260ff1610156112a35761128782601261387b565b61129290600a613978565b61129c9084613987565b90506112c6565b6112ae60128361387b565b6112b990600a613978565b6112c3908461399e565b90505b600081116112e65760405162461bcd60e51b81526004016109c0906139c0565b9392505050565b6112f5611894565b600081116113555760405162461bcd60e51b815260206004820152602760248201527f5472616e73616374696f6e20646561646c696e652077696e646f77206d7573746044820152660206265203e20360cc1b60648201526084016109c0565b601455565b611362611894565b60008111801561137457506101f48111155b6113c05760405162461bcd60e51b815260206004820152601f60248201527f496e76616c6964206d617820736c6970706167652028302e31252d353025290060448201526064016109c0565b601855565b6113cd611894565b6000811161141d5760405162461bcd60e51b815260206004820152601b60248201527f507572636861736520616d6f756e74206d757374206265203e2030000000000060448201526064016109c0565b601155565b61142a611894565b600081116114855760405162461bcd60e51b815260206004820152602260248201527f4d696e2074696d65206265747765656e207374657073206d757374206265203e604482015261020360f41b60648201526084016109c0565b600f55565b611492611894565b600d805460ff199081169091556000600e81905560158054831690556016819055601a8054909216909155601b55565b6114ca611894565b6001600160a01b0381166115205760405162461bcd60e51b815260206004820152601c60248201527f43616e6e6f7420666c75736820746f207a65726f20616464726573730000000060448201526064016109c0565b600b546040516370a0823160e01b81523060048201526000916001600160a01b0316906370a0823190602401602060405180830381865afa158015611569573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061158d91906137ee565b90506019548161159d919061381d565b90508015610a6b57600b5460405163a9059cbb60e01b81526001600160a01b038481166004830152602482018490529091169063a9059cbb906044016020604051808303816000875af11580156115f8573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061161c9190613836565b5060006019555050565b61162e611894565b6000811161167e5760405162461bcd60e51b815260206004820152601b60248201527f507572636861736520616d6f756e74206d757374206265203e2030000000000060448201526064016109c0565b601755565b61168b611894565b6001600160a01b0381166116f05760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016109c0565b6116f981611944565b50565b60006117066119d7565b61170e611a30565b42611717611a7d565b1561175257600d5460ff161561174a57600f54600e54611737919061381d565b421061174557611745611bb6565b6117ec565b6117456121cf565b61175a612285565b801561176957506117696123fa565b1561179f5760155460ff161561179757600f54601654611789919061381d565b421061174557611745612589565b611745612b0a565b6117a7612285565b80156117b657506117b6612bc0565b156117ec57601a5460ff16156117e457600f54601b546117d6919061381d565b421061174557611745612c8a565b6117ec613275565b600c819055600254604051630fe18f2d60e31b8152600481018390526001600160a01b0390911690637f0c796890602401600060405180830381600087803b15801561183757600080fd5b505af115801561184b573d6000803e3d6000fd5b5050505061185761332b565b6040518181527fb90c98e2ec0431685d927934719a4e255262cb2ee5f5180d72a67b634b7fe8e09060200160405180910390a15050600180805590565b6000546001600160a01b03163314610c195760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016109c0565b6118f661361f565b6000805460ff60a01b191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b0390911681526020015b60405180910390a1565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b61199c611a30565b6000805460ff60a01b1916600160a01b1790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586119263390565b600260015403611a295760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016109c0565b6002600155565b600054600160a01b900460ff1615610c195760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b60448201526064016109c0565b600080600560009054906101000a90046001600160a01b03166001600160a01b031663303382f66040518163ffffffff1660e01b8152600401602060405180830381865afa158015611ad3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611af791906137ee565b9050611b0e620f4240670de0b6b3a764000061399e565b611b189082613987565b90506000611b24610e5e565b90506000612710601054612710611b3b9190613a05565b611b459084613987565b611b4f919061399e565b604080516080808252601390820152725853442062656c6f772070656720636865636b60681b60a0820152602081018690529081018290528185106060820152909150600080516020613c938339815191529060c00160405180910390a190911092915050565b611bbe611a7d565b611c0a576040805181815260119181019190915270585344206e6f742062656c6f772070656760781b6060820152426020820152600080516020613c538339815191529060800161193a565b6000611c14611126565b90506000816011546c0c9f2c9cd04674edea40000000611c349190613987565b611c3e919061399e565b905080600003611c7157600080516020613c5383398151915242604051611c659190613a18565b60405180910390a15050565b6013546040805160808082526016908201527522aa241030b6b7bab73a1031b0b631bab630ba34b7b760511b60a08201526020810184905280820192909252821515606083015251600080516020613c938339815191529181900360c00190a1600060135482611ce1919061381d565b9050600080611cee61366f565b91509150816001600160701b031660001480611d1157506001600160701b038116155b15611d4257600080516020613c5383398151915242604051611d339190613a63565b60405180910390a15050505050565b6002546001600160a01b03168031841115611d8457600080516020613c5383398151915242604051611d749190613a99565b60405180910390a1505050505050565b60025460405163732b5a0560e11b8152600481018690526000916001600160a01b03169063e656b40a906024016020604051808303816000875af1158015611dd0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611df49190613836565b905080611e2957600080516020613c5383398151915242604051611e189190613ac9565b60405180910390a150505050505050565b6000836001600160701b0316856001600160701b031688611e4a9190613987565b611e54919061399e565b905080600003611ec45760408051818152601b818301527f457870656374656420585344206f7574707574206973207a65726f000000000060608201524260208201529051600080516020613c538339815191529181900360800190a1611eba876136f3565b5050505050505050565b6000601254600a611ed59190613987565b90506000612710611ee68382613a05565b611ef09085613987565b611efa919061399e565b9050600060145442611f0c919061381d565b600a546040516370a0823160e01b81523060048201529192506000916001600160a01b03909116906370a0823190602401602060405180830381865afa158015611f5a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f7e91906137ee565b60075460405163b15f62e760e01b815260048101869052602481018590529192506001600160a01b03169063b15f62e7908d906044016000604051808303818588803b158015611fcd57600080fd5b505af1158015611fe1573d6000803e3d6000fd5b5050600a546040516370a0823160e01b8152306004820152600094506001600160a01b0390911692506370a082319150602401602060405180830381865afa158015612031573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061205591906137ee565b905060006120638383613a05565b600a5460025460405163095ea7b360e01b81526001600160a01b03918216600482015260248101849052929350169063095ea7b3906044016020604051808303816000875af11580156120ba573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906120de9190613836565b50600254604051631ef16d9360e31b8152600481018390526001600160a01b039091169063f78b6c9890602401600060405180830381600087803b15801561212557600080fd5b505af1158015612139573d6000803e3d6000fd5b5050604080518481524260208201527fa6bcff7327a59a4537b80c4a4fb16db320e0a7621b2cdda1d9f73b56703bcbae935001905060405180910390a1600d805460ff19169055604080518e815260208101839052428183015290517f1e8e878037ccb9400e67d82c2a2cac22012d87c3dcddcfc54de3f9fb669aa1a29181900360600190a15050505050505050505050505050565b600560009054906101000a90046001600160a01b03166001600160a01b03166380524e596040518163ffffffff1660e01b8152600401600060405180830381600087803b15801561221f57600080fd5b505af1158015612233573d6000803e3d6000fd5b5050600d805460ff1916600190811790915542600e8190556040805191825260208201929092527ff6c9c96ad33a30ff6233a8608897630f2ee260eebf96017d9a8b5eeb5a7bf1de935001905061193a565b600080600560009054906101000a90046001600160a01b03166001600160a01b031663303382f66040518163ffffffff1660e01b8152600401602060405180830381865afa1580156122db573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906122ff91906137ee565b9050612316620f4240670de0b6b3a764000061399e565b6123209082613987565b9050600061232c610e5e565b905060006127106010546127106123439190613a05565b61234d9084613987565b612357919061399e565b9050600061271060105461271061236e919061381d565b6123789085613987565b612382919061399e565b905060008285101580156123965750818511155b6040805160808082526010908201526f5853442061742070656720636865636b60801b60a0820152602081018890529081018690528115156060820152909150600080516020613c938339815191529060c00160405180910390a195945050505050565b600080600560009054906101000a90046001600160a01b03166001600160a01b031663ca2f9c486040518163ffffffff1660e01b8152600401602060405180830381865afa158015612450573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906124749190613836565b90508061248357600091505090565b6005546040805163af3542ad60e01b815290516000926001600160a01b03169163af3542ad9160048083019260209291908290030181865afa1580156124cd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906124f191906137ee565b90506000600560009054906101000a90046001600160a01b03166001600160a01b0316636aa109936040518163ffffffff1660e01b8152600401602060405180830381865afa158015612548573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061256c91906137ee565b905080821161257f576000935050505090565b6001935050505090565b6005546040805163af3542ad60e01b815290516000926001600160a01b03169163af3542ad9160048083019260209291908290030181865afa1580156125d3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906125f791906137ee565b90506000600560009054906101000a90046001600160a01b03166001600160a01b0316636aa109936040518163ffffffff1660e01b8152600401602060405180830381865afa15801561264e573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061267291906137ee565b905060006126808284613a05565b604080518281524260208201529192507fb08ba1c49e85fa1e9baef9c91350617d103447a4c0f807b2237c99c66a11c04f910160405180910390a1604080518281524260208201527fe016044a4a247816f1e34086702eefd441fb174638fa416ea66559c5b5a25212910160405180910390a16002546013546001600160a01b039091169081311161277c57604080518181526018918101919091527f496e73756666696369656e742045544820666f7220676173000000000000000060608201524260208201527fa8132e228fce5817918dae66a0b9272ce6f59ff8387cae41ba65a610747903c7906080015b60405180910390a150505050565b60006064601354836001600160a01b0316316127989190613a05565b6127a390605f613987565b6127ad919061399e565b905060006127b9611126565b905060006127d2620f4240670de0b6b3a764000061399e565b6127dc9086613987565b90506000826127f3670de0b6b3a764000084613987565b6127fd919061399e565b9050600081851061280e5781612810565b845b90508060000361288a5760408051818152601d818301527f43616c63756c617465642045544820616d6f756e74206973207a65726f000000606082015242602082015290517fa8132e228fce5817918dae66a0b9272ce6f59ff8387cae41ba65a610747903c79181900360800190a1505050505050505050565b6040805160808082526019908201527f4c69717569646974792073656c6c2045544820616d6f756e740000000000000060a0820152602081018390529081018890528115156060820152600080516020613c938339815191529060c00160405180910390a16000601354826128ff919061381d565b60025460405163732b5a0560e11b8152600481018390529192506000916001600160a01b039091169063e656b40a906024016020604051808303816000875af1158015612950573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906129749190613836565b9050806129ff57604080518181526029818301527f4661696c656420746f207769746864726177204554482066726f6d20547265616060820152681cdd5c9e48141bdbdb60ba1b608082015242602082015290517fa8132e228fce5817918dae66a0b9272ce6f59ff8387cae41ba65a610747903c79181900360a00190a15050505050505050505050565b604080518381524260208201527fcb0be743e45c8e7be0cc5f52a51a5c0309146ae4126f21bfdc0fb44a20bbee12910160405180910390a1600060145442612a47919061381d565b600754600854604051631d906ba760e11b81526001600160a01b039182166004820152602481018490529293501690633b20d74e9086906044016000604051808303818588803b158015612a9a57600080fd5b505af1158015612aae573d6000803e3d6000fd5b5050604080518881524260208201527f49d857f7fba8b1f25ff18d826f4ff74022b29b38f2cfc7b1615b1a2598e2b8129450019150612aea9050565b60405180910390a150506015805460ff1916905550505050505050505050565b600560009054906101000a90046001600160a01b03166001600160a01b03166380524e596040518163ffffffff1660e01b8152600401600060405180830381600087803b158015612b5a57600080fd5b505af1158015612b6e573d6000803e3d6000fd5b50506015805460ff191660019081179091554260168190556040805191825260208201929092527f9e6aa7518705968b5cede54a4cee29e2ffe611ebbe54ccb568e3d122d51e5bc4935001905061193a565b6002546000906001600160a01b031681612bd8611126565b9050624c4b40600082612bf8836c0c9f2c9cd04674edea40000000613987565b612c02919061399e565b9050600060135482612c14919061381d565b6040805160808082526014908201527342616e6b5820707572636861736520636865636b60601b60a08201526001600160a01b038816803160208301529181018390529031821060608201819052919250600080516020613c938339815191529060c00160405180910390a19695505050505050565b612c92612285565b612ce357604080516060808252600e908201526d585344206e6f742061742070656760901b6080820152600060208201524291810191909152600080516020613c738339815191529060a00161193a565b612ceb6123fa565b15612d4c57604080516060808252601c908201527f4c697175696469747920636170616369747920617661696c61626c65000000006080820152600060208201524291810191909152600080516020613c738339815191529060a00161193a565b600080612d57613756565b91509150816001600160701b031660001480612d7a57506001600160701b038116155b15612d9f57600080516020613c73833981519152600042604051611c65929190613afe565b6000612da9611126565b90506000816017546c0c9f2c9cd04674edea40000000612dc99190613987565b612dd3919061399e565b905080600003612dfd57600080516020613c7383398151915260004260405161276e929190613b44565b601754604080516080808252601c908201527f42616e6b582045544820616d6f756e742063616c63756c6174696f6e0000000060a08201526020810184905280820192909252821515606083015251600080516020613c938339815191529181900360c00190a1600060135482612e74919061381d565b6002549091506001600160a01b03168031821115612eac57600080516020613c73833981519152600042604051611d74929190613b81565b60025460405163732b5a0560e11b8152600481018490526000916001600160a01b03169063e656b40a906024016020604051808303816000875af1158015612ef8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612f1c9190613836565b905080612f4357600080516020613c73833981519152600042604051611e18929190613bb1565b604080518481524260208201527f312f34410e09be2921360a00b14d5591ae1509b87e79776ff02ab8010a7caccf910160405180910390a16000866001600160701b0316886001600160701b031686612f9c9190613987565b612fa6919061399e565b90506000601854600a612fb99190613987565b60185460408051838152602081019290925242908201529091507fd0866cd9a3c49c46b7a2b1677d1713ce18ca121772213e9354e4194001e869859060600160405180910390a18160000361307757604080516060808252601d908201527f45787065637465642042616e6b58206f7574707574206973207a65726f00000060808201526000602082015242818301529051600080516020613c738339815191529181900360a00190a161306c856136f3565b505050505050505050565b60006127106130868382613a05565b6130909085613987565b61309a919061399e565b90506000601454426130ac919061381d565b600b546040516370a0823160e01b81523060048201529192506000916001600160a01b03909116906370a0823190602401602060405180830381865afa1580156130fa573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061311e91906137ee565b600754604051630c2a19bf60e21b815260048101869052602481018590529192506001600160a01b0316906330a866fc908b906044016000604051808303818588803b15801561316d57600080fd5b505af1158015613181573d6000803e3d6000fd5b5050600b546040516370a0823160e01b8152306004820152600094506001600160a01b0390911692506370a082319150602401602060405180830381865afa1580156131d1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906131f591906137ee565b905060006132038383613a05565b905080601e6000828254613217919061381d565b9091555050604080518c815260208101839052428183015290517f2e8f0686967aeb83ad79489ba699d08a72324cde49fe4d2246e0a8b5b74a39019181900360600190a15050601a805460ff19169055505050505050505050505050565b600560009054906101000a90046001600160a01b03166001600160a01b03166380524e596040518163ffffffff1660e01b8152600401600060405180830381600087803b1580156132c557600080fd5b505af11580156132d9573d6000803e3d6000fd5b5050601a805460ff1916600190811790915542601b8190556040805191825260208201929092527ff98c79a420d284fa9fccbba96f4bb32db3ab650d64a99a5df4f695e8717d24f8935001905061193a565b601d54601c5461333b919061381d565b42101561334457565b600b546040516370a0823160e01b81523060048201526000916001600160a01b0316906370a0823190602401602060405180830381865afa15801561338d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906133b191906137ee565b9050601954816133c1919061381d565b9050806000036133ce5750565b604080518281524260208201527f74f46507e63e5aa1ac4a0f8bfb7ccf74707049e735ecb28cc18a156ea8882bd8910160405180910390a1600b546040516370a0823160e01b81523060048201526000916001600160a01b0316906370a0823190602401602060405180830381865afa15801561344f573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061347391906137ee565b600b54604051630852cd8d60e31b8152600481018590529192506001600160a01b0316906342966c6890602401600060405180830381600087803b1580156134ba57600080fd5b505af11580156134ce573d6000803e3d6000fd5b5050600b546040516370a0823160e01b8152306004820152600093506001600160a01b0390911691506370a0823190602401602060405180830381865afa15801561351d573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061354191906137ee565b9050808211156135c25760006135578284613a05565b90506135638185613a05565b60195542601c55601f805482919060009061357f90849061381d565b9091555050604080518281524260208201527fc49f0961ab9db9428454edbcf70875fb788fdcdeabfe45ec201c477fef5d18b0910160405180910390a150610a69565b601983905560408051606080825260159082015274109d5c9b881bdc195c985d1a5bdb8819985a5b1959605a1b60808201526020810185905242818301529051600080516020613c738339815191529181900360a00190a1505050565b600054600160a01b900460ff16610c195760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b60448201526064016109c0565b600080600860009054906101000a90046001600160a01b03166001600160a01b0316630902f1ac6040518163ffffffff1660e01b8152600401606060405180830381865afa1580156136c5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906136e99190613c02565b5090939092509050565b60025460405163f52cc91360e01b8152600481018390526001600160a01b039091169063f52cc9139083906024016000604051808303818588803b15801561373a57600080fd5b505af115801561374e573d6000803e3d6000fd5b505050505050565b600080600960009054906101000a90046001600160a01b03166001600160a01b0316630902f1ac6040518163ffffffff1660e01b8152600401606060405180830381865afa1580156136c5573d6000803e3d6000fd5b6000602082840312156137be57600080fd5b81356001600160a01b03811681146112e657600080fd5b6000602082840312156137e757600080fd5b5035919050565b60006020828403121561380057600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b8082018082111561383057613830613807565b92915050565b60006020828403121561384857600080fd5b815180151581146112e657600080fd5b60006020828403121561386a57600080fd5b815160ff811681146112e657600080fd5b60ff828116828216039081111561383057613830613807565b600181815b808511156138cf5781600019048211156138b5576138b5613807565b808516156138c257918102915b93841c9390800290613899565b509250929050565b6000826138e657506001613830565b816138f357506000613830565b816001811461390957600281146139135761392f565b6001915050613830565b60ff84111561392457613924613807565b50506001821b613830565b5060208310610133831016604e8410600b8410161715613952575081810a613830565b61395c8383613894565b806000190482111561397057613970613807565b029392505050565b60006112e660ff8416836138d7565b808202811582820484141761383057613830613807565b6000826139bb57634e487b7160e01b600052601260045260246000fd5b500490565b60208082526025908201527f52756c657320456e67696e653a20507269636520636f6e76657274656420746f604082015264207a65726f60d81b606082015260800190565b8181038181111561383057613830613807565b604081526000613a5560408301601d81527f45544820616d6f756e742063616c63756c61746564206173207a65726f000000602082015260400190565b905082602083015292915050565b604081526000613a55604083016016815275506f6f6c20726573657276657320617265207a65726f60501b602082015260400190565b604081526000613a5560408301601081526f092dce6eaccccd2c6d2cadce8408aa8960831b602082015260400190565b604081526000613a55604083016015815274115512081dda5d1a191c985dd85b0819985a5b1959605a1b602082015260400190565b606081526000613b34606083016016815275506f6f6c20726573657276657320617265207a65726f60501b602082015260400190565b6020830194909452506040015290565b606081526000613b3460608301601d81527f45544820616d6f756e742063616c63756c61746564206173207a65726f000000602082015260400190565b606081526000613b3460608301601081526f092dce6eaccccd2c6d2cadce8408aa8960831b602082015260400190565b606081526000613b34606083016015815274115512081dda5d1a191c985dd85b0819985a5b1959605a1b602082015260400190565b80516001600160701b0381168114613bfd57600080fd5b919050565b600080600060608486031215613c1757600080fd5b613c2084613be6565b9250613c2e60208501613be6565b9150604084015163ffffffff81168114613c4757600080fd5b80915050925092509256fea93def8ebc799bf4d99ab7a5e261dab99d8495022ae474f710b7ac2c937357e32e58990f396e219eea40d80fc13ff05a8d62c4f477b86172e51e26cc91004c3a90f6b96915e8e55bd8e86cd2a8ff5028094874f7fb6c3237241a2ac9cea4f7c0a26469706673582212208ace7d444723c6c427958973496505139bd0f600e32b1f44d83629a3d6b9a72864736f6c63430008140033000000000000000000000000b64adc2dbd4106fd29aa2156965731801c76c4e50000000000000000000000002520648a8378dbc06a58e7e49dc5f7a8ddcc741d000000000000000000000000c2e61363e8a299e312ae13eac7db5e0aef1fbe9c000000000000000000000000a6fd872f0f6cf467cd0c2b8352d9e5046d6926a90000000000000000000000001d2e397bbc4b47d015bf8f9f3090cb840964d21b00000000000000000000000053f51fcdf06946aafe25f14d2f1c9b66e71ca6830000000000000000000000002147f5c02c2869e8c2d8f86471d3d7500355d69800000000000000000000000075cae30025a514b7ae069917e132cc99762a0e1600000000000000000000000013e636cbfd6a7d33a8df7ebbf42f63adc9bb592a0000000000000000000000002a0c55d66482e801abbae0271fe1bf43b9d03d2c

Deployed Bytecode

0x6080604052600436106103545760003560e01c806382cc696d116101c6578063b5a3acf9116100f7578063dd76b54d11610095578063eadac2fd1161006f578063eadac2fd146108fb578063f2fde38b14610911578063f887ea4014610931578063fce8f8931461095157600080fd5b8063dd76b54d146108a5578063e1f83d89146108c5578063e48d2100146108db57600080fd5b8063c597e802116100d1578063c597e80214610836578063c6f7599014610856578063cb967dc614610876578063d5d5aa651461088b57600080fd5b8063b5a3acf9146107e0578063bfc45a1614610800578063c4144af31461082057600080fd5b80638fdf7c8211610164578063a37f94f61161013e578063a37f94f614610770578063a588fc1e14610790578063aa507202146107b0578063ae909538146107ca57600080fd5b80638fdf7c821461072f57806394c77638146107455780639fd2f75b1461075a57600080fd5b8063898622e8116101a0578063898622e8146106cf5780638ae6ee2e146106e55780638c04166f146106fb5780638da5cb5b1461071157600080fd5b806382cc696d1461067a5780638327700a1461069a5780638456cb59146106ba57600080fd5b80633f4ba83a116102a05780635c975abb1161023e578063715018a611610218578063715018a61461060f57806371e07e84146106245780637fdeae651461063a5780638009b7bd1461065a57600080fd5b80635c975abb146105c4578063634b5948146105e357806363dc80ab146105f957600080fd5b806343f68a491161027a57806343f68a491461054f57806348df58291461056f5780634e279b791461058f57806355fb0b83146105a457600080fd5b80633f4ba83a146104fa57806341cb87fc1461050f578063425170e21461052f57600080fd5b80632115594b1161030d57806332ea099a116102e757806332ea099a1461049957806333579c10146104ae578063337247fa146104c4578063358d1fc6146104e457600080fd5b80632115594b1461044d57806323396d07146104635780632f0ded811461048357600080fd5b806306c2d5e51461036057806306cdb51a1461039d5780630f4ef8a6146103c7578063134dfcd8146103e7578063153ee554146104095780631cd6b20e1461042957600080fd5b3661035b57005b600080fd5b34801561036c57600080fd5b50600854610380906001600160a01b031681565b6040516001600160a01b0390911681526020015b60405180910390f35b3480156103a957600080fd5b50601a546103b79060ff1681565b6040519015158152602001610394565b3480156103d357600080fd5b50600654610380906001600160a01b031681565b3480156103f357600080fd5b506104076104023660046137ac565b610966565b005b34801561041557600080fd5b506104076104243660046137ac565b610a6f565b34801561043557600080fd5b5061043f60195481565b604051908152602001610394565b34801561045957600080fd5b5061043f601c5481565b34801561046f57600080fd5b5061040761047e3660046137ac565b610afd565b34801561048f57600080fd5b5061043f60115481565b3480156104a557600080fd5b5061043f610b89565b3480156104ba57600080fd5b5061043f60175481565b3480156104d057600080fd5b50600454610380906001600160a01b031681565b3480156104f057600080fd5b5061043f600c5481565b34801561050657600080fd5b50610407610c09565b34801561051b57600080fd5b5061040761052a3660046137ac565b610c1b565b34801561053b57600080fd5b5061040761054a3660046137ac565b610ca9565b34801561055b57600080fd5b5061040761056a3660046137d5565b610df3565b34801561057b57600080fd5b50600254610380906001600160a01b031681565b34801561059b57600080fd5b5061043f610e5e565b3480156105b057600080fd5b50600a54610380906001600160a01b031681565b3480156105d057600080fd5b50600054600160a01b900460ff166103b7565b3480156105ef57600080fd5b5061043f601e5481565b34801561060557600080fd5b5061043f601d5481565b34801561061b57600080fd5b50610407611044565b34801561063057600080fd5b5061043f60185481565b34801561064657600080fd5b506104076106553660046137d5565b611056565b34801561066657600080fd5b50600354610380906001600160a01b031681565b34801561068657600080fd5b506104076106953660046137d5565b6110b9565b3480156106a657600080fd5b50600554610380906001600160a01b031681565b3480156106c657600080fd5b50610407611116565b3480156106db57600080fd5b5061043f60135481565b3480156106f157600080fd5b5061043f600e5481565b34801561070757600080fd5b5061043f60125481565b34801561071d57600080fd5b506000546001600160a01b0316610380565b34801561073b57600080fd5b5061043f60105481565b34801561075157600080fd5b5061043f611126565b34801561076657600080fd5b5061043f601b5481565b34801561077c57600080fd5b5061040761078b3660046137d5565b6112ed565b34801561079c57600080fd5b50600954610380906001600160a01b031681565b3480156107bc57600080fd5b506015546103b79060ff1681565b3480156107d657600080fd5b5061043f601f5481565b3480156107ec57600080fd5b506104076107fb3660046137d5565b61135a565b34801561080c57600080fd5b5061040761081b3660046137d5565b6113c5565b34801561082c57600080fd5b5061043f60145481565b34801561084257600080fd5b50600b54610380906001600160a01b031681565b34801561086257600080fd5b506104076108713660046137d5565b611422565b34801561088257600080fd5b5061040761148a565b34801561089757600080fd5b50600d546103b79060ff1681565b3480156108b157600080fd5b506104076108c03660046137ac565b6114c2565b3480156108d157600080fd5b5061043f600f5481565b3480156108e757600080fd5b506104076108f63660046137d5565b611626565b34801561090757600080fd5b5061043f60165481565b34801561091d57600080fd5b5061040761092c3660046137ac565b611683565b34801561093d57600080fd5b50600754610380906001600160a01b031681565b34801561095d57600080fd5b506103b76116fc565b61096e611894565b6001600160a01b0381166109c95760405162461bcd60e51b815260206004820152601e60248201527f43616e6e6f74207265636f76657220746f207a65726f2061646472657373000060448201526064015b60405180910390fd5b478015610a6b576000826001600160a01b03168260405160006040518083038185875af1925050503d8060008114610a1d576040519150601f19603f3d011682016040523d82523d6000602084013e610a22565b606091505b5050905080610a695760405162461bcd60e51b8152602060048201526013602482015272115512081d1c985b9cd9995c8819985a5b1959606a1b60448201526064016109c0565b505b5050565b610a77611894565b6001600160a01b038116610adb5760405162461bcd60e51b815260206004820152602560248201527f526577617264204d616e616765722063616e6e6f74206265207a65726f206164604482015264647265737360d81b60648201526084016109c0565b600680546001600160a01b0319166001600160a01b0392909216919091179055565b610b05611894565b6001600160a01b038116610b675760405162461bcd60e51b8152602060048201526024808201527f547265617375727920506f6f6c2063616e6e6f74206265207a65726f206164646044820152637265737360e01b60648201526084016109c0565b600280546001600160a01b0319166001600160a01b0392909216919091179055565b601954600b546040516370a0823160e01b8152306004820152600092916001600160a01b0316906370a0823190602401602060405180830381865afa158015610bd6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bfa91906137ee565b610c04919061381d565b905090565b610c11611894565b610c196118ee565b565b610c23611894565b6001600160a01b038116610c875760405162461bcd60e51b815260206004820152602560248201527f526f7574657220616464726573732063616e6e6f74206265207a65726f206164604482015264647265737360d81b60648201526084016109c0565b600780546001600160a01b0319166001600160a01b0392909216919091179055565b610cb1611894565b6001600160a01b038116610d075760405162461bcd60e51b815260206004820152601c60248201527f43616e6e6f7420666c75736820746f207a65726f20616464726573730000000060448201526064016109c0565b600a546040516370a0823160e01b81523060048201526000916001600160a01b0316906370a0823190602401602060405180830381865afa158015610d50573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d7491906137ee565b90508015610a6b57600a5460405163a9059cbb60e01b81526001600160a01b038481166004830152602482018490529091169063a9059cbb906044016020604051808303816000875af1158015610dcf573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a699190613836565b610dfb611894565b600081118015610e0d57506101f48111155b610e595760405162461bcd60e51b815260206004820152601f60248201527f496e76616c6964206d617820736c6970706167652028302e31252d353025290060448201526064016109c0565b601255565b6004805460408051638e15f47360e01b8152905160009384936001600160a01b031692638e15f47392818301926020928290030181865afa158015610ea7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ecb91906137ee565b905060008113610f2c5760405162461bcd60e51b815260206004820152602660248201527f52756c657320456e67696e653a20496e76616c69642053696c7665722f55534460448201526520707269636560d01b60648201526084016109c0565b6000600460009054906101000a90046001600160a01b03166001600160a01b031663f0141d846040518163ffffffff1660e01b8152600401602060405180830381865afa158015610f81573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610fa59190613858565b9050600060128260ff161015610fdc57610fc082601261387b565b610fcb90600a613978565b610fd59084613987565b9050610fff565b610fe760128361387b565b610ff290600a613978565b610ffc908461399e565b90505b6000811161101f5760405162461bcd60e51b81526004016109c0906139c0565b60006204befb61103183612710613987565b61103b919061399e565b95945050505050565b61104c611894565b610c196000611944565b61105e611894565b60008111801561107057506105dc8111155b6110b45760405162461bcd60e51b8152602060048201526015602482015274125b9d985b1a59081c1959c81d1a1c995cda1bdb19605a1b60448201526064016109c0565b601055565b6110c1611894565b600081116111115760405162461bcd60e51b815260206004820152601b60248201527f47617320636f737420627566666572206d757374206265203e2030000000000060448201526064016109c0565b601355565b61111e611894565b610c19611994565b600080600360009054906101000a90046001600160a01b03166001600160a01b0316638e15f4736040518163ffffffff1660e01b8152600401602060405180830381865afa15801561117c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111a091906137ee565b9050600081136111fe5760405162461bcd60e51b815260206004820152602360248201527f52756c657320456e67696e653a20496e76616c6964204554482f55534420707260448201526269636560e81b60648201526084016109c0565b60035460408051633c05076160e21b815290516000926001600160a01b03169163f0141d849160048083019260209291908290030181865afa158015611248573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061126c9190613858565b9050600060128260ff1610156112a35761128782601261387b565b61129290600a613978565b61129c9084613987565b90506112c6565b6112ae60128361387b565b6112b990600a613978565b6112c3908461399e565b90505b600081116112e65760405162461bcd60e51b81526004016109c0906139c0565b9392505050565b6112f5611894565b600081116113555760405162461bcd60e51b815260206004820152602760248201527f5472616e73616374696f6e20646561646c696e652077696e646f77206d7573746044820152660206265203e20360cc1b60648201526084016109c0565b601455565b611362611894565b60008111801561137457506101f48111155b6113c05760405162461bcd60e51b815260206004820152601f60248201527f496e76616c6964206d617820736c6970706167652028302e31252d353025290060448201526064016109c0565b601855565b6113cd611894565b6000811161141d5760405162461bcd60e51b815260206004820152601b60248201527f507572636861736520616d6f756e74206d757374206265203e2030000000000060448201526064016109c0565b601155565b61142a611894565b600081116114855760405162461bcd60e51b815260206004820152602260248201527f4d696e2074696d65206265747765656e207374657073206d757374206265203e604482015261020360f41b60648201526084016109c0565b600f55565b611492611894565b600d805460ff199081169091556000600e81905560158054831690556016819055601a8054909216909155601b55565b6114ca611894565b6001600160a01b0381166115205760405162461bcd60e51b815260206004820152601c60248201527f43616e6e6f7420666c75736820746f207a65726f20616464726573730000000060448201526064016109c0565b600b546040516370a0823160e01b81523060048201526000916001600160a01b0316906370a0823190602401602060405180830381865afa158015611569573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061158d91906137ee565b90506019548161159d919061381d565b90508015610a6b57600b5460405163a9059cbb60e01b81526001600160a01b038481166004830152602482018490529091169063a9059cbb906044016020604051808303816000875af11580156115f8573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061161c9190613836565b5060006019555050565b61162e611894565b6000811161167e5760405162461bcd60e51b815260206004820152601b60248201527f507572636861736520616d6f756e74206d757374206265203e2030000000000060448201526064016109c0565b601755565b61168b611894565b6001600160a01b0381166116f05760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016109c0565b6116f981611944565b50565b60006117066119d7565b61170e611a30565b42611717611a7d565b1561175257600d5460ff161561174a57600f54600e54611737919061381d565b421061174557611745611bb6565b6117ec565b6117456121cf565b61175a612285565b801561176957506117696123fa565b1561179f5760155460ff161561179757600f54601654611789919061381d565b421061174557611745612589565b611745612b0a565b6117a7612285565b80156117b657506117b6612bc0565b156117ec57601a5460ff16156117e457600f54601b546117d6919061381d565b421061174557611745612c8a565b6117ec613275565b600c819055600254604051630fe18f2d60e31b8152600481018390526001600160a01b0390911690637f0c796890602401600060405180830381600087803b15801561183757600080fd5b505af115801561184b573d6000803e3d6000fd5b5050505061185761332b565b6040518181527fb90c98e2ec0431685d927934719a4e255262cb2ee5f5180d72a67b634b7fe8e09060200160405180910390a15050600180805590565b6000546001600160a01b03163314610c195760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016109c0565b6118f661361f565b6000805460ff60a01b191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b0390911681526020015b60405180910390a1565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b61199c611a30565b6000805460ff60a01b1916600160a01b1790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586119263390565b600260015403611a295760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016109c0565b6002600155565b600054600160a01b900460ff1615610c195760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b60448201526064016109c0565b600080600560009054906101000a90046001600160a01b03166001600160a01b031663303382f66040518163ffffffff1660e01b8152600401602060405180830381865afa158015611ad3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611af791906137ee565b9050611b0e620f4240670de0b6b3a764000061399e565b611b189082613987565b90506000611b24610e5e565b90506000612710601054612710611b3b9190613a05565b611b459084613987565b611b4f919061399e565b604080516080808252601390820152725853442062656c6f772070656720636865636b60681b60a0820152602081018690529081018290528185106060820152909150600080516020613c938339815191529060c00160405180910390a190911092915050565b611bbe611a7d565b611c0a576040805181815260119181019190915270585344206e6f742062656c6f772070656760781b6060820152426020820152600080516020613c538339815191529060800161193a565b6000611c14611126565b90506000816011546c0c9f2c9cd04674edea40000000611c349190613987565b611c3e919061399e565b905080600003611c7157600080516020613c5383398151915242604051611c659190613a18565b60405180910390a15050565b6013546040805160808082526016908201527522aa241030b6b7bab73a1031b0b631bab630ba34b7b760511b60a08201526020810184905280820192909252821515606083015251600080516020613c938339815191529181900360c00190a1600060135482611ce1919061381d565b9050600080611cee61366f565b91509150816001600160701b031660001480611d1157506001600160701b038116155b15611d4257600080516020613c5383398151915242604051611d339190613a63565b60405180910390a15050505050565b6002546001600160a01b03168031841115611d8457600080516020613c5383398151915242604051611d749190613a99565b60405180910390a1505050505050565b60025460405163732b5a0560e11b8152600481018690526000916001600160a01b03169063e656b40a906024016020604051808303816000875af1158015611dd0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611df49190613836565b905080611e2957600080516020613c5383398151915242604051611e189190613ac9565b60405180910390a150505050505050565b6000836001600160701b0316856001600160701b031688611e4a9190613987565b611e54919061399e565b905080600003611ec45760408051818152601b818301527f457870656374656420585344206f7574707574206973207a65726f000000000060608201524260208201529051600080516020613c538339815191529181900360800190a1611eba876136f3565b5050505050505050565b6000601254600a611ed59190613987565b90506000612710611ee68382613a05565b611ef09085613987565b611efa919061399e565b9050600060145442611f0c919061381d565b600a546040516370a0823160e01b81523060048201529192506000916001600160a01b03909116906370a0823190602401602060405180830381865afa158015611f5a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f7e91906137ee565b60075460405163b15f62e760e01b815260048101869052602481018590529192506001600160a01b03169063b15f62e7908d906044016000604051808303818588803b158015611fcd57600080fd5b505af1158015611fe1573d6000803e3d6000fd5b5050600a546040516370a0823160e01b8152306004820152600094506001600160a01b0390911692506370a082319150602401602060405180830381865afa158015612031573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061205591906137ee565b905060006120638383613a05565b600a5460025460405163095ea7b360e01b81526001600160a01b03918216600482015260248101849052929350169063095ea7b3906044016020604051808303816000875af11580156120ba573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906120de9190613836565b50600254604051631ef16d9360e31b8152600481018390526001600160a01b039091169063f78b6c9890602401600060405180830381600087803b15801561212557600080fd5b505af1158015612139573d6000803e3d6000fd5b5050604080518481524260208201527fa6bcff7327a59a4537b80c4a4fb16db320e0a7621b2cdda1d9f73b56703bcbae935001905060405180910390a1600d805460ff19169055604080518e815260208101839052428183015290517f1e8e878037ccb9400e67d82c2a2cac22012d87c3dcddcfc54de3f9fb669aa1a29181900360600190a15050505050505050505050505050565b600560009054906101000a90046001600160a01b03166001600160a01b03166380524e596040518163ffffffff1660e01b8152600401600060405180830381600087803b15801561221f57600080fd5b505af1158015612233573d6000803e3d6000fd5b5050600d805460ff1916600190811790915542600e8190556040805191825260208201929092527ff6c9c96ad33a30ff6233a8608897630f2ee260eebf96017d9a8b5eeb5a7bf1de935001905061193a565b600080600560009054906101000a90046001600160a01b03166001600160a01b031663303382f66040518163ffffffff1660e01b8152600401602060405180830381865afa1580156122db573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906122ff91906137ee565b9050612316620f4240670de0b6b3a764000061399e565b6123209082613987565b9050600061232c610e5e565b905060006127106010546127106123439190613a05565b61234d9084613987565b612357919061399e565b9050600061271060105461271061236e919061381d565b6123789085613987565b612382919061399e565b905060008285101580156123965750818511155b6040805160808082526010908201526f5853442061742070656720636865636b60801b60a0820152602081018890529081018690528115156060820152909150600080516020613c938339815191529060c00160405180910390a195945050505050565b600080600560009054906101000a90046001600160a01b03166001600160a01b031663ca2f9c486040518163ffffffff1660e01b8152600401602060405180830381865afa158015612450573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906124749190613836565b90508061248357600091505090565b6005546040805163af3542ad60e01b815290516000926001600160a01b03169163af3542ad9160048083019260209291908290030181865afa1580156124cd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906124f191906137ee565b90506000600560009054906101000a90046001600160a01b03166001600160a01b0316636aa109936040518163ffffffff1660e01b8152600401602060405180830381865afa158015612548573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061256c91906137ee565b905080821161257f576000935050505090565b6001935050505090565b6005546040805163af3542ad60e01b815290516000926001600160a01b03169163af3542ad9160048083019260209291908290030181865afa1580156125d3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906125f791906137ee565b90506000600560009054906101000a90046001600160a01b03166001600160a01b0316636aa109936040518163ffffffff1660e01b8152600401602060405180830381865afa15801561264e573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061267291906137ee565b905060006126808284613a05565b604080518281524260208201529192507fb08ba1c49e85fa1e9baef9c91350617d103447a4c0f807b2237c99c66a11c04f910160405180910390a1604080518281524260208201527fe016044a4a247816f1e34086702eefd441fb174638fa416ea66559c5b5a25212910160405180910390a16002546013546001600160a01b039091169081311161277c57604080518181526018918101919091527f496e73756666696369656e742045544820666f7220676173000000000000000060608201524260208201527fa8132e228fce5817918dae66a0b9272ce6f59ff8387cae41ba65a610747903c7906080015b60405180910390a150505050565b60006064601354836001600160a01b0316316127989190613a05565b6127a390605f613987565b6127ad919061399e565b905060006127b9611126565b905060006127d2620f4240670de0b6b3a764000061399e565b6127dc9086613987565b90506000826127f3670de0b6b3a764000084613987565b6127fd919061399e565b9050600081851061280e5781612810565b845b90508060000361288a5760408051818152601d818301527f43616c63756c617465642045544820616d6f756e74206973207a65726f000000606082015242602082015290517fa8132e228fce5817918dae66a0b9272ce6f59ff8387cae41ba65a610747903c79181900360800190a1505050505050505050565b6040805160808082526019908201527f4c69717569646974792073656c6c2045544820616d6f756e740000000000000060a0820152602081018390529081018890528115156060820152600080516020613c938339815191529060c00160405180910390a16000601354826128ff919061381d565b60025460405163732b5a0560e11b8152600481018390529192506000916001600160a01b039091169063e656b40a906024016020604051808303816000875af1158015612950573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906129749190613836565b9050806129ff57604080518181526029818301527f4661696c656420746f207769746864726177204554482066726f6d20547265616060820152681cdd5c9e48141bdbdb60ba1b608082015242602082015290517fa8132e228fce5817918dae66a0b9272ce6f59ff8387cae41ba65a610747903c79181900360a00190a15050505050505050505050565b604080518381524260208201527fcb0be743e45c8e7be0cc5f52a51a5c0309146ae4126f21bfdc0fb44a20bbee12910160405180910390a1600060145442612a47919061381d565b600754600854604051631d906ba760e11b81526001600160a01b039182166004820152602481018490529293501690633b20d74e9086906044016000604051808303818588803b158015612a9a57600080fd5b505af1158015612aae573d6000803e3d6000fd5b5050604080518881524260208201527f49d857f7fba8b1f25ff18d826f4ff74022b29b38f2cfc7b1615b1a2598e2b8129450019150612aea9050565b60405180910390a150506015805460ff1916905550505050505050505050565b600560009054906101000a90046001600160a01b03166001600160a01b03166380524e596040518163ffffffff1660e01b8152600401600060405180830381600087803b158015612b5a57600080fd5b505af1158015612b6e573d6000803e3d6000fd5b50506015805460ff191660019081179091554260168190556040805191825260208201929092527f9e6aa7518705968b5cede54a4cee29e2ffe611ebbe54ccb568e3d122d51e5bc4935001905061193a565b6002546000906001600160a01b031681612bd8611126565b9050624c4b40600082612bf8836c0c9f2c9cd04674edea40000000613987565b612c02919061399e565b9050600060135482612c14919061381d565b6040805160808082526014908201527342616e6b5820707572636861736520636865636b60601b60a08201526001600160a01b038816803160208301529181018390529031821060608201819052919250600080516020613c938339815191529060c00160405180910390a19695505050505050565b612c92612285565b612ce357604080516060808252600e908201526d585344206e6f742061742070656760901b6080820152600060208201524291810191909152600080516020613c738339815191529060a00161193a565b612ceb6123fa565b15612d4c57604080516060808252601c908201527f4c697175696469747920636170616369747920617661696c61626c65000000006080820152600060208201524291810191909152600080516020613c738339815191529060a00161193a565b600080612d57613756565b91509150816001600160701b031660001480612d7a57506001600160701b038116155b15612d9f57600080516020613c73833981519152600042604051611c65929190613afe565b6000612da9611126565b90506000816017546c0c9f2c9cd04674edea40000000612dc99190613987565b612dd3919061399e565b905080600003612dfd57600080516020613c7383398151915260004260405161276e929190613b44565b601754604080516080808252601c908201527f42616e6b582045544820616d6f756e742063616c63756c6174696f6e0000000060a08201526020810184905280820192909252821515606083015251600080516020613c938339815191529181900360c00190a1600060135482612e74919061381d565b6002549091506001600160a01b03168031821115612eac57600080516020613c73833981519152600042604051611d74929190613b81565b60025460405163732b5a0560e11b8152600481018490526000916001600160a01b03169063e656b40a906024016020604051808303816000875af1158015612ef8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612f1c9190613836565b905080612f4357600080516020613c73833981519152600042604051611e18929190613bb1565b604080518481524260208201527f312f34410e09be2921360a00b14d5591ae1509b87e79776ff02ab8010a7caccf910160405180910390a16000866001600160701b0316886001600160701b031686612f9c9190613987565b612fa6919061399e565b90506000601854600a612fb99190613987565b60185460408051838152602081019290925242908201529091507fd0866cd9a3c49c46b7a2b1677d1713ce18ca121772213e9354e4194001e869859060600160405180910390a18160000361307757604080516060808252601d908201527f45787065637465642042616e6b58206f7574707574206973207a65726f00000060808201526000602082015242818301529051600080516020613c738339815191529181900360a00190a161306c856136f3565b505050505050505050565b60006127106130868382613a05565b6130909085613987565b61309a919061399e565b90506000601454426130ac919061381d565b600b546040516370a0823160e01b81523060048201529192506000916001600160a01b03909116906370a0823190602401602060405180830381865afa1580156130fa573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061311e91906137ee565b600754604051630c2a19bf60e21b815260048101869052602481018590529192506001600160a01b0316906330a866fc908b906044016000604051808303818588803b15801561316d57600080fd5b505af1158015613181573d6000803e3d6000fd5b5050600b546040516370a0823160e01b8152306004820152600094506001600160a01b0390911692506370a082319150602401602060405180830381865afa1580156131d1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906131f591906137ee565b905060006132038383613a05565b905080601e6000828254613217919061381d565b9091555050604080518c815260208101839052428183015290517f2e8f0686967aeb83ad79489ba699d08a72324cde49fe4d2246e0a8b5b74a39019181900360600190a15050601a805460ff19169055505050505050505050505050565b600560009054906101000a90046001600160a01b03166001600160a01b03166380524e596040518163ffffffff1660e01b8152600401600060405180830381600087803b1580156132c557600080fd5b505af11580156132d9573d6000803e3d6000fd5b5050601a805460ff1916600190811790915542601b8190556040805191825260208201929092527ff98c79a420d284fa9fccbba96f4bb32db3ab650d64a99a5df4f695e8717d24f8935001905061193a565b601d54601c5461333b919061381d565b42101561334457565b600b546040516370a0823160e01b81523060048201526000916001600160a01b0316906370a0823190602401602060405180830381865afa15801561338d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906133b191906137ee565b9050601954816133c1919061381d565b9050806000036133ce5750565b604080518281524260208201527f74f46507e63e5aa1ac4a0f8bfb7ccf74707049e735ecb28cc18a156ea8882bd8910160405180910390a1600b546040516370a0823160e01b81523060048201526000916001600160a01b0316906370a0823190602401602060405180830381865afa15801561344f573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061347391906137ee565b600b54604051630852cd8d60e31b8152600481018590529192506001600160a01b0316906342966c6890602401600060405180830381600087803b1580156134ba57600080fd5b505af11580156134ce573d6000803e3d6000fd5b5050600b546040516370a0823160e01b8152306004820152600093506001600160a01b0390911691506370a0823190602401602060405180830381865afa15801561351d573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061354191906137ee565b9050808211156135c25760006135578284613a05565b90506135638185613a05565b60195542601c55601f805482919060009061357f90849061381d565b9091555050604080518281524260208201527fc49f0961ab9db9428454edbcf70875fb788fdcdeabfe45ec201c477fef5d18b0910160405180910390a150610a69565b601983905560408051606080825260159082015274109d5c9b881bdc195c985d1a5bdb8819985a5b1959605a1b60808201526020810185905242818301529051600080516020613c738339815191529181900360a00190a1505050565b600054600160a01b900460ff16610c195760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b60448201526064016109c0565b600080600860009054906101000a90046001600160a01b03166001600160a01b0316630902f1ac6040518163ffffffff1660e01b8152600401606060405180830381865afa1580156136c5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906136e99190613c02565b5090939092509050565b60025460405163f52cc91360e01b8152600481018390526001600160a01b039091169063f52cc9139083906024016000604051808303818588803b15801561373a57600080fd5b505af115801561374e573d6000803e3d6000fd5b505050505050565b600080600960009054906101000a90046001600160a01b03166001600160a01b0316630902f1ac6040518163ffffffff1660e01b8152600401606060405180830381865afa1580156136c5573d6000803e3d6000fd5b6000602082840312156137be57600080fd5b81356001600160a01b03811681146112e657600080fd5b6000602082840312156137e757600080fd5b5035919050565b60006020828403121561380057600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b8082018082111561383057613830613807565b92915050565b60006020828403121561384857600080fd5b815180151581146112e657600080fd5b60006020828403121561386a57600080fd5b815160ff811681146112e657600080fd5b60ff828116828216039081111561383057613830613807565b600181815b808511156138cf5781600019048211156138b5576138b5613807565b808516156138c257918102915b93841c9390800290613899565b509250929050565b6000826138e657506001613830565b816138f357506000613830565b816001811461390957600281146139135761392f565b6001915050613830565b60ff84111561392457613924613807565b50506001821b613830565b5060208310610133831016604e8410600b8410161715613952575081810a613830565b61395c8383613894565b806000190482111561397057613970613807565b029392505050565b60006112e660ff8416836138d7565b808202811582820484141761383057613830613807565b6000826139bb57634e487b7160e01b600052601260045260246000fd5b500490565b60208082526025908201527f52756c657320456e67696e653a20507269636520636f6e76657274656420746f604082015264207a65726f60d81b606082015260800190565b8181038181111561383057613830613807565b604081526000613a5560408301601d81527f45544820616d6f756e742063616c63756c61746564206173207a65726f000000602082015260400190565b905082602083015292915050565b604081526000613a55604083016016815275506f6f6c20726573657276657320617265207a65726f60501b602082015260400190565b604081526000613a5560408301601081526f092dce6eaccccd2c6d2cadce8408aa8960831b602082015260400190565b604081526000613a55604083016015815274115512081dda5d1a191c985dd85b0819985a5b1959605a1b602082015260400190565b606081526000613b34606083016016815275506f6f6c20726573657276657320617265207a65726f60501b602082015260400190565b6020830194909452506040015290565b606081526000613b3460608301601d81527f45544820616d6f756e742063616c63756c61746564206173207a65726f000000602082015260400190565b606081526000613b3460608301601081526f092dce6eaccccd2c6d2cadce8408aa8960831b602082015260400190565b606081526000613b34606083016015815274115512081dda5d1a191c985dd85b0819985a5b1959605a1b602082015260400190565b80516001600160701b0381168114613bfd57600080fd5b919050565b600080600060608486031215613c1757600080fd5b613c2084613be6565b9250613c2e60208501613be6565b9150604084015163ffffffff81168114613c4757600080fd5b80915050925092509256fea93def8ebc799bf4d99ab7a5e261dab99d8495022ae474f710b7ac2c937357e32e58990f396e219eea40d80fc13ff05a8d62c4f477b86172e51e26cc91004c3a90f6b96915e8e55bd8e86cd2a8ff5028094874f7fb6c3237241a2ac9cea4f7c0a26469706673582212208ace7d444723c6c427958973496505139bd0f600e32b1f44d83629a3d6b9a72864736f6c63430008140033

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

000000000000000000000000b64adc2dbd4106fd29aa2156965731801c76c4e50000000000000000000000002520648a8378dbc06a58e7e49dc5f7a8ddcc741d000000000000000000000000c2e61363e8a299e312ae13eac7db5e0aef1fbe9c000000000000000000000000a6fd872f0f6cf467cd0c2b8352d9e5046d6926a90000000000000000000000001d2e397bbc4b47d015bf8f9f3090cb840964d21b00000000000000000000000053f51fcdf06946aafe25f14d2f1c9b66e71ca6830000000000000000000000002147f5c02c2869e8c2d8f86471d3d7500355d69800000000000000000000000075cae30025a514b7ae069917e132cc99762a0e1600000000000000000000000013e636cbfd6a7d33a8df7ebbf42f63adc9bb592a0000000000000000000000002a0c55d66482e801abbae0271fe1bf43b9d03d2c

-----Decoded View---------------
Arg [0] : _ethUsdFeed (address): 0xB64Adc2dBD4106FD29AA2156965731801C76c4E5
Arg [1] : _silverUsdFeed (address): 0x2520648a8378dBc06A58E7E49Dc5f7A8ddcc741d
Arg [2] : _treasuryPool (address): 0xc2E61363E8A299E312ae13eaC7db5E0AEf1fbe9C
Arg [3] : _bankxPidController (address): 0xa6FD872F0F6cf467Cd0c2B8352d9E5046D6926A9
Arg [4] : _router (address): 0x1D2e397bBC4B47D015Bf8f9F3090cB840964d21B
Arg [5] : _xsdWethPool (address): 0x53f51fcDf06946AafE25F14d2f1C9B66E71Ca683
Arg [6] : _bankxWethPool (address): 0x2147F5c02c2869E8C2d8F86471d3d7500355d698
Arg [7] : _xsdToken (address): 0x75Cae30025A514b7AE069917E132Cc99762A0e16
Arg [8] : _bankxToken (address): 0x13E636CBFD6a7d33a8df7eBbF42f63ADC9bB592A
Arg [9] : _rewardManager (address): 0x2a0C55D66482e801abbaE0271FE1BF43B9D03D2c

-----Encoded View---------------
10 Constructor Arguments found :
Arg [0] : 000000000000000000000000b64adc2dbd4106fd29aa2156965731801c76c4e5
Arg [1] : 0000000000000000000000002520648a8378dbc06a58e7e49dc5f7a8ddcc741d
Arg [2] : 000000000000000000000000c2e61363e8a299e312ae13eac7db5e0aef1fbe9c
Arg [3] : 000000000000000000000000a6fd872f0f6cf467cd0c2b8352d9e5046d6926a9
Arg [4] : 0000000000000000000000001d2e397bbc4b47d015bf8f9f3090cb840964d21b
Arg [5] : 00000000000000000000000053f51fcdf06946aafe25f14d2f1c9b66e71ca683
Arg [6] : 0000000000000000000000002147f5c02c2869e8c2d8f86471d3d7500355d698
Arg [7] : 00000000000000000000000075cae30025a514b7ae069917e132cc99762a0e16
Arg [8] : 00000000000000000000000013e636cbfd6a7d33a8df7ebbf42f63adc9bb592a
Arg [9] : 0000000000000000000000002a0c55d66482e801abbae0271fe1bf43b9d03d2c


Block Uncle Number Difficulty Gas Used Reward
View All Uncles
Loading...
Loading
Loading...
Loading
Loading...
Loading
[ Download: CSV Export  ]

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.