Contract 0x605ce7209B6811c1892Ae18Cfa6595bA1462C403

Txn Hash Method
Block
From
To
Value [Txn Fee]
0x4676b4a44bca3b8f271f26605e8724ba8da887f232d40286b67de8895a5dba93Transfer Ownersh...220373742021-11-14 15:28:30227 days 1 hr agoCoffin Finance: Deployer IN  0x605ce7209b6811c1892ae18cfa6595ba1462c4030 FTM0.005359656369
0x4f5b3fabdad951f5d362bd2482249e961733ab8b3721c4bfc0cb23dedd4d4d69Init183124052021-10-04 20:43:30267 days 19 hrs agoCoffin Finance: Deployer IN  0x605ce7209b6811c1892ae18cfa6595ba1462c4030 FTM0.020118219223
0xf66a27eb88bf0577a247ae5901e8a22d729f974f21214521a0092496fb7acc700x60806040183123722021-10-04 20:42:57267 days 19 hrs agoCoffin Finance: Deployer IN  Create: CoffinOracle0 FTM0.541305254034
[ Download CSV Export 
Latest 1 internal transaction
Parent Txn Hash Block From To Value
0xf66a27eb88bf0577a247ae5901e8a22d729f974f21214521a0092496fb7acc70183123722021-10-04 20:42:57267 days 19 hrs ago Coffin Finance: Deployer  Contract Creation0 FTM
[ Download CSV Export 
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
CoffinOracle

Compiler Version
v0.8.7+commit.e28d00a7

Optimization Enabled:
Yes with 500 runs

Other Settings:
default evmVersion

Contract Source Code (Solidity Standard Json-Input format)

File 1 of 15 : CoffinOracle.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.7;
pragma experimental ABIEncoderV2;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
import "@openzeppelin/contracts/proxy/utils/Initializable.sol";

import "@openzeppelin/contracts/access/Ownable.sol";
import "./interfaces/IUniswapV2Router02.sol";
import "./interfaces/IUniswapV2Factory.sol";
import "./interfaces/IUniswapLP.sol";
import "./libs/FixedPoint.sol";
import "./interfaces/IBandStdReference.sol";


interface ICoffinOracle {
    function PERIOD() external view returns (uint32);
    function getCOFFINUSD() external view returns (uint256, uint8);
    function updateTwap(address token0, address token1) external ;
    function getCOUSDUSD() external view returns (uint256, uint8);
    function getTwapCOUSDUSD() external view returns (uint256, uint8);
    function getTwapCOFFINUSD() external view returns (uint256, uint8);
    function getTwapXCOFFINUSD() external view returns (uint256, uint8);
    function updateTwapDollar() external ;
    function updateTwapCoffin() external ;
    function updateTwapXCoffin() external ;
    function getXCOFFINUSD() external view returns (uint256, uint8);
    function getCOUSDFTM() external view returns (uint256, uint8);
    function getXCOFFINFTM() external view returns (uint256, uint8);
    function getCOFFINFTM() external view returns (uint256, uint8);
    function getFTMUSD() external view returns (uint256, uint8);

}

contract MockCoffinOracle is ICoffinOracle, Ownable {
    uint256 public xcoffinftm = (1 / 2) * 1 * 10**18;
    uint256 public coffinftm = 2 * 1 * 10**18;
    uint256 public ftmusd = (1 / 4) * 1 * 10**18;
    uint256 public cousdftm = (101 / 100) * 4 * 1 * 10**18;
    uint32 public override PERIOD = 600; // 10-minute TWAP 

    function updateTwap(address token0, address token1) external override {

    }
    function updateTwapDollar() external override{

    }
    function updateTwapCoffin() external override{

    }
    function updateTwapXCoffin() external override{

    }
    function setCOUSDFTM(uint256 val) external {
        cousdftm = val;
    }

    function getCOUSDFTM() public view override returns (uint256, uint8) {
        return (cousdftm, 18);
    }

    function setXCOFFINFTM(uint256 val) external {
        xcoffinftm = val;
    }

    function getXCOFFINFTM() public view override returns (uint256, uint8) {
        return (xcoffinftm, 18);
    }

    function setCOFFINFTM(uint256 val) external {
        coffinftm = val;
    }

    function getCOFFINFTM() public view override returns (uint256, uint8) {
        return (coffinftm, 18);
    }

 
    uint256 public cousdusd = 1030000000000000000;
    function setCOUSDUSD(uint256 val) external {
        cousdusd = val;// decimal 18 
    }
    function getCOUSDUSD() public view override returns(uint256,uint8){
        return (cousdusd,18);// decimal 18 
    }
    
 
    
    function setFTMUSD(uint256 val) external {
        ftmusd = val;
    }

    function getFTMUSD() public view override returns (uint256, uint8) {
        return (ftmusd, 18);
    }


    function getCOFFINUSD() public view override returns (uint256, uint8) {
        (uint256 v1, uint8 d1) = getCOFFINFTM();
        (uint256 v2, uint8 d2) = getFTMUSD();
        return ((v1 * v2) / (10**d1), d2);
    }

    function getXCOFFINUSD() public view override returns (uint256, uint8) {
        (uint256 v1, uint8 d1) = getXCOFFINFTM();
        (uint256 v2, uint8 d2) = getFTMUSD();
        return ((v1 * v2) / (10**d1), d2);
    }

    function getTwapCOUSDUSD() external view override returns (uint256, uint8){
        return getCOUSDUSD();
    }
    function getTwapCOFFINUSD() external view override returns (uint256, uint8){
        return getCOFFINUSD();
    }
    function getTwapXCOFFINUSD() external view override returns (uint256, uint8){
        return getXCOFFINUSD();
    }

}


contract CoffinOracle is ICoffinOracle, Initializable,Ownable {
    using SafeMath for uint256;
    using FixedPoint for *;

    IUniswapV2Router02 public uniswapv2router;
    address public coffin;
    address public dollar;
    address public xcoffin;
    address public wftm = 0x21be370D5312f44cB42ce377BC9b8a0cEF1A4C83;
    address public usdc = 0x04068DA6C83AFCFA0e13ba15A6696662335D5B75;
    address public dai = 0x8D11eC38a3EB5E956B052f67Da8Bdc9bef8Abf3E;
    address public boo = 0x841FAD6EAe12c286d1Fd18d1d525DFfA75C7EFFE;
    IBandStdReference bandRef;
    uint32 public override PERIOD = 600; // 10-minute TWAP

    struct Pair {
        uint256 price0CumulativeLast;
        uint256 price1CumulativeLast;
        uint32 blockTimestampLast;
        FixedPoint.uq112x112 price0Average;
        FixedPoint.uq112x112 price1Average;
        bool initialized;
    }

    mapping(address => Pair) public getPair;

    function setPeriod(uint32 _period) external onlyOwner {
        PERIOD = _period;
    }

    function init(
        address _coffinAddress,
        address _cousdAddress,
        address _xcoffinAddress
    ) external  initializer onlyOwner{
        // router address. it's spooky router by default. 
        address routerAddress = 0xF491e7B69E4244ad4002BC14e878a34207E38c29;
        setRouter(routerAddress);

        address fantomBandProtocol = 0x56E2898E0ceFF0D1222827759B56B28Ad812f92F;

        setBandOracle(fantomBandProtocol);
        setCOFFINAddress(_coffinAddress);
        setDollarAddress(_cousdAddress);
        setXCOFFINAddress(_xcoffinAddress);
    }

    function getBandRate(string memory token0, string memory token1)
        public
        view
        returns (uint256)
    {
        IBandStdReference.ReferenceData memory data = bandRef.getReferenceData(
            token0,
            token1
        );
        return data.rate;
    }


    function getFTMUSD() public view override returns (uint256, uint8) {
        return (getBandRate("FTM","USD"), 18);
    }

    



    function setCOFFINAddress(address _coffinAddress) public onlyOwner {
        coffin = _coffinAddress;
    }

    function setXCOFFINAddress(address _xcoffinAddress) public onlyOwner {
        xcoffin = _xcoffinAddress;
    }

    function setDollarAddress(address _cousdAddress) public onlyOwner {
        dollar = _cousdAddress;
    }

    function setRouter(address _uniswapv2routeraddress)
        public
        onlyOwner
    {
        uniswapv2router = IUniswapV2Router02(_uniswapv2routeraddress);
    }

    function setBandOracle(address _bandOracleAddress) public onlyOwner {
        bandRef = IBandStdReference(_bandOracleAddress);
    }


    function getCOFFINUSD() external view override returns (uint256, uint8) {
        (uint256 v1, uint8 d1) = getCOFFINFTM();
        (uint256 v2, uint8 d2) = getFTMUSD();
        return ((v1 * v2) / (10**d1), d2);
    }

    function getTwapCOFFINUSD() external view override returns (uint256, uint8) {
        (uint256 v1, uint8 d1) = getTwapCOFFINFTM();
        (uint256 v2, uint8 d2) = getFTMUSD();
        return ((v1 * v2) / (10**d1), d2);
    }
    
    function getUSDCUSD() public view  returns (uint256, uint8) {
        return (getBandRate("USDC","USD"), 18);
    }
    function getDAIUSD() public view  returns (uint256, uint8) {
        return (getBandRate("DAI","USD"), 18);
    }
    
    uint8 public oracleMode = 0; 

    function enableFTMOracle() external onlyOwner {
        oracleMode = 1;
    }
    function enableDAIOracle() external onlyOwner {
        oracleMode = 2 ;
    }
    function enableUSDCracle() external onlyOwner {
        oracleMode = 0 ;
    }

    function getCOUSDUSD() external view override returns (uint256, uint8) {
        if (oracleMode==1) {
            (uint256 v1, uint8 d1) = getCOUSDFTM();
            (uint256 v2, uint8 d2) = getFTMUSD();
            return ((v1 * v2) / (10**d1), d2);
        } else if (oracleMode==2) {
            (uint256 v1, uint8 d1) = getCOUSDDAI();
            (uint256 v2, uint8 d2) = getDAIUSD();
            return ((v1 * v2) / (10**d1), d2);
        } else {
            (uint256 v1, uint8 d1) = getCOUSDUSDC();
            (uint256 v2, uint8 d2) = getUSDCUSD();
            return ((v1 * v2) / (10**d1), d2);
        }
    }

    function getTwapCOUSDUSD() external view override returns (uint256, uint8) {
        if (oracleMode==1) {
            (uint256 v1, uint8 d1) = getTwapCOUSDFTM();
            (uint256 v2, uint8 d2) = getFTMUSD();
            return ((v1 * v2) / (10**d1), d2);
        } else if (oracleMode==2) {   
            (uint256 v1, uint8 d1) = getTwapCOUSDDAI();
            (uint256 v2, uint8 d2) = getDAIUSD();
            return ((v1 * v2) / (10**d1), d2);
        } else {
            (uint256 v1, uint8 d1) = getTwapCOUSDUSDC();
            (uint256 v2, uint8 d2) = getUSDCUSD();
            return ((v1 * v2) / (10**d1), d2);     
        }

    }

    
    


    function getXCOFFINUSD() external view override returns (uint256, uint8) {
        (uint256 v1, uint8 d1) = getXCOFFINFTM();
        (uint256 v2, uint8 d2) = getFTMUSD();
        return ((v1 * v2) / (10**d1), d2);
    }

    function getTwapXCOFFINUSD() external view override returns (uint256, uint8) {
        (uint256 v1, uint8 d1) = getTwapXCOFFINFTM();
        (uint256 v2, uint8 d2) = getFTMUSD();
        return ((v1 * v2) / (10**d1), d2);
    }

    function getTwapCOUSDFTM() public view  returns (uint256, uint8) {
        (uint256 a, uint8 b) = getTwapRate(dollar,wftm);
        if (a>0) {
            return (a,b);
        }
        return getRealtimeRate(dollar,wftm);
    }
    
    function getTwapCOUSDDAI() public view  returns (uint256, uint8) {
        (uint256 a, uint8 b) = getTwapRate(dollar,dai);
        if (a>0) {
            return (a,b);
        }
        return getRealtimeRate(dollar,usdc);
    }
    function getTwapCOUSDUSDC() public view  returns (uint256, uint8) {
        (uint256 a, uint8 b) = getTwapRate(dollar,usdc);
        if (a>0) {
            return (a,b);
        }
        return getRealtimeRate(dollar,usdc);
    }
    
    function getCOUSDFTM() public view override returns (uint256, uint8) {
        return getRealtimeRate(dollar,wftm);
    }
    function getCOUSDUSDC() public view returns (uint256, uint8) {
        return getRealtimeRate(dollar,usdc);
    }
    function getCOUSDDAI() public view returns (uint256, uint8) {
        return getRealtimeRate(dollar,dai);
    }
    

    function getTwapXCOFFINFTM() public view  returns (uint256, uint8) {
        (uint256 a, uint8 b) = getTwapRate(xcoffin,wftm);
        if (a>0) {
            return (a,b);
        }
        return getRealtimeRate(xcoffin,wftm);
    }

    function getXCOFFINFTM() public view override returns (uint256, uint8) {
        return getRealtimeRate(xcoffin,wftm);
    }

    function getTwapCOFFINFTM() public view returns (uint256, uint8) {
        (uint256 a, uint8 b) = getTwapRate(coffin,wftm);
        if (a>0) {
            return (a,b);
        }
        return getRealtimeRate(coffin,wftm);
    }
    function getCOFFINFTM() public view override returns (uint256, uint8) {
        return getRealtimeRate(coffin,wftm);
    }


    function currentBlockTimestamp() internal view returns (uint32) {
        return uint32(block.timestamp % 2**32);
    }

    function currentCumulativePrices(address uniswapV2Pair)
        internal
        view
        returns (
            uint256 price0Cumulative,
            uint256 price1Cumulative,
            uint32 blockTimestamp
        )
    {
        // Pair storage pairStorage = getPair[uniswapV2Pair];

        blockTimestamp = currentBlockTimestamp();
        IUniswapLP uniswapPair = IUniswapLP(uniswapV2Pair);
        price0Cumulative = uniswapPair.price0CumulativeLast();
        price1Cumulative = uniswapPair.price1CumulativeLast();

        // if time has elapsed since the last update on the pair, mock the accumulated price values
        (uint112 reserve0, uint112 reserve1, uint32 _blockTimestampLast) = uniswapPair.getReserves();
        if (_blockTimestampLast != blockTimestamp) {
            // subtraction overflow is desired
            uint32 timeElapsed = blockTimestamp - _blockTimestampLast;
            // addition overflow is desired
            // counterfactual
            price0Cumulative += uint256(FixedPoint.fraction(reserve1, reserve0)._x) * timeElapsed;
            // counterfactual
            price1Cumulative += uint256(FixedPoint.fraction(reserve0, reserve1)._x) * timeElapsed;
        }
    }


    function getTwapRate(address token0, address token1)
        public
        view
        returns (uint256 priceLatest, uint8 decimals)
    {
        address[] memory path = new address[](2);
        path[0] = token0;
        path[1] = token1;
        address factory = address(uniswapv2router.factory());
        address uniswapV2Pair = IUniswapV2Factory(factory).getPair(token0, token1);

        if (uniswapV2Pair== address(0)) {
            return (0,0);
        } 

        // Pair memory pair = getPair[uniswapV2Pair];
        Pair storage pairStorage = getPair[uniswapV2Pair];

        // require(pairStorage.initialized, "need to setup first");
        if (!pairStorage.initialized) {
            return getRealtimeRate(token0, token1);
            // return (0,0);
        }
        
        (uint256 price0Cumulative, uint256 price1Cumulative, uint32 blockTimestamp) = currentCumulativePrices(
            address(uniswapV2Pair)
        );
        uint32 timeElapsed = blockTimestamp - pairStorage.blockTimestampLast; // Overflow is desired

        FixedPoint.uq112x112 memory price0Average 
            = FixedPoint.uq112x112(uint224((price0Cumulative - pairStorage.price0CumulativeLast) / timeElapsed));
        FixedPoint.uq112x112 memory price1Average 
            = FixedPoint.uq112x112(uint224((price1Cumulative - pairStorage.price1CumulativeLast) / timeElapsed));

        uint256 amountIn = 1e18;
        if (IUniswapLP(uniswapV2Pair).token0() == token0) {
            priceLatest = uint256(price0Average.mul(amountIn).decode144());
            decimals = ERC20(token1).decimals();
        } else {
            require(IUniswapLP(uniswapV2Pair).token0() == token1, "TwapOracle: INVALID_TOKEN");
            priceLatest = uint256(price1Average.mul(amountIn).decode144());
            decimals = ERC20(token0).decimals();
        }
    }

    function getTwapRateWithUpdate(address token0, address token1)
        external
        returns (uint256 priceLatest, uint8 decimals)
    {
        updateTwap(token0,token1);
        return getTwapRate(token0,token1);
    }
    

    function updateTwapDollarFTM() public  {
        updateTwap(dollar, wftm);
    }
    function updateTwapDollar() public override {
        updateTwap(dollar, dai);
    }
    function updateTwapDollarUSDC() public  {
        updateTwap(dollar, usdc);
    }
    function updateTwapCoffin() public override {
        updateTwap(coffin, wftm);
    }
    function updateTwapXCoffin() public override {
        updateTwap(xcoffin, wftm);
    }

    function updateTwap(address token0, address token1) public override {

        address[] memory path = new address[](2);
        path[0] = token0;
        path[1] = token1;
        address factory = address(uniswapv2router.factory());
        address uniswapV2Pair = IUniswapV2Factory(factory).getPair(token0, token1);

        if (uniswapV2Pair== address(0)) {
            return;
        }
        Pair storage pairStorage = getPair[uniswapV2Pair];
        // require(pairStorage.initialized, "need to setup first");
        
        (uint256 price0Cumulative, uint256 price1Cumulative, uint32 blockTimestamp) = currentCumulativePrices(
            address(uniswapV2Pair)
        );

        if (!pairStorage.initialized) {
            // first time 
            pairStorage.price0CumulativeLast = price0Cumulative;
            pairStorage.price1CumulativeLast = price1Cumulative;
            pairStorage.blockTimestampLast = blockTimestamp;
            pairStorage.initialized = true;
            return;
        }

        // Overflow is desired
        uint32 timeElapsed = blockTimestamp - pairStorage.blockTimestampLast; 
        
        // Ensure that at least one full period has passed since the last update
        if (timeElapsed < PERIOD) {
            return ;
        }
        
        pairStorage.price0Average 
            = FixedPoint.uq112x112(uint224((price0Cumulative - pairStorage.price0CumulativeLast) / timeElapsed));
        pairStorage.price1Average 
            = FixedPoint.uq112x112(uint224((price1Cumulative - pairStorage.price1CumulativeLast) / timeElapsed));
        pairStorage.price0CumulativeLast = price0Cumulative;
        pairStorage.price1CumulativeLast = price1Cumulative;
        pairStorage.blockTimestampLast = blockTimestamp;
    }

    function getRealtimeRate(address tokenA, address tokenB)
        public
        view
        returns (uint256 priceLatest, uint8 decimals)
    {

        address factory = address(uniswapv2router.factory());
        address pair = IUniswapV2Factory(factory).getPair(tokenA, tokenB);
        if (pair== address(0)) {
            return (0,0);
        }
        
        (uint112 reserve0, uint112 reserve1,) =
            IUniswapLP(pair).getReserves();
        if (IUniswapLP(pair).token0()==address(tokenA)) {
            priceLatest = uint256(reserve1).mul(uint256(10**ERC20(tokenA).decimals())).div(uint256(reserve0));
            decimals = ERC20(tokenB).decimals();
        } else {
            priceLatest = uint256(reserve0).mul(uint256(10**ERC20(tokenA).decimals())).div(uint256(reserve1));
            decimals = ERC20(tokenB).decimals();
        }

        if ((18-decimals)>0) { 
            priceLatest = priceLatest.mul(10**(18-decimals));
            decimals = 18;
        }
    }
}

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

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

File 3 of 15 : ERC20.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

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

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

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

    uint256 private _totalSupply;

    string private _name;
    string private _symbol;

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

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

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

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

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

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

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

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

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

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

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

        return true;
    }

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

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

        return true;
    }

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

        _beforeTokenTransfer(sender, recipient, amount);

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

        emit Transfer(sender, recipient, amount);

        _afterTokenTransfer(sender, recipient, amount);
    }

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

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

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

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

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

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

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

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

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

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

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

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

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

