ETH Price: $3,321.99 (+2.77%)
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Token Holdings

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To

There are no matching entries

1 Internal Transaction and > 10 Token Transfers found.

Latest 1 internal transaction

Advanced mode:
Parent Transaction Hash Block
From
To
160477302022-11-25 14:54:59798 days ago1669388099  Contract Creation0 ETH
Loading...
Loading

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

Contract Name:
Clerk

Compiler Version
v0.7.6+commit.7338295f

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion
File 1 of 4 : clerk.sol
// SPDX-License-Identifier: AGPL-3.0-only
pragma solidity >=0.7.6;

import "tinlake-auth/auth.sol";
import "tinlake-math/interest.sol";

interface ManagerLike {
    // put collateral into cdp
    function join(uint256 amountDROP) external;
    // draw DAi from cdp
    function draw(uint256 amountDAI) external;
    // repay cdp debt
    function wipe(uint256 amountDAI) external;
    // remove collateral from cdp
    function exit(uint256 amountDROP) external;
    // collateral ID
    function ilk() external view returns (bytes32);
    // indicates if soft-liquidation was activated
    function safe() external view returns (bool);
    // indicates if hard-liquidation was activated
    function glad() external view returns (bool);
    // indicates if global settlement was triggered
    function live() external view returns (bool);
    // auth functions
    function file(bytes32 what, address data) external;

    function urn() external view returns (address);
}

// MKR contract
interface VatLike {
    function urns(bytes32, address) external view returns (uint256, uint256);
    function ilks(bytes32) external view returns (uint256, uint256, uint256, uint256, uint256);
}
// MKR contract

interface SpotterLike {
    function ilks(bytes32) external view returns (address, uint256);
}
// MKR contract

interface JugLike {
    function ilks(bytes32) external view returns (uint256, uint256);
    function drip(bytes32 ilk) external returns (uint256 rate);
    function base() external view returns (uint256);
}

interface GemJoinLike {
    function ilk() external view returns (bytes32);
}

interface UrnLike {
    function gemJoin() external view returns (address);
}

interface AssessorLike {
    function calcSeniorTokenPrice() external view returns (uint256);
    function calcSeniorAssetValue(uint256 seniorDebt_, uint256 seniorBalance_) external view returns (uint256);
    function changeSeniorAsset(uint256 seniorSupply, uint256 seniorRedeem) external;
    function seniorDebt() external view returns (uint256);
    function seniorBalance() external view returns (uint256);
    function getNAV() external view returns (uint256);
    function totalBalance() external view returns (uint256);
    function calcExpectedSeniorAsset(
        uint256 seniorRedeem,
        uint256 seniorSupply,
        uint256 seniorBalance_,
        uint256 seniorDebt_
    ) external view returns (uint256);
    function changeBorrowAmountEpoch(uint256 currencyAmount) external;
    function borrowAmountEpoch() external view returns (uint256);
}

interface CoordinatorLike {
    function validateRatioConstraints(uint256 assets, uint256 seniorAsset) external view returns (int256);
    function calcSeniorAssetValue(
        uint256 seniorRedeem,
        uint256 seniorSupply,
        uint256 currSeniorAsset,
        uint256 reserve_,
        uint256 nav_
    ) external returns (uint256);
    function calcSeniorRatio(uint256 seniorAsset, uint256 NAV, uint256 reserve_) external returns (uint256);
    function submissionPeriod() external view returns (bool);
}

interface ReserveLike {
    function totalBalance() external returns (uint256);
    function hardDeposit(uint256 daiAmount) external;
    function hardPayout(uint256 currencyAmount) external;
}

interface TrancheLike {
    function mint(address usr, uint256 amount) external;
    function token() external returns (address);
}

interface ERC20Like {
    function burn(address, uint256) external;
    function balanceOf(address) external view returns (uint256);
    function transferFrom(address, address, uint256) external returns (bool);
    function approve(address usr, uint256 amount) external;
}

