Contract 0x2217aec3440e8fd6d49a118b1502e539f88dba55 1

Tarot 
Txn Hash Method
Block
From
To
Value [Txn Fee]
0x5bab6cd8129ef0cfe41d7cede4327d3d43b5262b2555d37f0eb9170eae1444cf0x6080604099263122021-06-17 17:11:16385 days 8 mins agoTarot: Deployer IN  Create: BDeployer0 FTM0.1576505
[ Download CSV Export 
Latest 25 internal transaction
Parent Txn Hash Block From To Value
0x2a0b2754ae9ab8ca3139f6153c19eb0d459ed4b9a27e948da7cf8351626e7f35319435382022-02-25 15:22:02132 days 1 hr ago Tarot: B Deployer  Contract Creation0 FTM
0xb2489ca16f538cfd2295a75ce18b9bc3d7c5fa8de7273bd56e634140165575fd319435202022-02-25 15:21:33132 days 1 hr ago Tarot: B Deployer  Contract Creation0 FTM
0x2d8c8ef766d96da9be3a1ef6a46c07652108b65ebf61ab874d7df9a8846289cd306698922022-02-11 18:45:26145 days 22 hrs ago Tarot: B Deployer  Contract Creation0 FTM
0x9797fda4e6702bfcf69f946abbd8b3dc4e0033ad2860d41a2d14a49cbabc1945306698922022-02-11 18:45:26145 days 22 hrs ago Tarot: B Deployer  Contract Creation0 FTM
0xf0cfac6563d52e8077bb41b5d26e6f9e6eb089b48df7e77dcf3bce131db7cd49306698892022-02-11 18:45:22145 days 22 hrs ago Tarot: B Deployer  Contract Creation0 FTM
0x475c59441476da55d661ae2c93d391f57ec7e660652dfc163f1226dc41241277306698872022-02-11 18:45:20145 days 22 hrs ago Tarot: B Deployer  Contract Creation0 FTM
0xa70bc730f2133996e0f2cf531955f6b36be572d1ebdf4debcd5a05853d7f2d72302892482022-02-07 17:51:28149 days 23 hrs ago Tarot: B Deployer  Contract Creation0 FTM
0x4c87b460227d3cfd06e5a344a89b77daa58eb06dc73459b43020c6f942b5306f302892482022-02-07 17:51:28149 days 23 hrs ago Tarot: B Deployer  Contract Creation0 FTM
0x77deb35f4650abfe5047b09c2cc02d462bd673646d40f4f1405923227c526041302892462022-02-07 17:51:27149 days 23 hrs ago Tarot: B Deployer  Contract Creation0 FTM
0x433c5094645315ad9c2db7b4a1c2609d0d73136f8463f8f2e3f9fb0cc6da8cc7302892462022-02-07 17:51:27149 days 23 hrs ago Tarot: B Deployer  Contract Creation0 FTM
0x444309ffbff9cb8f17a83874d7817469bc4f66e478cdfa561a208a58e7b4a03f302892442022-02-07 17:51:25149 days 23 hrs ago Tarot: B Deployer  Contract Creation0 FTM
0x7fc3ffc700cab934d057bda485c40d4fdbaf1a372d603d9e602d0d7450bd6104302892442022-02-07 17:51:25149 days 23 hrs ago Tarot: B Deployer  Contract Creation0 FTM
0x646a26ba31dd8d761760afa9728dd332befe259efe193b57f2eb99e11e91a0f1302892422022-02-07 17:51:24149 days 23 hrs ago Tarot: B Deployer  Contract Creation0 FTM
0xe4af8ca43d7a5c8dd16aceb55bdd42ef6755ff4605a7501735ded10beda99458302892422022-02-07 17:51:24149 days 23 hrs ago Tarot: B Deployer  Contract Creation0 FTM
0x6c6725a0cd97693c60b2d16fdc1aa6389b45dc50404096890c3123bdd465baf7302892402022-02-07 17:51:22149 days 23 hrs ago Tarot: B Deployer  Contract Creation0 FTM
0xfbe22e6c1ee67e42502d09b074131d89bba4910c1b723bad0b764971765f5b2c302892382022-02-07 17:51:20149 days 23 hrs ago Tarot: B Deployer  Contract Creation0 FTM
0x5075ce787990f05277d9ee703bbde7ccaed1a1f99e00e00eefcbb86fdcbb56ce302892362022-02-07 17:51:19149 days 23 hrs ago Tarot: B Deployer  Contract Creation0 FTM
0x09dc6ef1e28df257b01baa534efee7308b03ffb1249f29a16d489b1e5511939e302892342022-02-07 17:51:17149 days 23 hrs ago Tarot: B Deployer  Contract Creation0 FTM
0x43df31152145020ea155a98bd8d51401b020316b65eba13a62b29767a5291298302892272022-02-07 17:51:12149 days 23 hrs ago Tarot: B Deployer  Contract Creation0 FTM
0xcb0a0b675ec6d553a75bb4178a941212bcda7d0a763769e96388ba1c9ab949df302892242022-02-07 17:51:09149 days 23 hrs ago Tarot: B Deployer  Contract Creation0 FTM
0x3ff9134ed5f385924c70038b064a8091c0a08ff3e272dfc31204abffdadf3ead296143192022-01-31 20:33:19156 days 20 hrs ago Tarot: B Deployer  Contract Creation0 FTM
0x9567dc496c64548a110bf783c5576795a774be027a17da3419e3b6070e39a74a296142602022-01-31 20:32:06156 days 20 hrs ago Tarot: B Deployer  Contract Creation0 FTM
0x3d16b4812ef375993ea94aa31fdeb618de52d3dcdd78d63829a9040c6e6328fd291179152022-01-26 17:13:06162 days 6 mins ago Tarot: B Deployer  Contract Creation0 FTM
0xe901f8e2eb22ec9d08ac6e8745a1c6184a043e3e68357974af6b9f0db18bcb0d291179072022-01-26 17:13:00162 days 7 mins ago Tarot: B Deployer  Contract Creation0 FTM
0x05a9e98ad93a31e1cf53b18cfc4c0aa183d4fe07a7feeec25cfef6680bd19ff7291178852022-01-26 17:12:43162 days 7 mins ago Tarot: B Deployer  Contract Creation0 FTM
[ Download CSV Export 
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
BDeployer

Compiler Version
v0.5.16+commit.9c3226ce

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion

Contract Source Code (Solidity Standard Json-Input format)

File 1 of 18 : BDeployer.sol
pragma solidity =0.5.16;

import "./Borrowable.sol";
import "./interfaces/IBDeployer.sol";

/*
 * This contract is used by the Factory to deploy Borrowable(s)
 * The bytecode would be too long to fit in the Factory
 */

contract BDeployer is IBDeployer {
	constructor () public {}
	
	function deployBorrowable(address uniswapV2Pair, uint8 index) external returns (address borrowable) {
		bytes memory bytecode = type(Borrowable).creationCode;
		bytes32 salt = keccak256(abi.encodePacked(msg.sender, uniswapV2Pair, index));
		assembly {
			borrowable := create2(0, add(bytecode, 32), mload(bytecode), salt)
		}
	}
}

File 2 of 18 : Borrowable.sol
pragma solidity =0.5.16;

import "./PoolToken.sol";
import "./BAllowance.sol";
import "./BInterestRateModel.sol";
import "./BSetter.sol";
import "./BStorage.sol";
import "./interfaces/IBorrowable.sol";
import "./interfaces/ICollateral.sol";
import "./interfaces/ITarotCallee.sol";
import "./interfaces/IERC20.sol";
import "./interfaces/IFactory.sol";
import "./interfaces/IBorrowTracker.sol";
import "./libraries/Math.sol";

contract Borrowable is
    IBorrowable,
    PoolToken,
    BStorage,
    BSetter,
    BInterestRateModel,
    BAllowance
{
    uint256 public constant BORROW_FEE = 0.001e18; //0.1%

    event Borrow(
        address indexed sender,
        address indexed borrower,
        address indexed receiver,
        uint256 borrowAmount,
        uint256 repayAmount,
        uint256 accountBorrowsPrior,
        uint256 accountBorrows,
        uint256 totalBorrows
    );
    event Liquidate(
        address indexed sender,
        address indexed borrower,
        address indexed liquidator,
        uint256 seizeTokens,
        uint256 repayAmount,
        uint256 accountBorrowsPrior,
        uint256 accountBorrows,
        uint256 totalBorrows
    );

    constructor() public {}

    /*** PoolToken ***/

    function _update() internal {
        super._update();
        _calculateBorrowRate();
    }

    function _mintReserves(uint256 _exchangeRate, uint256 _totalSupply)
        internal
        returns (uint256)
    {
        uint256 _exchangeRateLast = exchangeRateLast;
        if (_exchangeRate > _exchangeRateLast) {
            uint256 _exchangeRateNew =
                _exchangeRate.sub(
                    _exchangeRate.sub(_exchangeRateLast).mul(reserveFactor).div(
                        1e18
                    )
                );
            uint256 liquidity =
                _totalSupply.mul(_exchangeRate).div(_exchangeRateNew).sub(
                    _totalSupply
                );
            if (liquidity == 0) return _exchangeRate;
            address reservesManager = IFactory(factory).reservesManager();
            _mint(reservesManager, liquidity);
            exchangeRateLast = _exchangeRateNew;
            return _exchangeRateNew;
        } else return _exchangeRate;
    }

    function exchangeRate() public accrue returns (uint256) {
        uint256 _totalSupply = totalSupply;
        uint256 _actualBalance = totalBalance.add(totalBorrows);
        if (_totalSupply == 0 || _actualBalance == 0)
            return initialExchangeRate;
        uint256 _exchangeRate = _actualBalance.mul(1e18).div(_totalSupply);
        return _mintReserves(_exchangeRate, _totalSupply);
    }

    // force totalBalance to match real balance
    function sync() external nonReentrant update accrue {}

    /*** Borrowable ***/

    // this is the stored borrow balance; the current borrow balance may be slightly higher
    function borrowBalance(address borrower) public view returns (uint256) {
        BorrowSnapshot memory borrowSnapshot = borrowBalances[borrower];
        if (borrowSnapshot.interestIndex == 0) return 0; // not initialized
        return
            uint256(borrowSnapshot.principal).mul(borrowIndex).div(
                borrowSnapshot.interestIndex
            );
    }

    function _trackBorrow(
        address borrower,
        uint256 accountBorrows,
        uint256 _borrowIndex
    ) internal {
        address _borrowTracker = borrowTracker;
        if (_borrowTracker == address(0)) return;
        IBorrowTracker(_borrowTracker).trackBorrow(
            borrower,
            accountBorrows,
            _borrowIndex
        );
    }

    function _updateBorrow(
        address borrower,
        uint256 borrowAmount,
        uint256 repayAmount
    )
        private
        returns (
            uint256 accountBorrowsPrior,
            uint256 accountBorrows,
            uint256 _totalBorrows
        )
    {
        accountBorrowsPrior = borrowBalance(borrower);
        if (borrowAmount == repayAmount)
            return (accountBorrowsPrior, accountBorrowsPrior, totalBorrows);
        uint112 _borrowIndex = borrowIndex;
        if (borrowAmount > repayAmount) {
            BorrowSnapshot storage borrowSnapshot = borrowBalances[borrower];
            uint256 increaseAmount = borrowAmount - repayAmount;
            accountBorrows = accountBorrowsPrior.add(increaseAmount);
            borrowSnapshot.principal = safe112(accountBorrows);
            borrowSnapshot.interestIndex = _borrowIndex;
            _totalBorrows = uint256(totalBorrows).add(increaseAmount);
            totalBorrows = safe112(_totalBorrows);
        } else {
            BorrowSnapshot storage borrowSnapshot = borrowBalances[borrower];
            uint256 decreaseAmount = repayAmount - borrowAmount;
            accountBorrows = accountBorrowsPrior > decreaseAmount
                ? accountBorrowsPrior - decreaseAmount
                : 0;
            borrowSnapshot.principal = safe112(accountBorrows);
            if (accountBorrows == 0) {
                borrowSnapshot.interestIndex = 0;
            } else {
                borrowSnapshot.interestIndex = _borrowIndex;
            }
            uint256 actualDecreaseAmount =
                accountBorrowsPrior.sub(accountBorrows);
            _totalBorrows = totalBorrows; // gas savings
            _totalBorrows = _totalBorrows > actualDecreaseAmount
                ? _totalBorrows - actualDecreaseAmount
                : 0;
            totalBorrows = safe112(_totalBorrows);
        }
        _trackBorrow(borrower, accountBorrows, _borrowIndex);
    }

    // this low-level function should be called from another contract
    function borrow(
        address borrower,
        address receiver,
        uint256 borrowAmount,
        bytes calldata data
    ) external nonReentrant update accrue {
        uint256 _totalBalance = totalBalance;
        require(borrowAmount <= _totalBalance, "Tarot: INSUFFICIENT_CASH");
        _checkBorrowAllowance(borrower, msg.sender, borrowAmount);

        // optimistically transfer funds
        if (borrowAmount > 0) _safeTransfer(receiver, borrowAmount);
        if (data.length > 0)
            ITarotCallee(receiver).tarotBorrow(
                msg.sender,
                borrower,
                borrowAmount,
                data
            );
        uint256 balance = IERC20(underlying).balanceOf(address(this));

        uint256 borrowFee = borrowAmount.mul(BORROW_FEE).div(1e18);
        uint256 adjustedBorrowAmount = borrowAmount.add(borrowFee);
        uint256 repayAmount = balance.add(borrowAmount).sub(_totalBalance);
        (
            uint256 accountBorrowsPrior,
            uint256 accountBorrows,
            uint256 _totalBorrows
        ) = _updateBorrow(borrower, adjustedBorrowAmount, repayAmount);

        if (adjustedBorrowAmount > repayAmount)
            require(
                ICollateral(collateral).canBorrow(
                    borrower,
                    address(this),
                    accountBorrows
                ),
                "Tarot: INSUFFICIENT_LIQUIDITY"
            );

        emit Borrow(
            msg.sender,
            borrower,
            receiver,
            borrowAmount,
            repayAmount,
            accountBorrowsPrior,
            accountBorrows,
            _totalBorrows
        );
    }

    // this low-level function should be called from another contract
    function liquidate(address borrower, address liquidator)
        external
        nonReentrant
        update
        accrue
        returns (uint256 seizeTokens)
    {
        uint256 balance = IERC20(underlying).balanceOf(address(this));
        uint256 repayAmount = balance.sub(totalBalance);

        uint256 actualRepayAmount =
            Math.min(borrowBalance(borrower), repayAmount);
        seizeTokens = ICollateral(collateral).seize(
            liquidator,
            borrower,
            actualRepayAmount
        );
        (
            uint256 accountBorrowsPrior,
            uint256 accountBorrows,
            uint256 _totalBorrows
        ) = _updateBorrow(borrower, 0, repayAmount);

        emit Liquidate(
            msg.sender,
            borrower,
            liquidator,
            seizeTokens,
            repayAmount,
            accountBorrowsPrior,
            accountBorrows,
            _totalBorrows
        );
    }

    function trackBorrow(address borrower) external {
        _trackBorrow(borrower, borrowBalance(borrower), borrowIndex);
    }

    modifier accrue() {
        accrueInterest();
        _;
    }
}

File 3 of 18 : IBDeployer.sol
pragma solidity >=0.5.0;

interface IBDeployer {
	function deployBorrowable(address uniswapV2Pair, uint8 index) external returns (address borrowable);
}

File 4 of 18 : PoolToken.sol
pragma solidity =0.5.16;

import "./TarotERC20.sol";
import "./interfaces/IERC20.sol";
import "./interfaces/IPoolToken.sol";
import "./libraries/SafeMath.sol";

contract PoolToken is IPoolToken, TarotERC20 {
    uint256 internal constant initialExchangeRate = 1e18;
    address public underlying;
    address public factory;
    uint256 public totalBalance;
    uint256 public constant MINIMUM_LIQUIDITY = 1000;

    event Mint(
        address indexed sender,
        address indexed minter,
        uint256 mintAmount,
        uint256 mintTokens
    );
    event Redeem(
        address indexed sender,
        address indexed redeemer,
        uint256 redeemAmount,
        uint256 redeemTokens
    );
    event Sync(uint256 totalBalance);

    /*** Initialize ***/

    // called once by the factory
    function _setFactory() external {
        require(factory == address(0), "Tarot: FACTORY_ALREADY_SET");
        factory = msg.sender;
    }

    /*** PoolToken ***/

    function _update() internal {
        totalBalance = IERC20(underlying).balanceOf(address(this));
        emit Sync(totalBalance);
    }

    function exchangeRate() public returns (uint256) {
        uint256 _totalSupply = totalSupply; // gas savings
        uint256 _totalBalance = totalBalance; // gas savings
        if (_totalSupply == 0 || _totalBalance == 0) return initialExchangeRate;
        return _totalBalance.mul(1e18).div(_totalSupply);
    }

    // this low-level function should be called from another contract
    function mint(address minter)
        external
        nonReentrant
        update
        returns (uint256 mintTokens)
    {
        uint256 balance = IERC20(underlying).balanceOf(address(this));
        uint256 mintAmount = balance.sub(totalBalance);
        mintTokens = mintAmount.mul(1e18).div(exchangeRate());

        if (totalSupply == 0) {
            // permanently lock the first MINIMUM_LIQUIDITY tokens
            mintTokens = mintTokens.sub(MINIMUM_LIQUIDITY);
            _mint(address(0), MINIMUM_LIQUIDITY);
        }
        require(mintTokens > 0, "Tarot: MINT_AMOUNT_ZERO");
        _mint(minter, mintTokens);
        emit Mint(msg.sender, minter, mintAmount, mintTokens);
    }

    // this low-level function should be called from another contract
    function redeem(address redeemer)
        external
        nonReentrant
        update
        returns (uint256 redeemAmount)
    {
        uint256 redeemTokens = balanceOf[address(this)];
        redeemAmount = redeemTokens.mul(exchangeRate()).div(1e18);

        require(redeemAmount > 0, "Tarot: REDEEM_AMOUNT_ZERO");
        require(redeemAmount <= totalBalance, "Tarot: INSUFFICIENT_CASH");
        _burn(address(this), redeemTokens);
        _safeTransfer(redeemer, redeemAmount);
        emit Redeem(msg.sender, redeemer, redeemAmount, redeemTokens);
    }

    // force real balance to match totalBalance
    function skim(address to) external nonReentrant {
        _safeTransfer(
            to,
            IERC20(underlying).balanceOf(address(this)).sub(totalBalance)
        );
    }

    // force totalBalance to match real balance
    function sync() external nonReentrant update {}

    /*** Utilities ***/

    // same safe transfer function used by UniSwapV2 (with fixed underlying)
    bytes4 private constant SELECTOR =
        bytes4(keccak256(bytes("transfer(address,uint256)")));

    function _safeTransfer(address to, uint256 amount) internal {
        (bool success, bytes memory data) =
            underlying.call(abi.encodeWithSelector(SELECTOR, to, amount));
        require(
            success && (data.length == 0 || abi.decode(data, (bool))),
            "Tarot: TRANSFER_FAILED"
        );
    }

    // prevents a contract from calling itself, directly or indirectly.
    bool internal _notEntered = true;
    modifier nonReentrant() {
        require(_notEntered, "Tarot: REENTERED");
        _notEntered = false;
        _;
        _notEntered = true;
    }

    // update totalBalance with current balance
    modifier update() {
        _;
        _update();
    }
}

File 5 of 18 : BAllowance.sol
pragma solidity =0.5.16;

import "./BStorage.sol";
import "./PoolToken.sol";

contract BAllowance is PoolToken, BStorage {
    event BorrowApproval(
        address indexed owner,
        address indexed spender,
        uint256 value
    );

    function _borrowApprove(
        address owner,
        address spender,
        uint256 value
    ) private {
        borrowAllowance[owner][spender] = value;
        emit BorrowApproval(owner, spender, value);
    }

    function borrowApprove(address spender, uint256 value)
        external
        returns (bool)
    {
        _borrowApprove(msg.sender, spender, value);
        return true;
    }

    function _checkBorrowAllowance(
        address owner,
        address spender,
        uint256 value
    ) internal {
        uint256 _borrowAllowance = borrowAllowance[owner][spender];
        if (spender != owner && _borrowAllowance != uint256(-1)) {
            require(_borrowAllowance >= value, "Tarot: BORROW_NOT_ALLOWED");
            borrowAllowance[owner][spender] = _borrowAllowance - value;
        }
    }

    // keccak256("BorrowPermit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)");
    bytes32 public constant BORROW_PERMIT_TYPEHASH =
        0xf6d86ed606f871fa1a557ac0ba607adce07767acf53f492fb215a1a4db4aea6f;

    function borrowPermit(
        address owner,
        address spender,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) external {
        _checkSignature(
            owner,
            spender,
            value,
            deadline,
            v,
            r,
            s,
            BORROW_PERMIT_TYPEHASH
        );
        _borrowApprove(owner, spender, value);
    }
}

File 6 of 18 : BInterestRateModel.sol
pragma solidity =0.5.16;

import "./BStorage.sol";
import "./PoolToken.sol";

contract BInterestRateModel is PoolToken, BStorage {

	// When utilization is 100% borrowRate is kinkBorrowRate * KINK_MULTIPLIER
	// kinkBorrowRate relative adjustment per second belongs to [1-adjustSpeed, 1+adjustSpeed*(KINK_MULTIPLIER-1)]
	uint public constant KINK_MULTIPLIER = 5;
	uint public constant KINK_BORROW_RATE_MAX = 31.7097920e9; //100% per year
	uint public constant KINK_BORROW_RATE_MIN = 0.31709792e9; //1% per year

	event AccrueInterest(uint interestAccumulated, uint borrowIndex, uint totalBorrows);
	event CalculateKinkBorrowRate(uint kinkBorrowRate);
	event CalculateBorrowRate(uint borrowRate);
		
	function _calculateBorrowRate() internal {
		uint _kinkUtilizationRate = kinkUtilizationRate;		
		uint _adjustSpeed = adjustSpeed;
		uint _borrowRate = borrowRate;	
		uint _kinkBorrowRate = kinkBorrowRate;
		uint32 _rateUpdateTimestamp = rateUpdateTimestamp;		
	
		// update kinkBorrowRate using previous borrowRate
		uint32 timeElapsed = getBlockTimestamp() - _rateUpdateTimestamp; // underflow is desired
		if(timeElapsed > 0) {
			rateUpdateTimestamp = getBlockTimestamp();
			uint adjustFactor;
			
			if (_borrowRate < _kinkBorrowRate) {
				// never overflows, _kinkBorrowRate is never 0
				uint tmp = (_kinkBorrowRate - _borrowRate) * 1e18 / _kinkBorrowRate * _adjustSpeed * timeElapsed / 1e18;
				adjustFactor = tmp > 1e18 ? 0 : 1e18 - tmp;
			} else {
				// never overflows, _kinkBorrowRate is never 0
				uint tmp = (_borrowRate - _kinkBorrowRate) * 1e18 / _kinkBorrowRate * _adjustSpeed * timeElapsed / 1e18;
				adjustFactor = tmp + 1e18;
			}
			
			// never overflows
			_kinkBorrowRate = _kinkBorrowRate * adjustFactor / 1e18;
			if(_kinkBorrowRate > KINK_BORROW_RATE_MAX) _kinkBorrowRate = KINK_BORROW_RATE_MAX;
			if(_kinkBorrowRate < KINK_BORROW_RATE_MIN) _kinkBorrowRate = KINK_BORROW_RATE_MIN;

			kinkBorrowRate = uint48(_kinkBorrowRate);
			emit CalculateKinkBorrowRate(_kinkBorrowRate);
		}
		
		uint _utilizationRate;
		{ // avoid stack to deep
		uint _totalBorrows = totalBorrows; // gas savings
		uint _actualBalance = totalBalance.add(_totalBorrows);
		_utilizationRate = (_actualBalance == 0) ? 0 : _totalBorrows * 1e18 / _actualBalance;
		}
		
		// update borrowRate using the new kinkBorrowRate	
		if(_utilizationRate <= _kinkUtilizationRate) {
			// never overflows, _kinkUtilizationRate is never 0
			_borrowRate = _kinkBorrowRate * _utilizationRate / _kinkUtilizationRate;
		} else {
			// never overflows, _kinkUtilizationRate is always < 1e18
			uint overUtilization = (_utilizationRate - _kinkUtilizationRate) * 1e18 / (1e18 - _kinkUtilizationRate);
			// never overflows
			_borrowRate = ((KINK_MULTIPLIER - 1) * overUtilization + 1e18) * _kinkBorrowRate / 1e18;
		}
		borrowRate = uint48(_borrowRate);
		emit CalculateBorrowRate(_borrowRate);
	}
	
	// applies accrued interest to total borrows and reserves
	function accrueInterest() public {
		uint _borrowIndex = borrowIndex;
		uint _totalBorrows = totalBorrows;
		uint32 _accrualTimestamp = accrualTimestamp;
		
		uint32 blockTimestamp = getBlockTimestamp();
		if (_accrualTimestamp == blockTimestamp) return;
		uint32 timeElapsed = blockTimestamp - _accrualTimestamp; // underflow is desired
		accrualTimestamp = blockTimestamp;
		
		uint interestFactor = uint(borrowRate).mul(timeElapsed);	
		uint interestAccumulated = interestFactor.mul(_totalBorrows).div(1e18);
		_totalBorrows = _totalBorrows.add( interestAccumulated );
		_borrowIndex = _borrowIndex.add( interestFactor.mul(_borrowIndex).div(1e18) );
	
		borrowIndex = safe112(_borrowIndex);
		totalBorrows = safe112(_totalBorrows);
		emit AccrueInterest(interestAccumulated, _borrowIndex, _totalBorrows);
	}
		
	function getBlockTimestamp() public view returns (uint32) {
		return uint32(block.timestamp % 2**32);
	}
}

File 7 of 18 : BSetter.sol
pragma solidity =0.5.16;

import "./BStorage.sol";
import "./PoolToken.sol";
import "./interfaces/IFactory.sol";

contract BSetter is PoolToken, BStorage {
    uint256 public constant RESERVE_FACTOR_MAX = 0.20e18; //20%
    uint256 public constant KINK_UR_MIN = 0.50e18; //50%
    uint256 public constant KINK_UR_MAX = 0.99e18; //99%
    uint256 public constant ADJUST_SPEED_MIN = 0.05787037e12; //0.5% per day
    uint256 public constant ADJUST_SPEED_MAX = 5.787037e12; //50% per day

    event NewReserveFactor(uint256 newReserveFactor);
    event NewKinkUtilizationRate(uint256 newKinkUtilizationRate);
    event NewAdjustSpeed(uint256 newAdjustSpeed);
    event NewBorrowTracker(address newBorrowTracker);

    // called once by the factory at time of deployment
    function _initialize(
        string calldata _name,
        string calldata _symbol,
        address _underlying,
        address _collateral
    ) external {
        require(msg.sender == factory, "Tarot: UNAUTHORIZED"); // sufficient check
        _setName(_name, _symbol);
        underlying = _underlying;
        collateral = _collateral;
        exchangeRateLast = initialExchangeRate;
    }

    function _setReserveFactor(uint256 newReserveFactor) external nonReentrant {
        _checkSetting(newReserveFactor, 0, RESERVE_FACTOR_MAX);
        reserveFactor = newReserveFactor;
        emit NewReserveFactor(newReserveFactor);
    }

    function _setKinkUtilizationRate(uint256 newKinkUtilizationRate)
        external
        nonReentrant
    {
        _checkSetting(newKinkUtilizationRate, KINK_UR_MIN, KINK_UR_MAX);
        kinkUtilizationRate = newKinkUtilizationRate;
        emit NewKinkUtilizationRate(newKinkUtilizationRate);
    }

    function _setAdjustSpeed(uint256 newAdjustSpeed) external nonReentrant {
        _checkSetting(newAdjustSpeed, ADJUST_SPEED_MIN, ADJUST_SPEED_MAX);
        adjustSpeed = newAdjustSpeed;
        emit NewAdjustSpeed(newAdjustSpeed);
    }

    function _setBorrowTracker(address newBorrowTracker) external nonReentrant {
        _checkAdmin();
        borrowTracker = newBorrowTracker;
        emit NewBorrowTracker(newBorrowTracker);
    }

    function _checkSetting(
        uint256 parameter,
        uint256 min,
        uint256 max
    ) internal view {
        _checkAdmin();
        require(parameter >= min, "Tarot: INVALID_SETTING");
        require(parameter <= max, "Tarot: INVALID_SETTING");
    }

    function _checkAdmin() internal view {
        require(msg.sender == IFactory(factory).admin(), "Tarot: UNAUTHORIZED");
    }
}

File 8 of 18 : BStorage.sol
pragma solidity =0.5.16;

contract BStorage {
    address public collateral;

    mapping(address => mapping(address => uint256)) public borrowAllowance;

    struct BorrowSnapshot {
        uint112 principal; // amount in underlying when the borrow was last updated
        uint112 interestIndex; // borrow index when borrow was last updated
    }
    mapping(address => BorrowSnapshot) internal borrowBalances;

    // use one memory slot
    uint112 public borrowIndex = 1e18;
    uint112 public totalBorrows;
    uint32 public accrualTimestamp = uint32(block.timestamp % 2**32);

    uint256 public exchangeRateLast;

    // use one memory slot
    uint48 public borrowRate;
    uint48 public kinkBorrowRate = 3.1709792e9; //10% per year
    uint32 public rateUpdateTimestamp = uint32(block.timestamp % 2**32);

    uint256 public reserveFactor = 0.10e18; //10%
    uint256 public kinkUtilizationRate = 0.70e18; //70%
    uint256 public adjustSpeed = 0.5787037e12; //5% per day
    address public borrowTracker;

    function safe112(uint256 n) internal pure returns (uint112) {
        require(n < 2**112, "Tarot: SAFE112");
        return uint112(n);
    }
}

File 9 of 18 : IBorrowable.sol
pragma solidity >=0.5.0;

interface IBorrowable {
    /*** Tarot ERC20 ***/

    event Transfer(address indexed from, address indexed to, uint256 value);
    event Approval(
        address indexed owner,
        address indexed spender,
        uint256 value
    );

    function name() external pure returns (string memory);

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

    function decimals() external pure returns (uint8);

    function totalSupply() external view returns (uint256);

    function balanceOf(address owner) external view returns (uint256);

    function allowance(address owner, address spender)
        external
        view
        returns (uint256);

    function approve(address spender, uint256 value) external returns (bool);

    function transfer(address to, uint256 value) external returns (bool);

    function transferFrom(
        address from,
        address to,
        uint256 value
    ) external returns (bool);

    function DOMAIN_SEPARATOR() external view returns (bytes32);

    function PERMIT_TYPEHASH() external pure returns (bytes32);

    function nonces(address owner) external view returns (uint256);

    function permit(
        address owner,
        address spender,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) external;

    /*** Pool Token ***/

    event Mint(
        address indexed sender,
        address indexed minter,
        uint256 mintAmount,
        uint256 mintTokens
    );
    event Redeem(
        address indexed sender,
        address indexed redeemer,
        uint256 redeemAmount,
        uint256 redeemTokens
    );
    event Sync(uint256 totalBalance);

    function underlying() external view returns (address);

    function factory() external view returns (address);

    function totalBalance() external view returns (uint256);

    function MINIMUM_LIQUIDITY() external pure returns (uint256);

    function exchangeRate() external returns (uint256);

    function mint(address minter) external returns (uint256 mintTokens);

    function redeem(address redeemer) external returns (uint256 redeemAmount);

    function skim(address to) external;

    function sync() external;

    function _setFactory() external;

    /*** Borrowable ***/

    event BorrowApproval(
        address indexed owner,
        address indexed spender,
        uint256 value
    );
    event Borrow(
        address indexed sender,
        address indexed borrower,
        address indexed receiver,
        uint256 borrowAmount,
        uint256 repayAmount,
        uint256 accountBorrowsPrior,
        uint256 accountBorrows,
        uint256 totalBorrows
    );
    event Liquidate(
        address indexed sender,
        address indexed borrower,
        address indexed liquidator,
        uint256 seizeTokens,
        uint256 repayAmount,
        uint256 accountBorrowsPrior,
        uint256 accountBorrows,
        uint256 totalBorrows
    );

    function BORROW_FEE() external pure returns (uint256);

    function collateral() external view returns (address);

    function reserveFactor() external view returns (uint256);

    function exchangeRateLast() external view returns (uint256);

    function borrowIndex() external view returns (uint256);

    function totalBorrows() external view returns (uint256);

    function borrowAllowance(address owner, address spender)
        external
        view
        returns (uint256);

    function borrowBalance(address borrower) external view returns (uint256);

    function borrowTracker() external view returns (address);

    function BORROW_PERMIT_TYPEHASH() external pure returns (bytes32);

    function borrowApprove(address spender, uint256 value)
        external
        returns (bool);

    function borrowPermit(
        address owner,
        address spender,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) external;

    function borrow(
        address borrower,
        address receiver,
        uint256 borrowAmount,
        bytes calldata data
    ) external;

    function liquidate(address borrower, address liquidator)
        external
        returns (uint256 seizeTokens);

    function trackBorrow(address borrower) external;

    /*** Borrowable Interest Rate Model ***/

    event AccrueInterest(
        uint256 interestAccumulated,
        uint256 borrowIndex,
        uint256 totalBorrows
    );
    event CalculateKink(uint256 kinkRate);
    event CalculateBorrowRate(uint256 borrowRate);

    function KINK_BORROW_RATE_MAX() external pure returns (uint256);

    function KINK_BORROW_RATE_MIN() external pure returns (uint256);

    function KINK_MULTIPLIER() external pure returns (uint256);

    function borrowRate() external view returns (uint256);

    function kinkBorrowRate() external view returns (uint256);

    function kinkUtilizationRate() external view returns (uint256);

    function adjustSpeed() external view returns (uint256);

    function rateUpdateTimestamp() external view returns (uint32);

    function accrualTimestamp() external view returns (uint32);

    function accrueInterest() external;

    /*** Borrowable Setter ***/

    event NewReserveFactor(uint256 newReserveFactor);
    event NewKinkUtilizationRate(uint256 newKinkUtilizationRate);
    event NewAdjustSpeed(uint256 newAdjustSpeed);
    event NewBorrowTracker(address newBorrowTracker);

    function RESERVE_FACTOR_MAX() external pure returns (uint256);

    function KINK_UR_MIN() external pure returns (uint256);

    function KINK_UR_MAX() external pure returns (uint256);

    function ADJUST_SPEED_MIN() external pure returns (uint256);

    function ADJUST_SPEED_MAX() external pure returns (uint256);

    function _initialize(
        string calldata _name,
        string calldata _symbol,
        address _underlying,
        address _collateral
    ) external;

    function _setReserveFactor(uint256 newReserveFactor) external;

    function _setKinkUtilizationRate(uint256 newKinkUtilizationRate) external;

    function _setAdjustSpeed(uint256 newAdjustSpeed) external;

    function _setBorrowTracker(address newBorrowTracker) external;
}

File 10 of 18 : ICollateral.sol
pragma solidity >=0.5.0;

interface ICollateral {
    /*** Tarot ERC20 ***/

    event Transfer(address indexed from, address indexed to, uint256 value);
    event Approval(
        address indexed owner,
        address indexed spender,
        uint256 value
    );

    function name() external pure returns (string memory);

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

    function decimals() external pure returns (uint8);

    function totalSupply() external view returns (uint256);

    function balanceOf(address owner) external view returns (uint256);

    function allowance(address owner, address spender)
        external
        view
        returns (uint256);

    function approve(address spender, uint256 value) external returns (bool);

    function transfer(address to, uint256 value) external returns (bool);

    function transferFrom(
        address from,
        address to,
        uint256 value
    ) external returns (bool);

    function DOMAIN_SEPARATOR() external view returns (bytes32);

    function PERMIT_TYPEHASH() external pure returns (bytes32);

    function nonces(address owner) external view returns (uint256);

    function permit(
        address owner,
        address spender,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) external;

    /*** Pool Token ***/

    event Mint(
        address indexed sender,
        address indexed minter,
        uint256 mintAmount,
        uint256 mintTokens
    );
    event Redeem(
        address indexed sender,
        address indexed redeemer,
        uint256 redeemAmount,
        uint256 redeemTokens
    );
    event Sync(uint256 totalBalance);

    function underlying() external view returns (address);

    function factory() external view returns (address);

    function totalBalance() external view returns (uint256);

    function MINIMUM_LIQUIDITY() external pure returns (uint256);

    function exchangeRate() external returns (uint256);

    function mint(address minter) external returns (uint256 mintTokens);

    function redeem(address redeemer) external returns (uint256 redeemAmount);

    function skim(address to) external;

    function sync() external;

    function _setFactory() external;

    /*** Collateral ***/

    function borrowable0() external view returns (address);

    function borrowable1() external view returns (address);

    function tarotPriceOracle() external view returns (address);

    function safetyMarginSqrt() external view returns (uint256);

    function liquidationIncentive() external view returns (uint256);

    function getPrices() external returns (uint256 price0, uint256 price1);

    function tokensUnlocked(address from, uint256 value)
        external
        returns (bool);

    function accountLiquidityAmounts(
        address account,
        uint256 amount0,
        uint256 amount1
    ) external returns (uint256 liquidity, uint256 shortfall);

    function accountLiquidity(address account)
        external
        returns (uint256 liquidity, uint256 shortfall);

    function canBorrow(
        address account,
        address borrowable,
        uint256 accountBorrows
    ) external returns (bool);

    function seize(
        address liquidator,
        address borrower,
        uint256 repayAmount
    ) external returns (uint256 seizeTokens);

    function flashRedeem(
        address redeemer,
        uint256 redeemAmount,
        bytes calldata data
    ) external;

    /*** Collateral Setter ***/

    event NewSafetyMargin(uint256 newSafetyMarginSqrt);
    event NewLiquidationIncentive(uint256 newLiquidationIncentive);

    function SAFETY_MARGIN_SQRT_MIN() external pure returns (uint256);

    function SAFETY_MARGIN_SQRT_MAX() external pure returns (uint256);

    function LIQUIDATION_INCENTIVE_MIN() external pure returns (uint256);

    function LIQUIDATION_INCENTIVE_MAX() external pure returns (uint256);

    function _initialize(
        string calldata _name,
        string calldata _symbol,
        address _underlying,
        address _borrowable0,
        address _borrowable1
    ) external;

    function _setSafetyMarginSqrt(uint256 newSafetyMarginSqrt) external;

    function _setLiquidationIncentive(uint256 newLiquidationIncentive) external;
}

File 11 of 18 : ITarotCallee.sol
pragma solidity >=0.5.0;

interface ITarotCallee {
    function tarotBorrow(
        address sender,
        address borrower,
        uint256 borrowAmount,
        bytes calldata data
    ) external;

    function tarotRedeem(
        address sender,
        uint256 redeemAmount,
        bytes calldata data
    ) external;
}

File 12 of 18 : IERC20.sol
pragma solidity >=0.5.0;

interface IERC20 {
    event Approval(address indexed owner, address indexed spender, uint value);
    event Transfer(address indexed from, address indexed to, uint value);

    function name() external view returns (string memory);
    function symbol() external view returns (string memory);
    function decimals() external view returns (uint8);
    function totalSupply() external view returns (uint);
    function balanceOf(address owner) external view returns (uint);
    function allowance(address owner, address spender) external view returns (uint);

    function approve(address spender, uint value) external returns (bool);
    function transfer(address to, uint value) external returns (bool);
    function transferFrom(address from, address to, uint value) external returns (bool);
}

File 13 of 18 : IFactory.sol
pragma solidity >=0.5.0;

interface IFactory {
	event LendingPoolInitialized(address indexed uniswapV2Pair, address indexed token0, address indexed token1,
		address collateral, address borrowable0, address borrowable1, uint lendingPoolId);
	event NewPendingAdmin(address oldPendingAdmin, address newPendingAdmin);
	event NewAdmin(address oldAdmin, address newAdmin);
	event NewReservesPendingAdmin(address oldReservesPendingAdmin, address newReservesPendingAdmin);
	event NewReservesAdmin(address oldReservesAdmin, address newReservesAdmin);
	event NewReservesManager(address oldReservesManager, address newReservesManager);
	
	function admin() external view returns (address);
	function pendingAdmin() external view returns (address);
	function reservesAdmin() external view returns (address);
	function reservesPendingAdmin() external view returns (address);
	function reservesManager() external view returns (address);

	function getLendingPool(address uniswapV2Pair) external view returns (
		bool initialized, 
		uint24 lendingPoolId, 
		address collateral, 
		address borrowable0, 
		address borrowable1
	);
	function allLendingPools(uint) external view returns (address uniswapV2Pair);
	function allLendingPoolsLength() external view returns (uint);
	
	function bDeployer() external view returns (address);
	function cDeployer() external view returns (address);
	function tarotPriceOracle() external view returns (address);

	function createCollateral(address uniswapV2Pair) external returns (address collateral);
	function createBorrowable0(address uniswapV2Pair) external returns (address borrowable0);
	function createBorrowable1(address uniswapV2Pair) external returns (address borrowable1);
	function initializeLendingPool(address uniswapV2Pair) external;

	function _setPendingAdmin(address newPendingAdmin) external;
	function _acceptAdmin() external;
	function _setReservesPendingAdmin(address newPendingAdmin) external;
	function _acceptReservesAdmin() external;
	function _setReservesManager(address newReservesManager) external;
}

File 14 of 18 : IBorrowTracker.sol
pragma solidity >=0.5.0;

interface IBorrowTracker {
	function trackBorrow(address borrower, uint borrowBalance, uint borrowIndex) external;
}

File 15 of 18 : Math.sol
pragma solidity =0.5.16;

// a library for performing various math operations
// forked from: https://github.com/Uniswap/uniswap-v2-core/blob/master/contracts/libraries/Math.sol

library Math {
    function min(uint x, uint y) internal pure returns (uint z) {
        z = x < y ? x : y;
    }

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

File 16 of 18 : TarotERC20.sol
pragma solidity =0.5.16;

import "./libraries/SafeMath.sol";

// This contract is basically UniswapV2ERC20 with small modifications
// src: https://github.com/Uniswap/uniswap-v2-core/blob/master/contracts/UniswapV2ERC20.sol

contract TarotERC20 {
    using SafeMath for uint256;

    string public name;
    string public symbol;
    uint8 public decimals = 18;
    uint256 public totalSupply;
    mapping(address => uint256) public balanceOf;
    mapping(address => mapping(address => uint256)) public allowance;

    bytes32 public DOMAIN_SEPARATOR;
    mapping(address => uint256) public nonces;

    event Transfer(address indexed from, address indexed to, uint256 value);
    event Approval(
        address indexed owner,
        address indexed spender,
        uint256 value
    );

    constructor() public {}

    function _setName(string memory _name, string memory _symbol) internal {
        name = _name;
        symbol = _symbol;
        uint256 chainId;
        assembly {
            chainId := chainid
        }
        DOMAIN_SEPARATOR = keccak256(
            abi.encode(
                keccak256(
                    "EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)"
                ),
                keccak256(bytes(_name)),
                keccak256(bytes("1")),
                chainId,
                address(this)
            )
        );
    }

    function _mint(address to, uint256 value) internal {
        totalSupply = totalSupply.add(value);
        balanceOf[to] = balanceOf[to].add(value);
        emit Transfer(address(0), to, value);
    }

    function _burn(address from, uint256 value) internal {
        balanceOf[from] = balanceOf[from].sub(value);
        totalSupply = totalSupply.sub(value);
        emit Transfer(from, address(0), value);
    }

    function _approve(
        address owner,
        address spender,
        uint256 value
    ) private {
        allowance[owner][spender] = value;
        emit Approval(owner, spender, value);
    }

    function _transfer(
        address from,
        address to,
        uint256 value
    ) internal {
        balanceOf[from] = balanceOf[from].sub(
            value,
            "Tarot: TRANSFER_TOO_HIGH"
        );
        balanceOf[to] = balanceOf[to].add(value);
        emit Transfer(from, to, value);
    }

    function approve(address spender, uint256 value) external returns (bool) {
        _approve(msg.sender, spender, value);
        return true;
    }

    function transfer(address to, uint256 value) external returns (bool) {
        _transfer(msg.sender, to, value);
        return true;
    }

    function transferFrom(
        address from,
        address to,
        uint256 value
    ) external returns (bool) {
        if (allowance[from][msg.sender] != uint256(-1)) {
            allowance[from][msg.sender] = allowance[from][msg.sender].sub(
                value,
                "Tarot: TRANSFER_NOT_ALLOWED"
            );
        }
        _transfer(from, to, value);
        return true;
    }

    function _checkSignature(
        address owner,
        address spender,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s,
        bytes32 typehash
    ) internal {
        require(deadline >= block.timestamp, "Tarot: EXPIRED");
        bytes32 digest =
            keccak256(
                abi.encodePacked(
                    "\x19\x01",
                    DOMAIN_SEPARATOR,
                    keccak256(
                        abi.encode(
                            typehash,
                            owner,
                            spender,
                            value,
                            nonces[owner]++,
                            deadline
                        )
                    )
                )
            );
        address recoveredAddress = ecrecover(digest, v, r, s);
        require(
            recoveredAddress != address(0) && recoveredAddress == owner,
            "Tarot: INVALID_SIGNATURE"
        );
    }

    // keccak256("Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)");
    bytes32 public constant PERMIT_TYPEHASH =
        0x6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c9;

    function permit(
        address owner,
        address spender,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) external {
        _checkSignature(
            owner,
            spender,
            value,
            deadline,
            v,
            r,
            s,
            PERMIT_TYPEHASH
        );
        _approve(owner, spender, value);
    }
}

File 17 of 18 : IPoolToken.sol
pragma solidity >=0.5.0;

interface IPoolToken {
    /*** Tarot ERC20 ***/

    event Transfer(address indexed from, address indexed to, uint256 value);
    event Approval(
        address indexed owner,
        address indexed spender,
        uint256 value
    );

    function name() external pure returns (string memory);

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

    function decimals() external pure returns (uint8);

    function totalSupply() external view returns (uint256);

    function balanceOf(address owner) external view returns (uint256);

    function allowance(address owner, address spender)
        external
        view
        returns (uint256);

    function approve(address spender, uint256 value) external returns (bool);

    function transfer(address to, uint256 value) external returns (bool);

    function transferFrom(
        address from,
        address to,
        uint256 value
    ) external returns (bool);

    function DOMAIN_SEPARATOR() external view returns (bytes32);

    function PERMIT_TYPEHASH() external pure returns (bytes32);

    function nonces(address owner) external view returns (uint256);

    function permit(
        address owner,
        address spender,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) external;

    /*** Pool Token ***/

    event Mint(
        address indexed sender,
        address indexed minter,
        uint256 mintAmount,
        uint256 mintTokens
    );
    event Redeem(
        address indexed sender,
        address indexed redeemer,
        uint256 redeemAmount,
        uint256 redeemTokens
    );
    event Sync(uint256 totalBalance);

    function underlying() external view returns (address);

    function factory() external view returns (address);

    function totalBalance() external view returns (uint256);

    function MINIMUM_LIQUIDITY() external pure returns (uint256);

    function exchangeRate() external returns (uint256);

    function mint(address minter) external returns (uint256 mintTokens);

    function redeem(address redeemer) external returns (uint256 redeemAmount);

    function skim(address to) external;

    function sync() external;

    function _setFactory() external;
}

File 18 of 18 : SafeMath.sol
pragma solidity =0.5.16;

// From https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/math/Math.sol
// Subject to the MIT license.

/**
 * @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 addition of two unsigned integers, reverting with custom message on overflow.
     *
     * Counterpart to Solidity's `+` operator.
     *
     * Requirements:
     * - Addition cannot overflow.
     */
    function add(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
        uint256 c = a + b;
        require(c >= a, errorMessage);

        return c;
    }

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

    /**
     * @dev Returns the subtraction of two unsigned integers, reverting with custom message on underflow (when the result is negative).
     *
     * Counterpart to Solidity's `-` operator.
     *
     * Requirements:
     * - Subtraction cannot underflow.
     */
    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 multiplication of two unsigned integers, reverting on overflow.
     *
     * Counterpart to Solidity's `*` operator.
     *
     * Requirements:
     * - Multiplication cannot overflow.
     */
    function mul(uint256 a, uint256 b, string memory errorMessage) 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, errorMessage);

        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) {
        // Solidity only automatically asserts when dividing by 0
        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;
    }
}

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