File 4 of 15 : SafeMath.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

File 5 of 15 : Initializable.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

/**
 * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed
 * behind a proxy. Since a proxied contract can't have a constructor, it's common to move constructor logic to an
 * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer
 * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.
 *
 * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as
 * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.
 *
 * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure
 * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.
 */
abstract contract Initializable {
    /**
     * @dev Indicates that the contract has been initialized.
     */
    bool private _initialized;

    /**
     * @dev Indicates that the contract is in the process of being initialized.
     */
    bool private _initializing;

    /**
     * @dev Modifier to protect an initializer function from being invoked twice.
     */
    modifier initializer() {
        require(_initializing || !_initialized, "Initializable: contract is already initialized");

        bool isTopLevelCall = !_initializing;
        if (isTopLevelCall) {
            _initializing = true;
            _initialized = true;
        }

        _;

        if (isTopLevelCall) {
            _initializing = false;
        }
    }
}

File 6 of 15 : Ownable.sol
// SPDX-License-Identifier: MIT

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() {
        _setOwner(_msgSender());
    }

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

    /**
     * @dev Throws if called by any account other than the owner.
     */
    modifier onlyOwner() {
        require(owner() == _msgSender(), "Ownable: caller is not the owner");
        _;
    }

    /**
     * @dev Leaves the contract without owner. It will not be possible to call
     * `onlyOwner` functions anymore. Can only be called by the current owner.
     *
     * NOTE: Renouncing ownership will leave the contract without an owner,
     * thereby removing any functionality that is only available to the owner.
     */
    function renounceOwnership() public virtual onlyOwner {
        _setOwner(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");
        _setOwner(newOwner);
    }

    function _setOwner(address newOwner) private {
        address oldOwner = _owner;
        _owner = newOwner;
        emit OwnershipTransferred(oldOwner, newOwner);
    }
}