/// @notice operator contract for MKR interactions
contract Clerk is Auth, Interest {
    // max amount of DAI that can be brawn from MKR
    uint256 public creditline;

    // tinlake contracts
    CoordinatorLike public coordinator;
    AssessorLike public assessor;
    ReserveLike public reserve;
    TrancheLike public tranche;

    // MKR contracts
    ManagerLike public mgr;
    VatLike public vat;
    SpotterLike public spotter;
    JugLike public jug;

    ERC20Like public immutable dai;
    ERC20Like public collateral;

    uint256 public constant WAD = 10 * 18;

    // buffer to add on top of mat to avoid cdp liquidation => default 1%
    uint256 public matBuffer = 0.01 * 10 ** 27;

    // collateral tolerance accepted because of potential rounding problems
    uint256 public collateralTolerance = 10;

    // maximum amount which can be used to heal as part of a draw operation
    // if the collateral deficit is higher a specific heal call is required
    uint256 public autoHealMax = 100 ether;

    // the debt is only repaid if amount is higher than the threshold
    // repaying a lower amount would cause more cost in gas fees than the debt reduction
    uint256 public wipeThreshold = 1 * WAD;

    // adapter functions can only be active if the tinlake pool is currently not in epoch closing/submissions/execution state
    modifier active() {
        require(activated(), "epoch-closing");
        _;
    }

    /// @notice returns true if the clerk is active
    /// @return active_ true if the clerk is active
    function activated() public view returns (bool active_) {
        return coordinator.submissionPeriod() == false && mkrActive();
    }

    /// @notice returns true if the MKR cdp is active
    /// @return active_ true if the MKR cdp is active
    function mkrActive() public view returns (bool active_) {
        return mgr.safe() && mgr.glad() && mgr.live();
    }

    event Depend(bytes32 indexed contractName, address addr);
    event File(bytes32 indexed what, uint256 value);

    constructor(address dai_, address collateral_) {
        dai = ERC20Like(dai_);
        collateral = ERC20Like(collateral_);
        wards[msg.sender] = 1;
        emit Rely(msg.sender);
    }

    /// @notice sets the dependency to another contract
    /// @param contractName name of the contract
    /// @param addr contract address
    function depend(bytes32 contractName, address addr) public auth {
        if (contractName == "mgr") {
            mgr = ManagerLike(addr);
        } else if (contractName == "coordinator") {
            coordinator = CoordinatorLike(addr);
        } else if (contractName == "assessor") {
            assessor = AssessorLike(addr);
        } else if (contractName == "reserve") {
            reserve = ReserveLike(addr);
        } else if (contractName == "tranche") {
            tranche = TrancheLike(addr);
        } else if (contractName == "collateral") {
            collateral = ERC20Like(addr);
        } else if (contractName == "spotter") {
            spotter = SpotterLike(addr);
        } else if (contractName == "vat") {
            vat = VatLike(addr);
        } else if (contractName == "jug") {
            jug = JugLike(addr);
        } else {
            revert();
        }
        emit Depend(contractName, addr);
    }

    /// @notice changes the parameter of the clerk by wards
    /// @param what name of the parameter
    /// @param value new value of the parameter
    function file(bytes32 what, uint256 value) public auth {
        if (what == "buffer") {
            matBuffer = value;
        } else if (what == "tolerance") {
            collateralTolerance = value;
        } else if (what == "wipeThreshold") {
            wipeThreshold = value;
        } else if (what == "autoHealMax") {
            autoHealMax = value;
        } else {
            revert();
        }
        emit File(what, value);
    }

    /// @notice returns the remaining creditline from MKR
    /// @return creditline_ remaining creditline
    function remainingCredit() public view returns (uint256 creditline_) {
        uint256 debt_ = debt();
        if (creditline <= debt_ || mkrActive() == false) {
            return 0;
        }
        return safeSub(creditline, debt_);
    }

    /// @notice returns a collateral deficit if existing
    /// @return deficit collateral deficit
    function collatDeficit() public view returns (uint256 deficit) {
        uint256 lockedCollateralDAI = rmul(cdpink(), assessor.calcSeniorTokenPrice());
        uint256 requiredCollateralDAI = calcOvercollAmount(debt());

        if (requiredCollateralDAI > collateralTolerance) {
            requiredCollateralDAI = safeSub(requiredCollateralDAI, collateralTolerance);
        }

        if (requiredCollateralDAI > lockedCollateralDAI) {
            return safeSub(requiredCollateralDAI, lockedCollateralDAI);
        }
        return 0;
    }

    /// @notice returns the remaining creditline including a potential overcollateralization
    /// @return remaining_ remaining creditline
    function remainingOvercollCredit() public view returns (uint256 remaining_) {
        return calcOvercollAmount(remainingCredit());
    }

    /// @notice junior stake in the cdpink -> value of drop used for debt protection
    /// @return juniorStake_ of junior value at stake for overcollateralization
    function juniorStake() public view returns (uint256 juniorStake_) {
        // junior looses stake in case vault is in soft/hard liquidation mode
        uint256 collateralValue = rmul(cdpink(), assessor.calcSeniorTokenPrice());
        uint256 mkrDebt = debt();
        if (mkrActive() == false || collateralValue < mkrDebt) {
            return 0;
        }
        return safeSub(collateralValue, mkrDebt);
    }

    /// @notice increases MKR credit line
    /// @param amountDAI amount to increase creditline
    function raise(uint256 amountDAI) public auth active {
        // creditline amount including required overcollateralization => amount by that the seniorAssetValue should be increased
        uint256 overcollAmountDAI = calcOvercollAmount(amountDAI);
        // protection value for the creditline increase coming from the junior tranche => amount by that the juniorAssetValue should be decreased
        uint256 protectionDAI = safeSub(overcollAmountDAI, amountDAI);
        // check if the new creditline would break the pool constraints
        require((validate(0, protectionDAI, overcollAmountDAI, 0) == 0), "violates-constraints");
        // increase MKR crediline by amount
        creditline = safeAdd(creditline, amountDAI);
        // make increase in creditline available to new loans
        assessor.changeBorrowAmountEpoch(safeAdd(assessor.borrowAmountEpoch(), amountDAI));
    }

    /// @notice draw performs the following steps: mint DROP, join DROP into cdp, draw DAI and send to reserve
    /// @param amountDAI amount of DAI to draw
    function draw(uint256 amountDAI) public auth active {
        // make sure to heal CDP before drawing new DAI
        uint256 healAmountDAI = collatDeficit();

        require(healAmountDAI <= autoHealMax, "collateral-deficit-heal-needed");

        require(amountDAI <= remainingCredit(), "not-enough-credit-left");
        // collateral value that needs to be locked in vault to draw amountDAI
        uint256 collateralDAI = safeAdd(calcOvercollAmount(amountDAI), healAmountDAI);
        uint256 collateralDROP = rdiv(collateralDAI, assessor.calcSeniorTokenPrice());
        // mint required DROP
        tranche.mint(address(this), collateralDROP);
        // join collateral into the cdp
        collateral.approve(address(mgr), collateralDROP);
        mgr.join(collateralDROP);
        // draw dai from cdp
        mgr.draw(amountDAI);
        // move dai to reserve
        dai.approve(address(reserve), amountDAI);
        reserve.hardDeposit(amountDAI);
        // increase seniorAsset by collateralDAI
        updateSeniorAsset(0, collateralDAI);
    }

    /// @notice transfer DAI from reserve, wipe cdp debt, exit DROP from cdp, burn DROP, harvest junior profit
    /// @param amountDAI amount of DAI to wipe
    function wipe(uint256 amountDAI) public auth active {
        // if amountDAI is too low, required transaction fees of wipe would be higher
        // only continue with wipe if amountDAI is higher than wipeThreshold;
        if (amountDAI < wipeThreshold) {
            return;
        }

        uint256 debt_ = debt();
        require((debt_ > 0), "cdp-debt-already-repaid");

        // repayment amount should not exceed cdp debt
        if (amountDAI > debt_) {
            amountDAI = debt_;
        }

        uint256 dropPrice = assessor.calcSeniorTokenPrice();
        // get DAI from reserve
        reserve.hardPayout(amountDAI);
        // repay cdp debt
        dai.approve(address(mgr), amountDAI);
        mgr.wipe(amountDAI);
        // harvest junior interest & burn surplus drop
        _harvest(dropPrice);
    }

    /// @notice harvest the junior profit. Increased collateral value over time allows to reduce the needed amount of collateral
    function harvest() public active {
        _harvest(assessor.calcSeniorTokenPrice());
    }

    /// @notice internal helper function for harvest
    /// @param dropPrice price of DROP (seniorToken)
    function _harvest(uint256 dropPrice) internal {
        require((cdpink() > 0), "no-profit-to-harvest");

        uint256 lockedCollateralDAI = rmul(cdpink(), dropPrice);
        // profit => diff between the DAI value of the locked collateral in the cdp & the actual cdp debt including protection buffer
        uint256 requiredLocked = calcOvercollAmount(debt());

        if (lockedCollateralDAI < requiredLocked) {
            // nothing to harvest, currently under-collateralized;
            return;
        }
        uint256 profitDAI = safeSub(lockedCollateralDAI, requiredLocked);
        uint256 profitDROP = safeDiv(safeMul(profitDAI, ONE), dropPrice);
        // remove profitDROP from the vault & brun them
        mgr.exit(profitDROP);
        collateral.burn(address(this), profitDROP);
        // decrease the seniorAssetValue by profitDAI -> DROP price stays constant
        updateSeniorAsset(profitDAI, 0);
    }

    /// @notice decrease MKR creditline
    /// @param amountDAI amount of DAI to decrease creditline
    function sink(uint256 amountDAI) public auth active {
        require(remainingCredit() >= amountDAI, "decrease-amount-too-high");

        // creditline amount including required overcollateralization => amount by that the seniorAssetValue should be decreased
        uint256 overcollAmountDAI = calcOvercollAmount(amountDAI);
        // protection value for the creditline decrease going to the junior tranche => amount by that the juniorAssetValue should be increased
        uint256 protectionDAI = safeSub(overcollAmountDAI, amountDAI);
        // check if the new creditline would break the pool constraints
        require((validate(protectionDAI, 0, 0, overcollAmountDAI) == 0), "pool-constraints-violated");

        // increase MKR crediline by amount
        creditline = safeSub(creditline, amountDAI);
        // decrease in creditline impacts amount available for new loans

        uint256 borrowAmountEpoch = assessor.borrowAmountEpoch();

        if (borrowAmountEpoch <= amountDAI) {
            assessor.changeBorrowAmountEpoch(0);
            return;
        }

        assessor.changeBorrowAmountEpoch(safeSub(borrowAmountEpoch, amountDAI));
    }

    /// @notice increases the amount of collateral by minting new senior token (diluting other holders)
    /// @param amountDAI amount of DAI to increase collateral
    function heal(uint256 amountDAI) public auth active {
        uint256 collatDeficitDAI = collatDeficit();
        require(collatDeficitDAI > 0, "no-healing-required");

        // heal max up to the required missing collateral amount
        if (collatDeficitDAI < amountDAI) {
            amountDAI = collatDeficitDAI;
        }

        require((validate(0, amountDAI, 0, 0) == 0), "violates-constraints");
        // mint drop and move into vault
        uint256 priceDROP = assessor.calcSeniorTokenPrice();
        uint256 collateralDROP = rdiv(amountDAI, priceDROP);
        tranche.mint(address(this), collateralDROP);
        collateral.approve(address(mgr), collateralDROP);
        mgr.join(collateralDROP);
        // increase seniorAsset by amountDAI
        updateSeniorAsset(0, amountDAI);
    }

    /// @notice heal the cdp and put in more drop in case the collateral value has fallen below the bufferedmat ratio
    function heal() public auth active {
        uint256 collatDeficitDAI = collatDeficit();
        if (collatDeficitDAI > 0) {
            heal(collatDeficitDAI);
        }
    }

    /// @notice checks if the Maker credit line increase could violate the pool constraints // -> make function pure and call with current pool values approxNav
    /// @param juniorSupplyDAI  amount of new junior supply
    /// @param juniorRedeemDAI  amount of junior redeem
    /// @param seniorSupplyDAI  amount of new senior supply
    /// @param seniorRedeemDAI  amount of senior redeem
    /// @param err 0 if no error, otherwise error code
    function validate(
        uint256 juniorSupplyDAI,
        uint256 juniorRedeemDAI,
        uint256 seniorSupplyDAI,
        uint256 seniorRedeemDAI
    ) public view returns (int256 err) {
        uint256 newAssets = safeSub(
            safeSub(
                safeAdd(safeAdd(safeAdd(assessor.totalBalance(), assessor.getNAV()), seniorSupplyDAI), juniorSupplyDAI),
                juniorRedeemDAI
            ),
            seniorRedeemDAI
        );
        uint256 expectedSeniorAsset = assessor.calcExpectedSeniorAsset(
            seniorRedeemDAI, seniorSupplyDAI, assessor.seniorBalance(), assessor.seniorDebt()
        );
        return coordinator.validateRatioConstraints(newAssets, expectedSeniorAsset);
    }

    function updateSeniorAsset(uint256 decreaseDAI, uint256 increaseDAI) internal {
        assessor.changeSeniorAsset(increaseDAI, decreaseDAI);
    }

    /// @notice returns the collateral amount in the cdp
    /// @return ink_ amount in the cdp (in senior tokens)
    function cdpink() public view returns (uint256 ink_) {
        uint256 ink = collateral.balanceOf(address(mgr));
        return ink;
    }

    /// @notice returns the required security margin for the DROP tokens
    /// @return totalMat required security margin
    function mat() public view returns (uint256 totalMat) {
        (, uint256 mat_) = spotter.ilks(ilk());
        return safeAdd(mat_, matBuffer); //  e.g 150% denominated in RAY
    }

    /// @notice helper function that returns the overcollateralized DAI amount considering the current mat value
    /// @param amountDAI amount of DAI
    function calcOvercollAmount(uint256 amountDAI) public view returns (uint256) {
        return rmul(amountDAI, mat());
    }

    /// @notice in case contract received DAI as a leftover from the cdp liquidation return back to reserve
    function returnDAI() public auth {
        uint256 amountDAI = dai.balanceOf(address(this));
        dai.approve(address(reserve), amountDAI);
        reserve.hardDeposit(amountDAI);
    }

    /// @notice change the owner in the mgr contract
    /// @param usr new owner address
    function changeOwnerMgr(address usr) public auth {
        mgr.file("owner", usr);
    }

    /// @notice returns the current debt from the Maker vault
    /// @return debt_ current debt
    function debt() public view returns (uint256 debt_) {
        bytes32 ilk_ = ilk();
        // get debt index
        (, uint256 art) = vat.urns(ilk_, mgr.urn());

        // get accumulated interest rate index
        (, uint256 rateIdx,,,) = vat.ilks(ilk_);

        // get interest rate per second and last interest rate update timestamp
        (uint256 duty, uint256 rho) = jug.ilks(ilk_);

        // interest accumulation up to date
        if (block.timestamp == rho) {
            return rmul(art, rateIdx);
        }

        // calculate current debt (see jug.drip function in MakerDAO)
        return rmul(art, rmul(rpow(safeAdd(jug.base(), duty), safeSub(block.timestamp, rho), ONE), rateIdx));
    }

    /// @notice returns the stabliity fee index from Maker
    /// @return stabilityFeeIndex_ stability fee index
    function stabilityFeeIndex() public view returns (uint256 stabilityFeeIndex_) {
        (, uint256 rate,,,) = vat.ilks(ilk());
        return rate;
    }

    /// @notice returns the stability fee from Maker
    /// @return stabilityFee_ stability fee
    function stabilityFee() public view returns (uint256 stabilityFee_) {
        // mkr.duty is the stability fee in the mkr system
        (uint256 duty,) = jug.ilks(ilk());
        return safeAdd(jug.base(), duty);
    }

    /// @notice returns the ilk (collateral type/name) from Maker
    /// @return ilk_ ilk
    function ilk() public view returns (bytes32 ilk_) {
        return GemJoinLike(UrnLike(mgr.urn()).gemJoin()).ilk();
    }
}

