Contract 0xa859c44e62ce0e83d34578dc9d0a56c87a16d7e3

Contract Overview

Balance:
0 BTT
Txn Hash Method
Block
From
To
Value [Txn Fee]
0x9ea4b2f9b64ec340d050ec537a5d14321ec7a82ac6bbbc04e33f0da4fdb0a7bdSet Token Config141097562022-11-04 20:26:4232 days 9 hrs ago0xf2e3fbdc5038ca680a76bd416933abf0a1500c96 IN  0xa859c44e62ce0e83d34578dc9d0a56c87a16d7e30 BTT10.611
0x8aa5f3a9c26166f57e18c619df6d2143f222ce32b7284b8a69b0d3b05f6596a7Set Token Config141097532022-11-04 20:26:3632 days 9 hrs ago0xf2e3fbdc5038ca680a76bd416933abf0a1500c96 IN  0xa859c44e62ce0e83d34578dc9d0a56c87a16d7e30 BTT10.6182
0x3239099d545152c659265d20a1065da4c8b912ad7a25a20ff22b59b7d02914edSet Token Config141097512022-11-04 20:26:3232 days 9 hrs ago0xf2e3fbdc5038ca680a76bd416933abf0a1500c96 IN  0xa859c44e62ce0e83d34578dc9d0a56c87a16d7e30 BTT10.6182
0xbcf97ce270ff7a250c2461205173d54d21c0617acc32e40aaa3b5070698a60caSet Token Config141097482022-11-04 20:26:2632 days 9 hrs ago0xf2e3fbdc5038ca680a76bd416933abf0a1500c96 IN  0xa859c44e62ce0e83d34578dc9d0a56c87a16d7e30 BTT10.611
0x19884924d6b2b5921949eff3ee45dfa2c5537e223e0a37a7fce65fe8ae9f0292Set Token Config141097462022-11-04 20:26:2232 days 9 hrs ago0xf2e3fbdc5038ca680a76bd416933abf0a1500c96 IN  0xa859c44e62ce0e83d34578dc9d0a56c87a16d7e30 BTT10.611
0xa60393f0dd074755c61567bc1f754621fcb73fc6d82e6ef968c63289d120b6dfSet Token Config141097432022-11-04 20:26:1632 days 9 hrs ago0xf2e3fbdc5038ca680a76bd416933abf0a1500c96 IN  0xa859c44e62ce0e83d34578dc9d0a56c87a16d7e30 BTT10.611
0x0b79c3def784f6400e642c08962e5e7f1eda3a31019b6198eaa34690949efeffSet Band Price O...141097412022-11-04 20:26:1232 days 9 hrs ago0xf2e3fbdc5038ca680a76bd416933abf0a1500c96 IN  0xa859c44e62ce0e83d34578dc9d0a56c87a16d7e30 BTT8.1414
0x20f440d7ac58c8db382b21ab85d45956be30e9d29bc0b69ed05cd285b989a786Set Secondary Pr...141097382022-11-04 20:26:0632 days 9 hrs ago0xf2e3fbdc5038ca680a76bd416933abf0a1500c96 IN  0xa859c44e62ce0e83d34578dc9d0a56c87a16d7e30 BTT8.889
0xab24bc82e056e4806453597b9195d894bc29563fef5d45cb07b82e2604f034c9Set Is Amm Enabl...141082872022-11-04 19:36:1232 days 10 hrs ago0xf2e3fbdc5038ca680a76bd416933abf0a1500c96 IN  0xa859c44e62ce0e83d34578dc9d0a56c87a16d7e30 BTT8.2023
0xced125273128b9433d0635bc7887f6781bcc6120dd0d0abab84ac7e2e62d1398Set Max Strict P...141082582022-11-04 19:35:1432 days 10 hrs ago0xf2e3fbdc5038ca680a76bd416933abf0a1500c96 IN  0xa859c44e62ce0e83d34578dc9d0a56c87a16d7e30 BTT13.749
0xbe819a3cf53d3d47360ded5e5eac9510a70944867a6041e498ee39e1f7188bc8Set Token Config140155892022-11-02 14:29:4434 days 15 hrs ago0xf2e3fbdc5038ca680a76bd416933abf0a1500c96 IN  0xa859c44e62ce0e83d34578dc9d0a56c87a16d7e30 BTT21.8763
0xc5bcf86a99b4437141dce80873169b527a65a85b3c91abaf81cf8f457e964cb9Set Token Config140155872022-11-02 14:29:4034 days 15 hrs ago0xf2e3fbdc5038ca680a76bd416933abf0a1500c96 IN  0xa859c44e62ce0e83d34578dc9d0a56c87a16d7e30 BTT27.8535
0xb48c8c20c9c32cbb2bb3701f3dca59012ed4f623d9426c9c03426ff5c7420df1Set Token Config140155842022-11-02 14:29:3434 days 15 hrs ago0xf2e3fbdc5038ca680a76bd416933abf0a1500c96 IN  0xa859c44e62ce0e83d34578dc9d0a56c87a16d7e30 BTT27.8535
0x9ba29c83d5c988eb51f15ef5a4a032009b39dc8bd5613324a55a61658cf6a468Set Token Config140155822022-11-02 14:29:3034 days 15 hrs ago0xf2e3fbdc5038ca680a76bd416933abf0a1500c96 IN  0xa859c44e62ce0e83d34578dc9d0a56c87a16d7e30 BTT21.8763
0xe34469e35a0ba462a66b34f200441babd32bdb8d98f44b6ebf96457f8acfd54fSet Token Config140155792022-11-02 14:29:2434 days 15 hrs ago0xf2e3fbdc5038ca680a76bd416933abf0a1500c96 IN  0xa859c44e62ce0e83d34578dc9d0a56c87a16d7e30 BTT21.8763
0x9ec132c610055a34bc4095420224a9bb3103036cc8d963b2170019d8f5f4d3bfSet Token Config140155762022-11-02 14:29:1834 days 15 hrs ago0xf2e3fbdc5038ca680a76bd416933abf0a1500c96 IN  0xa859c44e62ce0e83d34578dc9d0a56c87a16d7e30 BTT21.8763
0x514a3ec7a537475ee9c5fe7e8089cb79dbf94aa8bdf5721754f7347e9a178558Set Band Price O...140155742022-11-02 14:29:1434 days 15 hrs ago0xf2e3fbdc5038ca680a76bd416933abf0a1500c96 IN  0xa859c44e62ce0e83d34578dc9d0a56c87a16d7e30 BTT14.1114
0x0269b825fd568c95bfaf0ea24c0cdbe3f645c988d93de10e9559927453c206bdSet Secondary Pr...140155712022-11-02 14:29:0834 days 15 hrs ago0xf2e3fbdc5038ca680a76bd416933abf0a1500c96 IN  0xa859c44e62ce0e83d34578dc9d0a56c87a16d7e30 BTT14.019
0x5cda9e0c3c22fafc39183d5ae15f7064e37123ac6cefce209fe322eb0d95b9e90x60806040140155682022-11-02 14:29:0234 days 15 hrs ago0xf2e3fbdc5038ca680a76bd416933abf0a1500c96 IN  Contract Creation0 BTT549.9135
[ Download CSV Export 
Latest 25 internal transaction
Parent Txn Hash Block From To Value
0x4c4e7d26c37d21fd2861ea8eef2b52b1fe49c6d3b131e3ce01361bad9968f2d6149433392022-11-24 18:02:0912 days 11 hrs ago 0xa859c44e62ce0e83d34578dc9d0a56c87a16d7e3 0x8c064bcf7c0da3b3b090babfe8f3323534d84d680 BTT
0x4c4e7d26c37d21fd2861ea8eef2b52b1fe49c6d3b131e3ce01361bad9968f2d6149433392022-11-24 18:02:0912 days 11 hrs ago 0x5e0e647eb613faa24244d4e404827414919a375a 0xa859c44e62ce0e83d34578dc9d0a56c87a16d7e30 BTT
0x4c4e7d26c37d21fd2861ea8eef2b52b1fe49c6d3b131e3ce01361bad9968f2d6149433392022-11-24 18:02:0912 days 11 hrs ago 0xa859c44e62ce0e83d34578dc9d0a56c87a16d7e3 0x8c064bcf7c0da3b3b090babfe8f3323534d84d680 BTT
0x4c4e7d26c37d21fd2861ea8eef2b52b1fe49c6d3b131e3ce01361bad9968f2d6149433392022-11-24 18:02:0912 days 11 hrs ago 0x5e0e647eb613faa24244d4e404827414919a375a 0xa859c44e62ce0e83d34578dc9d0a56c87a16d7e30 BTT
0x4c4e7d26c37d21fd2861ea8eef2b52b1fe49c6d3b131e3ce01361bad9968f2d6149433392022-11-24 18:02:0912 days 11 hrs ago 0xa859c44e62ce0e83d34578dc9d0a56c87a16d7e3 0x8c064bcf7c0da3b3b090babfe8f3323534d84d680 BTT
0x4c4e7d26c37d21fd2861ea8eef2b52b1fe49c6d3b131e3ce01361bad9968f2d6149433392022-11-24 18:02:0912 days 11 hrs ago 0x5e0e647eb613faa24244d4e404827414919a375a 0xa859c44e62ce0e83d34578dc9d0a56c87a16d7e30 BTT
0x4c4e7d26c37d21fd2861ea8eef2b52b1fe49c6d3b131e3ce01361bad9968f2d6149433392022-11-24 18:02:0912 days 11 hrs ago 0xa859c44e62ce0e83d34578dc9d0a56c87a16d7e3 0x8c064bcf7c0da3b3b090babfe8f3323534d84d680 BTT
0x4c4e7d26c37d21fd2861ea8eef2b52b1fe49c6d3b131e3ce01361bad9968f2d6149433392022-11-24 18:02:0912 days 11 hrs ago 0x5e0e647eb613faa24244d4e404827414919a375a 0xa859c44e62ce0e83d34578dc9d0a56c87a16d7e30 BTT
0x10437b3683f7c0396419fc6acd9c1dfa1e4ffa6b0acc6b299edcc7c343b91e34149433292022-11-24 18:01:4912 days 11 hrs ago 0xa859c44e62ce0e83d34578dc9d0a56c87a16d7e3 0x8c064bcf7c0da3b3b090babfe8f3323534d84d680 BTT
0x10437b3683f7c0396419fc6acd9c1dfa1e4ffa6b0acc6b299edcc7c343b91e34149433292022-11-24 18:01:4912 days 11 hrs ago 0x5e0e647eb613faa24244d4e404827414919a375a 0xa859c44e62ce0e83d34578dc9d0a56c87a16d7e30 BTT
0x10437b3683f7c0396419fc6acd9c1dfa1e4ffa6b0acc6b299edcc7c343b91e34149433292022-11-24 18:01:4912 days 11 hrs ago 0xa859c44e62ce0e83d34578dc9d0a56c87a16d7e3 0x8c064bcf7c0da3b3b090babfe8f3323534d84d680 BTT
0x10437b3683f7c0396419fc6acd9c1dfa1e4ffa6b0acc6b299edcc7c343b91e34149433292022-11-24 18:01:4912 days 11 hrs ago 0x5e0e647eb613faa24244d4e404827414919a375a 0xa859c44e62ce0e83d34578dc9d0a56c87a16d7e30 BTT
0x10437b3683f7c0396419fc6acd9c1dfa1e4ffa6b0acc6b299edcc7c343b91e34149433292022-11-24 18:01:4912 days 11 hrs ago 0xa859c44e62ce0e83d34578dc9d0a56c87a16d7e3 0x8c064bcf7c0da3b3b090babfe8f3323534d84d680 BTT
0x10437b3683f7c0396419fc6acd9c1dfa1e4ffa6b0acc6b299edcc7c343b91e34149433292022-11-24 18:01:4912 days 11 hrs ago 0x5e0e647eb613faa24244d4e404827414919a375a 0xa859c44e62ce0e83d34578dc9d0a56c87a16d7e30 BTT
0x10437b3683f7c0396419fc6acd9c1dfa1e4ffa6b0acc6b299edcc7c343b91e34149433292022-11-24 18:01:4912 days 11 hrs ago 0xa859c44e62ce0e83d34578dc9d0a56c87a16d7e3 0x8c064bcf7c0da3b3b090babfe8f3323534d84d680 BTT
0x10437b3683f7c0396419fc6acd9c1dfa1e4ffa6b0acc6b299edcc7c343b91e34149433292022-11-24 18:01:4912 days 11 hrs ago 0x5e0e647eb613faa24244d4e404827414919a375a 0xa859c44e62ce0e83d34578dc9d0a56c87a16d7e30 BTT
0xd4b36b0013cd43165e7a04c0705cd59be51fbb7147c5f43aaa5d2fbea286d8b9149433192022-11-24 18:01:2912 days 11 hrs ago 0xa859c44e62ce0e83d34578dc9d0a56c87a16d7e3 0x8c064bcf7c0da3b3b090babfe8f3323534d84d680 BTT
0xd4b36b0013cd43165e7a04c0705cd59be51fbb7147c5f43aaa5d2fbea286d8b9149433192022-11-24 18:01:2912 days 11 hrs ago 0x5e0e647eb613faa24244d4e404827414919a375a 0xa859c44e62ce0e83d34578dc9d0a56c87a16d7e30 BTT
0xd4b36b0013cd43165e7a04c0705cd59be51fbb7147c5f43aaa5d2fbea286d8b9149433192022-11-24 18:01:2912 days 11 hrs ago 0xa859c44e62ce0e83d34578dc9d0a56c87a16d7e3 0x8c064bcf7c0da3b3b090babfe8f3323534d84d680 BTT
0xd4b36b0013cd43165e7a04c0705cd59be51fbb7147c5f43aaa5d2fbea286d8b9149433192022-11-24 18:01:2912 days 11 hrs ago 0x5e0e647eb613faa24244d4e404827414919a375a 0xa859c44e62ce0e83d34578dc9d0a56c87a16d7e30 BTT
0xd4b36b0013cd43165e7a04c0705cd59be51fbb7147c5f43aaa5d2fbea286d8b9149433192022-11-24 18:01:2912 days 11 hrs ago 0xa859c44e62ce0e83d34578dc9d0a56c87a16d7e3 0x8c064bcf7c0da3b3b090babfe8f3323534d84d680 BTT
0xd4b36b0013cd43165e7a04c0705cd59be51fbb7147c5f43aaa5d2fbea286d8b9149433192022-11-24 18:01:2912 days 11 hrs ago 0x5e0e647eb613faa24244d4e404827414919a375a 0xa859c44e62ce0e83d34578dc9d0a56c87a16d7e30 BTT
0xd4b36b0013cd43165e7a04c0705cd59be51fbb7147c5f43aaa5d2fbea286d8b9149433192022-11-24 18:01:2912 days 11 hrs ago 0xa859c44e62ce0e83d34578dc9d0a56c87a16d7e3 0x8c064bcf7c0da3b3b090babfe8f3323534d84d680 BTT
0xd4b36b0013cd43165e7a04c0705cd59be51fbb7147c5f43aaa5d2fbea286d8b9149433192022-11-24 18:01:2912 days 11 hrs ago 0x5e0e647eb613faa24244d4e404827414919a375a 0xa859c44e62ce0e83d34578dc9d0a56c87a16d7e30 BTT
0xaf3802f4ef2cbc19e59df66376a417076e16f29134b1deb4180d313252f82f81149433092022-11-24 18:01:0912 days 11 hrs ago 0xa859c44e62ce0e83d34578dc9d0a56c87a16d7e3 0x8c064bcf7c0da3b3b090babfe8f3323534d84d680 BTT
[ Download CSV Export 
Loading

Similar Match Source Code
Note: This contract matches the deployed ByteCode of the Source Code for Contract 0xa9D3102B3991487aD3bbB643E197835D4ef7d05b

Contract Name:
VaultPriceFeed

Compiler Version
v0.6.12+commit.27d51765

Optimization Enabled:
Yes with 1 runs

Other Settings:
default evmVersion

Contract Source Code (Solidity Standard Json-Input format)

File 1 of 7 : VaultPriceFeed.sol
// SPDX-License-Identifier: MIT

import "../libraries/math/SafeMath.sol";

import "./interfaces/IVaultPriceFeed.sol";
import "../oracle/interfaces/IPriceFeed.sol";
import "../oracle/interfaces/ISecondaryPriceFeed.sol";
// import "../oracle/interfaces/IChainlinkFlags.sol";
import "../oracle/interfaces/IStdReference.sol";
import "../amm/interfaces/IPancakePair.sol";

pragma solidity 0.6.12;

pragma experimental ABIEncoderV2;

contract VaultPriceFeed is IVaultPriceFeed {
    using SafeMath for uint256;

    uint256 public constant PRICE_PRECISION = 10 ** 30;
    uint256 public constant ONE_USD = PRICE_PRECISION;
    uint256 public constant BASIS_POINTS_DIVISOR = 10000;
    uint256 public constant MAX_SPREAD_BASIS_POINTS = 50;
    uint256 public constant MAX_ADJUSTMENT_INTERVAL = 2 hours;
    uint256 public constant MAX_ADJUSTMENT_BASIS_POINTS = 20;

    // Identifier of the Sequencer offline flag on the Flags contract
    address constant private FLAG_ARBITRUM_SEQ_OFFLINE = address(bytes20(bytes32(uint256(keccak256("chainlink.flags.arbitrum-seq-offline")) - 1)));

    address public gov;
    // address public chainlinkFlags;

    bool public isAmmEnabled = true;
    bool public isSecondaryPriceEnabled = true;
    bool public useV2Pricing = false;
    bool public favorPrimaryPrice = false;
    // uint256 public priceSampleSpace = 3;
    uint256 public maxStrictPriceDeviation = 0;
    address public secondaryPriceFeed;
    uint256 public spreadThresholdBasisPoints = 30;

    address public btc;
    address public eth;
    address public bnb;
    address public bnbBusd;
    address public ethBnb;
    address public btcBnb;

    // mapping (address => address) public priceFeeds;
    address public bandPriceOracle;
    mapping (address => string) public priceFeedSymbols;
    mapping (address => uint256) public priceDecimals;
    mapping (address => uint256) public spreadBasisPoints;
    // Chainlink can return prices for stablecoins
    // that differs from 1 USD by a larger percentage than stableSwapFeeBasisPoints
    // we use strictStableTokens to cap the price to 1 USD
    // this allows us to configure stablecoins like DAI as being a stableToken
    // while not being a strictStableToken
    mapping (address => bool) public strictStableTokens;

    mapping (address => uint256) public override adjustmentBasisPoints;
    mapping (address => bool) public override isAdjustmentAdditive;
    mapping (address => uint256) public lastAdjustmentTimings;

    modifier onlyGov() {
        require(msg.sender == gov, "VaultPriceFeed: forbidden");
        _;
    }

    constructor() public {
        gov = msg.sender;
    }

    function setGov(address _gov) external onlyGov {
        gov = _gov;
    }

    // function setChainlinkFlags(address _chainlinkFlags) external onlyGov {
    //     chainlinkFlags = _chainlinkFlags;
    // }

    function setAdjustment(address _token, bool _isAdditive, uint256 _adjustmentBps) external override onlyGov {
        require(
            lastAdjustmentTimings[_token].add(MAX_ADJUSTMENT_INTERVAL) < block.timestamp,
            "VaultPriceFeed: adjustment frequency exceeded"
        );
        require(_adjustmentBps <= MAX_ADJUSTMENT_BASIS_POINTS, "invalid _adjustmentBps");
        isAdjustmentAdditive[_token] = _isAdditive;
        adjustmentBasisPoints[_token] = _adjustmentBps;
        lastAdjustmentTimings[_token] = block.timestamp;
    }

    function setUseV2Pricing(bool _useV2Pricing) external override onlyGov {
        useV2Pricing = _useV2Pricing;
    }

    function setIsAmmEnabled(bool _isEnabled) external override onlyGov {
        isAmmEnabled = _isEnabled;
    }

    function setIsSecondaryPriceEnabled(bool _isEnabled) external override onlyGov {
        isSecondaryPriceEnabled = _isEnabled;
    }

    function setSecondaryPriceFeed(address _secondaryPriceFeed) external onlyGov {
        secondaryPriceFeed = _secondaryPriceFeed;
    }

    function setTokens(address _btc, address _eth, address _bnb) external onlyGov {
        btc = _btc;
        eth = _eth;
        bnb = _bnb;
    }

    function setPairs(address _bnbBusd, address _ethBnb, address _btcBnb) external onlyGov {
        bnbBusd = _bnbBusd;
        ethBnb = _ethBnb;
        btcBnb = _btcBnb;
    }

    function setSpreadBasisPoints(address _token, uint256 _spreadBasisPoints) external override onlyGov {
        require(_spreadBasisPoints <= MAX_SPREAD_BASIS_POINTS, "VaultPriceFeed: invalid _spreadBasisPoints");
        spreadBasisPoints[_token] = _spreadBasisPoints;
    }

    function setSpreadThresholdBasisPoints(uint256 _spreadThresholdBasisPoints) external override onlyGov {
        spreadThresholdBasisPoints = _spreadThresholdBasisPoints;
    }

    function setFavorPrimaryPrice(bool _favorPrimaryPrice) external override onlyGov {
        favorPrimaryPrice = _favorPrimaryPrice;
    }

    // function setPriceSampleSpace(uint256 _priceSampleSpace) external override onlyGov {
    //     require(_priceSampleSpace > 0, "VaultPriceFeed: invalid _priceSampleSpace");
    //     priceSampleSpace = _priceSampleSpace;
    // }

    function setMaxStrictPriceDeviation(uint256 _maxStrictPriceDeviation) external override onlyGov {
        maxStrictPriceDeviation = _maxStrictPriceDeviation;
    }

    function setBandPriceOracle(address _bandPriceOracle) external onlyGov {
        bandPriceOracle = _bandPriceOracle;
    }

    function setTokenConfig(
        address _token,
        // address _priceFeed,
        string calldata _priceFeedSymbol,
        uint256 _priceDecimals,
        bool _isStrictStable
    ) external override onlyGov {
        // priceFeeds[_token] = _priceFeed;
        priceFeedSymbols[_token] = _priceFeedSymbol;
        priceDecimals[_token] = _priceDecimals;
        strictStableTokens[_token] = _isStrictStable;
    }

    function getPrice(address _token, bool _maximise, bool _includeAmmPrice, bool /* _useSwapPricing */) public override view returns (uint256) {
        uint256 price = useV2Pricing ? getPriceV2(_token, _maximise, _includeAmmPrice) : getPriceV1(_token, _maximise, _includeAmmPrice);

        uint256 adjustmentBps = adjustmentBasisPoints[_token];
        if (adjustmentBps > 0) {
            bool isAdditive = isAdjustmentAdditive[_token];
            if (isAdditive) {
                price = price.mul(BASIS_POINTS_DIVISOR.add(adjustmentBps)).div(BASIS_POINTS_DIVISOR);
            } else {
                price = price.mul(BASIS_POINTS_DIVISOR.sub(adjustmentBps)).div(BASIS_POINTS_DIVISOR);
            }
        }

        return price;
    }

    function getPriceV1(address _token, bool _maximise, bool _includeAmmPrice) public view returns (uint256) {
        uint256 price = getPrimaryPrice(_token, _maximise);

        if (_includeAmmPrice && isAmmEnabled) {
            uint256 ammPrice = getAmmPrice(_token);
            if (ammPrice > 0) {
                if (_maximise && ammPrice > price) {
                    price = ammPrice;
                }
                if (!_maximise && ammPrice < price) {
                    price = ammPrice;
                }
            }
        }

        if (isSecondaryPriceEnabled) {
            price = getSecondaryPrice(_token, price, _maximise);
        }

        if (strictStableTokens[_token]) {
            uint256 delta = price > ONE_USD ? price.sub(ONE_USD) : ONE_USD.sub(price);
            if (delta <= maxStrictPriceDeviation) {
                return ONE_USD;
            }

            // if _maximise and price is e.g. 1.02, return 1.02
            if (_maximise && price > ONE_USD) {
                return price;
            }

            // if !_maximise and price is e.g. 0.98, return 0.98
            if (!_maximise && price < ONE_USD) {
                return price;
            }

            return ONE_USD;
        }

        uint256 _spreadBasisPoints = spreadBasisPoints[_token];

        if (_maximise) {
            return price.mul(BASIS_POINTS_DIVISOR.add(_spreadBasisPoints)).div(BASIS_POINTS_DIVISOR);
        }

        return price.mul(BASIS_POINTS_DIVISOR.sub(_spreadBasisPoints)).div(BASIS_POINTS_DIVISOR);
    }

    function getPriceV2(address _token, bool _maximise, bool _includeAmmPrice) public view returns (uint256) {
        uint256 price = getPrimaryPrice(_token, _maximise);

        if (_includeAmmPrice && isAmmEnabled) {
            price = getAmmPriceV2(_token, _maximise, price);
        }

        if (isSecondaryPriceEnabled) {
            price = getSecondaryPrice(_token, price, _maximise);
        }

        if (strictStableTokens[_token]) {
            uint256 delta = price > ONE_USD ? price.sub(ONE_USD) : ONE_USD.sub(price);
            if (delta <= maxStrictPriceDeviation) {
                return ONE_USD;
            }

            // if _maximise and price is e.g. 1.02, return 1.02
            if (_maximise && price > ONE_USD) {
                return price;
            }

            // if !_maximise and price is e.g. 0.98, return 0.98
            if (!_maximise && price < ONE_USD) {
                return price;
            }

            return ONE_USD;
        }

        uint256 _spreadBasisPoints = spreadBasisPoints[_token];

        if (_maximise) {
            return price.mul(BASIS_POINTS_DIVISOR.add(_spreadBasisPoints)).div(BASIS_POINTS_DIVISOR);
        }

        return price.mul(BASIS_POINTS_DIVISOR.sub(_spreadBasisPoints)).div(BASIS_POINTS_DIVISOR);
    }

    function getAmmPriceV2(address _token, bool _maximise, uint256 _primaryPrice) public view returns (uint256) {
        uint256 ammPrice = getAmmPrice(_token);
        if (ammPrice == 0) {
            return _primaryPrice;
        }

        uint256 diff = ammPrice > _primaryPrice ? ammPrice.sub(_primaryPrice) : _primaryPrice.sub(ammPrice);
        if (diff.mul(BASIS_POINTS_DIVISOR) < _primaryPrice.mul(spreadThresholdBasisPoints)) {
            if (favorPrimaryPrice) {
                return _primaryPrice;
            }
            return ammPrice;
        }

        if (_maximise && ammPrice > _primaryPrice) {
            return ammPrice;
        }

        if (!_maximise && ammPrice < _primaryPrice) {
            return ammPrice;
        }

        return _primaryPrice;
    }

    // function getLatestPrimaryPrice(address _token) public override view returns (uint256) {
    //     address priceFeedAddress = priceFeeds[_token];
    //     require(priceFeedAddress != address(0), "VaultPriceFeed: invalid price feed");

    //     IPriceFeed priceFeed = IPriceFeed(priceFeedAddress);

    //     int256 price = priceFeed.latestAnswer();
    //     require(price > 0, "VaultPriceFeed: invalid price");

    //     return uint256(price);
    // }

    // function getPrimaryPrice(address _token, bool _maximise) public override view returns (uint256) {
    //     address priceFeedAddress = priceFeeds[_token];
    //     require(priceFeedAddress != address(0), "VaultPriceFeed: invalid price feed");

    //     if (chainlinkFlags != address(0)) {
    //         bool isRaised = IChainlinkFlags(chainlinkFlags).getFlag(FLAG_ARBITRUM_SEQ_OFFLINE);
    //         if (isRaised) {
    //                 // If flag is raised we shouldn't perform any critical operations
    //             revert("Chainlink feeds are not being updated");
    //         }
    //     }

    //     IPriceFeed priceFeed = IPriceFeed(priceFeedAddress);

    //     uint256 price = 0;
    //     uint80 roundId = priceFeed.latestRound();

    //     for (uint80 i = 0; i < priceSampleSpace; i++) {
    //         if (roundId <= i) { break; }
    //         uint256 p;

    //         if (i == 0) {
    //             int256 _p = priceFeed.latestAnswer();
    //             require(_p > 0, "VaultPriceFeed: invalid price");
    //             p = uint256(_p);
    //         } else {
    //             (, int256 _p, , ,) = priceFeed.getRoundData(roundId - i);
    //             require(_p > 0, "VaultPriceFeed: invalid price");
    //             p = uint256(_p);
    //         }

    //         if (price == 0) {
    //             price = p;
    //             continue;
    //         }

    //         if (_maximise && p > price) {
    //             price = p;
    //             continue;
    //         }

    //         if (!_maximise && p < price) {
    //             price = p;
    //         }
    //     }

    //     require(price > 0, "VaultPriceFeed: could not fetch price");
    //     // normalise price precision
    //     uint256 _priceDecimals = priceDecimals[_token];
    //     return price.mul(PRICE_PRECISION).div(10 ** _priceDecimals);
    // }

    function getLatestPrimaryPrice(address _token) public override view returns (uint256) {
        string memory priceFeedSymbol = priceFeedSymbols[_token];
        require(bytes(priceFeedSymbol).length != 0, "VaultPriceFeed: invalid price feed symbol");

        IStdReference.ReferenceData memory priceData = IStdReference(bandPriceOracle).getReferenceData(priceFeedSymbol, "USD");
        require(priceData.rate > 0, "VaultPriceFeed: invalid price");

        return uint256(priceData.rate);
    }

    function getPrimaryPrice(address _token, bool _maximise) public override view returns (uint256) {
        require(bandPriceOracle != address(0), "VaultPriceFeed: invalid band price oracle");
        string memory priceFeedSymbol = priceFeedSymbols[_token];
        require(bytes(priceFeedSymbol).length != 0, "VaultPriceFeed: invalid price feed symbol");

        IStdReference.ReferenceData memory priceData = IStdReference(bandPriceOracle).getReferenceData(priceFeedSymbol, "USD");
        
        uint256 price = priceData.rate;

        require(price > 0, "VaultPriceFeed: could not fetch price");
        // normalise price precision
        uint256 _priceDecimals = priceDecimals[_token];
        return price.mul(PRICE_PRECISION).div(10 ** _priceDecimals);
    }

    function getSecondaryPrice(address _token, uint256 _referencePrice, bool _maximise) public view returns (uint256) {
        if (secondaryPriceFeed == address(0)) { return _referencePrice; }
        return ISecondaryPriceFeed(secondaryPriceFeed).getPrice(_token, _referencePrice, _maximise);
    }

    function getAmmPrice(address _token) public override view returns (uint256) {
        if (_token == bnb) {
            // for bnbBusd, reserve0: BNB, reserve1: BUSD
            return getPairPrice(bnbBusd, true);
        }

        if (_token == eth) {
            uint256 price0 = getPairPrice(bnbBusd, true);
            // for ethBnb, reserve0: ETH, reserve1: BNB
            uint256 price1 = getPairPrice(ethBnb, true);
            // this calculation could overflow if (price0 / 10**30) * (price1 / 10**30) is more than 10**17
            return price0.mul(price1).div(PRICE_PRECISION);
        }

        if (_token == btc) {
            uint256 price0 = getPairPrice(bnbBusd, true);
            // for btcBnb, reserve0: BTC, reserve1: BNB
            uint256 price1 = getPairPrice(btcBnb, true);
            // this calculation could overflow if (price0 / 10**30) * (price1 / 10**30) is more than 10**17
            return price0.mul(price1).div(PRICE_PRECISION);
        }

        return 0;
    }

    // if divByReserve0: calculate price as reserve1 / reserve0
    // if !divByReserve1: calculate price as reserve0 / reserve1
    function getPairPrice(address _pair, bool _divByReserve0) public view returns (uint256) {
        (uint256 reserve0, uint256 reserve1, ) = IPancakePair(_pair).getReserves();
        if (_divByReserve0) {
            if (reserve0 == 0) { return 0; }
            return reserve1.mul(PRICE_PRECISION).div(reserve0);
        }
        if (reserve1 == 0) { return 0; }
        return reserve0.mul(PRICE_PRECISION).div(reserve1);
    }
}

File 2 of 7 : SafeMath.sol
// SPDX-License-Identifier: MIT

pragma solidity 0.6.12;

/**
 * @dev Wrappers over Solidity's arithmetic operations with added overflow
 * checks.
 *
 * Arithmetic operations in Solidity wrap on overflow. This can easily result
 * in bugs, because programmers usually assume that an overflow raises an
 * error, which is the standard behavior in high level programming languages.
 * `SafeMath` restores this intuition by reverting the transaction when an
 * operation overflows.
 *
 * Using this library instead of the unchecked operations eliminates an entire
 * class of bugs, so it's recommended to use it always.
 */
library SafeMath {
    /**
     * @dev Returns the addition of two unsigned integers, reverting on
     * overflow.
     *
     * Counterpart to Solidity's `+` operator.
     *
     * Requirements:
     *
     * - Addition cannot overflow.
     */
    function add(uint256 a, uint256 b) internal pure returns (uint256) {
        uint256 c = a + b;
        require(c >= a, "SafeMath: addition overflow");

        return c;
    }

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

    /**
     * @dev Returns the subtraction of two unsigned integers, reverting with custom message on
     * overflow (when the result is negative).
     *
     * Counterpart to Solidity's `-` operator.
     *
     * Requirements:
     *
     * - Subtraction cannot overflow.
     */
    function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
        require(b <= a, errorMessage);
        uint256 c = a - b;

        return c;
    }

    /**
     * @dev Returns the multiplication of two unsigned integers, reverting on
     * overflow.
     *
     * Counterpart to Solidity's `*` operator.
     *
     * Requirements:
     *
     * - Multiplication cannot overflow.
     */
    function mul(uint256 a, uint256 b) internal pure returns (uint256) {
        // Gas optimization: this is cheaper than requiring 'a' not being zero, but the
        // benefit is lost if 'b' is also tested.
        // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
        if (a == 0) {
            return 0;
        }

        uint256 c = a * b;
        require(c / a == b, "SafeMath: multiplication overflow");

        return c;
    }

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

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

        return c;
    }

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

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

File 3 of 7 : IVaultPriceFeed.sol
// SPDX-License-Identifier: MIT

pragma solidity 0.6.12;

interface IVaultPriceFeed {
    function adjustmentBasisPoints(address _token) external view returns (uint256);
    function isAdjustmentAdditive(address _token) external view returns (bool);
    function setAdjustment(address _token, bool _isAdditive, uint256 _adjustmentBps) external;
    function setUseV2Pricing(bool _useV2Pricing) external;
    function setIsAmmEnabled(bool _isEnabled) external;
    function setIsSecondaryPriceEnabled(bool _isEnabled) external;
    function setSpreadBasisPoints(address _token, uint256 _spreadBasisPoints) external;
    function setSpreadThresholdBasisPoints(uint256 _spreadThresholdBasisPoints) external;
    function setFavorPrimaryPrice(bool _favorPrimaryPrice) external;
    // function setPriceSampleSpace(uint256 _priceSampleSpace) external;
    function setMaxStrictPriceDeviation(uint256 _maxStrictPriceDeviation) external;
    function getPrice(address _token, bool _maximise, bool _includeAmmPrice, bool _useSwapPricing) external view returns (uint256);
    function getAmmPrice(address _token) external view returns (uint256);
    function getLatestPrimaryPrice(address _token) external view returns (uint256);
    function getPrimaryPrice(address _token, bool _maximise) external view returns (uint256);
    function setTokenConfig(
        address _token,
        // address _priceFeed,
        string calldata _priceFeedSymbol,
        uint256 _priceDecimals,
        bool _isStrictStable
    ) external;
}

File 4 of 7 : ISecondaryPriceFeed.sol
// SPDX-License-Identifier: MIT

pragma solidity 0.6.12;

interface ISecondaryPriceFeed {
    function getPrice(address _token, uint256 _referencePrice, bool _maximise) external view returns (uint256);
}

File 5 of 7 : IPriceFeed.sol
// SPDX-License-Identifier: MIT

pragma solidity 0.6.12;

interface IPriceFeed {
    function description() external view returns (string memory);
    function aggregator() external view returns (address);
    function latestAnswer() external view returns (int256);
    function latestRound() external view returns (uint80);
    function getRoundData(uint80 roundId) external view returns (uint80, int256, uint256, uint256, uint80);
}

File 6 of 7 : IPancakePair.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.5.0;

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

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

pragma solidity 0.6.12;

pragma experimental ABIEncoderV2;

interface IStdReference {
    /// A structure returned whenever someone requests for standard reference data.
    struct ReferenceData {
        uint256 rate; // base/quote exchange rate, multiplied by 1e18.
        uint256 lastUpdatedBase; // UNIX epoch of the last time when base price gets updated.
        uint256 lastUpdatedQuote; // UNIX epoch of the last time when quote price gets updated.
    }

    /// Returns the price data for the given base/quote pair. Revert if not available.
    function getReferenceData(string memory _base, string memory _quote) external view returns (ReferenceData memory);

    /// Similar to getReferenceData, but with multiple base/quote pairs at once.
    function getReferenceDataBulk(string[] memory _bases, string[] memory _quotes) external view returns (ReferenceData[] memory);
}

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

Contract ABI

[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"BASIS_POINTS_DIVISOR","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MAX_ADJUSTMENT_BASIS_POINTS","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MAX_ADJUSTMENT_INTERVAL","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MAX_SPREAD_BASIS_POINTS","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"ONE_USD","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"PRICE_PRECISION","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"adjustmentBasisPoints","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"bandPriceOracle","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"bnb","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"bnbBusd","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"btc","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"btcBnb","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"eth","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"ethBnb","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"favorPrimaryPrice","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"}],"name":"getAmmPrice","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"},{"internalType":"bool","name":"_maximise","type":"bool"},{"internalType":"uint256","name":"_primaryPrice","type":"uint256"}],"name":"getAmmPriceV2","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"}],"name":"getLatestPrimaryPrice","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_pair","type":"address"},{"internalType":"bool","name":"_divByReserve0","type":"bool"}],"name":"getPairPrice","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"},{"internalType":"bool","name":"_maximise","type":"bool"},{"internalType":"bool","name":"_includeAmmPrice","type":"bool"},{"internalType":"bool","name":"","type":"bool"}],"name":"getPrice","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"},{"internalType":"bool","name":"_maximise","type":"bool"},{"internalType":"bool","name":"_includeAmmPrice","type":"bool"}],"name":"getPriceV1","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"},{"internalType":"bool","name":"_maximise","type":"bool"},{"internalType":"bool","name":"_includeAmmPrice","type":"bool"}],"name":"getPriceV2","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"},{"internalType":"bool","name":"_maximise","type":"bool"}],"name":"getPrimaryPrice","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"},{"internalType":"uint256","name":"_referencePrice","type":"uint256"},{"internalType":"bool","name":"_maximise","type":"bool"}],"name":"getSecondaryPrice","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"gov","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"isAdjustmentAdditive","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"isAmmEnabled","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"isSecondaryPriceEnabled","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"lastAdjustmentTimings","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxStrictPriceDeviation","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"priceDecimals","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"priceFeedSymbols","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"secondaryPriceFeed","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"},{"internalType":"bool","name":"_isAdditive","type":"bool"},{"internalType":"uint256","name":"_adjustmentBps","type":"uint256"}],"name":"setAdjustment","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_bandPriceOracle","type":"address"}],"name":"setBandPriceOracle","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"_favorPrimaryPrice","type":"bool"}],"name":"setFavorPrimaryPrice","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_gov","type":"address"}],"name":"setGov","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"_isEnabled","type":"bool"}],"name":"setIsAmmEnabled","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"_isEnabled","type":"bool"}],"name":"setIsSecondaryPriceEnabled","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_maxStrictPriceDeviation","type":"uint256"}],"name":"setMaxStrictPriceDeviation","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_bnbBusd","type":"address"},{"internalType":"address","name":"_ethBnb","type":"address"},{"internalType":"address","name":"_btcBnb","type":"address"}],"name":"setPairs","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_secondaryPriceFeed","type":"address"}],"name":"setSecondaryPriceFeed","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"},{"internalType":"uint256","name":"_spreadBasisPoints","type":"uint256"}],"name":"setSpreadBasisPoints","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_spreadThresholdBasisPoints","type":"uint256"}],"name":"setSpreadThresholdBasisPoints","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"},{"internalType":"string","name":"_priceFeedSymbol","type":"string"},{"internalType":"uint256","name":"_priceDecimals","type":"uint256"},{"internalType":"bool","name":"_isStrictStable","type":"bool"}],"name":"setTokenConfig","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_btc","type":"address"},{"internalType":"address","name":"_eth","type":"address"},{"internalType":"address","name":"_bnb","type":"address"}],"name":"setTokens","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"_useV2Pricing","type":"bool"}],"name":"setUseV2Pricing","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"spreadBasisPoints","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"spreadThresholdBasisPoints","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"strictStableTokens","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"useV2Pricing","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"}]