File 7 of 15 : IUniswapV2Router02.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.11;

import "./IUniswapV2Router01.sol";

interface IUniswapV2Router02 is IUniswapV2Router01 {
    function removeLiquidityETHSupportingFeeOnTransferTokens(
        address token,
        uint256 liquidity,
        uint256 amountTokenMin,
        uint256 amountETHMin,
        address to,
        uint256 deadline
    ) external returns (uint256 amountETH);

    function removeLiquidityETHWithPermitSupportingFeeOnTransferTokens(
        address token,
        uint256 liquidity,
        uint256 amountTokenMin,
        uint256 amountETHMin,
        address to,
        uint256 deadline,
        bool approveMax,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) external returns (uint256 amountETH);

    function swapExactTokensForTokensSupportingFeeOnTransferTokens(
        uint256 amountIn,
        uint256 amountOutMin,
        address[] calldata path,
        address to,
        uint256 deadline
    ) external;

    function swapExactETHForTokensSupportingFeeOnTransferTokens(
        uint256 amountOutMin,
        address[] calldata path,
        address to,
        uint256 deadline
    ) external payable;

    function swapExactTokensForETHSupportingFeeOnTransferTokens(
        uint256 amountIn,
        uint256 amountOutMin,
        address[] calldata path,
        address to,
        uint256 deadline
    ) external;

}

