Contract 0x4e5acc5d171faa9e376089afbf6caedd2c2416eb 6

 

Contract Overview

Balance:
0 ETH

EtherValue:
$0.00

Token:
Txn Hash Method
Block
From
To
Value
0xe941579a4c4a9b3b0e9ec9477f347988b229a2f5cba88fd7f9747d7344dd28bbApprove1061943862023-06-28 21:25:49243 days 13 hrs ago0x01a66607e2f13f89c1af094e7bac50082f094686 IN  0x4e5acc5d171faa9e376089afbf6caedd2c2416eb0 ETH0.0000410506110.000004887
0xbe76ba5b092e006ca85ac5bb52c0f34815233f230808eadabbae57da3a304180Approve1053774532023-06-09 23:34:43262 days 11 hrs ago0x6244cb96a99b7557c0ed56e7633cf2c70e435b82 IN  0x4e5acc5d171faa9e376089afbf6caedd2c2416eb0 ETH0.0000351936910.000000608
0x4adb4bc2d15f3774d86dd8d020d64ec68eb3b5c4160b4ddf2a355287496634b1Approve895022162023-04-12 13:47:45320 days 21 hrs ago0x52cc1bc45d387a52ce48a9c051614a6265529bba IN  0x4e5acc5d171faa9e376089afbf6caedd2c2416eb0 ETH0.0001070824150.001
0x173d91cc55a62eaf8ed1dbd8882fac52db771539e557b9c71b6a2898413fe909Approve734683782023-02-10 12:43:14381 days 22 hrs ago0x8ab8226e45224cd2330934d0cc5cc25dcab0b7ba IN  0x4e5acc5d171faa9e376089afbf6caedd2c2416eb0 ETH0.0001062959330.001
0x10b0bc7ecf63ecb5cf979ebe566731089ec53bf1e0ee12c3388abcd203ae40cbApprove734596712023-02-10 12:02:21381 days 23 hrs ago0x8ab8226e45224cd2330934d0cc5cc25dcab0b7ba IN  0x4e5acc5d171faa9e376089afbf6caedd2c2416eb0 ETH0.0000894742150.001
0x9710fd639d2c812b7faaaa063a65caffeaa3a4a9bcfa22246a5f3b58866d49e1Approve536449762022-12-22 17:26:10431 days 17 hrs ago0xfacec1c32ae56097866a6c1dda1124f2c6844f40 IN  0x4e5acc5d171faa9e376089afbf6caedd2c2416eb0 ETH0.0000775557640.001
0x621370dd743bb37fd16b2ced0874fe94950aecef3bcfcaffafebeaee6782933cApprove340898702022-11-03 21:19:28480 days 13 hrs ago0x0253dfdf6a55d0696b3335d7fece9ca1147b444d IN  0x4e5acc5d171faa9e376089afbf6caedd2c2416eb0 ETH0.0000862960510.001
0x0dd451b3dd0f8ae00314bf359a4fb6587215d2f12ce70c129ccee67c7f8a6d20Approve259050382022-09-28 5:24:32517 days 5 hrs ago0x5275817b74021e97c980e95ede6bbac0d0d6f3a2 IN  0x4e5acc5d171faa9e376089afbf6caedd2c2416eb0 ETH0.0000448248030.00100155
0x939e3fdb25c2cf5fa8b3589681667bffc0fbeb857596fe35d91730cbfd68635eApprove178245842022-08-05 7:51:43571 days 3 hrs ago0x4325c590dd27437f08aced052608fc3db9b50cd5 IN  0x4e5acc5d171faa9e376089afbf6caedd2c2416eb0 ETH0.0000368871790.001
0xfb702b8968bf2ee735c40c2337e0d89ed311e5b8783fd3418aa821016c8e5a04Approve157507232022-07-25 18:28:20581 days 16 hrs ago0x58d68892383340e4d04bdd925c0bfb67f1684562 IN  0x4e5acc5d171faa9e376089afbf6caedd2c2416eb0 ETH0.0003526731460.001
0xd0295f701c7f68fd5c760d68eb4cf726f0f714d1275a2ae2ab1a69ee2b945cd4Approve143032382022-07-12 3:12:54595 days 7 hrs ago0x6fe797a05359c9d91b1f85d418e2ed4ea6c65a8f IN  0x4e5acc5d171faa9e376089afbf6caedd2c2416eb0 ETH0.0001109878590.001
0xa0fbcb6b08f354b367be8938d5534caae89f47b8b23c7908e6d78ecf209e3680Approve140429062022-07-07 21:58:01599 days 13 hrs ago 0xd861415f6703ab50ce101c7e6f6a80ada1fc2b1c IN  0x4e5acc5d171faa9e376089afbf6caedd2c2416eb0 ETH0.000184096460.001
[ Download CSV Export 
Latest 25 internal transaction
Parent Txn Hash Block From To Value
0x82a23db94a44c2139a5c69e42121f16734209f9a616aca314510edad970a1b7c1061943972023-06-28 21:26:11243 days 13 hrs ago 0x4e5acc5d171faa9e376089afbf6caedd2c2416eb 0x1b59389ab4d77eb51048fc8ee5b0cda59a561de10 ETH
0x82a23db94a44c2139a5c69e42121f16734209f9a616aca314510edad970a1b7c1061943972023-06-28 21:26:11243 days 13 hrs ago 0x4e5acc5d171faa9e376089afbf6caedd2c2416eb 0x1b59389ab4d77eb51048fc8ee5b0cda59a561de10 ETH
0x82a23db94a44c2139a5c69e42121f16734209f9a616aca314510edad970a1b7c1061943972023-06-28 21:26:11243 days 13 hrs ago 0x4e5acc5d171faa9e376089afbf6caedd2c2416eb 0x1b59389ab4d77eb51048fc8ee5b0cda59a561de10 ETH
0x82a23db94a44c2139a5c69e42121f16734209f9a616aca314510edad970a1b7c1061943972023-06-28 21:26:11243 days 13 hrs ago 0x4e5acc5d171faa9e376089afbf6caedd2c2416eb 0x5a8931f2b235caa2eabf3f07cd1154360c933e170 ETH
0x82a23db94a44c2139a5c69e42121f16734209f9a616aca314510edad970a1b7c1061943972023-06-28 21:26:11243 days 13 hrs ago 0x4e5acc5d171faa9e376089afbf6caedd2c2416eb 0xa514558c9ed596e69d7a42b8bc5e3c0a03ccc9800 ETH
0x82a23db94a44c2139a5c69e42121f16734209f9a616aca314510edad970a1b7c1061943972023-06-28 21:26:11243 days 13 hrs ago 0x4e5acc5d171faa9e376089afbf6caedd2c2416eb 0xad4c0cd0a8c220e9a55593966177be33f741e69d0 ETH
0x82a23db94a44c2139a5c69e42121f16734209f9a616aca314510edad970a1b7c1061943972023-06-28 21:26:11243 days 13 hrs ago 0xa516b9c7378799799e6dfadbdabf45d5b584405f 0x4e5acc5d171faa9e376089afbf6caedd2c2416eb0 ETH
0x82a23db94a44c2139a5c69e42121f16734209f9a616aca314510edad970a1b7c1061943972023-06-28 21:26:11243 days 13 hrs ago 0x4e5acc5d171faa9e376089afbf6caedd2c2416eb 0xa516b9c7378799799e6dfadbdabf45d5b584405f0 ETH
0x82a23db94a44c2139a5c69e42121f16734209f9a616aca314510edad970a1b7c1061943972023-06-28 21:26:11243 days 13 hrs ago 0x4e5acc5d171faa9e376089afbf6caedd2c2416eb 0x1b59389ab4d77eb51048fc8ee5b0cda59a561de10 ETH
0x82a23db94a44c2139a5c69e42121f16734209f9a616aca314510edad970a1b7c1061943972023-06-28 21:26:11243 days 13 hrs ago 0xa516b9c7378799799e6dfadbdabf45d5b584405f 0x4e5acc5d171faa9e376089afbf6caedd2c2416eb0 ETH
0x82a23db94a44c2139a5c69e42121f16734209f9a616aca314510edad970a1b7c1061943972023-06-28 21:26:11243 days 13 hrs ago 0xa516b9c7378799799e6dfadbdabf45d5b584405f 0x4e5acc5d171faa9e376089afbf6caedd2c2416eb0 ETH
0x395f473da0a4a5e0a7f3fb8d478a2a437c7a7abb71f8d82ea26267c441b061841053774612023-06-09 23:34:59262 days 11 hrs ago 0x4e5acc5d171faa9e376089afbf6caedd2c2416eb 0x1b59389ab4d77eb51048fc8ee5b0cda59a561de10 ETH
0x395f473da0a4a5e0a7f3fb8d478a2a437c7a7abb71f8d82ea26267c441b061841053774612023-06-09 23:34:59262 days 11 hrs ago 0x4e5acc5d171faa9e376089afbf6caedd2c2416eb 0x1b59389ab4d77eb51048fc8ee5b0cda59a561de10 ETH
0x395f473da0a4a5e0a7f3fb8d478a2a437c7a7abb71f8d82ea26267c441b061841053774612023-06-09 23:34:59262 days 11 hrs ago 0x4e5acc5d171faa9e376089afbf6caedd2c2416eb 0x1b59389ab4d77eb51048fc8ee5b0cda59a561de10 ETH
0x395f473da0a4a5e0a7f3fb8d478a2a437c7a7abb71f8d82ea26267c441b061841053774612023-06-09 23:34:59262 days 11 hrs ago 0x4e5acc5d171faa9e376089afbf6caedd2c2416eb 0x5a8931f2b235caa2eabf3f07cd1154360c933e170 ETH
0x395f473da0a4a5e0a7f3fb8d478a2a437c7a7abb71f8d82ea26267c441b061841053774612023-06-09 23:34:59262 days 11 hrs ago 0x4e5acc5d171faa9e376089afbf6caedd2c2416eb 0xa514558c9ed596e69d7a42b8bc5e3c0a03ccc9800 ETH
0x395f473da0a4a5e0a7f3fb8d478a2a437c7a7abb71f8d82ea26267c441b061841053774612023-06-09 23:34:59262 days 11 hrs ago 0x4e5acc5d171faa9e376089afbf6caedd2c2416eb 0xad4c0cd0a8c220e9a55593966177be33f741e69d0 ETH
0x395f473da0a4a5e0a7f3fb8d478a2a437c7a7abb71f8d82ea26267c441b061841053774612023-06-09 23:34:59262 days 11 hrs ago 0xa516b9c7378799799e6dfadbdabf45d5b584405f 0x4e5acc5d171faa9e376089afbf6caedd2c2416eb0 ETH
0x395f473da0a4a5e0a7f3fb8d478a2a437c7a7abb71f8d82ea26267c441b061841053774612023-06-09 23:34:59262 days 11 hrs ago 0x4e5acc5d171faa9e376089afbf6caedd2c2416eb 0xa516b9c7378799799e6dfadbdabf45d5b584405f0 ETH
0x395f473da0a4a5e0a7f3fb8d478a2a437c7a7abb71f8d82ea26267c441b061841053774612023-06-09 23:34:59262 days 11 hrs ago 0x4e5acc5d171faa9e376089afbf6caedd2c2416eb 0x1b59389ab4d77eb51048fc8ee5b0cda59a561de10 ETH
0x395f473da0a4a5e0a7f3fb8d478a2a437c7a7abb71f8d82ea26267c441b061841053774612023-06-09 23:34:59262 days 11 hrs ago 0xa516b9c7378799799e6dfadbdabf45d5b584405f 0x4e5acc5d171faa9e376089afbf6caedd2c2416eb0 ETH
0x395f473da0a4a5e0a7f3fb8d478a2a437c7a7abb71f8d82ea26267c441b061841053774612023-06-09 23:34:59262 days 11 hrs ago 0xa516b9c7378799799e6dfadbdabf45d5b584405f 0x4e5acc5d171faa9e376089afbf6caedd2c2416eb0 ETH
0x09ab26f9654bfa47c6de7ea73834c8c8bd9678c66cd8b732d7f3bffaede141921053773582023-06-09 23:31:33262 days 11 hrs ago 0x4e5acc5d171faa9e376089afbf6caedd2c2416eb 0x1b59389ab4d77eb51048fc8ee5b0cda59a561de10 ETH
0x09ab26f9654bfa47c6de7ea73834c8c8bd9678c66cd8b732d7f3bffaede141921053773582023-06-09 23:31:33262 days 11 hrs ago 0x4e5acc5d171faa9e376089afbf6caedd2c2416eb 0x1b59389ab4d77eb51048fc8ee5b0cda59a561de10 ETH
0x09ab26f9654bfa47c6de7ea73834c8c8bd9678c66cd8b732d7f3bffaede141921053773582023-06-09 23:31:33262 days 11 hrs ago 0x4e5acc5d171faa9e376089afbf6caedd2c2416eb 0x5a8931f2b235caa2eabf3f07cd1154360c933e170 ETH
[ Download CSV Export 
Loading

Similar Match Source Code
This contract matches the deployed Bytecode of the Source Code for Contract 0x1dB39b72721e1C4F8532346d861C273af00db443
The constructor portion of the code might be different and could alter the actual behaviour of the contract

Contract Name:
Collateral

Compiler Version
v0.5.16+commit.9c3226ce

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion
File 1 of 16 : Collateral.sol
pragma solidity =0.5.16;

import "./PoolToken.sol";
import "./CStorage.sol";
import "./CSetter.sol";
import "./interfaces/IBorrowable.sol";
import "./interfaces/ICollateral.sol";
import "./interfaces/IFactory.sol";
import "./interfaces/ITarotPriceOracle.sol";
import "./interfaces/ITarotCallee.sol";
import "./interfaces/IUniswapV2Pair.sol";
import "./libraries/UQ112x112.sol";
import "./libraries/Math.sol";

contract Collateral is ICollateral, PoolToken, CStorage, CSetter {
    using UQ112x112 for uint224;

    constructor() public {}

    /*** Collateralization Model ***/

    // returns the prices of borrowable0's and borrowable1's underlyings with collateral's underlying as denom
    function getPrices() public returns (uint256 price0, uint256 price1) {
        (uint224 twapPrice112x112, ) =
            ITarotPriceOracle(tarotPriceOracle).getResult(underlying);
        (uint112 reserve0, uint112 reserve1, ) =
            IUniswapV2Pair(underlying).getReserves();
        uint256 collateralTotalSupply =
            IUniswapV2Pair(underlying).totalSupply();

        uint224 currentPrice112x112 =
            UQ112x112.encode(reserve1).uqdiv(reserve0);
        uint256 adjustmentSquared =
            uint256(twapPrice112x112).mul(2**32).div(currentPrice112x112);
        uint256 adjustment = Math.sqrt(adjustmentSquared.mul(2**32));

        uint256 currentBorrowable0Price =
            uint256(collateralTotalSupply).mul(1e18).div(reserve0 * 2);
        uint256 currentBorrowable1Price =
            uint256(collateralTotalSupply).mul(1e18).div(reserve1 * 2);

        price0 = currentBorrowable0Price.mul(adjustment).div(2**32);
        price1 = currentBorrowable1Price.mul(2**32).div(adjustment);

        /*
         * Price calculation errors may happen in some edge pairs where
         * reserve0 / reserve1 is close to 2**112 or 1/2**112
         * We're going to prevent users from using pairs at risk from the UI
         */
        require(price0 > 100, "Tarot: PRICE_CALCULATION_ERROR");
        require(price1 > 100, "Tarot: PRICE_CALCULATION_ERROR");
    }

    // returns liquidity in  collateral's underlying
    function _calculateLiquidity(
        uint256 amountCollateral,
        uint256 amount0,
        uint256 amount1
    ) internal returns (uint256 liquidity, uint256 shortfall) {
        uint256 _safetyMarginSqrt = safetyMarginSqrt;
        (uint256 price0, uint256 price1) = getPrices();

        uint256 a = amount0.mul(price0).div(1e18);
        uint256 b = amount1.mul(price1).div(1e18);
        if (a < b) (a, b) = (b, a);
        a = a.mul(_safetyMarginSqrt).div(1e18);
        b = b.mul(1e18).div(_safetyMarginSqrt);
        uint256 collateralNeeded = a.add(b).mul(liquidationIncentive).div(1e18);

        if (amountCollateral >= collateralNeeded) {
            return (amountCollateral - collateralNeeded, 0);
        } else {
            return (0, collateralNeeded - amountCollateral);
        }
    }

    /*** ERC20 ***/

    function _transfer(
        address from,
        address to,
        uint256 value
    ) internal {
        require(tokensUnlocked(from, value), "Tarot: INSUFFICIENT_LIQUIDITY");
        super._transfer(from, to, value);
    }

    function tokensUnlocked(address from, uint256 value) public returns (bool) {
        uint256 _balance = balanceOf[from];
        if (value > _balance) return false;
        uint256 finalBalance = _balance - value;
        uint256 amountCollateral = finalBalance.mul(exchangeRate()).div(1e18);
        uint256 amount0 = IBorrowable(borrowable0).borrowBalance(from);
        uint256 amount1 = IBorrowable(borrowable1).borrowBalance(from);
        (, uint256 shortfall) =
            _calculateLiquidity(amountCollateral, amount0, amount1);
        return shortfall == 0;
    }

    /*** Collateral ***/

    function accountLiquidityAmounts(
        address borrower,
        uint256 amount0,
        uint256 amount1
    ) public returns (uint256 liquidity, uint256 shortfall) {
        if (amount0 == uint256(-1))
            amount0 = IBorrowable(borrowable0).borrowBalance(borrower);
        if (amount1 == uint256(-1))
            amount1 = IBorrowable(borrowable1).borrowBalance(borrower);
        uint256 amountCollateral =
            balanceOf[borrower].mul(exchangeRate()).div(1e18);
        return _calculateLiquidity(amountCollateral, amount0, amount1);
    }

    function accountLiquidity(address borrower)
        public
        returns (uint256 liquidity, uint256 shortfall)
    {
        return accountLiquidityAmounts(borrower, uint256(-1), uint256(-1));
    }

    function canBorrow(
        address borrower,
        address borrowable,
        uint256 accountBorrows
    ) public returns (bool) {
        address _borrowable0 = borrowable0;
        address _borrowable1 = borrowable1;
        require(
            borrowable == _borrowable0 || borrowable == _borrowable1,
            "Tarot: INVALID_BORROWABLE"
        );
        uint256 amount0 =
            borrowable == _borrowable0 ? accountBorrows : uint256(-1);
        uint256 amount1 =
            borrowable == _borrowable1 ? accountBorrows : uint256(-1);
        (, uint256 shortfall) =
            accountLiquidityAmounts(borrower, amount0, amount1);
        return shortfall == 0;
    }

    // this function must be called from borrowable0 or borrowable1
    function seize(
        address liquidator,
        address borrower,
        uint256 repayAmount
    ) external returns (uint256 seizeTokens) {
        require(
            msg.sender == borrowable0 || msg.sender == borrowable1,
            "Tarot: UNAUTHORIZED"
        );

        (, uint256 shortfall) = accountLiquidity(borrower);
        require(shortfall > 0, "Tarot: INSUFFICIENT_SHORTFALL");

        uint256 price;
        if (msg.sender == borrowable0) (price, ) = getPrices();
        else (, price) = getPrices();

        seizeTokens = repayAmount
            .mul(liquidationIncentive)
            .div(1e18)
            .mul(price)
            .div(exchangeRate());

        balanceOf[borrower] = balanceOf[borrower].sub(
            seizeTokens,
            "Tarot: LIQUIDATING_TOO_MUCH"
        );
        balanceOf[liquidator] = balanceOf[liquidator].add(seizeTokens);
        emit Transfer(borrower, liquidator, seizeTokens);
    }

    // this low-level function should be called from another contract
    function flashRedeem(
        address redeemer,
        uint256 redeemAmount,
        bytes calldata data
    ) external nonReentrant update {
        require(redeemAmount <= totalBalance, "Tarot: INSUFFICIENT_CASH");

        // optimistically transfer funds
        _safeTransfer(redeemer, redeemAmount);
        if (data.length > 0)
            ITarotCallee(redeemer).tarotRedeem(msg.sender, redeemAmount, data);

        uint256 redeemTokens = balanceOf[address(this)];
        uint256 declaredRedeemTokens =
            redeemAmount.mul(1e18).div(exchangeRate()).add(1); // rounded up
        require(
            redeemTokens >= declaredRedeemTokens,
            "Tarot: INSUFFICIENT_REDEEM_TOKENS"
        );

        _burn(address(this), redeemTokens);
        emit Redeem(msg.sender, redeemer, redeemAmount, redeemTokens);
    }
}

File 2 of 16 : 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 3 of 16 : CStorage.sol
pragma solidity =0.5.16;


contract CStorage {
	address public borrowable0;
	address public borrowable1;
	address public tarotPriceOracle;
	uint public safetyMarginSqrt = 1.41421356e18; //safetyMargin: 200%
	uint public liquidationIncentive = 1.02e18; //2%
}

File 4 of 16 : CSetter.sol
pragma solidity =0.5.16;

import "./CStorage.sol";
import "./PoolToken.sol";
import "./interfaces/IFactory.sol";
import "./interfaces/ITarotPriceOracle.sol";

contract CSetter is PoolToken, CStorage {
    uint256 public constant SAFETY_MARGIN_SQRT_MIN = 1.00e18; //safetyMargin: 100%
    uint256 public constant SAFETY_MARGIN_SQRT_MAX = 1.58113884e18; //safetyMargin: 250%
    uint256 public constant LIQUIDATION_INCENTIVE_MIN = 1.00e18; //100%
    uint256 public constant LIQUIDATION_INCENTIVE_MAX = 1.05e18; //105%

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

    // called once by the factory at the time of deployment
    function _initialize(
        string calldata _name,
        string calldata _symbol,
        address _underlying,
        address _borrowable0,
        address _borrowable1
    ) external {
        require(msg.sender == factory, "Tarot: UNAUTHORIZED"); // sufficient check
        _setName(_name, _symbol);
        underlying = _underlying;
        borrowable0 = _borrowable0;
        borrowable1 = _borrowable1;
        tarotPriceOracle = IFactory(factory).tarotPriceOracle();
    }

    function _setSafetyMarginSqrt(uint256 newSafetyMarginSqrt)
        external
        nonReentrant
    {
        _checkSetting(
            newSafetyMarginSqrt,
            SAFETY_MARGIN_SQRT_MIN,
            SAFETY_MARGIN_SQRT_MAX
        );
        safetyMarginSqrt = newSafetyMarginSqrt;
        emit NewSafetyMargin(newSafetyMarginSqrt);
    }

    function _setLiquidationIncentive(uint256 newLiquidationIncentive)
        external
        nonReentrant
    {
        _checkSetting(
            newLiquidationIncentive,
            LIQUIDATION_INCENTIVE_MIN,
            LIQUIDATION_INCENTIVE_MAX
        );
        liquidationIncentive = newLiquidationIncentive;
        emit NewLiquidationIncentive(newLiquidationIncentive);
    }

    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 5 of 16 : 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 6 of 16 : 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 7 of 16 : 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 8 of 16 : ITarotPriceOracle.sol
pragma solidity >=0.5.0;

interface ITarotPriceOracle {
    event PriceUpdate(
        address indexed pair,
        uint256 priceCumulative,
        uint32 blockTimestamp,
        bool latestIsSlotA
    );

    function MIN_T() external pure returns (uint32);

    function getPair(address uniswapV2Pair)
        external
        view
        returns (
            uint256 priceCumulativeSlotA,
            uint256 priceCumulativeSlotB,
            uint32 lastUpdateSlotA,
            uint32 lastUpdateSlotB,
            bool latestIsSlotA,
            bool initialized
        );

    function initialize(address uniswapV2Pair) external;

    function getResult(address uniswapV2Pair)
        external
        returns (uint224 price, uint32 T);
}

File 9 of 16 : 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 10 of 16 : IUniswapV2Pair.sol
pragma solidity >=0.5.0;

interface IUniswapV2Pair {
    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);
	
    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 (uint);
}

File 11 of 16 : UQ112x112.sol
pragma solidity =0.5.16;

// a library for handling binary fixed point numbers (https://en.wikipedia.org/wiki/Q_(number_format))
// src: https://github.com/Uniswap/uniswap-v2-core/blob/master/contracts/libraries/UQ112x112.sol

// range: [0, 2**112 - 1]
// resolution: 1 / 2**112

library UQ112x112 {
    uint224 constant Q112 = 2**112;

    // encode a uint112 as a UQ112x112
    function encode(uint112 y) internal pure returns (uint224 z) {
        z = uint224(y) * Q112; // never overflows
    }

    // divide a UQ112x112 by a uint112, returning a UQ112x112
    function uqdiv(uint224 x, uint112 y) internal pure returns (uint224 z) {
        z = x / uint224(y);
    }
}

File 12 of 16 : 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 13 of 16 : 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 14 of 16 : 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 15 of 16 : 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 16 of 16 : 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",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  },
  "libraries": {}
}

Contract Security Audit

Contract ABI

[{"inputs":[],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"spender","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":true,"internalType":"address","name":"minter","type":"address"},{"indexed":false,"internalType":"uint256","name":"mintAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"mintTokens","type":"uint256"}],"name":"Mint","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"newLiquidationIncentive","type":"uint256"}],"name":"NewLiquidationIncentive","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"newSafetyMarginSqrt","type":"uint256"}],"name":"NewSafetyMargin","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":true,"internalType":"address","name":"redeemer","type":"address"},{"indexed":false,"internalType":"uint256","name":"redeemAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"redeemTokens","type":"uint256"}],"name":"Redeem","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"totalBalance","type":"uint256"}],"name":"Sync","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Transfer","type":"event"},{"constant":true,"inputs":[],"name":"DOMAIN_SEPARATOR","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"LIQUIDATION_INCENTIVE_MAX","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"LIQUIDATION_INCENTIVE_MIN","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"MINIMUM_LIQUIDITY","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"PERMIT_TYPEHASH","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"SAFETY_MARGIN_SQRT_MAX","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"SAFETY_MARGIN_SQRT_MIN","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"string","name":"_name","type":"string"},{"internalType":"string","name":"_symbol","type":"string"},{"internalType":"address","name":"_underlying","type":"address"},{"internalType":"address","name":"_borrowable0","type":"address"},{"internalType":"address","name":"_borrowable1","type":"address"}],"name":"_initialize","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"_setFactory","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"uint256","name":"newLiquidationIncentive","type":"uint256"}],"name":"_setLiquidationIncentive","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"uint256","name":"newSafetyMarginSqrt","type":"uint256"}],"name":"_setSafetyMarginSqrt","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"borrower","type":"address"}],"name":"accountLiquidity","outputs":[{"internalType":"uint256","name":"liquidity","type":"uint256"},{"internalType":"uint256","name":"shortfall","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"borrower","type":"address"},{"internalType":"uint256","name":"amount0","type":"uint256"},{"internalType":"uint256","name":"amount1","type":"uint256"}],"name":"accountLiquidityAmounts","outputs":[{"internalType":"uint256","name":"liquidity","type":"uint256"},{"internalType":"uint256","name":"shortfall","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"}],"name":"allowance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"}],"name":"approve","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"borrowable0","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"borrowable1","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"borrower","type":"address"},{"internalType":"address","name":"borrowable","type":"address"},{"internalType":"uint256","name":"accountBorrows","type":"uint256"}],"name":"canBorrow","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"exchangeRate","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"factory","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"redeemer","type":"address"},{"internalType":"uint256","name":"redeemAmount","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"flashRedeem","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"getPrices","outputs":[{"internalType":"uint256","name":"price0","type":"uint256"},{"internalType":"uint256","name":"price1","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"liquidationIncentive","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"minter","type":"address"}],"name":"mint","outputs":[{"internalType":"uint256","name":"mintTokens","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"nonces","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"uint256","name":"deadline","type":"uint256"},{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"}],"name":"permit","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"redeemer","type":"address"}],"name":"redeem","outputs":[{"internalType":"uint256","name":"redeemAmount","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"safetyMarginSqrt","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"liquidator","type":"address"},{"internalType":"address","name":"borrower","type":"address"},{"internalType":"uint256","name":"repayAmount","type":"uint256"}],"name":"seize","outputs":[{"internalType":"uint256","name":"seizeTokens","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"to","type":"address"}],"name":"skim","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"sync","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"tarotPriceOracle","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"}],"name":"tokensUnlocked","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"totalBalance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"}],"name":"transfer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"underlying","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"}]

