Contract 0xf7d924A8F414a16a54F2CF9a98AC266281239FfB

Contract Overview

Balance:
0 AVAX
Txn Hash Method
Block
From
To
Value [Txn Fee]
0x6b44a93b5be2f2a41865181f8627b5de8558bc3e57590d94955f03306095bad8Set Addresses60673192022-02-14 1:31:23598 days 1 hr ago0x9e97ae5d91da840eed47a5b07fdabbc2bfad8ada IN 0xf7d924a8f414a16a54f2cf9a98ac266281239ffb0 AVAX0.006786135 45
0x96600c46cdcbeca0cee83ee0ff5a94e7d0896c013ac6d82a982c3e022d0be0c70x6080604060664562022-02-14 1:01:47598 days 1 hr ago0x9e97ae5d91da840eed47a5b07fdabbc2bfad8ada IN  Create: DefaultPool0 AVAX0.06382854 45
[ Download CSV Export 
Latest 25 internal transaction
Parent Txn Hash Block From To Value
0xa5e4f1986a442e0a970b3a0b1eb60a2d5dbc48f571ee03b15f21b4df4e400713156436772022-11-11 1:51:47328 days 46 mins ago 0x6387c0e385196fecb43d5fe37ebe9777b790a8820xf7d924a8f414a16a54f2cf9a98ac266281239ffb0 AVAX
0xa5e4f1986a442e0a970b3a0b1eb60a2d5dbc48f571ee03b15f21b4df4e400713156436772022-11-11 1:51:47328 days 46 mins ago 0xf7d924a8f414a16a54f2cf9a98ac266281239ffb0x1aa108e2392cd316be9255f78a3673e9f6f654470 AVAX
0xa5e4f1986a442e0a970b3a0b1eb60a2d5dbc48f571ee03b15f21b4df4e400713156436772022-11-11 1:51:47328 days 46 mins ago 0xf7d924a8f414a16a54f2cf9a98ac266281239ffb0x1aa108e2392cd316be9255f78a3673e9f6f654470 AVAX
0xa5e4f1986a442e0a970b3a0b1eb60a2d5dbc48f571ee03b15f21b4df4e400713156436772022-11-11 1:51:47328 days 46 mins ago 0xf7d924a8f414a16a54f2cf9a98ac266281239ffb0x1aa108e2392cd316be9255f78a3673e9f6f654470 AVAX
0xa5e4f1986a442e0a970b3a0b1eb60a2d5dbc48f571ee03b15f21b4df4e400713156436772022-11-11 1:51:47328 days 46 mins ago 0xf7d924a8f414a16a54f2cf9a98ac266281239ffb0x1aa108e2392cd316be9255f78a3673e9f6f654470 AVAX
0xa5e4f1986a442e0a970b3a0b1eb60a2d5dbc48f571ee03b15f21b4df4e400713156436772022-11-11 1:51:47328 days 46 mins ago 0xf7d924a8f414a16a54f2cf9a98ac266281239ffb0x1aa108e2392cd316be9255f78a3673e9f6f654470 AVAX
0xa5e4f1986a442e0a970b3a0b1eb60a2d5dbc48f571ee03b15f21b4df4e400713156436772022-11-11 1:51:47328 days 46 mins ago 0xf7d924a8f414a16a54f2cf9a98ac266281239ffb0x1aa108e2392cd316be9255f78a3673e9f6f654470 AVAX
0xa5e4f1986a442e0a970b3a0b1eb60a2d5dbc48f571ee03b15f21b4df4e400713156436772022-11-11 1:51:47328 days 46 mins ago 0xf7d924a8f414a16a54f2cf9a98ac266281239ffb0x1aa108e2392cd316be9255f78a3673e9f6f654470 AVAX
0xa5e4f1986a442e0a970b3a0b1eb60a2d5dbc48f571ee03b15f21b4df4e400713156436772022-11-11 1:51:47328 days 46 mins ago 0xf7d924a8f414a16a54f2cf9a98ac266281239ffb0x1aa108e2392cd316be9255f78a3673e9f6f654470 AVAX
0xa5e4f1986a442e0a970b3a0b1eb60a2d5dbc48f571ee03b15f21b4df4e400713156436772022-11-11 1:51:47328 days 46 mins ago 0xf7d924a8f414a16a54f2cf9a98ac266281239ffb0x1aa108e2392cd316be9255f78a3673e9f6f654470 AVAX
0xa5e4f1986a442e0a970b3a0b1eb60a2d5dbc48f571ee03b15f21b4df4e400713156436772022-11-11 1:51:47328 days 46 mins ago 0x6387c0e385196fecb43d5fe37ebe9777b790a8820xf7d924a8f414a16a54f2cf9a98ac266281239ffb0 AVAX
0xa5e4f1986a442e0a970b3a0b1eb60a2d5dbc48f571ee03b15f21b4df4e400713156436772022-11-11 1:51:47328 days 46 mins ago 0xf7d924a8f414a16a54f2cf9a98ac266281239ffb0x1aa108e2392cd316be9255f78a3673e9f6f654470 AVAX
0xa5e4f1986a442e0a970b3a0b1eb60a2d5dbc48f571ee03b15f21b4df4e400713156436772022-11-11 1:51:47328 days 46 mins ago 0xf7d924a8f414a16a54f2cf9a98ac266281239ffb0x1aa108e2392cd316be9255f78a3673e9f6f654470 AVAX
0xa5e4f1986a442e0a970b3a0b1eb60a2d5dbc48f571ee03b15f21b4df4e400713156436772022-11-11 1:51:47328 days 46 mins ago 0x6387c0e385196fecb43d5fe37ebe9777b790a8820xf7d924a8f414a16a54f2cf9a98ac266281239ffb0 AVAX
0xa5e4f1986a442e0a970b3a0b1eb60a2d5dbc48f571ee03b15f21b4df4e400713156436772022-11-11 1:51:47328 days 46 mins ago 0xf7d924a8f414a16a54f2cf9a98ac266281239ffb0x1aa108e2392cd316be9255f78a3673e9f6f654470 AVAX
0xa5e4f1986a442e0a970b3a0b1eb60a2d5dbc48f571ee03b15f21b4df4e400713156436772022-11-11 1:51:47328 days 46 mins ago 0xf7d924a8f414a16a54f2cf9a98ac266281239ffb0x1aa108e2392cd316be9255f78a3673e9f6f654470 AVAX
0xa5e4f1986a442e0a970b3a0b1eb60a2d5dbc48f571ee03b15f21b4df4e400713156436772022-11-11 1:51:47328 days 46 mins ago 0xf7d924a8f414a16a54f2cf9a98ac266281239ffb0x1aa108e2392cd316be9255f78a3673e9f6f654470 AVAX
0xa5e4f1986a442e0a970b3a0b1eb60a2d5dbc48f571ee03b15f21b4df4e400713156436772022-11-11 1:51:47328 days 46 mins ago 0xf7d924a8f414a16a54f2cf9a98ac266281239ffb0x1aa108e2392cd316be9255f78a3673e9f6f654470 AVAX
0xa5e4f1986a442e0a970b3a0b1eb60a2d5dbc48f571ee03b15f21b4df4e400713156436772022-11-11 1:51:47328 days 46 mins ago 0xf7d924a8f414a16a54f2cf9a98ac266281239ffb0x1aa108e2392cd316be9255f78a3673e9f6f654470 AVAX
0xa5e4f1986a442e0a970b3a0b1eb60a2d5dbc48f571ee03b15f21b4df4e400713156436772022-11-11 1:51:47328 days 46 mins ago 0xf7d924a8f414a16a54f2cf9a98ac266281239ffb0x1aa108e2392cd316be9255f78a3673e9f6f654470 AVAX
0xa5e4f1986a442e0a970b3a0b1eb60a2d5dbc48f571ee03b15f21b4df4e400713156436772022-11-11 1:51:47328 days 46 mins ago 0xf7d924a8f414a16a54f2cf9a98ac266281239ffb0x1aa108e2392cd316be9255f78a3673e9f6f654470 AVAX
0xa5e4f1986a442e0a970b3a0b1eb60a2d5dbc48f571ee03b15f21b4df4e400713156436772022-11-11 1:51:47328 days 46 mins ago 0xf7d924a8f414a16a54f2cf9a98ac266281239ffb0x1aa108e2392cd316be9255f78a3673e9f6f654470 AVAX
0xa5e4f1986a442e0a970b3a0b1eb60a2d5dbc48f571ee03b15f21b4df4e400713156436772022-11-11 1:51:47328 days 46 mins ago 0xf7d924a8f414a16a54f2cf9a98ac266281239ffb0x1aa108e2392cd316be9255f78a3673e9f6f654470 AVAX
0xa5e4f1986a442e0a970b3a0b1eb60a2d5dbc48f571ee03b15f21b4df4e400713156436772022-11-11 1:51:47328 days 46 mins ago 0x6387c0e385196fecb43d5fe37ebe9777b790a8820xf7d924a8f414a16a54f2cf9a98ac266281239ffb0 AVAX
0xa5e4f1986a442e0a970b3a0b1eb60a2d5dbc48f571ee03b15f21b4df4e400713156436772022-11-11 1:51:47328 days 46 mins ago 0x6387c0e385196fecb43d5fe37ebe9777b790a8820xf7d924a8f414a16a54f2cf9a98ac266281239ffb0 AVAX
[ Download CSV Export 
Index Block
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
DefaultPool

Compiler Version
v0.6.11+commit.5ef660b1

Optimization Enabled:
Yes with 100 runs

Other Settings:
default evmVersion
File 1 of 13 : DefaultPool.sol
// SPDX-License-Identifier: UNLICENSED

pragma solidity 0.6.11;

import "./Interfaces/IDefaultPool.sol";
import "./Interfaces/IActivePool.sol";
import "./Interfaces/IWhitelist.sol";
import "./Interfaces/IERC20.sol";
import "./Interfaces/IWAsset.sol";
import "./Dependencies/SafeMath.sol";
import "./Dependencies/Ownable.sol";
import "./Dependencies/CheckContract.sol";
import "./Dependencies/YetiCustomBase.sol";


/*
 * The Default Pool holds the collateral and YUSD debt (but not YUSD tokens) from liquidations that have been redistributed
 * to active troves but not yet "applied", i.e. not yet recorded on a recipient active trove's struct.
 *
 * When a trove makes an operation that applies its pending collateral and YUSD debt, its pending collateral and YUSD debt is moved
 * from the Default Pool to the Active Pool.
 */
contract DefaultPool is Ownable, CheckContract, IDefaultPool, YetiCustomBase {
    using SafeMath for uint256;

    string public constant NAME = "DefaultPool";

    address public troveManagerAddress;
    address public activePoolAddress;
    address public whitelistAddress;
    address public yetiFinanceTreasury;

    // deposited collateral tracker. Colls is always the whitelist list of all collateral tokens. Amounts
    newColls internal poolColl;

    uint256 internal YUSDDebt;

    event TroveManagerAddressChanged(address _newTroveManagerAddress);
    event DefaultPoolYUSDDebtUpdated(uint256 _YUSDDebt);
    event DefaultPoolBalanceUpdated(address _collateral, uint256 _amount);
    event DefaultPoolBalancesUpdated(address[] _collaterals, uint256[] _amounts);

    // --- Dependency setters ---

    function setAddresses(
        address _troveManagerAddress,
        address _activePoolAddress,
        address _whitelistAddress, 
        address _yetiTreasuryAddress
    ) external onlyOwner {
        checkContract(_troveManagerAddress);
        checkContract(_activePoolAddress);
        checkContract(_whitelistAddress);
        checkContract(_yetiTreasuryAddress);

        troveManagerAddress = _troveManagerAddress;
        activePoolAddress = _activePoolAddress;
        whitelist = IWhitelist(_whitelistAddress);
        whitelistAddress = _whitelistAddress;
        yetiFinanceTreasury = _yetiTreasuryAddress;

        emit TroveManagerAddressChanged(_troveManagerAddress);
        emit ActivePoolAddressChanged(_activePoolAddress);

        _renounceOwnership();
    }

    // --- Internal Functions ---

    // --- Getters for public variables. Required by IPool interface ---

    /*
     * Returns the collateralBalance for a given collateral
     *
     * Returns the amount of a given collateral in state. Not necessarily the contract's actual balance.
     */
    function getCollateral(address _collateral) public view override returns (uint256) {
        return poolColl.amounts[whitelist.getIndex(_collateral)];
    }

    /*
     * Returns all collateral balances in state. Not necessarily the contract's actual balances.
     */
    function getAllCollateral() public view override returns (address[] memory, uint256[] memory) {
        return (poolColl.tokens, poolColl.amounts);
    }

    // returns the VC value of a given collateralAddress in this contract
    function getCollateralVC(address _collateral) external view override returns (uint) {
        return whitelist.getValueVC(_collateral, getCollateral(_collateral));
    }

    /*
     * Returns the VC of the contract
     *
     * Not necessarily equal to the the contract's raw VC balance - Collateral can be forcibly sent to contracts.
     *
     * Computed when called by taking the collateral balances and
     * multiplying them by the corresponding price and ratio and then summing that
     */
    function getVC() external view override returns (uint256 totalVC) {
        uint256 len = poolColl.tokens.length;
        for (uint256 i; i < len; ++i) {
            address collateral = poolColl.tokens[i];
            uint256 amount = poolColl.amounts[i];

            uint256 collateralVC = whitelist.getValueVC(collateral, amount);
            totalVC = totalVC.add(collateralVC);
        }
        return totalVC;
    }

    // Debt that this pool holds. 
    function getYUSDDebt() external view override returns (uint256) {
        return YUSDDebt;
    }

    // Internal function to send collateral to a different pool. 
    function _sendCollateral(address _collateral, uint256 _amount) internal {
        address activePool = activePoolAddress;
        uint256 index = whitelist.getIndex(_collateral);
        poolColl.amounts[index] = poolColl.amounts[index].sub(_amount);

        emit DefaultPoolBalanceUpdated(_collateral, _amount);
        emit CollateralSent(_collateral, activePool, _amount);

        bool success = IERC20(_collateral).transfer(activePool, _amount);
        require(success, "DefaultPool: sending collateral failed");
    }

    // Returns true if all payments were successfully sent. Must be called by borrower operations, trove manager, or stability pool. 
    function sendCollsToActivePool(address[] memory _tokens, uint256[] memory _amounts, address _borrower)
        external
        override
    {
        _requireCallerIsTroveManager();
        address activePool = activePoolAddress;
        uint256 tokensLen = _tokens.length;
        require(tokensLen == _amounts.length);
        for (uint256 i; i < tokensLen; ++i) {
            uint256 thisAmounts = _amounts[i];
            if(thisAmounts != 0) {
                address thisToken = _tokens[i];
                _sendCollateral(thisToken, _amounts[i]);
                if (whitelist.isWrapped(thisToken)) {
                    IWAsset(thisToken).updateReward(yetiFinanceTreasury, _borrower, _amounts[i]);
                }
            }
        }
        IActivePool(activePool).receiveCollateral(_tokens, _amounts);
    }

    // Increases the YUSD Debt of this pool. 
    function increaseYUSDDebt(uint256 _amount) external override {
        _requireCallerIsTroveManager();
        YUSDDebt = YUSDDebt.add(_amount);
        emit DefaultPoolYUSDDebtUpdated(YUSDDebt);
    }

    // Decreases the YUSD Debt of this pool.
    function decreaseYUSDDebt(uint256 _amount) external override {
        _requireCallerIsTroveManager();
        YUSDDebt = YUSDDebt.sub(_amount);
        emit DefaultPoolYUSDDebtUpdated(YUSDDebt);
    }

    // --- 'require' functions ---

    function _requireCallerIsActivePool() internal view {
        require(msg.sender == activePoolAddress, "DefaultPool: Caller is not the ActivePool");
    }

    function _requireCallerIsTroveManager() internal view {
        require(msg.sender == troveManagerAddress, "DefaultPool: Caller is not the TroveManager");
    }

    function _requireCallerIsWhitelist() internal view {
        require(msg.sender == address(whitelist), "DefaultPool: Caller is not whitelist");
    }

    // Should be called by ActivePool
    // __after__ collateral is transferred to this contract from Active Pool
    function receiveCollateral(address[] memory _tokens, uint256[] memory _amounts)
        external
        override
    {
        _requireCallerIsActivePool();
        poolColl.amounts = _leftSumColls(poolColl, _tokens, _amounts);
        emit DefaultPoolBalancesUpdated(_tokens, _amounts);
    }

    // Adds collateral type from whitelist. 
    function addCollateralType(address _collateral) external override {
        _requireCallerIsWhitelist();
        poolColl.tokens.push(_collateral);
        poolColl.amounts.push(0);
    }
}

File 2 of 13 : IDefaultPool.sol
// SPDX-License-Identifier: UNLICENSED

pragma solidity 0.6.11;

import "./IPool.sol";

interface IDefaultPool is IPool {
    // --- Events ---
    event TroveManagerAddressChanged(address _newTroveManagerAddress);
    event DefaultPoolYUSDDebtUpdated(uint _YUSDDebt);
    event DefaultPoolETHBalanceUpdated(uint _ETH);

    // --- Functions ---
    
    function sendCollsToActivePool(address[] memory _collaterals, uint[] memory _amounts, address _borrower) external;
    function addCollateralType(address _collateral) external;
    function getCollateralVC(address collateralAddress) external view returns (uint);
}

File 3 of 13 : IActivePool.sol
// SPDX-License-Identifier: UNLICENSED

pragma solidity 0.6.11;

import "./IPool.sol";

    
interface IActivePool is IPool {
    // --- Events ---
    event BorrowerOperationsAddressChanged(address _newBorrowerOperationsAddress);
    event TroveManagerAddressChanged(address _newTroveManagerAddress);
    event ActivePoolYUSDDebtUpdated(uint _YUSDDebt);
    event ActivePoolCollateralBalanceUpdated(address _collateral, uint _amount);

    // --- Functions ---
    
    function sendCollaterals(address _to, address[] memory _tokens, uint[] memory _amounts) external returns (bool);
    function sendCollateralsUnwrap(
        address _to,
        address[] memory _tokens,
        uint[] memory _amounts,
        bool _collectRewards) external returns (bool);
    function getCollateralVC(address collateralAddress) external view returns (uint);
    function addCollateralType(address _collateral) external;
}

File 4 of 13 : IWhitelist.sol
// SPDX-License-Identifier: UNLICENSED

pragma solidity 0.6.11;


interface IWhitelist {
    function getValidCollateral() view external returns (address[] memory);

    function setAddresses(
        address _activePoolAddress,
        address _defaultPoolAddress,
        address _stabilityPoolAddress,
        address _collSurplusPoolAddress, 
        address _borrowerOperationsAddress
    ) external;

    function isValidRouter(address _router) external view returns (bool);
    function getOracle(address _collateral) view external returns (address);
    function getRatio(address _collateral) view external returns (uint256);
    function getIsActive(address _collateral) view external returns (bool);
    function getPriceCurve(address _collateral) external view returns (address);
    function getDecimals(address _collateral) external view returns (uint256);
    function getFee(address _collateral, uint _collateralVCInput, uint256 _collateralVCBalancePost, uint256 _totalVCBalancePre, uint256 _totalVCBalancePost) external view returns (uint256 fee);
    function getFeeAndUpdate(address _collateral, uint _collateralVCInput, uint256 _collateralVCBalancePost, uint256 _totalVCBalancePre, uint256 _totalVCBalancePost) external returns (uint256 fee);
    function getIndex(address _collateral) external view returns (uint256);
    function isWrapped(address _collateral) external view returns (bool);
    function setDefaultRouter(address _collateral, address _router) external;

    function getValueVC(address _collateral, uint _amount) view external returns (uint);
    function getValueUSD(address _collateral, uint _amount) view external returns (uint256);
    function getDefaultRouterAddress(address _collateral) external view returns (address);
}

File 5 of 13 : IERC20.sol
// SPDX-License-Identifier: UNLICENSED

pragma solidity 0.6.11;

/**
 * Based on the OpenZeppelin IER20 interface:
 * https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC20/IERC20.sol
 *
 * @dev Interface of the ERC20 standard as defined in the EIP.
 */
interface IERC20 {
    /**
     * @dev Returns the amount of tokens in existence.
     */
    function totalSupply() external view returns (uint256);

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

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

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

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

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

    function name() external view returns (string memory);
    function symbol() external view returns (string memory);
    function decimals() external view returns (uint8);
    
    /**
     * @dev Emitted when `value` tokens are moved from one account (`from`) to
     * another (`to`).
     *
     * Note that `value` may be zero.
     */
    event Transfer(address indexed from, address indexed to, uint256 value);

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

File 6 of 13 : IWAsset.sol
// SPDX-License-Identifier: UNLICENSED

pragma solidity 0.6.11;


// Wrapped Asset
interface IWAsset  {

    function wrap(uint _amount, address _from, address _to, address _rewardOwner) external;

    function unwrapFor(address _for, uint amount) external;

    function updateReward(address from, address to, uint amount) external;

    function claimReward(address _to) external;

    function claimRewardFor(address _for) external;

    function getPendingRewards(address _for) external returns (address[] memory tokens, uint[] memory amounts);

    function endTreasuryReward(uint _amount) external;
}

File 7 of 13 : SafeMath.sol
// SPDX-License-Identifier: UNLICENSED

pragma solidity 0.6.11;

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

        return c;
    }

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

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

        return c;
    }

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

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

        return c;
    }

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

    /**
     * @dev Returns the integer division of two unsigned integers. Reverts with custom message on
     * division by zero. The result is rounded towards zero.
     *
     * Counterpart to Solidity's `/` operator. Note: this function uses a
     * `revert` opcode (which leaves remaining gas untouched) while Solidity
     * uses an invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     * - The divisor cannot be zero.
     *
     * _Available since v2.4.0._
     */
    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.
     *
     * _Available since v2.4.0._
     */
    function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
        require(b != 0, errorMessage);
        return a % b;
    }
}