File 8 of 15 : IUniswapV2Factory.sol
// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.7;
interface IUniswapV2Factory {

    function feeTo() external view returns (address);
    function feeToSetter() external view returns (address);

    function getPair(address tokenA, address tokenB) external view returns (address pair);
    function allPairs(uint) external view returns (address pair);
    function allPairsLength() external view returns (uint);

    function createPair(address tokenA, address tokenB) external returns (address pair);

    function setFeeTo(address) external;
    function setFeeToSetter(address) external;
}

File 9 of 15 : IUniswapLP.sol
// SPDX-License-Identifier: MIT

pragma solidity 0.8.7;
pragma experimental ABIEncoderV2;

interface IUniswapLP {
    function token0() external view returns (address);

    function token1() external view returns (address);

    function getReserves()
        external
        view
        returns (
            uint112 reserve0,
            uint112 reserve1,
            uint32 blockTimestampLast
        );

    function price0CumulativeLast() external view returns (uint256);

    function price1CumulativeLast() external view returns (uint256);

    function getTokenWeights() external view returns (uint32 tokenWeight0, uint32 tokenWeight1);
}

File 10 of 15 : FixedPoint.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.7;

import "./Babylonian.sol";

// a library for handling binary fixed point numbers (https://en.wikipedia.org/wiki/Q_(number_format))
library FixedPoint {
    // range: [0, 2**112 - 1]
    // resolution: 1 / 2**112
    struct uq112x112 {
        uint224 _x;
    }

    // range: [0, 2**144 - 1]
    // resolution: 1 / 2**112
    struct uq144x112 {
        uint256 _x;
    }

    uint8 private constant RESOLUTION = 112;
    uint256 private constant Q112 = uint256(1) << RESOLUTION;
    uint256 private constant Q224 = Q112 << RESOLUTION;

    // encode a uint112 as a UQ112x112
    function encode(uint112 x) internal pure returns (uq112x112 memory) {
        return uq112x112(uint224(x) << RESOLUTION);
    }

    // encodes a uint144 as a UQ144x112
    function encode144(uint144 x) internal pure returns (uq144x112 memory) {
        return uq144x112(uint256(x) << RESOLUTION);
    }

    // divide a UQ112x112 by a uint112, returning a UQ112x112
    function div(uq112x112 memory self, uint112 x) internal pure returns (uq112x112 memory) {
        require(x != 0, "FixedPoint: DIV_BY_ZERO");
        return uq112x112(self._x / uint224(x));
    }

    // multiply a UQ112x112 by a uint, returning a UQ144x112
    // reverts on overflow
    function mul(uq112x112 memory self, uint256 y) internal pure returns (uq144x112 memory) {
        uint256 z;
        require(y == 0 || (z = uint256(self._x) * y) / y == uint256(self._x), "FixedPoint: MULTIPLICATION_OVERFLOW");
        return uq144x112(z);
    }

    // returns a UQ112x112 which represents the ratio of the numerator to the denominator
    // equivalent to encode(numerator).div(denominator)
    function fraction(uint112 numerator, uint112 denominator) internal pure returns (uq112x112 memory) {
        require(denominator > 0, "FixedPoint: DIV_BY_ZERO");
        return uq112x112((uint224(numerator) << RESOLUTION) / denominator);
    }

    // decode a UQ112x112 into a uint112 by truncating after the radix point
    function decode(uq112x112 memory self) internal pure returns (uint112) {
        return uint112(self._x >> RESOLUTION);
    }

    // decode a UQ144x112 into a uint144 by truncating after the radix point
    function decode144(uq144x112 memory self) internal pure returns (uint144) {
        return uint144(self._x >> RESOLUTION);
    }

    // take the reciprocal of a UQ112x112
    function reciprocal(uq112x112 memory self) internal pure returns (uq112x112 memory) {
        require(self._x != 0, "FixedPoint: ZERO_RECIPROCAL");
        return uq112x112(uint224(Q224 / self._x));
    }

    // square root of a UQ112x112
    function sqrt(uq112x112 memory self) internal pure returns (uq112x112 memory) {
        return uq112x112(uint224(Babylonian.sqrt(uint256(self._x)) << 56));
    }
}

File 11 of 15 : IBandStdReference.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.7;

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

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

pragma solidity ^0.8.0;

import "../IERC20.sol";

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

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

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

File 13 of 15 : Context.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

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

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

File 14 of 15 : IUniswapV2Router01.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.7;

interface IUniswapV2Router01 {
    function factory() external view   returns (address);
    function WETH() external view  returns (address);