60806040526000805461ffff60b01b1960ff60a81b1960ff60a01b19909216600160a01b1791909116600160a81b17168155600155601e60035534801561004557600080fd5b50600080546001600160a01b03191633179055611f52806100676000396000f3fe608060405234801561001057600080fd5b50600436106102515760003560e01c80630957aed9146102565780631193c80914610274578063126082cf1461028957806312d43a51146102915780632fbfe3d3146102995780632fc3a70a146102ae57806330536ee5146102c1578063378e7bf7146102d65780633d949c5f146102de5780633eba8d36146102f15780633ebbc601146103045780633f0c3bb71461030c578063443be2091461031457806348cac2771461032757806349a876e41461033a5780634a4b1f4f1461034257806356bf9de41461034a57806356c8c2c11461035d578063593d9e8014610370578063604f37e91461037857806367781c0e1461038b5780636ce8a44b14610393578063717cfe7a146103a6578063732391b4146103b95780638b86616c146103cc5780638c7c9e0c146103d457806391ad8d08146103dc57806393f69074146103fc57806395082d251461038b578063971bd3961461040f57806397dfade7146104175780639917dc741461041f5780639a0a6635146104325780639b18dc47146104455780639b8893801461044d578063a27ea38614610460578063a28d57d814610473578063a2ad7b931461047b578063a39c73a31461048e578063b02a2de414610496578063b731dd87146104a9578063b8f61105146104bc578063c2138d8c146104cf578063cefe0f21146104e2578063cfad57a2146104f5578063d694376c14610508578063dab772ae1461051b578063dad2c6361461052e578063dc4c231c14610541578063eb1c92a914610549578063fd34ec401461055c575b600080fd5b61025e61056f565b60405161026b9190611eed565b60405180910390f35b61027c610574565b60405161026b9190611be2565b61025e610583565b61027c610589565b6102ac6102a7366004611b67565b610598565b005b61025e6102bc366004611913565b6105d0565b6102c961068c565b60405161026b9190611c19565b61025e61069c565b61025e6102ec3660046118ca565b6106a2565b61025e6102ff366004611a6b565b610876565b6102c961091c565b6102c961092c565b6102ac610322366004611851565b61093c565b61025e610335366004611836565b6109a5565b61027c6109b7565b61025e6109c6565b61025e610358366004611836565b6109cb565b61025e61036b366004611896565b610b44565b6102c9610d25565b6102ac610386366004611aac565b610d35565b61025e610d7d565b6102c96103a1366004611836565b610d8d565b61025e6103b4366004611836565b610da2565b61025e6103c73660046118ca565b610db4565b61027c610e09565b61027c610e18565b6103ef6103ea366004611836565b610e27565b60405161026b9190611c24565b6102ac61040a366004611851565b610ec2565b61027c610f2b565b61027c610f3a565b6102ac61042d366004611aac565b610f49565b6102ac610440366004611836565b610f91565b61025e610fdd565b6102ac61045b366004611a41565b610fe3565b61025e61046e366004611836565b61104a565b61027c61105c565b61025e610489366004611896565b61106b565b61025e611164565b61025e6104a436600461196a565b61116a565b6102ac6104b7366004611b67565b611232565b6102c96104ca366004611836565b611261565b61025e6104dd366004611836565b611276565b61025e6104f0366004611836565b611374565b6102ac610503366004611836565b611386565b6102ac61051636600461196a565b6113d2565b6102ac610529366004611836565b6114a5565b6102ac61053c3660046119a7565b6114f1565b61027c611579565b6102ac610557366004611aac565b611588565b6102ac61056a366004611aac565b6115d0565b603281565b6008546001600160a01b031681565b61271081565b6000546001600160a01b031681565b6000546001600160a01b031633146105cb5760405162461bcd60e51b81526004016105c290611d99565b60405180910390fd5b600155565b600080548190600160b01b900460ff166105f4576105ef8686866106a2565b6105ff565b6105ff868686610db4565b6001600160a01b0387166000908152600f60205260409020549091508015610682576001600160a01b03871660009081526010602052604090205460ff16801561066a5761066361271061065d6106568286611618565b869061163d565b90611677565b9250610680565b61067d61271061065d61065682866116b6565b92505b505b5095945050505050565b600054600160b01b900460ff1681565b60015481565b6000806106af8585610b44565b90508280156106c75750600054600160a01b900460ff165b1561070c5760006106d786611276565b9050801561070a578480156106eb57508181115b156106f4578091505b8415801561070157508181105b1561070a578091505b505b600054600160a81b900460ff161561072c57610729858286610876565b90505b6001600160a01b0385166000908152600e602052604090205460ff161561081557600068327cb2734119d3b7a9601e1b821161077d5761077868327cb2734119d3b7a9601e1b836116b6565b610793565b6107938268327cb2734119d3b7a9601e1b6116b6565b905060015481116107b45768327cb2734119d3b7a9601e1b9250505061086f565b8480156107cc575068327cb2734119d3b7a9601e1b82115b156107d95750905061086f565b841580156107f2575068327cb2734119d3b7a9601e1b82105b156107ff5750905061086f565b68327cb2734119d3b7a9601e1b9250505061086f565b6001600160a01b0385166000908152600d602052604090205484156108575761084e61271061065d6108478285611618565b859061163d565b9250505061086f565b61086a61271061065d61084782856116b6565b925050505b9392505050565b6002546000906001600160a01b031661089057508161086f565b600254604051630ffd9c6d60e31b81526001600160a01b0390911690637fece368906108c490879087908790600401611bf6565b60206040518083038186803b1580156108dc57600080fd5b505afa1580156108f0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109149190611b7f565b949350505050565b600054600160a81b900460ff1681565b600054600160a01b900460ff1681565b6000546001600160a01b031633146109665760405162461bcd60e51b81526004016105c290611d99565b600480546001600160a01b039485166001600160a01b031991821617909155600580549385169382169390931790925560068054919093169116179055565b600f6020526000908152604090205481565b6006546001600160a01b031681565b601481565b6001600160a01b0381166000908152600b6020908152604080832080548251601f60026000196101006001861615020190931692909204918201859004850281018501909352808352606093830182828015610a685780601f10610a3d57610100808354040283529160200191610a68565b820191906000526020600020905b815481529060010190602001808311610a4b57829003601f168201915b50505050509050805160001415610a915760405162461bcd60e51b81526004016105c290611ea4565b610a9961175b565b600a5460405163195556f360e21b81526001600160a01b03909116906365555bcc90610ac9908590600401611c37565b60606040518083038186803b158015610ae157600080fd5b505afa158015610af5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b199190611ac8565b8051909150610b3a5760405162461bcd60e51b81526004016105c290611d62565b519150505b919050565b600a546000906001600160a01b0316610b6f5760405162461bcd60e51b81526004016105c290611d19565b6001600160a01b0383166000908152600b602090815260409182902080548351601f6002600019610100600186161502019093169290920491820184900484028101840190945280845260609392830182828015610c0e5780601f10610be357610100808354040283529160200191610c0e565b820191906000526020600020905b815481529060010190602001808311610bf157829003601f168201915b50505050509050805160001415610c375760405162461bcd60e51b81526004016105c290611ea4565b610c3f61175b565b600a5460405163195556f360e21b81526001600160a01b03909116906365555bcc90610c6f908590600401611c37565b60606040518083038186803b158015610c8757600080fd5b505afa158015610c9b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cbf9190611ac8565b805190915080610ce15760405162461bcd60e51b81526004016105c290611c9f565b6001600160a01b0386166000908152600c6020526040902054610d18600a82900a61065d8468327cb2734119d3b7a9601e1b61163d565b9450505050505b92915050565b600054600160b81b900460ff1681565b6000546001600160a01b03163314610d5f5760405162461bcd60e51b81526004016105c290611d99565b60008054911515600160b81b0260ff60b81b19909216919091179055565b68327cb2734119d3b7a9601e1b81565b60106020526000908152604090205460ff1681565b60116020526000908152604090205481565b600080610dc18585610b44565b9050828015610dd95750600054600160a01b900460ff165b1561070c57610de985858361116a565b905060005460ff600160a81b909104161561072c57610729858286610876565b6002546001600160a01b031681565b6005546001600160a01b031681565b600b6020908152600091825260409182902080548351601f600260001961010060018616150201909316929092049182018490048402810184019094528084529091830182828015610eba5780601f10610e8f57610100808354040283529160200191610eba565b820191906000526020600020905b815481529060010190602001808311610e9d57829003601f168201915b505050505081565b6000546001600160a01b03163314610eec5760405162461bcd60e51b81526004016105c290611d99565b600780546001600160a01b039485166001600160a01b031991821617909155600880549385169382169390931790925560098054919093169116179055565b6009546001600160a01b031681565b6007546001600160a01b031681565b6000546001600160a01b03163314610f735760405162461bcd60e51b81526004016105c290611d99565b60008054911515600160a01b0260ff60a01b19909216919091179055565b6000546001600160a01b03163314610fbb5760405162461bcd60e51b81526004016105c290611d99565b600280546001600160a01b0319166001600160a01b0392909216919091179055565b611c2081565b6000546001600160a01b0316331461100d5760405162461bcd60e51b81526004016105c290611d99565b603281111561102e5760405162461bcd60e51b81526004016105c290611e5a565b6001600160a01b039091166000908152600d6020526040902055565b600d6020526000908152604090205481565b6004546001600160a01b031681565b6000806000846001600160a01b0316630902f1ac6040518163ffffffff1660e01b815260040160606040518083038186803b1580156110a957600080fd5b505afa1580156110bd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110e19190611b1e565b506001600160701b031691506001600160701b031691508315611131578161110e57600092505050610d1f565b6111288261065d8368327cb2734119d3b7a9601e1b61163d565b92505050610d1f565b8061114157600092505050610d1f565b61115b8161065d8468327cb2734119d3b7a9601e1b61163d565b95945050505050565b60035481565b60008061117685611276565b905080611186578291505061086f565b600083821161119e5761119984836116b6565b6111a8565b6111a882856116b6565b90506111bf6003548561163d90919063ffffffff16565b6111cb8261271061163d565b10156111f557600054600160b81b900460ff16156111ed57839250505061086f565b50905061086f565b84801561120157508382115b1561120e5750905061086f565b8415801561121b57508382105b156112285750905061086f565b5091949350505050565b6000546001600160a01b0316331461125c5760405162461bcd60e51b81526004016105c290611d99565b600355565b600e6020526000908152604090205460ff1681565b6006546000906001600160a01b03838116911614156112ad576007546112a6906001600160a01b0316600161106b565b9050610b3f565b6005546001600160a01b038381169116141561131f576007546000906112dd906001600160a01b0316600161106b565b6008549091506000906112fa906001600160a01b0316600161106b565b905061131668327cb2734119d3b7a9601e1b61065d848461163d565b92505050610b3f565b6004546001600160a01b038381169116141561136c5760075460009061134f906001600160a01b0316600161106b565b6009549091506000906112fa906001600160a01b0316600161106b565b506000919050565b600c6020526000908152604090205481565b6000546001600160a01b031633146113b05760405162461bcd60e51b81526004016105c290611d99565b600080546001600160a01b0319166001600160a01b0392909216919091179055565b6000546001600160a01b031633146113fc5760405162461bcd60e51b81526004016105c290611d99565b6001600160a01b038316600090815260116020526040902054429061142390611c20611618565b106114405760405162461bcd60e51b81526004016105c290611e0d565b60148111156114615760405162461bcd60e51b81526004016105c290611c6f565b6001600160a01b03929092166000908152601060209081526040808320805460ff191694151594909417909355600f81528282209390935560119092529020429055565b6000546001600160a01b031633146114cf5760405162461bcd60e51b81526004016105c290611d99565b600a80546001600160a01b0319166001600160a01b0392909216919091179055565b6000546001600160a01b0316331461151b5760405162461bcd60e51b81526004016105c290611d99565b6001600160a01b0385166000908152600b6020526040902061153e90858561177c565b506001600160a01b03949094166000908152600c6020908152604080832093909355600e905220805460ff1916931515939093179092555050565b600a546001600160a01b031681565b6000546001600160a01b031633146115b25760405162461bcd60e51b81526004016105c290611d99565b60008054911515600160a81b0260ff60a81b19909216919091179055565b6000546001600160a01b031633146115fa5760405162461bcd60e51b81526004016105c290611d99565b60008054911515600160b01b0260ff60b01b19909216919091179055565b60008282018381101561086f5760405162461bcd60e51b81526004016105c290611ce4565b60008261164c57506000610d1f565b8282028284828161165957fe5b041461086f5760405162461bcd60e51b81526004016105c290611dcc565b600061086f83836040518060400160405280601a815260200179536166654d6174683a206469766973696f6e206279207a65726f60301b8152506116f8565b600061086f83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f77000081525061172f565b600081836117195760405162461bcd60e51b81526004016105c29190611c24565b50600083858161172557fe5b0495945050505050565b600081848411156117535760405162461bcd60e51b81526004016105c29190611c24565b505050900390565b60405180606001604052806000815260200160008152602001600081525090565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106117bd5782800160ff198235161785556117ea565b828001600101855582156117ea579182015b828111156117ea5782358255916020019190600101906117cf565b506117f69291506117fa565b5090565b5b808211156117f657600081556001016117fb565b80356001600160a01b0381168114610d1f57600080fd5b80358015158114610d1f57600080fd5b600060208284031215611847578081fd5b61086f838361180f565b600080600060608486031215611865578182fd5b61186f858561180f565b925061187e856020860161180f565b915061188d856040860161180f565b90509250925092565b600080604083850312156118a8578182fd5b6118b2848461180f565b91506118c18460208501611826565b90509250929050565b6000806000606084860312156118de578283fd5b6118e8858561180f565b925060208401356118f881611ef6565b9150604084013561190881611ef6565b809150509250925092565b60008060008060808587031215611928578081fd5b611932868661180f565b93506119418660208701611826565b92506119508660408701611826565b915061195f8660608701611826565b905092959194509250565b60008060006060848603121561197e578283fd5b611988858561180f565b92506119978560208601611826565b9150604084013590509250925092565b6000806000806000608086880312156119be578081fd5b6119c8878761180f565b945060208601356001600160401b03808211156119e3578283fd5b818801915088601f8301126119f6578283fd5b813581811115611a04578384fd5b896020828501011115611a15578384fd5b60208301965080955050505060408601359150611a358760608801611826565b90509295509295909350565b60008060408385031215611a53578182fd5b611a5d848461180f565b946020939093013593505050565b600080600060608486031215611a7f578283fd5b83356001600160a01b0381168114611a95578384fd5b925060208401359150604084013561190881611ef6565b600060208284031215611abd578081fd5b813561086f81611ef6565b600060608284031215611ad9578081fd5b604051606081016001600160401b0381118282101715611af7578283fd5b80604052508251815260208301516020820152604083015160408201528091505092915050565b600080600060608486031215611b32578283fd5b8351611b3d81611f07565b6020850151909350611b4e81611f07565b604085015190925063ffffffff81168114611908578182fd5b600060208284031215611b78578081fd5b5035919050565b600060208284031215611b90578081fd5b5051919050565b60008151808452815b81811015611bbc57602081850181015186830182015201611ba0565b81811115611bcd5782602083870101525b50601f01601f19169290920160200192915050565b6001600160a01b0391909116815260200190565b6001600160a01b0393909316835260208301919091521515604082015260600190565b901515815260200190565b60006020825261086f6020830184611b97565b600060408252611c4a6040830184611b97565b828103602084015260038152621554d160ea1b60208201526040810191505092915050565b602080825260169082015275696e76616c6964205f61646a7573746d656e7442707360501b604082015260600190565b60208082526025908201527f5661756c745072696365466565643a20636f756c64206e6f7420666574636820604082015264707269636560d81b606082015260800190565b6020808252601b908201527a536166654d6174683a206164646974696f6e206f766572666c6f7760281b604082015260600190565b60208082526029908201527f5661756c745072696365466565643a20696e76616c69642062616e64207072696040820152686365206f7261636c6560b81b606082015260800190565b6020808252601d908201527f5661756c745072696365466565643a20696e76616c6964207072696365000000604082015260600190565b6020808252601990820152782b30bab63a283934b1b2a332b2b21d103337b93134b23232b760391b604082015260600190565b60208082526021908201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6040820152607760f81b606082015260800190565b6020808252602d908201527f5661756c745072696365466565643a2061646a7573746d656e7420667265717560408201526c195b98de48195e18d959591959609a1b606082015260800190565b6020808252602a908201527f5661756c745072696365466565643a20696e76616c6964205f7370726561644260408201526961736973506f696e747360b01b606082015260800190565b60208082526029908201527f5661756c745072696365466565643a20696e76616c69642070726963652066656040820152681959081cde5b589bdb60ba1b606082015260800190565b90815260200190565b8015158114611f0457600080fd5b50565b6001600160701b0381168114611f0457600080fdfea26469706673582212202fd6c09826ccbd32f9b641bb8363257c887969f6a0583e8a5c54e782a6d2cb7f64736f6c634300060c0033

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