File 8 of 13 : Ownable.sol
// SPDX-License-Identifier: UNLICENSED

pragma solidity 0.6.11;

/**
 * Based on OpenZeppelin's Ownable contract:
 * https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/access/Ownable.sol
 *
 * @dev Contract module which provides a basic access control mechanism, where
 * there is an account (an owner) that can be granted exclusive access to
 * specific functions.
 *
 * This module is used through inheritance. It will make available the modifier
 * `onlyOwner`, which can be applied to your functions to restrict their use to
 * the owner.
 */
contract Ownable {
    address private _owner;

    event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);

    /**
     * @dev Initializes the contract setting the deployer as the initial owner.
     */
    constructor () internal {
        _owner = msg.sender;
        emit OwnershipTransferred(address(0), msg.sender);
    }

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

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

    /**
     * @dev Returns true if the caller is the current owner.
     */
    function isOwner() public view returns (bool) {
        return msg.sender == _owner;
    }

    /**
     * @dev Leaves the contract without owner. It will not be possible to call
     * `onlyOwner` functions anymore.
     *
     * NOTE: Renouncing ownership will leave the contract without an owner,
     * thereby removing any functionality that is only available to the owner.
     *
     * NOTE: This function is not safe, as it doesn’t check owner is calling it.
     * Make sure you check it before calling it.
     */
    function _renounceOwnership() internal {
        emit OwnershipTransferred(_owner, address(0));
        _owner = address(0);
    }
}