    function addLiquidity(
        address tokenA,
        address tokenB,
        uint amountADesired,
        uint amountBDesired,
        uint amountAMin,
        uint amountBMin,
        address to,
        uint deadline
    ) external returns (uint amountA, uint amountB, uint liquidity);
    function addLiquidityETH(
        address token,
        uint amountTokenDesired,
        uint amountTokenMin,
        uint amountETHMin,
        address to,
        uint deadline
    ) external payable returns (uint amountToken, uint amountETH, uint liquidity);
    function removeLiquidity(
        address tokenA,
        address tokenB,
        uint liquidity,
        uint amountAMin,
        uint amountBMin,
        address to,
        uint deadline
    ) external returns (uint amountA, uint amountB);
    function removeLiquidityETH(
        address token,
        uint liquidity,
        uint amountTokenMin,
        uint amountETHMin,
        address to,
        uint deadline
    ) external returns (uint amountToken, uint amountETH);
    function removeLiquidityWithPermit(
        address tokenA,
        address tokenB,
        uint liquidity,
        uint amountAMin,
        uint amountBMin,
        address to,
        uint deadline,
        bool approveMax, uint8 v, bytes32 r, bytes32 s
    ) external returns (uint amountA, uint amountB);
    function removeLiquidityETHWithPermit(
        address token,
        uint liquidity,
        uint amountTokenMin,
        uint amountETHMin,
        address to,
        uint deadline,
        bool approveMax, uint8 v, bytes32 r, bytes32 s
    ) external returns (uint amountToken, uint amountETH);
    function swapExactTokensForTokens(
        uint amountIn,
        uint amountOutMin,
        address[] calldata path,
        address to,
        uint deadline
    ) external returns (uint[] memory amounts);
    function swapTokensForExactTokens(
        uint amountOut,
        uint amountInMax,
        address[] calldata path,
        address to,
        uint deadline
    ) external returns (uint[] memory amounts);
    function swapExactETHForTokens(uint amountOutMin, address[] calldata path, address to, uint deadline)
        external
        payable
        returns (uint[] memory amounts);
    function swapTokensForExactETH(uint amountOut, uint amountInMax, address[] calldata path, address to, uint deadline)
        external
        returns (uint[] memory amounts);
    function swapExactTokensForETH(uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline)
        external
        returns (uint[] memory amounts);
    function swapETHForExactTokens(uint amountOut, address[] calldata path, address to, uint deadline)
        external
        payable
        returns (uint[] memory amounts);

    function quote(uint amountA, uint reserveA, uint reserveB) external pure returns (uint amountB);
    function getAmountOut(uint amountIn, uint reserveIn, uint reserveOut) external pure returns (uint amountOut);
    function getAmountIn(uint amountOut, uint reserveIn, uint reserveOut) external pure returns (uint amountIn);
    function getAmountsOut(uint amountIn, address[] calldata path) external view returns (uint[] memory amounts);
    function getAmountsIn(uint amountOut, address[] calldata path) external view returns (uint[] memory amounts);
}

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

pragma solidity ^0.8.7;

// computes square roots using the babylonian method
// https://en.wikipedia.org/wiki/Methods_of_computing_square_roots#Babylonian_method
library Babylonian {
    function sqrt(uint256 y) internal pure returns (uint256 z) {
        if (y > 3) {
            z = y;
            uint256 x = y / 2 + 1;
            while (x < z) {
                z = x;
                x = (y / x + x) / 2;
            }
        } else if (y != 0) {
            z = 1;
        }
        // else z = 0
    }
}

Settings
{
  "optimizer": {
    "enabled": true,
    "runs": 500
  },
  "metadata": {
    "bytecodeHash": "none",
    "useLiteralContent": true
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "abi"
      ]
    }
  },
  "libraries": {}
}

Contract Security Audit

Contract ABI