Contract Security Audit

Contract ABI

[{"inputs":[],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"constant":false,"inputs":[{"internalType":"address","name":"uniswapV2Pair","type":"address"},{"internalType":"uint8","name":"index","type":"uint8"}],"name":"deployBorrowable","outputs":[{"internalType":"address","name":"borrowable","type":"address"}],"payable":false,"stateMutability":"nonpayable","type":"function"}]

608060405234801561001057600080fd5b50613817806100206000396000f3fe608060405234801561001057600080fd5b506004361061002b5760003560e01c806354bcd7ad14610030575b600080fd5b61005f6004803603604081101561004657600080fd5b5080356001600160a01b0316906020013560ff1661007b565b604080516001600160a01b039092168252519081900360200190f35b600060606040518060200161008f90610111565b818103601f199081018352601f90910116604081815233606090811b6020808501919091529088901b6bffffffffffffffffffffffff1916603484015260f887901b6001600160f81b0319166048840152815180840360290181526049909301909152815191810191909120825192935091829184016000f595945050505050565b6136c48061011f8339019056fe60806040526002805460ff199081166012908117909255600b80549091166001179055600e80546001600160701b031916670de0b6b3a7640000176001600160e01b0316600160e01b4263ffffffff16908102919091179091556010805465ffffffffffff60301b191669bd014d800000000000001763ffffffff60601b19166c0100000000000000000000000090920291909117905567016345785d8a00006011556709b6e64a8ec6000090556486bd6db0206013553480156100c257600080fd5b506135f2806100d26000396000f3fe608060405234801561001057600080fd5b50600436106103995760003560e01c806370a08231116101e9578063b7f1118a1161010f578063c914b437116100ad578063e07660001161007c578063e076600014610a80578063e12b630614610a88578063fca7820b14610a90578063fff6cae914610aad57610399565b8063c914b437146109f1578063d505accf146109f9578063d8dfeb4514610a4a578063dd62ed3e14610a5257610399565b8063bc25cf77116100e9578063bc25cf77146109b3578063be340e32146109d9578063c45a0155146109e1578063c72f3fbb146109e957610399565b8063b7f1118a1461097d578063b95b92a3146109a3578063ba9a7a56146109ab57610399565b806395a2251f11610187578063a6afed9511610156578063a6afed9514610939578063a9059cbb14610941578063aa5af0fd1461096d578063ad7a672f1461097557610399565b806395a2251f146108b257806395d89b41146108d85780639e79b55c146108e0578063a07157191461093157610399565b806386b9d81f116101c357806386b9d81f1461081857806391b4274514610846578063926d845b146108695780639292b0321461089557610399565b806370a08231146107ab578063796b89b9146107d15780637ecebe00146107f257610399565b806335542822116102ce5780634d73e9ba1161026c5780636a030c111161023b5780636a030c111461067c5780636a6278421461074f5780636bd76d24146107755780636f307dc3146107a357610399565b80634d73e9ba1461062257806355957220146106485780635b2b9d1a1461066c578063685440651461067457610399565b80634322b714116102a85780634322b714146105e6578063452ae95f146105ee57806347bd3718146105f65780634a5d316c1461061a57610399565b806335542822146105b05780633644e515146105d65780633ba0b9a9146105de57610399565b80632374e8a91161033b57806327549a0b1161031557806327549a0b146105655780632d5231d31461058257806330adf81f1461058a578063313ce5671461059257610399565b80632374e8a91461051f57806323b872dd14610527578063253c24f31461055d57610399565b8063095ea7b311610377578063095ea7b31461043d57806318160ddd1461047d5780631aebf12f146104855780631e7dcc0d1461048d57610399565b806301f8c1c81461039e57806306fdde03146103b8578063075f4e7f14610435575b600080fd5b6103a6610ab5565b60408051918252519081900360200190f35b6103c0610ad9565b6040805160208082528351818301528351919283929083019185019080838360005b838110156103fa5781810151838201526020016103e2565b50505050905090810190601f1680156104275780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6103a6610b67565b6104696004803603604081101561045357600080fd5b506001600160a01b038135169060200135610b70565b604080519115158252519081900360200190f35b6103a6610b87565b6103a6610b8d565b61051d600480360360808110156104a357600080fd5b6001600160a01b038235811692602081013590911691604082013591908101906080810160608201356401000000008111156104de57600080fd5b8201836020820111156104f057600080fd5b8035906020019184600183028401116401000000008311171561051257600080fd5b509092509050610b93565b005b6103a6610fb6565b6104696004803603606081101561053d57600080fd5b506001600160a01b03813581169160208101359091169060400135610fc2565b6103a6611091565b61051d6004803603602081101561057b57600080fd5b503561109b565b6103a661114d565b6103a6611153565b61059a611177565b6040805160ff9092168252519081900360200190f35b61051d600480360360208110156105c657600080fd5b50356001600160a01b0316611180565b6103a661123d565b6103a6611243565b6103a66112ca565b6103a66112d0565b6105fe6112d9565b604080516001600160701b039092168252519081900360200190f35b61051d6112ef565b6103a66004803603602081101561063857600080fd5b50356001600160a01b0316611361565b6106506113f1565b604080516001600160a01b039092168252519081900360200190f35b6103a6611400565b6103a6611405565b61051d6004803603608081101561069257600080fd5b8101906020810181356401000000008111156106ad57600080fd5b8201836020820111156106bf57600080fd5b803590602001918460018302840111640100000000831117156106e157600080fd5b9193909290916020810190356401000000008111156106ff57600080fd5b82018360208201111561071157600080fd5b8035906020019184600183028401116401000000008311171561073357600080fd5b91935091506001600160a01b0381358116916020013516611411565b6103a66004803603602081101561076557600080fd5b50356001600160a01b0316611525565b6103a66004803603604081101561078b57600080fd5b506001600160a01b0381358116916020013516611723565b610650611740565b6103a6600480360360208110156107c157600080fd5b50356001600160a01b031661174f565b6107d9611761565b6040805163ffffffff9092168252519081900360200190f35b6103a66004803603602081101561080857600080fd5b50356001600160a01b031661176b565b6103a66004803603604081101561082e57600080fd5b506001600160a01b038135811691602001351661177d565b61084e6119ae565b6040805165ffffffffffff9092168252519081900360200190f35b6104696004803603604081101561087f57600080fd5b506001600160a01b0381351690602001356119c3565b61051d600480360360208110156108ab57600080fd5b50356119d0565b6103a6600480360360208110156108c857600080fd5b50356001600160a01b0316611a87565b6103c0611c20565b61051d600480360360e08110156108f657600080fd5b506001600160a01b03813581169160208101359091169060408101359060608101359060ff6080820135169060a08101359060c00135611c7a565b6103a6611cbe565b61051d611cc9565b6104696004803603604081101561095757600080fd5b506001600160a01b038135169060200135611e69565b6105fe611e76565b6103a6611e85565b61051d6004803603602081101561099357600080fd5b50356001600160a01b0316611e8b565b6107d9611eac565b6103a6611ebf565b61051d600480360360208110156109c957600080fd5b50356001600160a01b0316611ec5565b6103a6611fbf565b610650611fc5565b6103a6611fd4565b61084e611fe0565b61051d600480360360e0811015610a0f57600080fd5b506001600160a01b03813581169160208101359091169060408101359060608101359060ff6080820135169060a08101359060c00135611fee565b610650612029565b6103a660048036036040811015610a6857600080fd5b506001600160a01b038135811691602001351661203d565b6103a661205a565b6107d9612062565b61051d60048036036020811015610aa657600080fd5b5035612075565b61051d612125565b7ff6d86ed606f871fa1a557ac0ba607adce07767acf53f492fb215a1a4db4aea6f81565b6000805460408051602060026001851615610100026000190190941693909304601f81018490048402820184019092528181529291830182828015610b5f5780601f10610b3457610100808354040283529160200191610b5f565b820191906000526020600020905b815481529060010190602001808311610b4257829003601f168201915b505050505081565b640d7957c4d081565b6000610b7d338484612198565b5060015b92915050565b60035481565b60125481565b600b5460ff16610bdd576040805162461bcd60e51b815260206004820152601060248201526f15185c9bdd0e8814915153951154915160821b604482015290519081900360640190fd5b600b805460ff19169055610bef611cc9565b600a5480841115610c42576040805162461bcd60e51b81526020600482015260186024820152770a8c2e4dee87440929ca6aa8c8c9286928a9ca8be8682a6960431b604482015290519081900360640190fd5b610c4d8633866121fa565b8315610c5d57610c5d85856122bf565b8115610d0f57604051631b4a79ff60e21b815233600482018181526001600160a01b038981166024850152604484018890526080606485019081526084850187905290891693636d29e7fc93928b928a928a928a92909160a401848480828437600081840152601f19601f8201169050808301925050509650505050505050600060405180830381600087803b158015610cf657600080fd5b505af1158015610d0a573d6000803e3d6000fd5b505050505b600854604080516370a0823160e01b815230600482015290516000926001600160a01b0316916370a08231916024808301926020929190829003018186803b158015610d5a57600080fd5b505afa158015610d6e573d6000803e3d6000fd5b505050506040513d6020811015610d8457600080fd5b505190506000610db9670de0b6b3a7640000610dad8866038d7ea4c6800063ffffffff61244b16565b9063ffffffff6124ab16565b90506000610dcd878363ffffffff6124ed16565b90506000610df185610de5868b63ffffffff6124ed16565b9063ffffffff61254716565b90506000806000610e038d8686612589565b92509250925083851115610f1d57600b60019054906101000a90046001600160a01b03166001600160a01b0316639aac2c538e30856040518463ffffffff1660e01b815260040180846001600160a01b03166001600160a01b03168152602001836001600160a01b03166001600160a01b031681526020018281526020019350505050602060405180830381600087803b158015610ea057600080fd5b505af1158015610eb4573d6000803e3d6000fd5b505050506040513d6020811015610eca57600080fd5b5051610f1d576040805162461bcd60e51b815260206004820152601d60248201527f5461726f743a20494e53554646494349454e545f4c4951554944495459000000604482015290519081900360640190fd5b8b6001600160a01b03168d6001600160a01b0316336001600160a01b03167f33f3048bd4e6af45e53afb722adfd57dbde82da7e93e44db921fb4b8c6a70c4b8e88888888604051808681526020018581526020018481526020018381526020018281526020019550505050505060405180910390a45050505050505050610fa26127a3565b5050600b805460ff19166001179055505050565b6706f05b59d3b2000081565b6001600160a01b03831660009081526005602090815260408083203384529091528120546000191461107c57604080518082018252601b81527f5461726f743a205452414e534645525f4e4f545f414c4c4f57454400000000006020808301919091526001600160a01b038716600090815260058252838120338252909152919091205461105791849063ffffffff6127b316565b6001600160a01b03851660009081526005602090815260408083203384529091529020555b61108784848461284a565b5060019392505050565b6505436648e14081565b600b5460ff166110e5576040805162461bcd60e51b815260206004820152601060248201526f15185c9bdd0e8814915153951154915160821b604482015290519081900360640190fd5b600b805460ff1916905561110581640d7957c4d06505436648e14061293c565b60138190556040805182815290517f1396dfcdb64fb7eb77fb84966f27b81afe14aa70b6e966c68d74af3302a9fe909181900360200190a150600b805460ff19166001179055565b60135481565b7f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c981565b60025460ff1681565b600b5460ff166111ca576040805162461bcd60e51b815260206004820152601060248201526f15185c9bdd0e8814915153951154915160821b604482015290519081900360640190fd5b600b805460ff191690556111dc6129e5565b601480546001600160a01b0383166001600160a01b0319909116811790915560408051918252517f468b6598e7e810c65c9858b5f23a2d5b8692fb753b78a032232de4c6ed3cabbf9181900360200190a150600b805460ff19166001179055565b60065481565b600061124d611cc9565b600354600e54600a546000916112739190600160701b90046001600160701b03166124ed565b9050811580611280575080155b1561129757670de0b6b3a7640000925050506112c7565b60006112b583610dad84670de0b6b3a764000063ffffffff61244b16565b90506112c18184612ab1565b93505050505b90565b60115481565b6407620d070081565b600e54600160701b90046001600160701b031681565b6009546001600160a01b03161561134d576040805162461bcd60e51b815260206004820152601a60248201527f5461726f743a20464143544f52595f414c52454144595f534554000000000000604482015290519081900360640190fd5b600980546001600160a01b03191633179055565b600061136b6134a5565b506001600160a01b0382166000908152600d60209081526040918290208251808401909352546001600160701b038082168452600160701b909104169082018190526113bb5760009150506113ec565b6020810151600e5482516113e8926001600160701b0390811692610dad928216911663ffffffff61244b16565b9150505b919050565b6014546001600160a01b031681565b600581565b670dbd2fc137a3000081565b6009546001600160a01b03163314611466576040805162461bcd60e51b815260206004820152601360248201527215185c9bdd0e8815539055551213d492569151606a1b604482015290519081900360640190fd5b6114d986868080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525050604080516020601f8a018190048102820181019092528881529250889150879081908401838280828437600092019190915250612bc692505050565b600880546001600160a01b039384166001600160a01b0319909116179055600b80549190921661010002610100600160a81b03199091161790555050670de0b6b3a7640000600f555050565b600b5460009060ff16611572576040805162461bcd60e51b815260206004820152601060248201526f15185c9bdd0e8814915153951154915160821b604482015290519081900360640190fd5b600b805460ff19169055600854604080516370a0823160e01b815230600482015290516000926001600160a01b0316916370a08231916024808301926020929190829003018186803b1580156115c757600080fd5b505afa1580156115db573d6000803e3d6000fd5b505050506040513d60208110156115f157600080fd5b5051600a5490915060009061160d90839063ffffffff61254716565b905061163261161a611243565b610dad83670de0b6b3a764000063ffffffff61244b16565b92506003546000141561166057611651836103e863ffffffff61254716565b925061166060006103e8612c8e565b600083116116b5576040805162461bcd60e51b815260206004820152601760248201527f5461726f743a204d494e545f414d4f554e545f5a45524f000000000000000000604482015290519081900360640190fd5b6116bf8484612c8e565b604080518281526020810185905281516001600160a01b0387169233927f2f00e3cdd69a77be7ed215ec7b2a36784dd158f921fca79ac29deffa353fe6ee929081900390910190a350506117116127a3565b600b805460ff19166001179055919050565b600c60209081526000928352604080842090915290825290205481565b6008546001600160a01b031681565b60046020526000908152604090205481565b63ffffffff421690565b60076020526000908152604090205481565b600b5460009060ff166117ca576040805162461bcd60e51b815260206004820152601060248201526f15185c9bdd0e8814915153951154915160821b604482015290519081900360640190fd5b600b805460ff191690556117dc611cc9565b600854604080516370a0823160e01b815230600482015290516000926001600160a01b0316916370a08231916024808301926020929190829003018186803b15801561182757600080fd5b505afa15801561183b573d6000803e3d6000fd5b505050506040513d602081101561185157600080fd5b5051600a5490915060009061186d90839063ffffffff61254716565b9050600061188361187d87611361565b83612d25565b600b546040805163b2a02ff160e01b81526001600160a01b0389811660048301528a81166024830152604482018590529151939450610100909204169163b2a02ff1916064808201926020929091908290030181600087803b1580156118e857600080fd5b505af11580156118fc573d6000803e3d6000fd5b505050506040513d602081101561191257600080fd5b5051935060008080611925898287612589565b604080518b8152602081018a90528082018590526060810184905260808101839052905193965091945092506001600160a01b03808b1692908c169133917fb0dbe18c6ffdf0da655dd690e77211d379205c497be44c64447c3f5f021b51679181900360a00190a450505050505061199b6127a3565b600b805460ff1916600117905592915050565b601054600160301b900465ffffffffffff1681565b6000610b7d338484612d3b565b600b5460ff16611a1a576040805162461bcd60e51b815260206004820152601060248201526f15185c9bdd0e8814915153951154915160821b604482015290519081900360640190fd5b600b805460ff19169055611a3f816706f05b59d3b20000670dbd2fc137a3000061293c565b60128190556040805182815290517f7a550b1995ff63260fb313f12024e66e73bad425372e5af6b1e04cb3799ef38c9181900360200190a150600b805460ff19166001179055565b600b5460009060ff16611ad4576040805162461bcd60e51b815260206004820152601060248201526f15185c9bdd0e8814915153951154915160821b604482015290519081900360640190fd5b600b805460ff1916905530600090815260046020526040902054611b12670de0b6b3a7640000610dad611b05611243565b849063ffffffff61244b16565b915060008211611b69576040805162461bcd60e51b815260206004820152601960248201527f5461726f743a2052454445454d5f414d4f554e545f5a45524f00000000000000604482015290519081900360640190fd5b600a54821115611bbb576040805162461bcd60e51b81526020600482015260186024820152770a8c2e4dee87440929ca6aa8c8c9286928a9ca8be8682a6960431b604482015290519081900360640190fd5b611bc53082612d9d565b611bcf83836122bf565b604080518381526020810183905281516001600160a01b0386169233927f3f693fff038bb8a046aa76d9516190ac7444f7d69cf952c4cbdc086fdef2d6fc929081900390910190a3506117116127a3565b60018054604080516020600284861615610100026000190190941693909304601f81018490048402820184019092528181529291830182828015610b5f5780601f10610b3457610100808354040283529160200191610b5f565b611caa878787878787877ff6d86ed606f871fa1a557ac0ba607adce07767acf53f492fb215a1a4db4aea6f612e3a565b611cb5878787612d3b565b50505050505050565b66038d7ea4c6800081565b600e546001600160701b0380821691600160701b810490911690600160e01b900463ffffffff166000611cfa611761565b90508063ffffffff168263ffffffff161415611d195750505050611e67565b600e805463ffffffff808416600160e01b026001600160e01b039092169190911790915560105483830391600091611d609165ffffffffffff909116908085169061244b16565b90506000611d80670de0b6b3a7640000610dad848963ffffffff61244b16565b9050611d92868263ffffffff6124ed16565b9550611dc0611db3670de0b6b3a7640000610dad858b63ffffffff61244b16565b889063ffffffff6124ed16565b9650611dcb8761300f565b600e80546001600160701b0319166001600160701b0392909216919091179055611df48661300f565b600e80546001600160701b0392909216600160701b02600160701b600160e01b0319909216919091179055604080518281526020810189905280820188905290517f875352fb3fadeb8c0be7cbbe8ff761b308fa7033470cd0287f02f3436fd76cb99181900360600190a1505050505050505b565b6000610b7d33848461284a565b600e546001600160701b031681565b600a5481565b611ea981611e9883611361565b600e546001600160701b031661305e565b50565b600e54600160e01b900463ffffffff1681565b6103e881565b600b5460ff16611f0f576040805162461bcd60e51b815260206004820152601060248201526f15185c9bdd0e8814915153951154915160821b604482015290519081900360640190fd5b600b805460ff19169055600a54600854604080516370a0823160e01b81523060048201529051611faf938593611faa9391926001600160a01b03909116916370a08231916024808301926020929190829003018186803b158015611f7257600080fd5b505afa158015611f86573d6000803e3d6000fd5b505050506040513d6020811015611f9c57600080fd5b50519063ffffffff61254716565b6122bf565b50600b805460ff19166001179055565b600f5481565b6009546001600160a01b031681565b6702c68af0bb14000081565b60105465ffffffffffff1681565b61201e878787878787877f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c9612e3a565b611cb5878787612198565b600b5461010090046001600160a01b031681565b600560209081526000928352604080842090915290825290205481565b6312e687c081565b601054600160601b900463ffffffff1681565b600b5460ff166120bf576040805162461bcd60e51b815260206004820152601060248201526f15185c9bdd0e8814915153951154915160821b604482015290519081900360640190fd5b600b805460ff191690556120dd8160006702c68af0bb14000061293c565b60118190556040805182815290517f9d9cd27245b4e6b06dcf523ac57b6e851b934e199eee376313f906e94bfbfd559181900360200190a150600b805460ff19166001179055565b600b5460ff1661216f576040805162461bcd60e51b815260206004820152601060248201526f15185c9bdd0e8814915153951154915160821b604482015290519081900360640190fd5b600b805460ff19169055612181611cc9565b6121896127a3565b600b805460ff19166001179055565b6001600160a01b03808416600081815260056020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b6001600160a01b038084166000818152600c6020908152604080832094871680845294909152902054911480159061223457506000198114155b156122b9578181101561228e576040805162461bcd60e51b815260206004820152601960248201527f5461726f743a20424f52524f575f4e4f545f414c4c4f57454400000000000000604482015290519081900360640190fd5b6001600160a01b038085166000908152600c6020908152604080832093871683529290522082820390555b50505050565b600854604080518082018252601981527f7472616e7366657228616464726573732c75696e74323536290000000000000060209182015281516001600160a01b0386811660248301526044808301879052845180840390910181526064909201845291810180516001600160e01b031663a9059cbb60e01b1781529251815160009560609594169382918083835b6020831061236c5780518252601f19909201916020918201910161234d565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d80600081146123ce576040519150601f19603f3d011682016040523d82523d6000602084013e6123d3565b606091505b509150915081801561240157508051158061240157508080602001905160208110156123fe57600080fd5b50515b6122b9576040805162461bcd60e51b815260206004820152601660248201527515185c9bdd0e881514905394d1915497d1905253115160521b604482015290519081900360640190fd5b60008261245a57506000610b81565b8282028284828161246757fe5b04146124a45760405162461bcd60e51b815260040180806020018281038252602181526020018061359d6021913960400191505060405180910390fd5b9392505050565b60006124a483836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506130ec565b6000828201838110156124a4576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b60006124a483836040518060400160405280601f81526020017f536166654d6174683a207375627472616374696f6e20756e646572666c6f77008152506127b3565b600080600061259786611361565b9250838514156125bd575050600e548190600160701b90046001600160701b031661279a565b600e546001600160701b031684861115612684576001600160a01b0387166000908152600d602052604090208587036125fc868263ffffffff6124ed16565b94506126078561300f565b82546001600160701b0319166001600160701b0391821617600160701b600160e01b031916600160701b8583168102919091178455600e5461264d9291900416826124ed565b93506126588461300f565b600e806101000a8154816001600160701b0302191690836001600160701b031602179055505050612784565b6001600160a01b0387166000908152600d602052604090208686038086116126ad5760006126b1565b8086035b94506126bc8561300f565b82546001600160701b0319166001600160701b0391909116178255846126f2578154600160701b600160e01b0319168255612715565b8154600160701b600160e01b031916600160701b6001600160701b038516021782555b6000612727878763ffffffff61254716565b600e54600160701b90046001600160701b03169550905080851161274c576000612750565b8085035b945061275b8561300f565b600e806101000a8154816001600160701b0302191690836001600160701b031602179055505050505b6127988784836001600160701b031661305e565b505b93509350939050565b6127ab613151565b611e67613201565b600081848411156128425760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b838110156128075781810151838201526020016127ef565b50505050905090810190601f1680156128345780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b604080518082018252601881527f5461726f743a205452414e534645525f544f4f5f4849474800000000000000006020808301919091526001600160a01b0386166000908152600490915291909120546128ab91839063ffffffff6127b316565b6001600160a01b0380851660009081526004602052604080822093909355908416815220546128e0908263ffffffff6124ed16565b6001600160a01b0380841660008181526004602090815260409182902094909455805185815290519193928716927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a3505050565b6129446129e5565b81831015612992576040805162461bcd60e51b81526020600482015260166024820152755461726f743a20494e56414c49445f53455454494e4760501b604482015290519081900360640190fd5b808311156129e0576040805162461bcd60e51b81526020600482015260166024820152755461726f743a20494e56414c49445f53455454494e4760501b604482015290519081900360640190fd5b505050565b600960009054906101000a90046001600160a01b03166001600160a01b031663f851a4406040518163ffffffff1660e01b815260040160206040518083038186803b158015612a3357600080fd5b505afa158015612a47573d6000803e3d6000fd5b505050506040513d6020811015612a5d57600080fd5b50516001600160a01b03163314611e67576040805162461bcd60e51b815260206004820152601360248201527215185c9bdd0e8815539055551213d492569151606a1b604482015290519081900360640190fd5b600f5460009080841115612bbd576000612b02612af5670de0b6b3a7640000610dad601154612ae9878b61254790919063ffffffff16565b9063ffffffff61244b16565b869063ffffffff61254716565b90506000612b1e85610de584610dad838b63ffffffff61244b16565b905080612b3057859350505050610b81565b6009546040805163345ef94160e01b815290516000926001600160a01b03169163345ef941916004808301926020929190829003018186803b158015612b7557600080fd5b505afa158015612b89573d6000803e3d6000fd5b505050506040513d6020811015612b9f57600080fd5b50519050612bad8183612c8e565b5050600f8190559150610b819050565b83915050610b81565b8151612bd99060009060208501906134bc565b508051612bed9060019060208401906134bc565b50604051469080605261354b8239604080519182900360520182208651602097880120838301835260018452603160f81b93880193909352815180880191909152808201929092527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc6606083015260808201939093523060a0808301919091528351808303909101815260c090910190925250805192019190912060065550565b600354612ca1908263ffffffff6124ed16565b6003556001600160a01b038216600090815260046020526040902054612ccd908263ffffffff6124ed16565b6001600160a01b03831660008181526004602090815260408083209490945583518581529351929391927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a35050565b6000818310612d3457816124a4565b5090919050565b6001600160a01b038084166000818152600c6020908152604080832094871680845294825291829020859055815185815291517fc3c1215b41d54142382d54a05fb991007165ae91bcb1879bac8b290d9111aaf49281900390910190a3505050565b6001600160a01b038216600090815260046020526040902054612dc6908263ffffffff61254716565b6001600160a01b038316600090815260046020526040902055600354612df2908263ffffffff61254716565b6003556040805182815290516000916001600160a01b038516917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9181900360200190a35050565b42851015612e80576040805162461bcd60e51b815260206004820152600e60248201526d15185c9bdd0e881156141254915160921b604482015290519081900360640190fd5b6006546001600160a01b03808a1660008181526007602090815260408083208054600180820190925582518085018a905280840196909652958e166060860152608085018d905260a085019590955260c08085018c90528151808603909101815260e08501825280519083012061190160f01b6101008601526101028501969096526101228085019690965280518085039096018652610142840180825286519683019690962095839052610162840180825286905260ff8a166101828501526101a284018990526101c28401889052519193926101e280820193601f1981019281900390910190855afa158015612f7c573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b03811615801590612fb25750896001600160a01b0316816001600160a01b0316145b613003576040805162461bcd60e51b815260206004820152601860248201527f5461726f743a20494e56414c49445f5349474e41545552450000000000000000604482015290519081900360640190fd5b50505050505050505050565b6000600160701b821061305a576040805162461bcd60e51b815260206004820152600e60248201526d2a30b937ba1d1029a0a32298989960911b604482015290519081900360640190fd5b5090565b6014546001600160a01b03168061307557506129e0565b604080516305285d7f60e01b81526001600160a01b03868116600483015260248201869052604482018590529151918316916305285d7f9160648082019260009290919082900301818387803b1580156130ce57600080fd5b505af11580156130e2573d6000803e3d6000fd5b5050505050505050565b6000818361313b5760405162461bcd60e51b81526020600482018181528351602484015283519092839260449091019190850190808383600083156128075781810151838201526020016127ef565b50600083858161314757fe5b0495945050505050565b600854604080516370a0823160e01b815230600482015290516001600160a01b03909216916370a0823191602480820192602092909190829003018186803b15801561319c57600080fd5b505afa1580156131b0573d6000803e3d6000fd5b505050506040513d60208110156131c657600080fd5b5051600a81905560408051918252517f8a0df8ef054fae2c3d2d19a7b322e864870cc9fd3cb07fb9526309c596244bf49181900360200190a1565b60125460135460105465ffffffffffff80821691600160301b810490911690600160601b900463ffffffff16600081613238611761565b03905063ffffffff8116156133ad5761324f611761565b6010600c6101000a81548163ffffffff021916908363ffffffff1602179055506000838510156132d8576000670de0b6b3a76400008363ffffffff168887898903670de0b6b3a764000002816132a157fe5b040202816132ab57fe5b049050670de0b6b3a764000081116132cd5780670de0b6b3a7640000036132d0565b60005b915050613319565b6000670de0b6b3a76400008363ffffffff168887888a03670de0b6b3a7640000028161330057fe5b0402028161330a57fe5b04670de0b6b3a7640000019150505b670de0b6b3a76400008482020493506407620d070084111561333e576407620d070093505b6312e687c0841015613352576312e687c093505b601080546bffffffffffff0000000000001916600160301b65ffffffffffff8716021790556040805185815290517f713a98ffb7d769b8e33e2ee945ebb6acb7f397532688164d3ce1081f903c77bc916020908290030190a1505b600e54600a54600091600160701b90046001600160701b03169082906133d390836124ed565b905080156133f4578082670de0b6b3a764000002816133ee57fe5b046133f7565b60005b9250505086811161341557868185028161340d57fe5b04945061344f565b600087670de0b6b3a764000003888303670de0b6b3a7640000028161343657fe5b049050670de0b6b3a76400006004820281018602049550505b6010805465ffffffffffff191665ffffffffffff87161790556040805186815290517f338541dc9083f6af6715482fb419e1483c1ae9097764fd68a5dc98109bd5a788916020908290030190a150505050505050565b604080518082019091526000808252602082015290565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106134fd57805160ff191683800117855561352a565b8280016001018555821561352a579182015b8281111561352a57825182559160200191906001019061350f565b5061305a926112c79250905b8082111561305a576000815560010161353656fe454950373132446f6d61696e28737472696e67206e616d652c737472696e672076657273696f6e2c75696e7432353620636861696e49642c6164647265737320766572696679696e67436f6e747261637429536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f77a265627a7a7231582023fb3858826e70547859ad9f710fa44fe1adaa923b59a3fe8c783867c21f2ac864736f6c63430005100032a265627a7a72315820965c032d3879599840eed3df0984c32703149e4d93c667803cf9ed262b511d2a64736f6c63430005100032

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.