File 9 of 13 : CheckContract.sol
// SPDX-License-Identifier: UNLICENSED

pragma solidity 0.6.11;


contract CheckContract {
    /**
     * Check that the account is an already deployed non-destroyed contract.
     * See: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/utils/Address.sol#L12
     */
    function checkContract(address _account) internal view {
        require(_account != address(0), "Account cannot be zero address");

        uint256 size;
        // solhint-disable-next-line no-inline-assembly
        assembly { size := extcodesize(_account) }
        require(size > 0, "Account code size cannot be zero");
    }
}

File 10 of 13 : YetiCustomBase.sol
// SPDX-License-Identifier: UNLICENSED

pragma solidity 0.6.11;

import "./BaseMath.sol";
import "./SafeMath.sol";
import "../Interfaces/IERC20.sol";
import "../Interfaces/IWhitelist.sol";


contract YetiCustomBase is BaseMath {
    using SafeMath for uint256;

    IWhitelist whitelist;

    struct newColls {
        // tokens and amounts should be the same length
        address[] tokens;
        uint256[] amounts;
    }

    // Collateral math

    // gets the sum of _coll1 and _coll2
    function _sumColls(newColls memory _coll1, newColls memory _coll2)
        internal
        view
        returns (newColls memory finalColls)
    {
        newColls memory coll3;

        coll3.tokens = whitelist.getValidCollateral();
        coll3.amounts = new uint256[](coll3.tokens.length);

        uint256 n = 0;
        for (uint256 i = 0; i < _coll1.tokens.length; i++) {
            uint256 tokenIndex = whitelist.getIndex(_coll1.tokens[i]);
            if (_coll1.amounts[i] > 0) {
                n++;
                coll3.amounts[tokenIndex] = _coll1.amounts[i];
            }
        }

        for (uint256 i = 0; i < _coll2.tokens.length; i++) {
            uint256 tokenIndex = whitelist.getIndex(_coll2.tokens[i]);
            if (_coll2.amounts[i] > 0) {
                if (coll3.amounts[tokenIndex] == 0) {
                    n++;
                }
                coll3.amounts[tokenIndex] = coll3.amounts[tokenIndex].add(_coll2.amounts[i]);
            }
        }

        address[] memory sumTokens = new address[](n);
        uint256[] memory sumAmounts = new uint256[](n);
        uint256 j = 0;

        // should only find n amounts over 0
        for (uint256 i = 0; i < coll3.tokens.length; i++) {
            if (coll3.amounts[i] > 0) {
                sumTokens[j] = coll3.tokens[i];
                sumAmounts[j] = coll3.amounts[i];
                j++;
            }
        }
        finalColls.tokens = sumTokens;
        finalColls.amounts = sumAmounts;
    }


    // gets the sum of coll1 with tokens and amounts
    function _sumColls(
        newColls memory _coll1,
        address[] memory tokens,
        uint256[] memory amounts
    ) internal view returns (newColls memory) {
        newColls memory coll2 = newColls(tokens, amounts);
        return _sumColls(_coll1, coll2);
    }


    function _sumColls(
        address[] memory tokens1,
        uint256[] memory amounts1,
        address[] memory tokens2,
        uint256[] memory amounts2
    ) internal view returns (newColls memory) {
        newColls memory coll1 = newColls(tokens1, amounts1);
        return _sumColls(coll1, tokens2, amounts2);
    }


    // Function for summing colls when coll1 includes all the tokens in the whitelist
    // Used in active, default, stability, and surplus pools
    // assumes _coll1.tokens = all whitelisted tokens
    function _leftSumColls(
        newColls memory _coll1,
        address[] memory _tokens,
        uint256[] memory _amounts
    ) internal view returns (uint[] memory) {
        uint[] memory sumAmounts = _getArrayCopy(_coll1.amounts);

        // assumes that sumAmounts length = whitelist tokens length.
        for (uint256 i = 0; i < _tokens.length; i++) {
            uint tokenIndex = whitelist.getIndex(_tokens[i]);
            sumAmounts[tokenIndex] = sumAmounts[tokenIndex].add(_amounts[i]);
        }

        return sumAmounts;
    }


    // Function for summing colls when one list is all tokens. Used in active, default, stability, and surplus pools
    function _leftSubColls(newColls memory _coll1, address[] memory _subTokens, uint[] memory _subAmounts)
        internal
        view
        returns (uint[] memory)
    {
        uint[] memory diffAmounts = _getArrayCopy(_coll1.amounts);

        //assumes that coll1.tokens = whitelist tokens. Keeps all of coll1's tokens, and subtracts coll2's amounts
        for (uint256 i = 0; i < _subTokens.length; i++) {
            uint256 tokenIndex = whitelist.getIndex(_subTokens[i]);
            diffAmounts[tokenIndex] = diffAmounts[tokenIndex].sub(_subAmounts[i]);
        }
        return diffAmounts;
    }
    

    // Returns _coll1 minus _tokens and _amounts
    // will error if _tokens include a token not in _coll1.tokens
    function _subColls(newColls memory _coll1, address[] memory _tokens, uint[] memory _amounts)
        internal
        view
        returns (newColls memory finalColls)
    {
        require(_tokens.length == _amounts.length, "Sub Colls invalid input");

        newColls memory coll3;
        coll3.tokens = whitelist.getValidCollateral();
        coll3.amounts = new uint256[](coll3.tokens.length);
        uint256 n = 0;

        for (uint256 i = 0; i < _coll1.tokens.length; i++) {
            if (_coll1.amounts[i] > 0) {
                uint256 tokenIndex = whitelist.getIndex(_coll1.tokens[i]);
                coll3.amounts[tokenIndex] = _coll1.amounts[i];
                n++;
            }
        }

        for (uint256 i = 0; i < _tokens.length; i++) {
            uint256 tokenIndex = whitelist.getIndex(_tokens[i]);
            require(coll3.amounts[tokenIndex] >= _amounts[i], "illegal sub");
            coll3.amounts[tokenIndex] = coll3.amounts[tokenIndex].sub(_amounts[i]);
            if (coll3.amounts[tokenIndex] == 0) {
                n--;
            }
        }

        address[] memory diffTokens = new address[](n);
        uint256[] memory diffAmounts = new uint256[](n);
        uint256 j = 0;

        for (uint256 i = 0; i < coll3.tokens.length; i++) {
            if (coll3.amounts[i] > 0) {
                diffTokens[j] = coll3.tokens[i];
                diffAmounts[j] = coll3.amounts[i];
                j++;
            }
        }
        finalColls.tokens = diffTokens;
        finalColls.amounts = diffAmounts;
    }

    function _getArrayCopy(uint[] memory _arr) internal pure returns (uint[] memory){
        uint[] memory copy = new uint[](_arr.length);
        for (uint i = 0; i < _arr.length; i++) {
            copy[i] = _arr[i];
        }
        return copy;
    }
}