[{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"inputs":[],"name":"PERIOD","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"boo","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"coffin","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"dai","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"dollar","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"enableDAIOracle","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"enableFTMOracle","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"enableUSDCracle","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"token0","type":"string"},{"internalType":"string","name":"token1","type":"string"}],"name":"getBandRate","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getCOFFINFTM","outputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getCOFFINUSD","outputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getCOUSDDAI","outputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getCOUSDFTM","outputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getCOUSDUSD","outputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getCOUSDUSDC","outputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getDAIUSD","outputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getFTMUSD","outputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"getPair","outputs":[{"internalType":"uint256","name":"price0CumulativeLast","type":"uint256"},{"internalType":"uint256","name":"price1CumulativeLast","type":"uint256"},{"internalType":"uint32","name":"blockTimestampLast","type":"uint32"},{"components":[{"internalType":"uint224","name":"_x","type":"uint224"}],"internalType":"struct FixedPoint.uq112x112","name":"price0Average","type":"tuple"},{"components":[{"internalType":"uint224","name":"_x","type":"uint224"}],"internalType":"struct FixedPoint.uq112x112","name":"price1Average","type":"tuple"},{"internalType":"bool","name":"initialized","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"tokenA","type":"address"},{"internalType":"address","name":"tokenB","type":"address"}],"name":"getRealtimeRate","outputs":[{"internalType":"uint256","name":"priceLatest","type":"uint256"},{"internalType":"uint8","name":"decimals","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getTwapCOFFINFTM","outputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getTwapCOFFINUSD","outputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getTwapCOUSDDAI","outputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getTwapCOUSDFTM","outputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getTwapCOUSDUSD","outputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getTwapCOUSDUSDC","outputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"token0","type":"address"},{"internalType":"address","name":"token1","type":"address"}],"name":"getTwapRate","outputs":[{"internalType":"uint256","name":"priceLatest","type":"uint256"},{"internalType":"uint8","name":"decimals","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"token0","type":"address"},{"internalType":"address","name":"token1","type":"address"}],"name":"getTwapRateWithUpdate","outputs":[{"internalType":"uint256","name":"priceLatest","type":"uint256"},{"internalType":"uint8","name":"decimals","type":"uint8"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"getTwapXCOFFINFTM","outputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getTwapXCOFFINUSD","outputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getUSDCUSD","outputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getXCOFFINFTM","outputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getXCOFFINUSD","outputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_coffinAddress","type":"address"},{"internalType":"address","name":"_cousdAddress","type":"address"},{"internalType":"address","name":"_xcoffinAddress","type":"address"}],"name":"init","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"oracleMode","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_bandOracleAddress","type":"address"}],"name":"setBandOracle","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_coffinAddress","type":"address"}],"name":"setCOFFINAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_cousdAddress","type":"address"}],"name":"setDollarAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint32","name":"_period","type":"uint32"}],"name":"setPeriod","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_uniswapv2routeraddress","type":"address"}],"name":"setRouter","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_xcoffinAddress","type":"address"}],"name":"setXCOFFINAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"uniswapv2router","outputs":[{"internalType":"contract IUniswapV2Router02","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"token0","type":"address"},{"internalType":"address","name":"token1","type":"address"}],"name":"updateTwap","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"updateTwapCoffin","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"updateTwapDollar","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"updateTwapDollarFTM","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"updateTwapDollarUSDC","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"updateTwapXCoffin","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"usdc","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"wftm","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"xcoffin","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"}]

6080604052600580546001600160a01b03199081167321be370d5312f44cb42ce377bc9b8a0cef1a4c83179091556006805482167304068da6c83afcfa0e13ba15a6696662335d5b75179055600780548216738d11ec38a3eb5e956b052f67da8bdc9bef8abf3e1790556008805490911673841fad6eae12c286d1fd18d1d525dffa75c7effe17905560098054604b60a31b63ffffffff60a01b19909116179055600b805460ff191690553480156100b657600080fd5b506100c0336100c5565b610120565b600080546001600160a01b038381166201000081810262010000600160b01b0319851617855560405193049190911692909183917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a35050565b6129908061012f6000396000f3fe608060405234801561001057600080fd5b50600436106103575760003560e01c806393f1603f116101c8578063e01b32bf11610104578063f4b9fa75116100a2578063f7f398a51161007c578063f7f398a514610700578063fc59574c14610708578063fd21e6371461071b578063fe4f880e1461072357600080fd5b8063f4b9fa75146106d2578063f4f45b46146106e5578063f530a211146106f857600080fd5b8063e926649b116100de578063e926649b146106a7578063edc808a3146106af578063eed0c062146106b7578063f2fde38b146106bf57600080fd5b8063e01b32bf14610679578063e61574b01461068c578063e83999e81461069457600080fd5b8063acdaa69a11610171578063b4d1d7951161014b578063b4d1d7951461061f578063b8ec2d381461064b578063c0d786551461065e578063d34410ba1461067157600080fd5b8063acdaa69a14610607578063af80c0011461060f578063b1c0c6e81461061757600080fd5b8063aa09d9bf116101a2578063aa09d9bf146105ef578063ab3f7348146105f7578063ac5c4b11146105ff57600080fd5b806393f1603f146105c15780639478e212146105d457806397e8e4ca146105e757600080fd5b80633e413bee11610297578063593a48c111610240578063715018a61161021a578063715018a61461057c57806380097fda146105845780638da5cb5b146105975780638de4011e146105ae57600080fd5b8063593a48c11461054e5780635c16cb8114610561578063712de3131461056957600080fd5b80634b3df200116102715780634b3df200146105155780634f3e27381461052857806351adeb571461053b57600080fd5b80633e413bee146104d95780633ea803e3146104ec57806343be12301461050d57600080fd5b80631b35a4a611610304578063287a7801116102de578063287a7801146104965780632dd67f241461049e5780632fbc2192146104a6578063339d2e38146104ae57600080fd5b80631b35a4a6146104675780632075d8a71461046f57806323db4bbc1461048e57600080fd5b8063177d8a3211610335578063177d8a3214610392578063184b95591461039a5780631a788a02146103ad57600080fd5b806311b6875d1461035c57806312eb11191461036657806315e06f1f1461038a575b600080fd5b61036461072b565b005b61036e610749565b6040805192835260ff9091166020830152015b60405180910390f35b61036e610795565b6103646107f4565b6103646103a83660046124f7565b610810565b61041f6103bb366004612484565b600a602090815260009182526040918290208054600182015460028301548551808601875260038501546001600160e01b0390811682528751968701909752600485015490961685526005909301549194909363ffffffff90931692909160ff1686565b60408051968752602087019590955263ffffffff90931693850193909352516001600160e01b03908116606085015291519091166080830152151560a082015260c001610381565b61036e610982565b600b5461047c9060ff1681565b60405160ff9091168152602001610381565b61036e6109ab565b6103646109cc565b61036e610a27565b610364610a6a565b6004546104c1906001600160a01b031681565b6040516001600160a01b039091168152602001610381565b6006546104c1906001600160a01b031681565b6104ff6104fa366004612542565b610a86565b604051908152602001610381565b61036e610b18565b6008546104c1906001600160a01b031681565b610364610536366004612484565b610b64565b6003546104c1906001600160a01b031681565b6002546104c1906001600160a01b031681565b610364610bd5565b61036e6105773660046124be565b610c33565b610364610c56565b6103646105923660046124be565b610caf565b6000546201000090046001600160a01b03166104c1565b6103646105bc366004612484565b610fd0565b6103646105cf366004612484565b611041565b6001546104c1906001600160a01b031681565b61036e6110b2565b61036e611107565b61036461114b565b61036e6111a9565b61036e6111b7565b6103646111dc565b61036e6111f8565b60095461063690600160a01b900463ffffffff1681565b60405163ffffffff9091168152602001610381565b610364610659366004612657565b611219565b61036461066c366004612484565b61128e565b61036e6112ff565b61036e6106873660046124be565b61135f565b61036e611897565b6103646106a2366004612484565b6118d9565b61036e61194a565b61036e611958565b61036e611979565b6103646106cd366004612484565b6119ce565b6007546104c1906001600160a01b031681565b6005546104c1906001600160a01b031681565b61036e611a8e565b61036e611a9c565b61036e6107163660046124be565b611ab9565b61036e611f62565b610364611fb7565b600454600554610747916001600160a01b039081169116610caf565b565b60008061078c6040518060400160405280600381526020016246544d60e81b815250604051806040016040528060038152602001621554d160ea1b815250610a86565b92601292509050565b6003546005546000918291829182916107ba916001600160a01b03908116911661135f565b909250905081156107ce5790939092509050565b6003546005546107ea916001600160a01b039081169116611ab9565b9350935050509091565b600354600754610747916001600160a01b039081169116610caf565b600054610100900460ff1680610829575060005460ff16155b6108a05760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201527f647920696e697469616c697a656400000000000000000000000000000000000060648201526084015b60405180910390fd5b600054610100900460ff161580156108c2576000805461ffff19166101011790555b6000546001600160a01b03620100009091041633146109115760405162461bcd60e51b815260206004820181905260248201526000805160206129648339815191526044820152606401610897565b73f491e7b69e4244ad4002bc14e878a34207e38c2961092f8161128e565b7356e2898e0ceff0d1222827759b56b28ad812f92f61094d81611041565b61095686610b64565b61095f85610fd0565b610968846118d9565b5050801561097c576000805461ff00191690555b50505050565b60035460075460009182916109a3916001600160a01b039081169116611ab9565b915091509091565b60035460065460009182916109a3916001600160a01b039081169116611ab9565b6000546001600160a01b0362010000909104163314610a1b5760405162461bcd60e51b815260206004820181905260248201526000805160206129648339815191526044820152606401610897565b600b805460ff19169055565b60008061078c6040518060400160405280600381526020016244414960e81b815250604051806040016040528060038152602001621554d160ea1b815250610a86565b600254600554610747916001600160a01b039081169116610caf565b60095460405163195556f360e21b815260009182916001600160a01b03909116906365555bcc90610abd90879087906004016126e4565b60606040518083038186803b158015610ad557600080fd5b505afa158015610ae9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b0d91906125a6565b519150505b92915050565b600080600080610b266111f8565b91509150600080610b35610749565b9092509050610b4583600a6127a7565b610b4f8386612852565b610b599190612750565b969095509350505050565b6000546001600160a01b0362010000909104163314610bb35760405162461bcd60e51b815260206004820181905260248201526000805160206129648339815191526044820152606401610897565b600280546001600160a01b0319166001600160a01b0392909216919091179055565b6000546001600160a01b0362010000909104163314610c245760405162461bcd60e51b815260206004820181905260248201526000805160206129648339815191526044820152606401610897565b600b805460ff19166001179055565b600080610c408484610caf565b610c4a848461135f565b915091505b9250929050565b6000546001600160a01b0362010000909104163314610ca55760405162461bcd60e51b815260206004820181905260248201526000805160206129648339815191526044820152606401610897565b6107476000611fd3565b6040805160028082526060820183526000926020830190803683370190505090508281600081518110610ce457610ce4612910565b60200260200101906001600160a01b031690816001600160a01b0316815250508181600181518110610d1857610d18612910565b6001600160a01b039283166020918202929092018101919091526001546040805163c45a015560e01b81529051600094929092169263c45a015592600480840193829003018186803b158015610d6d57600080fd5b505afa158015610d81573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610da591906124a1565b60405163e6a4390560e01b81526001600160a01b038681166004830152858116602483015291925060009183169063e6a439059060440160206040518083038186803b158015610df457600080fd5b505afa158015610e08573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e2c91906124a1565b90506001600160a01b038116610e43575050505050565b6001600160a01b0381166000908152600a60205260408120908080610e678561203b565b6005870154929550909350915060ff16610eba5791835560018084019190915560028301805463ffffffff191663ffffffff909316929092179091556005909101805460ff191690911790555050505050565b6002840154600090610ed29063ffffffff1683612888565b60095490915063ffffffff600160a01b90910481169082161015610efc5750505050505050505050565b60405180602001604052808263ffffffff16876000015487610f1e9190612871565b610f289190612750565b6001600160e01b0390811690915290516003870180546001600160e01b0319169190921617905560408051602081019091526001860154819063ffffffff841690610f739087612871565b610f7d9190612750565b6001600160e01b0390811690915290516004870180546001600160e01b031916919092161790555091835560018301556002909101805463ffffffff191663ffffffff9092169190911790555050505050565b6000546001600160a01b036201000090910416331461101f5760405162461bcd60e51b815260206004820181905260248201526000805160206129648339815191526044820152606401610897565b600380546001600160a01b0319166001600160a01b0392909216919091179055565b6000546001600160a01b03620100009091041633146110905760405162461bcd60e51b815260206004820181905260248201526000805160206129648339815191526044820152606401610897565b600980546001600160a01b0319166001600160a01b0392909216919091179055565b6003546006546000918291829182916110d7916001600160a01b03908116911661135f565b909250905081156110eb5790939092509050565b6003546006546107ea916001600160a01b039081169116611ab9565b60008061078c604051806040016040528060048152602001635553444360e01b815250604051806040016040528060038152602001621554d160ea1b815250610a86565b6000546001600160a01b036201000090910416331461119a5760405162461bcd60e51b815260206004820181905260248201526000805160206129648339815191526044820152606401610897565b600b805460ff19166002179055565b600080600080610b26611958565b6003546007546000918291829182916110d7916001600160a01b03908116911661135f565b600354600554610747916001600160a01b039081169116610caf565b60025460055460009182916109a3916001600160a01b039081169116611ab9565b6000546001600160a01b03620100009091041633146112685760405162461bcd60e51b815260206004820181905260248201526000805160206129648339815191526044820152606401610897565b6009805463ffffffff909216600160a01b0263ffffffff60a01b19909216919091179055565b6000546001600160a01b03620100009091041633146112dd5760405162461bcd60e51b815260206004820181905260248201526000805160206129648339815191526044820152606401610897565b600180546001600160a01b0319166001600160a01b0392909216919091179055565b600b54600090819060ff166001141561131d57600080610b26610795565b600b5460ff1660021415611345576000806113366111b7565b91509150600080610b35610a27565b6000806113506110b2565b91509150600080610b35611107565b604080516002808252606082018352600092839283929091602083019080368337019050509050848160008151811061139a5761139a612910565b60200260200101906001600160a01b031690816001600160a01b03168152505083816001815181106113ce576113ce612910565b6001600160a01b039283166020918202929092018101919091526001546040805163c45a015560e01b81529051600094929092169263c45a015592600480840193829003018186803b15801561142357600080fd5b505afa158015611437573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061145b91906124a1565b60405163e6a4390560e01b81526001600160a01b038881166004830152878116602483015291925060009183169063e6a439059060440160206040518083038186803b1580156114aa57600080fd5b505afa1580156114be573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114e291906124a1565b90506001600160a01b0381166115015760008094509450505050610c4f565b6001600160a01b0381166000908152600a60205260409020600581015460ff1661153c5761152f8888611ab9565b9550955050505050610c4f565b600080600061154a8561203b565b6002870154929550909350915060009061156a9063ffffffff1683612888565b9050600060405180602001604052808363ffffffff168860000154886115909190612871565b61159a9190612750565b6001600160e01b03168152509050600060405180602001604052808463ffffffff168960010154886115cc9190612871565b6115d69190612750565b6001600160e01b031681525090506000670de0b6b3a764000090508e6001600160a01b0316896001600160a01b0316630dfe16816040518163ffffffff1660e01b815260040160206040518083038186803b15801561163457600080fd5b505afa158015611648573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061166c91906124a1565b6001600160a01b0316141561171d5761168f6116888483612241565b5160701c90565b71ffffffffffffffffffffffffffffffffffff169c508d6001600160a01b031663313ce5676040518163ffffffff1660e01b815260040160206040518083038186803b1580156116de57600080fd5b505afa1580156116f2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117169190612674565b9b50611885565b8d6001600160a01b0316896001600160a01b0316630dfe16816040518163ffffffff1660e01b815260040160206040518083038186803b15801561176057600080fd5b505afa158015611774573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061179891906124a1565b6001600160a01b0316146117ee5760405162461bcd60e51b815260206004820152601960248201527f547761704f7261636c653a20494e56414c49445f544f4b454e000000000000006044820152606401610897565b6117fb6116888383612241565b71ffffffffffffffffffffffffffffffffffff169c508e6001600160a01b031663313ce5676040518163ffffffff1660e01b815260040160206040518083038186803b15801561184a57600080fd5b505afa15801561185e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118829190612674565b9b505b50505050505050505050509250929050565b600b54600090819060ff16600114156118b557600080610b26611a9c565b600b5460ff16600214156118ce57600080611336610982565b6000806113506109ab565b6000546001600160a01b03620100009091041633146119285760405162461bcd60e51b815260206004820181905260248201526000805160206129648339815191526044820152606401610897565b600480546001600160a01b0319166001600160a01b0392909216919091179055565b600080600080610b26611f62565b60045460055460009182916109a3916001600160a01b039081169116611ab9565b60045460055460009182918291829161199e916001600160a01b03908116911661135f565b909250905081156119b25790939092509050565b6004546005546107ea916001600160a01b039081169116611ab9565b6000546001600160a01b0362010000909104163314611a1d5760405162461bcd60e51b815260206004820181905260248201526000805160206129648339815191526044820152606401610897565b6001600160a01b038116611a825760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610897565b611a8b81611fd3565b50565b600080600080610b26611979565b60035460055460009182916109a3916001600160a01b0390811691165b6000806000600160009054906101000a90046001600160a01b03166001600160a01b031663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015611b0c57600080fd5b505afa158015611b20573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b4491906124a1565b60405163e6a4390560e01b81526001600160a01b038781166004830152868116602483015291925060009183169063e6a439059060440160206040518083038186803b158015611b9357600080fd5b505afa158015611ba7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611bcb91906124a1565b90506001600160a01b038116611be957600080935093505050610c4f565b600080826001600160a01b0316630902f1ac6040518163ffffffff1660e01b815260040160606040518083038186803b158015611c2557600080fd5b505afa158015611c39573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c5d9190612602565b5091509150876001600160a01b0316836001600160a01b0316630dfe16816040518163ffffffff1660e01b815260040160206040518083038186803b158015611ca557600080fd5b505afa158015611cb9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611cdd91906124a1565b6001600160a01b03161415611e0857611d8e826001600160701b0316611d888a6001600160a01b031663313ce5676040518163ffffffff1660e01b815260040160206040518083038186803b158015611d3557600080fd5b505afa158015611d49573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d6d9190612674565b611d7890600a6127a7565b6001600160701b038516906122eb565b906122fe565b9550866001600160a01b031663313ce5676040518163ffffffff1660e01b815260040160206040518083038186803b158015611dc957600080fd5b505afa158015611ddd573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e019190612674565b9450611f1a565b611ea4816001600160701b0316611d888a6001600160a01b031663313ce5676040518163ffffffff1660e01b815260040160206040518083038186803b158015611e5157600080fd5b505afa158015611e65573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e899190612674565b611e9490600a6127a7565b6001600160701b038616906122eb565b9550866001600160a01b031663313ce5676040518163ffffffff1660e01b815260040160206040518083038186803b158015611edf57600080fd5b505afa158015611ef3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f179190612674565b94505b6000611f278660126128ad565b60ff161115611f5757611f50611f3e8660126128ad565b611f4990600a6127a7565b87906122eb565b9550601294505b505050509250929050565b600254600554600091829182918291611f87916001600160a01b03908116911661135f565b90925090508115611f9b5790939092509050565b6002546005546107ea916001600160a01b039081169116611ab9565b600354600654610747916001600160a01b039081169116610caf565b600080546001600160a01b038381166201000081810275ffffffffffffffffffffffffffffffffffffffff000019851617855560405193049190911692909183917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a35050565b600080600061204861230a565b90506000849050806001600160a01b0316635909c0d56040518163ffffffff1660e01b815260040160206040518083038186803b15801561208857600080fd5b505afa15801561209c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906120c0919061263e565b9350806001600160a01b0316635a3d54936040518163ffffffff1660e01b815260040160206040518083038186803b1580156120fb57600080fd5b505afa15801561210f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612133919061263e565b92506000806000836001600160a01b0316630902f1ac6040518163ffffffff1660e01b815260040160606040518083038186803b15801561217357600080fd5b505afa158015612187573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906121ab9190612602565b9250925092508463ffffffff168163ffffffff16146122365760006121d08287612888565b90508063ffffffff166121e38486612320565b516121f791906001600160e01b0316612852565b6122019089612712565b97508063ffffffff166122148585612320565b5161222891906001600160e01b0316612852565b6122329088612712565b9650505b505050509193909250565b604080516020810190915260008152600082158061227e575083516001600160e01b0316836122708183612852565b925061227c9083612750565b145b6122d65760405162461bcd60e51b815260206004820152602360248201527f4669786564506f696e743a204d554c5449504c49434154494f4e5f4f564552466044820152624c4f5760e81b6064820152608401610897565b60408051602081019091529081529392505050565b60006122f78284612852565b9392505050565b60006122f78284612750565b600061231b640100000000426128d0565b905090565b6040805160208101909152600081526000826001600160701b0316116123885760405162461bcd60e51b815260206004820152601760248201527f4669786564506f696e743a204449565f42595f5a45524f0000000000000000006044820152606401610897565b6040805160208101909152806123c96001600160701b0385167bffffffffffffffffffffffffffff0000000000000000000000000000607088901b1661272a565b6001600160e01b031690529392505050565b600082601f8301126123ec57600080fd5b813567ffffffffffffffff8082111561240757612407612926565b604051601f8301601f19908116603f0116810190828211818310171561242f5761242f612926565b8160405283815286602085880101111561244857600080fd5b836020870160208301376000602085830101528094505050505092915050565b80516001600160701b038116811461247f57600080fd5b919050565b60006020828403121561249657600080fd5b81356122f78161293c565b6000602082840312156124b357600080fd5b81516122f78161293c565b600080604083850312156124d157600080fd5b82356124dc8161293c565b915060208301356124ec8161293c565b809150509250929050565b60008060006060848603121561250c57600080fd5b83356125178161293c565b925060208401356125278161293c565b915060408401356125378161293c565b809150509250925092565b6000806040838503121561255557600080fd5b823567ffffffffffffffff8082111561256d57600080fd5b612579868387016123db565b9350602085013591508082111561258f57600080fd5b5061259c858286016123db565b9150509250929050565b6000606082840312156125b857600080fd5b6040516060810181811067ffffffffffffffff821117156125db576125db612926565b80604052508251815260208301516020820152604083015160408201528091505092915050565b60008060006060848603121561261757600080fd5b61262084612468565b925061262e60208501612468565b9150604084015161253781612951565b60006020828403121561265057600080fd5b5051919050565b60006020828403121561266957600080fd5b81356122f781612951565b60006020828403121561268657600080fd5b815160ff811681146122f757600080fd5b6000815180845260005b818110156126bd576020818501810151868301820152016126a1565b818111156126cf576000602083870101525b50601f01601f19169290920160200192915050565b6040815260006126f76040830185612697565b82810360208401526127098185612697565b95945050505050565b60008219821115612725576127256128e4565b500190565b60006001600160e01b0380841680612744576127446128fa565b92169190910492915050565b60008261275f5761275f6128fa565b500490565b600181815b8085111561279f578160001904821115612785576127856128e4565b8085161561279257918102915b93841c9390800290612769565b509250929050565b60006122f760ff8416836000826127c057506001610b12565b816127cd57506000610b12565b81600181146127e357600281146127ed57612809565b6001915050610b12565b60ff8411156127fe576127fe6128e4565b50506001821b610b12565b5060208310610133831016604e8410600b841016171561282c575081810a610b12565b6128368383612764565b806000190482111561284a5761284a6128e4565b029392505050565b600081600019048311821515161561286c5761286c6128e4565b500290565b600082821015612883576128836128e4565b500390565b600063ffffffff838116908316818110156128a5576128a56128e4565b039392505050565b600060ff821660ff8416808210156128c7576128c76128e4565b90039392505050565b6000826128df576128df6128fa565b500690565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052601260045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b0381168114611a8b57600080fd5b63ffffffff81168114611a8b57600080fdfe4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572a164736f6c6343000807000a

Block Transaction Gas Used Reward
Age Block Fee Address BC Fee Address Voting Power Jailed Incoming
Validator ID :
0 FTM

Amount Staked
0

Amount Delegated
0

Staking Total
0

Staking Start Epoch
0

Staking Start Time
0

Proof of Importance
0

Origination Score
0

Validation Score
0

Active
0

Online
0

Downtime
0 s
Address Amount claimed Rewards Created On Epoch Created On
Block Uncle Number Difficulty Gas Used Reward
Loading
Loading
Make sure to use the "Vote Down" button for any spammy posts, and the "Vote Up" for interesting conversations.