File 2 of 4 : auth.sol
// SPDX-License-Identifier: AGPL-3.0-only
// Copyright (C) Centrifuge 2020, based on MakerDAO dss https://github.com/makerdao/dss
pragma solidity >=0.5.15;

contract Auth {
    mapping (address => uint256) public wards;
    
    event Rely(address indexed usr);
    event Deny(address indexed usr);

    function rely(address usr) external auth {
        wards[usr] = 1;
        emit Rely(usr);
    }
    function deny(address usr) external auth {
        wards[usr] = 0;
        emit Deny(usr);
    }

    modifier auth {
        require(wards[msg.sender] == 1, "not-authorized");
        _;
    }

}

File 3 of 4 : interest.sol
// SPDX-License-Identifier: AGPL-3.0-only
// Copyright (C) 2018 Rain <[email protected]> and Centrifuge, referencing MakerDAO dss => https://github.com/makerdao/dss/blob/master/src/pot.sol
pragma solidity >=0.5.15;

import "./math.sol";

contract Interest is Math {
    // @notice This function provides compounding in seconds
    // @param chi Accumulated interest rate over time
    // @param ratePerSecond Interest rate accumulation per second in RAD(10ˆ27)
    // @param lastUpdated When the interest rate was last updated
    // @param pie Total sum of all amounts accumulating under one interest rate, divided by that rate
    // @return The new accumulated rate, as well as the difference between the debt calculated with the old and new accumulated rates.
    function compounding(uint chi, uint ratePerSecond, uint lastUpdated, uint pie) public view returns (uint, uint) {
        require(block.timestamp >= lastUpdated, "tinlake-math/invalid-timestamp");
        require(chi != 0);
        // instead of a interestBearingAmount we use a accumulated interest rate index (chi)
        uint updatedChi = _chargeInterest(chi ,ratePerSecond, lastUpdated, block.timestamp);
        return (updatedChi, safeSub(rmul(updatedChi, pie), rmul(chi, pie)));
    }

    // @notice This function charge interest on a interestBearingAmount
    // @param interestBearingAmount is the interest bearing amount
    // @param ratePerSecond Interest rate accumulation per second in RAD(10ˆ27)
    // @param lastUpdated last time the interest has been charged
    // @return interestBearingAmount + interest
    function chargeInterest(uint interestBearingAmount, uint ratePerSecond, uint lastUpdated) public view returns (uint) {
        if (block.timestamp >= lastUpdated) {
            interestBearingAmount = _chargeInterest(interestBearingAmount, ratePerSecond, lastUpdated, block.timestamp);
        }
        return interestBearingAmount;
    }

    function _chargeInterest(uint interestBearingAmount, uint ratePerSecond, uint lastUpdated, uint current) internal pure returns (uint) {
        return rmul(rpow(ratePerSecond, current - lastUpdated, ONE), interestBearingAmount);
    }


    // convert pie to debt/savings amount
    function toAmount(uint chi, uint pie) public pure returns (uint) {
        return rmul(pie, chi);
    }

    // convert debt/savings amount to pie
    function toPie(uint chi, uint amount) public pure returns (uint) {
        return rdivup(amount, chi);
    }

    function rpow(uint x, uint n, uint base) public pure returns (uint z) {
        assembly {
            switch x case 0 {switch n case 0 {z := base} default {z := 0}}
            default {
                switch mod(n, 2) case 0 { z := base } default { z := x }
                let half := div(base, 2)  // for rounding.
                for { n := div(n, 2) } n { n := div(n,2) } {
                let xx := mul(x, x)
                if iszero(eq(div(xx, x), x)) { revert(0,0) }
                let xxRound := add(xx, half)
                if lt(xxRound, xx) { revert(0,0) }
                x := div(xxRound, base)
                if mod(n,2) {
                    let zx := mul(z, x)
                    if and(iszero(iszero(x)), iszero(eq(div(zx, x), z))) { revert(0,0) }
                    let zxRound := add(zx, half)
                    if lt(zxRound, zx) { revert(0,0) }
                    z := div(zxRound, base)
                }
            }
            }
        }
    }
}