File 11 of 13 : IPool.sol
// SPDX-License-Identifier: UNLICENSED

pragma solidity 0.6.11;

import "./ICollateralReceiver.sol";

// Common interface for the Pools.
interface IPool is ICollateralReceiver {
    
    // --- Events ---
    
    event ETHBalanceUpdated(uint _newBalance);
    event YUSDBalanceUpdated(uint _newBalance);
    event ActivePoolAddressChanged(address _newActivePoolAddress);
    event DefaultPoolAddressChanged(address _newDefaultPoolAddress);
    event StabilityPoolAddressChanged(address _newStabilityPoolAddress);
    event WhitelistAddressChanged(address _newWhitelistAddress);
    event EtherSent(address _to, uint _amount);
    event CollateralSent(address _collateral, address _to, uint _amount);

    // --- Functions ---

    function getVC() external view returns (uint);

    function getCollateral(address collateralAddress) external view returns (uint);

    function getAllCollateral() external view returns (address[] memory, uint256[] memory);

    function getYUSDDebt() external view returns (uint);

    function increaseYUSDDebt(uint _amount) external;

    function decreaseYUSDDebt(uint _amount) external;

}

File 12 of 13 : ICollateralReceiver.sol
// SPDX-License-Identifier: UNLICENSED

pragma solidity 0.6.11;