Deployed Bytecode

0x608060405234801561001057600080fd5b506004361061025e5760003560e01c80637ecebe0011610146578063bb6ff386116100c3578063c548e3c511610087578063c548e3c5146106dc578063d490e7e0146107b5578063d505accf146107bd578063daf888181461080e578063dd62ed3e14610816578063fff6cae9146108445761025e565b8063bb6ff38614610689578063bc25cf77146106a6578063bc9bd12a14610320578063bd9a548b146106cc578063c45a0155146106d45761025e565b8063a9059cbb1161010a578063a9059cbb1461060f578063ad7a672f1461063b578063afc8276c14610643578063b2a02ff11461064b578063ba9a7a56146106815761025e565b80637ecebe001461057d5780638c765e94146105a357806395a2251f146105ab57806395d89b41146105d15780639aac2c53146105d95761025e565b8063356c571f116101df5780635a0f03c6116101a35780635a0f03c61461048c5780636a627842146104cb5780636e01be10146104f15780636f13cb831461051d5780636f307dc31461054f57806370a08231146105575761025e565b8063356c571f1461044f5780633644e515146104575780633ba0b9a91461045f5780634a5d316c146104675780634fd42e171461046f5761025e565b806323b872dd1161022657806323b872dd146103c75780632fa5ae1b146103fd57806330adf81f14610421578063313ce5671461042957806334fb08a8146104475761025e565b806306fdde0314610263578063095ea7b3146102e05780630fb60fef1461032057806318160ddd1461033a57806319f3400d14610342575b600080fd5b61026b61084c565b6040805160208082528351818301528351919283929083019185019080838360005b838110156102a557818101518382015260200161028d565b50505050905090810190601f1680156102d25780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61030c600480360360408110156102f657600080fd5b506001600160a01b0381351690602001356108da565b604080519115158252519081900360200190f35b6103286108f1565b60408051918252519081900360200190f35b6103286108fd565b6103c56004803603606081101561035857600080fd5b6001600160a01b0382351691602081013591810190606081016040820135600160201b81111561038757600080fd5b82018360208201111561039957600080fd5b803590602001918460018302840111600160201b831117156103ba57600080fd5b509092509050610903565b005b61030c600480360360608110156103dd57600080fd5b506001600160a01b03813581169160208101359091169060400135610b5a565b610405610c29565b604080516001600160a01b039092168252519081900360200190f35b610328610c3d565b610431610c61565b6040805160ff9092168252519081900360200190f35b610405610c6a565b610328610c79565b610328610c7f565b610328610c85565b6103c5610cd5565b6103c56004803603602081101561048557600080fd5b5035610d47565b6104b2600480360360208110156104a257600080fd5b50356001600160a01b0316610dfe565b6040805192835260208301919091528051918290030190f35b610328600480360360208110156104e157600080fd5b50356001600160a01b0316610e17565b61030c6004803603604081101561050757600080fd5b506001600160a01b038135169060200135611015565b6104b26004803603606081101561053357600080fd5b506001600160a01b0381351690602081013590604001356111a1565b61040561130f565b6103286004803603602081101561056d57600080fd5b50356001600160a01b031661131e565b6103286004803603602081101561059357600080fd5b50356001600160a01b0316611330565b610328611342565b610328600480360360208110156105c157600080fd5b50356001600160a01b0316611348565b61026b6114e1565b61030c600480360360608110156105ef57600080fd5b506001600160a01b0381358116916020810135909116906040013561153b565b61030c6004803603604081101561062557600080fd5b506001600160a01b038135169060200135611624565b610328611631565b610328611637565b6103286004803603606081101561066157600080fd5b506001600160a01b03813581169160208101359091169060400135611643565b61032861187f565b6103c56004803603602081101561069f57600080fd5b5035611885565b6103c5600480360360208110156106bc57600080fd5b50356001600160a01b031661193c565b6104b2611a36565b610405611d5b565b6103c5600480360360a08110156106f257600080fd5b810190602081018135600160201b81111561070c57600080fd5b82018360208201111561071e57600080fd5b803590602001918460018302840111600160201b8311171561073f57600080fd5b919390929091602081019035600160201b81111561075c57600080fd5b82018360208201111561076e57600080fd5b803590602001918460018302840111600160201b8311171561078f57600080fd5b91935091506001600160a01b038135811691602081013582169160409091013516611d6a565b610328611f0b565b6103c5600480360360e08110156107d357600080fd5b506001600160a01b03813581169160208101359091169060408101359060608101359060ff6080820135169060a08101359060c00135611f17565b610405611f5b565b6103286004803603604081101561082c57600080fd5b506001600160a01b0381358116916020013516611f6a565b6103c5611f87565b6000805460408051602060026001851615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156108d25780601f106108a7576101008083540402835291602001916108d2565b820191906000526020600020905b8154815290600101906020018083116108b557829003601f168201915b505050505081565b60006108e7338484611ff2565b5060015b92915050565b670de0b6b3a764000081565b60035481565b600b5460ff1661094d576040805162461bcd60e51b815260206004820152601060248201526f15185c9bdd0e8814915153951154915160821b604482015290519081900360640190fd5b600b805460ff19169055600a548311156109a9576040805162461bcd60e51b81526020600482015260186024820152770a8c2e4dee87440929ca6aa8c8c9286928a9ca8be8682a6960431b604482015290519081900360640190fd5b6109b38484612054565b8015610a5957604051636b4d4dc160e01b8152336004820181815260248301869052606060448401908152606484018590526001600160a01b03881693636b4d4dc193928892889288929190608401848480828437600081840152601f19601f82011690508083019250505095505050505050600060405180830381600087803b158015610a4057600080fd5b505af1158015610a54573d6000803e3d6000fd5b505050505b3060009081526004602052604081205490610aaa6001610a9e610a7a610c85565b610a9289670de0b6b3a764000063ffffffff6121e616565b9063ffffffff61224616565b9063ffffffff61228816565b905080821015610aeb5760405162461bcd60e51b8152600401808060200182810382526021815260200180612d506021913960400191505060405180910390fd5b610af530836122e2565b604080518681526020810184905281516001600160a01b0389169233927f3f693fff038bb8a046aa76d9516190ac7444f7d69cf952c4cbdc086fdef2d6fc929081900390910190a35050610b4761236d565b5050600b805460ff191660011790555050565b6001600160a01b038316600090815260056020908152604080832033845290915281205460001914610c1457604080518082018252601b81527f5461726f743a205452414e534645525f4e4f545f414c4c4f57454400000000006020808301919091526001600160a01b0387166000908152600582528381203382529091529190912054610bef91849063ffffffff61241d16565b6001600160a01b03851660009081526005602090815260408083203384529091529020555b610c1f8484846124b4565b5060019392505050565b600b5461010090046001600160a01b031681565b7f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c981565b60025460ff1681565b600d546001600160a01b031681565b600e5481565b60065481565b600354600a5460009190811580610c9a575080155b15610cb157670de0b6b3a764000092505050610cd2565b610ccd82610a9283670de0b6b3a764000063ffffffff6121e616565b925050505b90565b6009546001600160a01b031615610d33576040805162461bcd60e51b815260206004820152601a60248201527f5461726f743a20464143544f52595f414c52454144595f534554000000000000604482015290519081900360640190fd5b600980546001600160a01b03191633179055565b600b5460ff16610d91576040805162461bcd60e51b815260206004820152601060248201526f15185c9bdd0e8814915153951154915160821b604482015290519081900360640190fd5b600b805460ff19169055610db681670de0b6b3a7640000670e92596fd629000061251f565b600f8190556040805182815290517f8a9bb9067f9ecb13a322b548e6df3dd1bd10a54698834dac43ed8f0e765bf94d9181900360200190a150600b805460ff19166001179055565b600080610e0e83600019806111a1565b91509150915091565b600b5460009060ff16610e64576040805162461bcd60e51b815260206004820152601060248201526f15185c9bdd0e8814915153951154915160821b604482015290519081900360640190fd5b600b805460ff19169055600854604080516370a0823160e01b815230600482015290516000926001600160a01b0316916370a08231916024808301926020929190829003018186803b158015610eb957600080fd5b505afa158015610ecd573d6000803e3d6000fd5b505050506040513d6020811015610ee357600080fd5b5051600a54909150600090610eff90839063ffffffff6125c316565b9050610f24610f0c610c85565b610a9283670de0b6b3a764000063ffffffff6121e616565b925060035460001415610f5257610f43836103e863ffffffff6125c316565b9250610f5260006103e8612605565b60008311610fa7576040805162461bcd60e51b815260206004820152601760248201527f5461726f743a204d494e545f414d4f554e545f5a45524f000000000000000000604482015290519081900360640190fd5b610fb18484612605565b604080518281526020810185905281516001600160a01b0387169233927f2f00e3cdd69a77be7ed215ec7b2a36784dd158f921fca79ac29deffa353fe6ee929081900390910190a3505061100361236d565b600b805460ff19166001179055919050565b6001600160a01b038216600090815260046020526040812054808311156110405760009150506108eb565b8281036000611069670de0b6b3a7640000610a9261105c610c85565b859063ffffffff6121e616565b90506000600b60019054906101000a90046001600160a01b03166001600160a01b0316634d73e9ba886040518263ffffffff1660e01b815260040180826001600160a01b03166001600160a01b0316815260200191505060206040518083038186803b1580156110d857600080fd5b505afa1580156110ec573d6000803e3d6000fd5b505050506040513d602081101561110257600080fd5b5051600c54604080516326b9f4dd60e11b81526001600160a01b038b8116600483015291519394506000939190921691634d73e9ba916024808301926020929190829003018186803b15801561115757600080fd5b505afa15801561116b573d6000803e3d6000fd5b505050506040513d602081101561118157600080fd5b50519050600061119284848461268a565b159a9950505050505050505050565b60008060001984141561123057600b54604080516326b9f4dd60e11b81526001600160a01b038881166004830152915161010090930490911691634d73e9ba91602480820192602092909190829003018186803b15801561120157600080fd5b505afa158015611215573d6000803e3d6000fd5b505050506040513d602081101561122b57600080fd5b505193505b6000198314156112b657600c54604080516326b9f4dd60e11b81526001600160a01b03888116600483015291519190921691634d73e9ba916024808301926020929190829003018186803b15801561128757600080fd5b505afa15801561129b573d6000803e3d6000fd5b505050506040513d60208110156112b157600080fd5b505192505b60006112f4670de0b6b3a7640000610a926112cf610c85565b6001600160a01b038a166000908152600460205260409020549063ffffffff6121e616565b905061130181868661268a565b92509250505b935093915050565b6008546001600160a01b031681565b60046020526000908152604090205481565b60076020526000908152604090205481565b600f5481565b600b5460009060ff16611395576040805162461bcd60e51b815260206004820152601060248201526f15185c9bdd0e8814915153951154915160821b604482015290519081900360640190fd5b600b805460ff19169055306000908152600460205260409020546113d3670de0b6b3a7640000610a926113c6610c85565b849063ffffffff6121e616565b91506000821161142a576040805162461bcd60e51b815260206004820152601960248201527f5461726f743a2052454445454d5f414d4f554e545f5a45524f00000000000000604482015290519081900360640190fd5b600a5482111561147c576040805162461bcd60e51b81526020600482015260186024820152770a8c2e4dee87440929ca6aa8c8c9286928a9ca8be8682a6960431b604482015290519081900360640190fd5b61148630826122e2565b6114908383612054565b604080518381526020810183905281516001600160a01b0386169233927f3f693fff038bb8a046aa76d9516190ac7444f7d69cf952c4cbdc086fdef2d6fc929081900390910190a35061100361236d565b60018054604080516020600284861615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156108d25780601f106108a7576101008083540402835291602001916108d2565b600b54600c546000916001600160a01b0361010090910481169181169085168214806115785750806001600160a01b0316856001600160a01b0316145b6115c9576040805162461bcd60e51b815260206004820152601960248201527f5461726f743a20494e56414c49445f424f52524f5741424c4500000000000000604482015290519081900360640190fd5b6000826001600160a01b0316866001600160a01b0316146115ec576000196115ee565b845b90506000826001600160a01b0316876001600160a01b03161461161357600019611615565b855b905060006111928984846111a1565b60006108e73384846124b4565b600a5481565b670e92596fd629000081565b600b5460009061010090046001600160a01b031633148061166e5750600c546001600160a01b031633145b6116b5576040805162461bcd60e51b815260206004820152601360248201527215185c9bdd0e8815539055551213d492569151606a1b604482015290519081900360640190fd5b60006116c084610dfe565b91505060008111611718576040805162461bcd60e51b815260206004820152601d60248201527f5461726f743a20494e53554646494349454e545f53484f525446414c4c000000604482015290519081900360640190fd5b600b5460009061010090046001600160a01b03163314156117435761173b611a36565b50905061174f565b61174b611a36565b9150505b61178b61175a610c85565b610a928361177f670de0b6b3a7640000610a92600f548b6121e690919063ffffffff16565b9063ffffffff6121e616565b92506117fc836040518060400160405280601b81526020017f5461726f743a204c49515549444154494e475f544f4f5f4d554348000000000081525060046000896001600160a01b03166001600160a01b031681526020019081526020016000205461241d9092919063ffffffff16565b6001600160a01b038087166000908152600460205260408082209390935590881681522054611831908463ffffffff61228816565b6001600160a01b038088166000818152600460209081526040918290209490945580518781529051919392891692600080516020612de483398151915292918290030190a350509392505050565b6103e881565b600b5460ff166118cf576040805162461bcd60e51b815260206004820152601060248201526f15185c9bdd0e8814915153951154915160821b604482015290519081900360640190fd5b600b805460ff191690556118f481670de0b6b3a76400006715f15565d2c5f00061251f565b600e8190556040805182815290517fdff9a61839be6f6ce5ea77311cc351786a39a9f337c507ff35e7b358fd39c0439181900360200190a150600b805460ff19166001179055565b600b5460ff16611986576040805162461bcd60e51b815260206004820152601060248201526f15185c9bdd0e8814915153951154915160821b604482015290519081900360640190fd5b600b805460ff19169055600a54600854604080516370a0823160e01b81523060048201529051611a26938593611a219391926001600160a01b03909116916370a08231916024808301926020929190829003018186803b1580156119e957600080fd5b505afa1580156119fd573d6000803e3d6000fd5b505050506040513d6020811015611a1357600080fd5b50519063ffffffff6125c316565b612054565b50600b805460ff19166001179055565b600d546008546040805163022351bf60e51b81526001600160a01b03928316600482015281516000948594859491169263446a37e0926024808301939282900301818787803b158015611a8857600080fd5b505af1158015611a9c573d6000803e3d6000fd5b505050506040513d6040811015611ab257600080fd5b505160085460408051630240bc6b60e21b8152905192935060009283926001600160a01b031691630902f1ac916004808301926060929190829003018186803b158015611afe57600080fd5b505afa158015611b12573d6000803e3d6000fd5b505050506040513d6060811015611b2857600080fd5b508051602091820151600854604080516318160ddd60e01b815290519396509194506000936001600160a01b03909116926318160ddd926004808201939291829003018186803b158015611b7b57600080fd5b505afa158015611b8f573d6000803e3d6000fd5b505050506040513d6020811015611ba557600080fd5b505190506000611bcd84611bb88561277e565b6001600160e01b03169063ffffffff61279016565b90506000611bf66001600160e01b0380841690610a92908916600160201b63ffffffff6121e616565b90506000611c16611c1183600160201b63ffffffff6121e616565b6127b5565b90506000611c426001600160701b036002890216610a9287670de0b6b3a764000063ffffffff6121e616565b90506000611c6e6001600160701b036002890216610a9288670de0b6b3a764000063ffffffff6121e616565b9050611c88600160201b610a92848663ffffffff6121e616565b9a50611ca283610a9283600160201b63ffffffff6121e616565b995060648b11611cf9576040805162461bcd60e51b815260206004820152601e60248201527f5461726f743a2050524943455f43414c43554c4154494f4e5f4552524f520000604482015290519081900360640190fd5b60648a11611d4e576040805162461bcd60e51b815260206004820152601e60248201527f5461726f743a2050524943455f43414c43554c4154494f4e5f4552524f520000604482015290519081900360640190fd5b5050505050505050509091565b6009546001600160a01b031681565b6009546001600160a01b03163314611dbf576040805162461bcd60e51b815260206004820152601360248201527215185c9bdd0e8815539055551213d492569151606a1b604482015290519081900360640190fd5b611e3287878080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525050604080516020601f8b01819004810282018101909252898152925089915088908190840183828082843760009201919091525061280792505050565b600880546001600160a01b03199081166001600160a01b0386811691909117909255600b8054610100600160a81b03191661010086851602179055600c80549091168383161790556009546040805163069f611560e31b8152905191909216916334fb08a8916004808301926020929190829003018186803b158015611eb757600080fd5b505afa158015611ecb573d6000803e3d6000fd5b505050506040513d6020811015611ee157600080fd5b5051600d80546001600160a01b0319166001600160a01b0390921691909117905550505050505050565b6715f15565d2c5f00081565b611f47878787878787877f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c96128cf565b611f52878787611ff2565b50505050505050565b600c546001600160a01b031681565b600560209081526000928352604080842090915290825290205481565b600b5460ff16611fd1576040805162461bcd60e51b815260206004820152601060248201526f15185c9bdd0e8814915153951154915160821b604482015290519081900360640190fd5b600b805460ff19169055611fe361236d565b600b805460ff19166001179055565b6001600160a01b03808416600081815260056020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b600854604080518082018252601981527f7472616e7366657228616464726573732c75696e74323536290000000000000060209182015281516001600160a01b0386811660248301526044808301879052845180840390910181526064909201845291810180516001600160e01b031663a9059cbb60e01b1781529251815160009560609594169382918083835b602083106121015780518252601f1990920191602091820191016120e2565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d8060008114612163576040519150601f19603f3d011682016040523d82523d6000602084013e612168565b606091505b5091509150818015612196575080511580612196575080806020019051602081101561219357600080fd5b50515b6121e0576040805162461bcd60e51b815260206004820152601660248201527515185c9bdd0e881514905394d1915497d1905253115160521b604482015290519081900360640190fd5b50505050565b6000826121f5575060006108eb565b8282028284828161220257fe5b041461223f5760405162461bcd60e51b8152600401808060200182810382526021815260200180612dc36021913960400191505060405180910390fd5b9392505050565b600061223f83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612aa4565b60008282018381101561223f576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b6001600160a01b03821660009081526004602052604090205461230b908263ffffffff6125c316565b6001600160a01b038316600090815260046020526040902055600354612337908263ffffffff6125c316565b6003556040805182815290516000916001600160a01b03851691600080516020612de48339815191529181900360200190a35050565b600854604080516370a0823160e01b815230600482015290516001600160a01b03909216916370a0823191602480820192602092909190829003018186803b1580156123b857600080fd5b505afa1580156123cc573d6000803e3d6000fd5b505050506040513d60208110156123e257600080fd5b5051600a81905560408051918252517f8a0df8ef054fae2c3d2d19a7b322e864870cc9fd3cb07fb9526309c596244bf49181900360200190a1565b600081848411156124ac5760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015612471578181015183820152602001612459565b50505050905090810190601f16801561249e5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b6124be8382611015565b61250f576040805162461bcd60e51b815260206004820152601d60248201527f5461726f743a20494e53554646494349454e545f4c4951554944495459000000604482015290519081900360640190fd5b61251a838383612b09565b505050565b612527612be9565b81831015612575576040805162461bcd60e51b81526020600482015260166024820152755461726f743a20494e56414c49445f53455454494e4760501b604482015290519081900360640190fd5b8083111561251a576040805162461bcd60e51b81526020600482015260166024820152755461726f743a20494e56414c49445f53455454494e4760501b604482015290519081900360640190fd5b600061223f83836040518060400160405280601f81526020017f536166654d6174683a207375627472616374696f6e20756e646572666c6f770081525061241d565b600354612618908263ffffffff61228816565b6003556001600160a01b038216600090815260046020526040902054612644908263ffffffff61228816565b6001600160a01b0383166000818152600460209081526040808320949094558351858152935192939192600080516020612de48339815191529281900390910190a35050565b600e546000908190818061269c611a36565b909250905060006126bf670de0b6b3a7640000610a928a8663ffffffff6121e616565b905060006126df670de0b6b3a7640000610a928a8663ffffffff6121e616565b9050808210156126eb57905b612707670de0b6b3a7640000610a92848863ffffffff6121e616565b915061272585610a9283670de0b6b3a764000063ffffffff6121e616565b9050600061274e670de0b6b3a7640000610a92600f5461177f868861228890919063ffffffff16565b9050808b1061276a578a03965060009550611307945050505050565b600097508a90039550611307945050505050565b6001600160701b0316600160701b0290565b60006001600160701b0382166001600160e01b038416816127ad57fe5b049392505050565b600060038211156127f8575080600160028204015b818110156127f2578091506002818285816127e157fe5b0401816127ea57fe5b0490506127ca565b50612802565b8115612802575060015b919050565b815161281a906000906020850190612cb7565b50805161282e906001906020840190612cb7565b506040514690806052612d718239604080519182900360520182208651602097880120838301835260018452603160f81b93880193909352815180880191909152808201929092527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc6606083015260808201939093523060a0808301919091528351808303909101815260c090910190925250805192019190912060065550565b42851015612915576040805162461bcd60e51b815260206004820152600e60248201526d15185c9bdd0e881156141254915160921b604482015290519081900360640190fd5b6006546001600160a01b03808a1660008181526007602090815260408083208054600180820190925582518085018a905280840196909652958e166060860152608085018d905260a085019590955260c08085018c90528151808603909101815260e08501825280519083012061190160f01b6101008601526101028501969096526101228085019690965280518085039096018652610142840180825286519683019690962095839052610162840180825286905260ff8a166101828501526101a284018990526101c28401889052519193926101e280820193601f1981019281900390910190855afa158015612a11573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b03811615801590612a475750896001600160a01b0316816001600160a01b0316145b612a98576040805162461bcd60e51b815260206004820152601860248201527f5461726f743a20494e56414c49445f5349474e41545552450000000000000000604482015290519081900360640190fd5b50505050505050505050565b60008183612af35760405162461bcd60e51b8152602060048201818152835160248401528351909283926044909101919085019080838360008315612471578181015183820152602001612459565b506000838581612aff57fe5b0495945050505050565b604080518082018252601881527f5461726f743a205452414e534645525f544f4f5f4849474800000000000000006020808301919091526001600160a01b038616600090815260049091529190912054612b6a91839063ffffffff61241d16565b6001600160a01b038085166000908152600460205260408082209390935590841681522054612b9f908263ffffffff61228816565b6001600160a01b038084166000818152600460209081526040918290209490945580518581529051919392871692600080516020612de483398151915292918290030190a3505050565b600960009054906101000a90046001600160a01b03166001600160a01b031663f851a4406040518163ffffffff1660e01b815260040160206040518083038186803b158015612c3757600080fd5b505afa158015612c4b573d6000803e3d6000fd5b505050506040513d6020811015612c6157600080fd5b50516001600160a01b03163314612cb5576040805162461bcd60e51b815260206004820152601360248201527215185c9bdd0e8815539055551213d492569151606a1b604482015290519081900360640190fd5b565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10612cf857805160ff1916838001178555612d25565b82800160010185558215612d25579182015b82811115612d25578251825591602001919060010190612d0a565b50612d31929150612d35565b5090565b610cd291905b80821115612d315760008155600101612d3b56fe5461726f743a20494e53554646494349454e545f52454445454d5f544f4b454e53454950373132446f6d61696e28737472696e67206e616d652c737472696e672076657273696f6e2c75696e7432353620636861696e49642c6164647265737320766572696679696e67436f6e747261637429536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f77ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa265627a7a7231582055b629cf5ed0a78d64b53e8a5169a85fa86b69141676d2d06062a98bd3488d0d64736f6c63430005100032

Block Transaction Difficulty Gas Used Reward
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.