File 4 of 4 : math.sol
// SPDX-License-Identifier: AGPL-3.0-only
// Copyright (C) 2018 Rain <[email protected]>
pragma solidity >=0.5.15;

contract Math {
    uint256 constant ONE = 10 ** 27;

    function safeAdd(uint x, uint y) public pure returns (uint z) {
        require((z = x + y) >= x, "safe-add-failed");
    }

    function safeSub(uint x, uint y) public pure returns (uint z) {
        require((z = x - y) <= x, "safe-sub-failed");
    }

    function safeMul(uint x, uint y) public pure returns (uint z) {
        require(y == 0 || (z = x * y) / y == x, "safe-mul-failed");
    }

    function safeDiv(uint x, uint y) public pure returns (uint z) {
        z = x / y;
    }

    function rmul(uint x, uint y) public pure returns (uint z) {
        z = safeMul(x, y) / ONE;
    }

    function rdiv(uint x, uint y) public pure returns (uint z) {
        require(y > 0, "division by zero");
        z = safeAdd(safeMul(x, ONE), y / 2) / y;
    }

    function rdivup(uint x, uint y) internal pure returns (uint z) {
        require(y > 0, "division by zero");
        // always rounds up
        z = safeAdd(safeMul(x, ONE), safeSub(y, 1)) / y;
    }


}