interface ICollateralReceiver {
    function receiveCollateral(address[] memory _tokens, uint[] memory _amounts) external;
}

File 13 of 13 : BaseMath.sol
// SPDX-License-Identifier: UNLICENSED
pragma solidity 0.6.11;


contract BaseMath {
    uint constant public DECIMAL_PRECISION = 1e18;
}

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

Contract ABI

[{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"_newActivePoolAddress","type":"address"}],"name":"ActivePoolAddressChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"_collateral","type":"address"},{"indexed":false,"internalType":"address","name":"_to","type":"address"},{"indexed":false,"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"CollateralSent","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"_newDefaultPoolAddress","type":"address"}],"name":"DefaultPoolAddressChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"_collateral","type":"address"},{"indexed":false,"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"DefaultPoolBalanceUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address[]","name":"_collaterals","type":"address[]"},{"indexed":false,"internalType":"uint256[]","name":"_amounts","type":"uint256[]"}],"name":"DefaultPoolBalancesUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"_ETH","type":"uint256"}],"name":"DefaultPoolETHBalanceUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"_YUSDDebt","type":"uint256"}],"name":"DefaultPoolYUSDDebtUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"_newBalance","type":"uint256"}],"name":"ETHBalanceUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"_to","type":"address"},{"indexed":false,"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"EtherSent","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"_newStabilityPoolAddress","type":"address"}],"name":"StabilityPoolAddressChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"_newTroveManagerAddress","type":"address"}],"name":"TroveManagerAddressChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"_newWhitelistAddress","type":"address"}],"name":"WhitelistAddressChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"_newBalance","type":"uint256"}],"name":"YUSDBalanceUpdated","type":"event"},{"inputs":[],"name":"DECIMAL_PRECISION","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"NAME","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"activePoolAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_collateral","type":"address"}],"name":"addCollateralType","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"decreaseYUSDDebt","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"getAllCollateral","outputs":[{"internalType":"address[]","name":"","type":"address[]"},{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_collateral","type":"address"}],"name":"getCollateral","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_collateral","type":"address"}],"name":"getCollateralVC","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getVC","outputs":[{"internalType":"uint256","name":"totalVC","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getYUSDDebt","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"increaseYUSDDebt","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"isOwner","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"_tokens","type":"address[]"},{"internalType":"uint256[]","name":"_amounts","type":"uint256[]"}],"name":"receiveCollateral","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"_tokens","type":"address[]"},{"internalType":"uint256[]","name":"_amounts","type":"uint256[]"},{"internalType":"address","name":"_borrower","type":"address"}],"name":"sendCollsToActivePool","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_troveManagerAddress","type":"address"},{"internalType":"address","name":"_activePoolAddress","type":"address"},{"internalType":"address","name":"_whitelistAddress","type":"address"},{"internalType":"address","name":"_yetiTreasuryAddress","type":"address"}],"name":"setAddresses","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"troveManagerAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"whitelistAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"yetiFinanceTreasury","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"}]