Settings
{
  "remappings": [
    "ds-test/=lib/forge-std/lib/ds-test/src/",
    "forge-std/=lib/forge-std/src/",
    "tinlake-auth/=lib/tinlake-auth/src/",
    "tinlake-erc20/=lib/tinlake-erc20/src/",
    "tinlake-math/=lib/tinlake-math/src/",
    "tinlake-title/=lib/tinlake-title/src/"
  ],
  "optimizer": {
    "enabled": true,
    "runs": 200
  },
  "metadata": {
    "bytecodeHash": "ipfs"
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  },
  "evmVersion": "istanbul",
  "libraries": {}
}

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"address","name":"dai_","type":"address"},{"internalType":"address","name":"collateral_","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"usr","type":"address"}],"name":"Deny","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"contractName","type":"bytes32"},{"indexed":false,"internalType":"address","name":"addr","type":"address"}],"name":"Depend","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"what","type":"bytes32"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"File","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"usr","type":"address"}],"name":"Rely","type":"event"},{"inputs":[],"name":"WAD","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"activated","outputs":[{"internalType":"bool","name":"active_","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"assessor","outputs":[{"internalType":"contract AssessorLike","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"autoHealMax","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"amountDAI","type":"uint256"}],"name":"calcOvercollAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"cdpink","outputs":[{"internalType":"uint256","name":"ink_","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"usr","type":"address"}],"name":"changeOwnerMgr","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"interestBearingAmount","type":"uint256"},{"internalType":"uint256","name":"ratePerSecond","type":"uint256"},{"internalType":"uint256","name":"lastUpdated","type":"uint256"}],"name":"chargeInterest","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"collatDeficit","outputs":[{"internalType":"uint256","name":"deficit","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"collateral","outputs":[{"internalType":"contract ERC20Like","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"collateralTolerance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"chi","type":"uint256"},{"internalType":"uint256","name":"ratePerSecond","type":"uint256"},{"internalType":"uint256","name":"lastUpdated","type":"uint256"},{"internalType":"uint256","name":"pie","type":"uint256"}],"name":"compounding","outputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"coordinator","outputs":[{"internalType":"contract CoordinatorLike","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"creditline","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"dai","outputs":[{"internalType":"contract ERC20Like","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"debt","outputs":[{"internalType":"uint256","name":"debt_","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"usr","type":"address"}],"name":"deny","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"contractName","type":"bytes32"},{"internalType":"address","name":"addr","type":"address"}],"name":"depend","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amountDAI","type":"uint256"}],"name":"draw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"what","type":"bytes32"},{"internalType":"uint256","name":"value","type":"uint256"}],"name":"file","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"harvest","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"heal","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amountDAI","type":"uint256"}],"name":"heal","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"ilk","outputs":[{"internalType":"bytes32","name":"ilk_","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"jug","outputs":[{"internalType":"contract JugLike","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"juniorStake","outputs":[{"internalType":"uint256","name":"juniorStake_","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"mat","outputs":[{"internalType":"uint256","name":"totalMat","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"matBuffer","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"mgr","outputs":[{"internalType":"contract ManagerLike","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"mkrActive","outputs":[{"internalType":"bool","name":"active_","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"amountDAI","type":"uint256"}],"name":"raise","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"x","type":"uint256"},{"internalType":"uint256","name":"y","type":"uint256"}],"name":"rdiv","outputs":[{"internalType":"uint256","name":"z","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"address","name":"usr","type":"address"}],"name":"rely","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"remainingCredit","outputs":[{"internalType":"uint256","name":"creditline_","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"remainingOvercollCredit","outputs":[{"internalType":"uint256","name":"remaining_","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"reserve","outputs":[{"internalType":"contract ReserveLike","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"returnDAI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"x","type":"uint256"},{"internalType":"uint256","name":"y","type":"uint256"}],"name":"rmul","outputs":[{"internalType":"uint256","name":"z","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"uint256","name":"x","type":"uint256"},{"internalType":"uint256","name":"n","type":"uint256"},{"internalType":"uint256","name":"base","type":"uint256"}],"name":"rpow","outputs":[{"internalType":"uint256","name":"z","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"uint256","name":"x","type":"uint256"},{"internalType":"uint256","name":"y","type":"uint256"}],"name":"safeAdd","outputs":[{"internalType":"uint256","name":"z","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"uint256","name":"x","type":"uint256"},{"internalType":"uint256","name":"y","type":"uint256"}],"name":"safeDiv","outputs":[{"internalType":"uint256","name":"z","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"uint256","name":"x","type":"uint256"},{"internalType":"uint256","name":"y","type":"uint256"}],"name":"safeMul","outputs":[{"internalType":"uint256","name":"z","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"uint256","name":"x","type":"uint256"},{"internalType":"uint256","name":"y","type":"uint256"}],"name":"safeSub","outputs":[{"internalType":"uint256","name":"z","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"uint256","name":"amountDAI","type":"uint256"}],"name":"sink","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"spotter","outputs":[{"internalType":"contract SpotterLike","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"stabilityFee","outputs":[{"internalType":"uint256","name":"stabilityFee_","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"stabilityFeeIndex","outputs":[{"internalType":"uint256","name":"stabilityFeeIndex_","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"chi","type":"uint256"},{"internalType":"uint256","name":"pie","type":"uint256"}],"name":"toAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"uint256","name":"chi","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"toPie","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"tranche","outputs":[{"internalType":"contract TrancheLike","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"juniorSupplyDAI","type":"uint256"},{"internalType":"uint256","name":"juniorRedeemDAI","type":"uint256"},{"internalType":"uint256","name":"seniorSupplyDAI","type":"uint256"},{"internalType":"uint256","name":"seniorRedeemDAI","type":"uint256"}],"name":"validate","outputs":[{"internalType":"int256","name":"err","type":"int256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"vat","outputs":[{"internalType":"contract VatLike","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"wards","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"amountDAI","type":"uint256"}],"name":"wipe","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"wipeThreshold","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"}]

Deployed Bytecode

0x608060405234801561001057600080fd5b506004361061035c5760003560e01c8063891f7af2116101d3578063cd3293de11610104578063eaf2a1cc116100a2578063f5d75dec1161007c578063f5d75dec146107cc578063fc9f472c146107d4578063fefe740e146107dc578063ffc62be11461080b5761035c565b8063eaf2a1cc1461079f578063f37ac61c146107a7578063f4b9fa75146107c45761035c565b8063d8dfeb45116100de578063d8dfeb4514610724578063e4064a771461072c578063e4a91fe914610774578063e6cb90131461077c5761035c565b8063cd3293de146106dc578063cde0a105146106e4578063d05c78da146107015761035c565b8063a72a832f11610171578063b5931f7c1161014b578063b5931f7c14610683578063bf353dbb146106a6578063c2b26aac146106cc578063c5ce281e146106d45761035c565b8063a72a832f14610656578063ab0783da1461065e578063b38a1620146106665761035c565b80639e1aaae6116101ad5780639e1aaae6146105eb578063a293d1e81461060e578063a370737714610631578063a4ba067e146106395761035c565b8063891f7af2146105915780639adc339d146105995780639c52a7f1146105c55761035c565b8063361416e1116102ad578063674570221161024b5780636ebc0af1116102255780636ebc0af11461057157806370c85d46146105795780637bacd3741461058157806384718d89146105895761035c565b8063674570221461051d57806367b870af146105405780636a146024146105695761035c565b80634641257d116102875780634641257d146104c157806347a0670d146104c9578063483c5090146104d157806365fae35e146104f75761035c565b8063361416e11461049457806336569e771461049c5780633b304147146104a45761035c565b80631821d6961161031a57806329a8f4f8116102f457806329a8f4f81461043857806329ae8114146104615780632e77468d146104845780633242643c1461048c5761035c565b80631821d69614610405578063186601ca1461040d57806328a7996f146104155761035c565b80624f4803146103615780630434fe0b14610380578063050e5eac146103885780630a009097146103a45780630dca59c1146103c85780630e2286d3146103e2575b600080fd5b61037e6004803603602081101561037757600080fd5b5035610813565b005b61037e610a07565b610390610ac3565b604080519115158252519081900360200190f35b6103ac610c3e565b604080516001600160a01b039092168252519081900360200190f35b6103d0610c4d565b60408051918252519081900360200190f35b6103d0600480360360408110156103f857600080fd5b5080359060200135610f37565b6103ac610fb2565b610390610fc1565b6103d06004803603604081101561042b57600080fd5b5080359060200135611042565b6103d06004803603606081101561044e57600080fd5b5080359060208101359060400135611057565b61037e6004803603604081101561047757600080fd5b5080359060200135611077565b6103ac61117d565b6103d061118c565b6103d0611192565b6103ac611293565b61037e600480360360208110156104ba57600080fd5b50356112a2565b61037e61173e565b6103d0611800565b61037e600480360360208110156104e757600080fd5b50356001600160a01b0316611806565b61037e6004803603602081101561050d57600080fd5b50356001600160a01b03166118d2565b6103d06004803603604081101561053357600080fd5b508035906020013561196c565b6103d06004803603606081101561055657600080fd5b5080359060208101359060400135611985565b6103d0611a43565b6103ac611a48565b6103ac611a57565b6103d0611a66565b6103ac611b46565b6103d0611b55565b61037e600480360360408110156105af57600080fd5b50803590602001356001600160a01b0316611b5b565b61037e600480360360208110156105db57600080fd5b50356001600160a01b0316611dad565b6103d06004803603604081101561060157600080fd5b5080359060200135611e46565b6103d06004803603604081101561062457600080fd5b5080359060200135611e52565b6103d0611e9c565b61037e6004803603602081101561064f57600080fd5b5035611ea2565b6103d061217a565b6103d06121ca565b61037e6004803603602081101561067c57600080fd5b503561225b565b6103d06004803603604081101561069957600080fd5b508035906020013561254c565b6103d0600480360360208110156106bc57600080fd5b50356001600160a01b0316612557565b6103d0612569565b6103d0612576565b6103ac612696565b6103d0600480360360208110156106fa57600080fd5b50356126a5565b6103d06004803603604081101561071757600080fd5b50803590602001356126b3565b6103ac612711565b61075b6004803603608081101561074257600080fd5b5080359060208101359060408101359060600135612720565b6040805192835260208301919091528051918290030190f35b6103d06127bd565b6103d06004803603604081101561079257600080fd5b5080359060200135612841565b6103d061288b565b61037e600480360360208110156107bd57600080fd5b5035612891565b6103ac612bb6565b6103d0612bda565b6103d0612c61565b6103d0600480360360808110156107f257600080fd5b5080359060208101359060408101359060600135612c9f565b61037e612fb7565b33600090815260208190526040902054600114610868576040805162461bcd60e51b815260206004820152600e60248201526d1b9bdd0b585d5d1a1bdc9a5e995960921b604482015290519081900360640190fd5b610870610fc1565b6108b1576040805162461bcd60e51b815260206004820152600d60248201526c65706f63682d636c6f73696e6760981b604482015290519081900360640190fd5b60006108bc826126a5565b905060006108ca8284611e52565b90506108da600082846000612c9f565b15610923576040805162461bcd60e51b815260206004820152601460248201527376696f6c617465732d636f6e73747261696e747360601b604482015290519081900360640190fd5b61092f60015484612841565b60015560035460408051633e81976360e21b815290516001600160a01b039092169163045b1c64916109b491849163fa065d8c916004808301926020929190829003018186803b15801561098257600080fd5b505afa158015610996573d6000803e3d6000fd5b505050506040513d60208110156109ac57600080fd5b505186612841565b6040518263ffffffff1660e01b815260040180828152602001915050600060405180830381600087803b1580156109ea57600080fd5b505af11580156109fe573d6000803e3d6000fd5b50505050505050565b33600090815260208190526040902054600114610a5c576040805162461bcd60e51b815260206004820152600e60248201526d1b9bdd0b585d5d1a1bdc9a5e995960921b604482015290519081900360640190fd5b610a64610fc1565b610aa5576040805162461bcd60e51b815260206004820152600d60248201526c65706f63682d636c6f73696e6760981b604482015290519081900360640190fd5b6000610aaf611a66565b90508015610ac057610ac081612891565b50565b6006546040805163061bc0d560e21b815290516000926001600160a01b03169163186f0354916004808301926020929190829003018186803b158015610b0857600080fd5b505afa158015610b1c573d6000803e3d6000fd5b505050506040513d6020811015610b3257600080fd5b50518015610bb65750600660009054906101000a90046001600160a01b03166001600160a01b031663968e79536040518163ffffffff1660e01b815260040160206040518083038186803b158015610b8957600080fd5b505afa158015610b9d573d6000803e3d6000fd5b505050506040513d6020811015610bb357600080fd5b50515b8015610c385750600660009054906101000a90046001600160a01b03166001600160a01b031663957aa58c6040518163ffffffff1660e01b815260040160206040518083038186803b158015610c0b57600080fd5b505afa158015610c1f573d6000803e3d6000fd5b505050506040513d6020811015610c3557600080fd5b50515b90505b90565b6002546001600160a01b031681565b600080610c58612576565b600754600654604080516317c0406f60e11b815290519394506000936001600160a01b0393841693632424be5c938793911691632f8080de91600480820192602092909190829003018186803b158015610cb157600080fd5b505afa158015610cc5573d6000803e3d6000fd5b505050506040513d6020811015610cdb57600080fd5b5051604080516001600160e01b031960e086901b16815260048101939093526001600160a01b0390911660248301528051604480840193829003018186803b158015610d2657600080fd5b505afa158015610d3a573d6000803e3d6000fd5b505050506040513d6040811015610d5057600080fd5b506020015160075460408051636cb1c69b60e11b81526004810186905290519293506000926001600160a01b039092169163d9638d369160248082019260a092909190829003018186803b158015610da757600080fd5b505afa158015610dbb573d6000803e3d6000fd5b505050506040513d60a0811015610dd157600080fd5b506020015160095460408051636cb1c69b60e11b815260048101879052815193945060009384936001600160a01b03169263d9638d369260248082019391829003018186803b158015610e2357600080fd5b505afa158015610e37573d6000803e3d6000fd5b505050506040513d6040811015610e4d57600080fd5b508051602090910151909250905042811415610e7957610e6d848461196c565b95505050505050610c3b565b610f2d84610f28610f22610f06600960009054906101000a90046001600160a01b03166001600160a01b0316635001f3b56040518163ffffffff1660e01b815260040160206040518083038186803b158015610ed457600080fd5b505afa158015610ee8573d6000803e3d6000fd5b505050506040513d6020811015610efe57600080fd5b505187612841565b610f104287611e52565b6b033b2e3c9fd0803ce8000000611985565b8661196c565b61196c565b9550505050505090565b6000808211610f80576040805162461bcd60e51b815260206004820152601060248201526f6469766973696f6e206279207a65726f60801b604482015290519081900360640190fd5b81610fa3610f9a856b033b2e3c9fd0803ce80000006126b3565b60028504612841565b81610faa57fe5b049392505050565b6003546001600160a01b031681565b60025460408051630c2fef3f60e11b815290516000926001600160a01b03169163185fde7e916004808301926020929190829003018186803b15801561100657600080fd5b505afa15801561101a573d6000803e3d6000fd5b505050506040513d602081101561103057600080fd5b5051158015610c385750610c38610ac3565b600061104e8284613183565b90505b92915050565b600081421061106f5761106c848484426131f6565b93505b509192915050565b336000908152602081905260409020546001146110cc576040805162461bcd60e51b815260206004820152600e60248201526d1b9bdd0b585d5d1a1bdc9a5e995960921b604482015290519081900360640190fd5b8165313ab33332b960d11b14156110e757600b819055611143565b8168746f6c6572616e636560b81b141561110557600c819055611143565b816c1dda5c19551a1c995cda1bdb19609a1b141561112757600e819055611143565b816a0c2eae8de90cac2d89ac2f60ab1b141561035c57600d8190555b60408051828152905183917fe986e40cc8c151830d4f61050f4fb2e4add8567caad2d5f5496f9158e91fe4c7919081900360200190a25050565b6008546001600160a01b031681565b600e5481565b60095460009081906001600160a01b031663d9638d366111b0612576565b6040518263ffffffff1660e01b815260040180828152602001915050604080518083038186803b1580156111e357600080fd5b505afa1580156111f7573d6000803e3d6000fd5b505050506040513d604081101561120d57600080fd5b505160095460408051635001f3b560e01b8152905192935061128d926001600160a01b0390921691635001f3b591600480820192602092909190829003018186803b15801561125b57600080fd5b505afa15801561126f573d6000803e3d6000fd5b505050506040513d602081101561128557600080fd5b505182612841565b91505090565b6007546001600160a01b031681565b336000908152602081905260409020546001146112f7576040805162461bcd60e51b815260206004820152600e60248201526d1b9bdd0b585d5d1a1bdc9a5e995960921b604482015290519081900360640190fd5b6112ff610fc1565b611340576040805162461bcd60e51b815260206004820152600d60248201526c65706f63682d636c6f73696e6760981b604482015290519081900360640190fd5b600061134a611a66565b9050600d548111156113a3576040805162461bcd60e51b815260206004820152601e60248201527f636f6c6c61746572616c2d646566696369742d6865616c2d6e65656465640000604482015290519081900360640190fd5b6113ab612c61565b8211156113f8576040805162461bcd60e51b81526020600482015260166024820152751b9bdd0b595b9bdd59da0b58dc99591a5d0b5b19599d60521b604482015290519081900360640190fd5b600061140c611406846126a5565b83612841565b9050600061149382600360009054906101000a90046001600160a01b03166001600160a01b031663e75bd63d6040518163ffffffff1660e01b815260040160206040518083038186803b15801561146257600080fd5b505afa158015611476573d6000803e3d6000fd5b505050506040513d602081101561148c57600080fd5b5051610f37565b600554604080516340c10f1960e01b81523060048201526024810184905290519293506001600160a01b03909116916340c10f199160448082019260009290919082900301818387803b1580156114e957600080fd5b505af11580156114fd573d6000803e3d6000fd5b5050600a546006546040805163095ea7b360e01b81526001600160a01b03928316600482015260248101879052905191909216935063095ea7b39250604480830192600092919082900301818387803b15801561155957600080fd5b505af115801561156d573d6000803e3d6000fd5b50506006546040805163049878f360e01b81526004810186905290516001600160a01b03909216935063049878f3925060248082019260009290919082900301818387803b1580156115be57600080fd5b505af11580156115d2573d6000803e3d6000fd5b505060065460408051633b30414760e01b81526004810189905290516001600160a01b039092169350633b304147925060248082019260009290919082900301818387803b15801561162357600080fd5b505af1158015611637573d6000803e3d6000fd5b5050600480546040805163095ea7b360e01b81526001600160a01b039283169381019390935260248301899052517f0000000000000000000000006b175474e89094c44da98b954eedeac495271d0f909116935063095ea7b39250604480830192600092919082900301818387803b1580156116b257600080fd5b505af11580156116c6573d6000803e3d6000fd5b50506004805460408051632ecb515d60e11b8152928301899052516001600160a01b039091169350635d96a2ba9250602480830192600092919082900301818387803b15801561171557600080fd5b505af1158015611729573d6000803e3d6000fd5b5050505061173860008361321d565b50505050565b611746610fc1565b611787576040805162461bcd60e51b815260206004820152600d60248201526c65706f63682d636c6f73696e6760981b604482015290519081900360640190fd5b6003546040805163e75bd63d60e01b815290516117fe926001600160a01b03169163e75bd63d916004808301926020929190829003018186803b1580156117cd57600080fd5b505afa1580156117e1573d6000803e3d6000fd5b505050506040513d60208110156117f757600080fd5b505161328d565b565b600b5481565b3360009081526020819052604090205460011461185b576040805162461bcd60e51b815260206004820152600e60248201526d1b9bdd0b585d5d1a1bdc9a5e995960921b604482015290519081900360640190fd5b6006546040805163d4e8be8360e01b81526437bbb732b960d91b60048201526001600160a01b0384811660248301529151919092169163d4e8be8391604480830192600092919082900301818387803b1580156118b757600080fd5b505af11580156118cb573d6000803e3d6000fd5b5050505050565b33600090815260208190526040902054600114611927576040805162461bcd60e51b815260206004820152600e60248201526d1b9bdd0b585d5d1a1bdc9a5e995960921b604482015290519081900360640190fd5b6001600160a01b03811660008181526020819052604080822060019055517fdd0e34038ac38b2a1ce960229778ac48a8719bc900b6c4f8d0475c6e8b385a609190a250565b60006b033b2e3c9fd0803ce8000000610fa384846126b3565b6000838015611a25576001841680156119a0578592506119a4565b8392505b50600283046002850494505b8415611a1f5785860286878204146119c757600080fd5b818101818110156119d757600080fd5b8590049650506001851615611a145785830283878204141587151516156119fd57600080fd5b81810181811015611a0d57600080fd5b8590049350505b6002850494506119b0565b50611a3b565b838015611a355760009250611a39565b8392505b505b509392505050565b60b481565b6005546001600160a01b031681565b6006546001600160a01b031681565b600080611af3611a746127bd565b600360009054906101000a90046001600160a01b03166001600160a01b031663e75bd63d6040518163ffffffff1660e01b815260040160206040518083038186803b158015611ac257600080fd5b505afa158015611ad6573d6000803e3d6000fd5b505050506040513d6020811015611aec57600080fd5b505161196c565b90506000611b07611b02610c4d565b6126a5565b9050600c54811115611b2257611b1f81600c54611e52565b90505b81811115611b3d57611b348183611e52565b92505050610c3b565b60009250505090565b6009546001600160a01b031681565b600d5481565b33600090815260208190526040902054600114611bb0576040805162461bcd60e51b815260206004820152600e60248201526d1b9bdd0b585d5d1a1bdc9a5e995960921b604482015290519081900360640190fd5b816236b3b960e91b1415611bde57600680546001600160a01b0319166001600160a01b038316179055611d6a565b816a31b7b7b93234b730ba37b960a91b1415611c1457600280546001600160a01b0319166001600160a01b038316179055611d6a565b816730b9b9b2b9b9b7b960c11b1415611c4757600380546001600160a01b0319166001600160a01b038316179055611d6a565b81667265736572766560c81b1415611c7957600480546001600160a01b0319166001600160a01b038316179055611d6a565b81667472616e63686560c81b1415611cab57600580546001600160a01b0319166001600160a01b038316179055611d6a565b816918dbdb1b185d195c985b60b21b1415611ce057600a80546001600160a01b0319166001600160a01b038316179055611d6a565b816639b837ba3a32b960c91b1415611d1257600880546001600160a01b0319166001600160a01b038316179055611d6a565b81621d985d60ea1b1415611d4057600780546001600160a01b0319166001600160a01b038316179055611d6a565b81626a756760e81b141561035c57600980546001600160a01b0319166001600160a01b0383161790555b604080516001600160a01b0383168152905183917f6b1c5500aa423d5848c47aefec3615dc13387acaa5bcd947bd971e7c53483cef919081900360200190a25050565b33600090815260208190526040902054600114611e02576040805162461bcd60e51b815260206004820152600e60248201526d1b9bdd0b585d5d1a1bdc9a5e995960921b604482015290519081900360640190fd5b6001600160a01b038116600081815260208190526040808220829055517f184450df2e323acec0ed3b5c7531b81f9b4cdef7914dfd4c0a4317416bb5251b9190a250565b600061104e828461196c565b80820382811115611051576040805162461bcd60e51b815260206004820152600f60248201526e1cd859994b5cdd588b59985a5b1959608a1b604482015290519081900360640190fd5b60015481565b33600090815260208190526040902054600114611ef7576040805162461bcd60e51b815260206004820152600e60248201526d1b9bdd0b585d5d1a1bdc9a5e995960921b604482015290519081900360640190fd5b611eff610fc1565b611f40576040805162461bcd60e51b815260206004820152600d60248201526c65706f63682d636c6f73696e6760981b604482015290519081900360640190fd5b80611f49612c61565b1015611f9c576040805162461bcd60e51b815260206004820152601860248201527f64656372656173652d616d6f756e742d746f6f2d686967680000000000000000604482015290519081900360640190fd5b6000611fa7826126a5565b90506000611fb58284611e52565b9050611fc48160008085612c9f565b15612016576040805162461bcd60e51b815260206004820152601960248201527f706f6f6c2d636f6e73747261696e74732d76696f6c6174656400000000000000604482015290519081900360640190fd5b61202260015484611e52565b60015560035460408051633e81976360e21b815290516000926001600160a01b03169163fa065d8c916004808301926020929190829003018186803b15801561206a57600080fd5b505afa15801561207e573d6000803e3d6000fd5b505050506040513d602081101561209457600080fd5b5051905083811161210b5760035460408051630116c71960e21b815260006004820181905291516001600160a01b039093169263045b1c649260248084019391929182900301818387803b1580156120eb57600080fd5b505af11580156120ff573d6000803e3d6000fd5b50505050505050610ac0565b6003546001600160a01b031663045b1c646121268387611e52565b6040518263ffffffff1660e01b815260040180828152602001915050600060405180830381600087803b15801561215c57600080fd5b505af1158015612170573d6000803e3d6000fd5b5050505050505050565b600080612188611a746127bd565b90506000612194610c4d565b905061219e610ac3565b15806121a957508082105b156121b957600092505050610c3b565b6121c38282611e52565b9250505090565b60085460009081906001600160a01b031663d9638d366121e8612576565b6040518263ffffffff1660e01b815260040180828152602001915050604080518083038186803b15801561221b57600080fd5b505afa15801561222f573d6000803e3d6000fd5b505050506040513d604081101561224557600080fd5b5060200151600b5490915061128d908290612841565b336000908152602081905260409020546001146122b0576040805162461bcd60e51b815260206004820152600e60248201526d1b9bdd0b585d5d1a1bdc9a5e995960921b604482015290519081900360640190fd5b6122b8610fc1565b6122f9576040805162461bcd60e51b815260206004820152600d60248201526c65706f63682d636c6f73696e6760981b604482015290519081900360640190fd5b600e5481101561230857610ac0565b6000612312610c4d565b905060008111612369576040805162461bcd60e51b815260206004820152601760248201527f6364702d646562742d616c72656164792d726570616964000000000000000000604482015290519081900360640190fd5b80821115612375578091505b6003546040805163e75bd63d60e01b815290516000926001600160a01b03169163e75bd63d916004808301926020929190829003018186803b1580156123ba57600080fd5b505afa1580156123ce573d6000803e3d6000fd5b505050506040513d60208110156123e457600080fd5b50516004805460408051637b45fe1760e01b8152928301879052519293506001600160a01b031691637b45fe179160248082019260009290919082900301818387803b15801561243357600080fd5b505af1158015612447573d6000803e3d6000fd5b50506006546040805163095ea7b360e01b81526001600160a01b0392831660048201526024810188905290517f0000000000000000000000006b175474e89094c44da98b954eedeac495271d0f909216935063095ea7b3925060448082019260009290919082900301818387803b1580156124c157600080fd5b505af11580156124d5573d6000803e3d6000fd5b50506006546040805163059c50b160e51b81526004810188905290516001600160a01b03909216935063b38a1620925060248082019260009290919082900301818387803b15801561252657600080fd5b505af115801561253a573d6000803e3d6000fd5b505050506125478161328d565b505050565b6000818381610faa57fe5b60006020819052908152604090205481565b6000610c38611b02612c61565b600654604080516317c0406f60e11b815290516000926001600160a01b031691632f8080de916004808301926020929190829003018186803b1580156125bb57600080fd5b505afa1580156125cf573d6000803e3d6000fd5b505050506040513d60208110156125e557600080fd5b50516040805162b327b360e11b815290516001600160a01b03909216916301664f6691600480820192602092909190829003018186803b15801561262857600080fd5b505afa15801561263c573d6000803e3d6000fd5b505050506040513d602081101561265257600080fd5b5051604080516362e7140f60e11b815290516001600160a01b039092169163c5ce281e91600480820192602092909190829003018186803b158015610c0b57600080fd5b6004546001600160a01b031681565b600061105182610f286121ca565b60008115806126ce575050808202828282816126cb57fe5b04145b611051576040805162461bcd60e51b815260206004820152600f60248201526e1cd859994b5b5d5b0b59985a5b1959608a1b604482015290519081900360640190fd5b600a546001600160a01b031681565b60008083421015612778576040805162461bcd60e51b815260206004820152601e60248201527f74696e6c616b652d6d6174682f696e76616c69642d74696d657374616d700000604482015290519081900360640190fd5b8561278257600080fd5b6000612790878787426131f6565b9050806127af6127a0838761196c565b6127aa8a8861196c565b611e52565b925092505094509492505050565b600a54600654604080516370a0823160e01b81526001600160a01b0392831660048201529051600093849316916370a08231916024808301926020929190829003018186803b15801561280f57600080fd5b505afa158015612823573d6000803e3d6000fd5b505050506040513d602081101561283957600080fd5b505191505090565b80820182811015611051576040805162461bcd60e51b815260206004820152600f60248201526e1cd859994b5859190b59985a5b1959608a1b604482015290519081900360640190fd5b600c5481565b336000908152602081905260409020546001146128e6576040805162461bcd60e51b815260206004820152600e60248201526d1b9bdd0b585d5d1a1bdc9a5e995960921b604482015290519081900360640190fd5b6128ee610fc1565b61292f576040805162461bcd60e51b815260206004820152600d60248201526c65706f63682d636c6f73696e6760981b604482015290519081900360640190fd5b6000612939611a66565b905060008111612986576040805162461bcd60e51b81526020600482015260136024820152721b9bcb5a19585b1a5b99cb5c995c5d5a5c9959606a1b604482015290519081900360640190fd5b81811015612992578091505b6129a0600083600080612c9f565b156129e9576040805162461bcd60e51b815260206004820152601460248201527376696f6c617465732d636f6e73747261696e747360601b604482015290519081900360640190fd5b6003546040805163e75bd63d60e01b815290516000926001600160a01b03169163e75bd63d916004808301926020929190829003018186803b158015612a2e57600080fd5b505afa158015612a42573d6000803e3d6000fd5b505050506040513d6020811015612a5857600080fd5b505190506000612a688483610f37565b600554604080516340c10f1960e01b81523060048201526024810184905290519293506001600160a01b03909116916340c10f199160448082019260009290919082900301818387803b158015612abe57600080fd5b505af1158015612ad2573d6000803e3d6000fd5b5050600a546006546040805163095ea7b360e01b81526001600160a01b03928316600482015260248101879052905191909216935063095ea7b39250604480830192600092919082900301818387803b158015612b2e57600080fd5b505af1158015612b42573d6000803e3d6000fd5b50506006546040805163049878f360e01b81526004810186905290516001600160a01b03909216935063049878f3925060248082019260009290919082900301818387803b158015612b9357600080fd5b505af1158015612ba7573d6000803e3d6000fd5b5050505061173860008561321d565b7f0000000000000000000000006b175474e89094c44da98b954eedeac495271d0f81565b60075460009081906001600160a01b031663d9638d36612bf8612576565b6040518263ffffffff1660e01b81526004018082815260200191505060a06040518083038186803b158015612c2c57600080fd5b505afa158015612c40573d6000803e3d6000fd5b505050506040513d60a0811015612c5657600080fd5b506020015191505090565b600080612c6c610c4d565b905080600154111580612c845750612c82610ac3565b155b15612c93576000915050610c3b565b61128d60015482611e52565b600080612db8612db2612dac612da6612da0600360009054906101000a90046001600160a01b03166001600160a01b031663ad7a672f6040518163ffffffff1660e01b815260040160206040518083038186803b158015612cff57600080fd5b505afa158015612d13573d6000803e3d6000fd5b505050506040513d6020811015612d2957600080fd5b5051600354604080516293630360e11b815290516001600160a01b0390921691630126c60691600480820192602092909190829003018186803b158015612d6f57600080fd5b505afa158015612d83573d6000803e3d6000fd5b505050506040513d6020811015612d9957600080fd5b5051612841565b88612841565b89612841565b87611e52565b84611e52565b6003546040805163ac62d38560e01b815290519293506000926001600160a01b039092169163ec846eee9187918991859163ac62d38591600480820192602092909190829003018186803b158015612e0f57600080fd5b505afa158015612e23573d6000803e3d6000fd5b505050506040513d6020811015612e3957600080fd5b505160035460408051630f0c235d60e21b815290516001600160a01b0390921691633c308d7491600480820192602092909190829003018186803b158015612e8057600080fd5b505afa158015612e94573d6000803e3d6000fd5b505050506040513d6020811015612eaa57600080fd5b5051604080516001600160e01b031960e088901b1681526004810195909552602485019390935260448401919091526064830152516084808301926020929190829003018186803b158015612efe57600080fd5b505afa158015612f12573d6000803e3d6000fd5b505050506040513d6020811015612f2857600080fd5b505160025460408051638011618960e01b8152600481018690526024810184905290519293506001600160a01b0390911691638011618991604480820192602092909190829003018186803b158015612f8057600080fd5b505afa158015612f94573d6000803e3d6000fd5b505050506040513d6020811015612faa57600080fd5b5051979650505050505050565b3360009081526020819052604090205460011461300c576040805162461bcd60e51b815260206004820152600e60248201526d1b9bdd0b585d5d1a1bdc9a5e995960921b604482015290519081900360640190fd5b60007f0000000000000000000000006b175474e89094c44da98b954eedeac495271d0f6001600160a01b03166370a08231306040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b15801561307b57600080fd5b505afa15801561308f573d6000803e3d6000fd5b505050506040513d60208110156130a557600080fd5b5051600480546040805163095ea7b360e01b81526001600160a01b039283169381019390935260248301849052519293507f0000000000000000000000006b175474e89094c44da98b954eedeac495271d0f169163095ea7b39160448082019260009290919082900301818387803b15801561312057600080fd5b505af1158015613134573d6000803e3d6000fd5b50506004805460408051632ecb515d60e11b8152928301869052516001600160a01b039091169350635d96a2ba9250602480830192600092919082900301818387803b1580156118b757600080fd5b60008082116131cc576040805162461bcd60e51b815260206004820152601060248201526f6469766973696f6e206279207a65726f60801b604482015290519081900360640190fd5b81610fa36131e6856b033b2e3c9fd0803ce80000006126b3565b6131f1856001611e52565b612841565b6000613214610f22858585036b033b2e3c9fd0803ce8000000611985565b95945050505050565b60035460408051631d514ebd60e11b8152600481018490526024810185905290516001600160a01b0390921691633aa29d7a9160448082019260009290919082900301818387803b15801561327157600080fd5b505af1158015613285573d6000803e3d6000fd5b505050505050565b60006132976127bd565b116132e0576040805162461bcd60e51b81526020600482015260146024820152731b9bcb5c1c9bd99a5d0b5d1bcb5a185c9d995cdd60621b604482015290519081900360640190fd5b60006132f36132ed6127bd565b8361196c565b90506000613302611b02610c4d565b905080821015613313575050610ac0565b600061331f8383611e52565b9050600061334261333c836b033b2e3c9fd0803ce80000006126b3565b8661254c565b60065460408051637f8661a160e01b81526004810184905290519293506001600160a01b0390911691637f8661a19160248082019260009290919082900301818387803b15801561339257600080fd5b505af11580156133a6573d6000803e3d6000fd5b5050600a5460408051632770a7eb60e21b81523060048201526024810186905290516001600160a01b039092169350639dc29fac925060448082019260009290919082900301818387803b1580156133fd57600080fd5b505af1158015613411573d6000803e3d6000fd5b505050506118cb82600061321d56fea26469706673582212204c8658fb30f7de602ccc7fb8ce89a43e77a2a13f7d6e964e29062faa956a2ad064736f6c63430007060033

Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

Block Uncle Number Difficulty Gas Used Reward
View All Uncles
Loading...
Loading
Loading...
Loading

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
Loading...
Loading
[ Download: CSV Export  ]

A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.