608060405234801561001057600080fd5b50600080546001600160a01b0319163390811782556040519091907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908290a361183f8061005f6000396000f3fe608060405234801561001057600080fd5b50600436106101115760003560e01c80638f32d59b116100ad578063b08bc72211610071578063b08bc72214610507578063c6ba09361461050f578063e5002a05146105b0578063e7b1d678146105b8578063ec0d5e0c146105d557610111565b80638f32d59b1461031d5780639b56d6c914610339578063a20baee61461035f578063a3f4df7e14610367578063a7a24edd146103e457610111565b806301d40b63146101165780633270a9e014610130578063420429ca146101565780634a945f8d146101755780635a4d28bb146101b357806361ccca58146101d7578063862c1642146103055780638da5cb5b1461030d5780638df7099214610315575b600080fd5b61011e6105fb565b60408051918252519081900360200190f35b61011e6004803603602081101561014657600080fd5b50356001600160a01b03166106f6565b6101736004803603602081101561016c57600080fd5b5035610793565b005b6101736004803603608081101561018b57600080fd5b506001600160a01b0381358116916020810135821691604082013581169160600135166107e8565b6101bb610936565b604080516001600160a01b039092168252519081900360200190f35b610173600480360360608110156101ed57600080fd5b810190602081018135600160201b81111561020757600080fd5b82018360208201111561021957600080fd5b803590602001918460208302840111600160201b8311171561023a57600080fd5b9190808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152509295949360208101935035915050600160201b81111561028957600080fd5b82018360208201111561029b57600080fd5b803590602001918460208302840111600160201b831117156102bc57600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250929550505090356001600160a01b031691506109459050565b6101bb610bf9565b6101bb610c08565b61011e610c17565b610325610c1d565b604080519115158252519081900360200190f35b61011e6004803603602081101561034f57600080fd5b50356001600160a01b0316610c2e565b61011e610cc6565b61036f610cd2565b6040805160208082528351818301528351919283929083019185019080838360005b838110156103a9578181015183820152602001610391565b50505050905090810190601f1680156103d65780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b610173600480360360408110156103fa57600080fd5b810190602081018135600160201b81111561041457600080fd5b82018360208201111561042657600080fd5b803590602001918460208302840111600160201b8311171561044757600080fd5b9190808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152509295949360208101935035915050600160201b81111561049657600080fd5b8201836020820111156104a857600080fd5b803590602001918460208302840111600160201b831117156104c957600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250929550610cf9945050505050565b6101bb610e98565b610517610ea7565b604051808060200180602001838103835285818151815260200191508051906020019060200280838360005b8381101561055b578181015183820152602001610543565b50505050905001838103825284818151815260200191508051906020019060200280838360005b8381101561059a578181015183820152602001610582565b5050505090500194505050505060405180910390f35b6101bb610f6a565b610173600480360360208110156105ce57600080fd5b5035610f79565b610173600480360360208110156105eb57600080fd5b50356001600160a01b0316610f94565b600654600090815b818110156106f05760006006600001828154811061061d57fe5b6000918252602082200154600780546001600160a01b039092169350908490811061064457fe5b6000918252602080832090910154600154604080516305c5635160e31b81526001600160a01b038881166004830152602482018590529151939650911692632e2b1a8892604480840193829003018186803b1580156106a257600080fd5b505afa1580156106b6573d6000803e3d6000fd5b505050506040513d60208110156106cc57600080fd5b505190506106e0868263ffffffff61101e16565b9550505050806001019050610603565b50505b90565b6001546000906001600160a01b0316632e2b1a888361071481610c2e565b6040518363ffffffff1660e01b815260040180836001600160a01b03166001600160a01b031681526020018281526020019250505060206040518083038186803b15801561076157600080fd5b505afa158015610775573d6000803e3d6000fd5b505050506040513d602081101561078b57600080fd5b505192915050565b61079b61107f565b6008546107ae908263ffffffff61101e16565b600881905560408051918252517f3bf79447c17dad8ef32505dafadf08826a309977009fd58dfc0530c41d72047f9181900360200190a150565b6107f0610c1d565b610841576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b61084a846110ca565b610853836110ca565b61085c826110ca565b610865816110ca565b600280546001600160a01b038087166001600160a01b03199283168117909355600380548783169084161790556001805486831690841681179091556004805484169091179055600580549185169190921617905560408051918252517f143219c9e69b09e07e095fcc889b43d8f46ca892bba65f08dc3a0050869a56789181900360200190a1604080516001600160a01b038516815290517f78f058b189175430c48dc02699e3a0031ea4ff781536dc2fab847de4babdd8829181900360200190a161093061117d565b50505050565b6002546001600160a01b031681565b61094d61107f565b600354835183516001600160a01b0390921691811461096b57600080fd5b60005b81811015610b0f57600085828151811061098457fe5b6020026020010151905080600014610b065760008783815181106109a457fe5b602002602001015190506109cb818885815181106109be57fe5b60200260200101516111c7565b600154604080516324af709f60e11b81526001600160a01b0384811660048301529151919092169163495ee13e916024808301926020929190829003018186803b158015610a1857600080fd5b505afa158015610a2c573d6000803e3d6000fd5b505050506040513d6020811015610a4257600080fd5b505115610b0457806001600160a01b0316632c8e8dfa600560009054906101000a90046001600160a01b0316888a8781518110610a7b57fe5b60200260200101516040518463ffffffff1660e01b815260040180846001600160a01b03166001600160a01b03168152602001836001600160a01b03166001600160a01b031681526020018281526020019350505050600060405180830381600087803b158015610aeb57600080fd5b505af1158015610aff573d6000803e3d6000fd5b505050505b505b5060010161096e565b506040805163a7a24edd60e01b8152600481019182528651604482015286516001600160a01b0385169263a7a24edd92899289929182916024820191606401906020808801910280838360005b83811015610b74578181015183820152602001610b5c565b50505050905001838103825284818151815260200191508051906020019060200280838360005b83811015610bb3578181015183820152602001610b9b565b50505050905001945050505050600060405180830381600087803b158015610bda57600080fd5b505af1158015610bee573d6000803e3d6000fd5b505050505050505050565b6005546001600160a01b031681565b6000546001600160a01b031690565b60085490565b6000546001600160a01b0316331490565b6001546040805163b31610db60e01b81526001600160a01b0384811660048301529151600093600793169163b31610db916024808301926020929190829003018186803b158015610c7e57600080fd5b505afa158015610c92573d6000803e3d6000fd5b505050506040513d6020811015610ca857600080fd5b505181548110610cb457fe5b90600052602060002001549050919050565b670de0b6b3a764000081565b6040518060400160405280600b81526020016a111959985d5b1d141bdbdb60aa1b81525081565b610d016113e9565b6040805160068054606060208202840181018552938301818152610dc49484928491840182828015610d5c57602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311610d3e575b5050505050815260200160018201805480602002602001604051908101604052809291908181526020018280548015610db457602002820191906000526020600020905b815481526020019060010190808311610da0575b5050505050815250508383611432565b8051610dd891600791602090910190611706565b507f6391fbe8d7e4cc90b439d4e8d3dc07b9cbb23b914d46148b61b246bd9f638c5e8282604051808060200180602001838103835285818151815260200191508051906020019060200280838360005b83811015610e40578181015183820152602001610e28565b50505050905001838103825284818151815260200191508051906020019060200280838360005b83811015610e7f578181015183820152602001610e67565b5050505090500194505050505060405180910390a15050565b6003546001600160a01b031681565b6060806006600001600660010181805480602002602001604051908101604052809291908181526020018280548015610f0957602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311610eeb575b5050505050915080805480602002602001604051908101604052809291908181526020018280548015610f5b57602002820191906000526020600020905b815481526020019060010190808311610f47575b50505050509050915091509091565b6004546001600160a01b031681565b610f8161107f565b6008546107ae908263ffffffff61155616565b610f9c611598565b6006805460018082019092557ff652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d3f0180546001600160a01b0319166001600160a01b03939093169290921790915560078054918201815560009081527fa66cc928b5edb82af9bd49922954155ab7b0942694bea4ce44661d9a8736c68890910155565b600082820183811015611078576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b9392505050565b6002546001600160a01b031633146110c85760405162461bcd60e51b815260040180806020018281038252602b8152602001806117df602b913960400191505060405180910390fd5b565b6001600160a01b038116611125576040805162461bcd60e51b815260206004820152601e60248201527f4163636f756e742063616e6e6f74206265207a65726f20616464726573730000604482015290519081900360640190fd5b803b80611179576040805162461bcd60e51b815260206004820181905260248201527f4163636f756e7420636f64652073697a652063616e6e6f74206265207a65726f604482015290519081900360640190fd5b5050565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6003546001546040805163b31610db60e01b81526001600160a01b0386811660048301529151938216936000939092169163b31610db91602480820192602092909190829003018186803b15801561121e57600080fd5b505afa158015611232573d6000803e3d6000fd5b505050506040513d602081101561124857600080fd5b50516007805491925061127b918591908490811061126257fe5b906000526020600020015461155690919063ffffffff16565b600780548390811061128957fe5b60009182526020918290200191909155604080516001600160a01b038716815291820185905280517fcafa306d97bbac7bcdcb03e1b58c2624b7aaa17a5a85a70e04dd4a7a22b4e93d9281900390910190a1604080516001600160a01b0380871682528416602082015280820185905290517fe664153eb516123e000bb334869ec912418f6fe4c1abb53fe2f848c947a8405d9181900360600190a16040805163a9059cbb60e01b81526001600160a01b03848116600483015260248201869052915160009287169163a9059cbb91604480830192602092919082900301818787803b15801561137857600080fd5b505af115801561138c573d6000803e3d6000fd5b505050506040513d60208110156113a257600080fd5b50519050806113e25760405162461bcd60e51b81526004018080602001828103825260268152602001806117956026913960400191505060405180910390fd5b5050505050565b6003546001600160a01b031633146110c85760405162461bcd60e51b815260040180806020018281038252602981526020018061176c6029913960400191505060405180910390fd5b60608061144285602001516115e1565b905060005b845181101561154d5760015485516000916001600160a01b03169063b31610db9088908590811061147457fe5b60200260200101516040518263ffffffff1660e01b815260040180826001600160a01b03166001600160a01b0316815260200191505060206040518083038186803b1580156114c257600080fd5b505afa1580156114d6573d6000803e3d6000fd5b505050506040513d60208110156114ec57600080fd5b5051855190915061152d9086908490811061150357fe5b602002602001015184838151811061151757fe5b602002602001015161101e90919063ffffffff16565b83828151811061153957fe5b602090810291909101015250600101611447565b50949350505050565b600061107883836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f77000081525061166f565b6001546001600160a01b031633146110c85760405162461bcd60e51b81526004018080602001828103825260248152602001806117bb6024913960400191505060405180910390fd5b606080825167ffffffffffffffff811180156115fc57600080fd5b50604051908082528060200260200182016040528015611626578160200160208202803683370190505b50905060005b83518110156116685783818151811061164157fe5b602002602001015182828151811061165557fe5b602090810291909101015260010161162c565b5092915050565b600081848411156116fe5760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b838110156116c35781810151838201526020016116ab565b50505050905090810190601f1680156116f05780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b828054828255906000526020600020908101928215611741579160200282015b82811115611741578251825591602001919060010190611726565b5061174d929150611751565b5090565b6106f391905b8082111561174d576000815560010161175756fe44656661756c74506f6f6c3a2043616c6c6572206973206e6f742074686520416374697665506f6f6c44656661756c74506f6f6c3a2073656e64696e6720636f6c6c61746572616c206661696c656444656661756c74506f6f6c3a2043616c6c6572206973206e6f742077686974656c69737444656661756c74506f6f6c3a2043616c6c6572206973206e6f74207468652054726f76654d616e61676572a2646970667358221220056a886f0d0d8b004b858b0cb467890b5cf4ebb2161a29b06102193f9ce280c164736f6c634300060b0033

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