ETH Price: $1,809.17 (+10.92%)
Gas: 0.11 GWei

Contract

0x0f489dB29f29CEd4d61965e3C109eef765495f03

Overview

ETH Balance

Linea Mainnet LogoLinea Mainnet LogoLinea Mainnet Logo0 ETH

ETH Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To

There are no matching entries

> 10 Internal Transactions and > 10 Token Transfers found.

Latest 25 internal transactions (View All)

Parent Transaction Hash Block From To
182895642025-04-23 0:05:5211 hrs ago1745366752
0x0f489dB2...765495f03
0 ETH
182895642025-04-23 0:05:5211 hrs ago1745366752
0x0f489dB2...765495f03
0 ETH
182895642025-04-23 0:05:5211 hrs ago1745366752
0x0f489dB2...765495f03
0 ETH
182895642025-04-23 0:05:5211 hrs ago1745366752
0x0f489dB2...765495f03
0 ETH
182895642025-04-23 0:05:5211 hrs ago1745366752
0x0f489dB2...765495f03
0 ETH
182895642025-04-23 0:05:5211 hrs ago1745366752
0x0f489dB2...765495f03
0 ETH
182895642025-04-23 0:05:5211 hrs ago1745366752
0x0f489dB2...765495f03
0 ETH
182895642025-04-23 0:05:5211 hrs ago1745366752
0x0f489dB2...765495f03
0 ETH
182895642025-04-23 0:05:5211 hrs ago1745366752
0x0f489dB2...765495f03
0 ETH
182895642025-04-23 0:05:5211 hrs ago1745366752
0x0f489dB2...765495f03
0 ETH
182895642025-04-23 0:05:5211 hrs ago1745366752
0x0f489dB2...765495f03
0 ETH
182895642025-04-23 0:05:5211 hrs ago1745366752
0x0f489dB2...765495f03
0 ETH
182895642025-04-23 0:05:5211 hrs ago1745366752
0x0f489dB2...765495f03
0 ETH
182895642025-04-23 0:05:5211 hrs ago1745366752
0x0f489dB2...765495f03
0 ETH
182895642025-04-23 0:05:5211 hrs ago1745366752
0x0f489dB2...765495f03
0 ETH
182895642025-04-23 0:05:5211 hrs ago1745366752
0x0f489dB2...765495f03
0 ETH
182895642025-04-23 0:05:5211 hrs ago1745366752
0x0f489dB2...765495f03
0 ETH
182895642025-04-23 0:05:5211 hrs ago1745366752
0x0f489dB2...765495f03
0 ETH
182895642025-04-23 0:05:5211 hrs ago1745366752
0x0f489dB2...765495f03
0 ETH
182895642025-04-23 0:05:5211 hrs ago1745366752
0x0f489dB2...765495f03
0 ETH
182895642025-04-23 0:05:5211 hrs ago1745366752
0x0f489dB2...765495f03
0 ETH
182893542025-04-22 23:54:5611 hrs ago1745366096
0x0f489dB2...765495f03
0 ETH
182893542025-04-22 23:54:5611 hrs ago1745366096
0x0f489dB2...765495f03
0 ETH
182893542025-04-22 23:54:5611 hrs ago1745366096
0x0f489dB2...765495f03
0 ETH
182893542025-04-22 23:54:5611 hrs ago1745366096
0x0f489dB2...765495f03
0 ETH
View All Internal Transactions
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
CompoundV2Adapter

Compiler Version
v0.8.19+commit.7dd6d404

Optimization Enabled:
No with 200 runs

Other Settings:
paris EvmVersion
File 1 of 18 : CompoundV2Adapter.sol
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.19;

import "openzeppelin-contracts/contracts/token/ERC20/utils/SafeERC20.sol";
import "openzeppelin-contracts/contracts/utils/Strings.sol";
import "openzeppelin-contracts/contracts/token/ERC20/extensions/IERC20Metadata.sol";
import "openzeppelin-contracts/contracts/utils/introspection/ERC165.sol";
import "openzeppelin-contracts/contracts/utils/introspection/IERC165.sol";

import "./interfaces/IComptroller.sol";
import "./interfaces/IPriceOracle.sol";
import "./interfaces/ICToken.sol";
import "./interfaces/IInterestRateModel.sol";

import "../../interfaces/ILendingAdapter.sol";
import "../../interfaces/ILendingAdapterWithRawSupplyRate.sol";
import "../../interfaces/ILendingAdapterWithAccrualTrigger.sol";
import "../../interfaces/ILendingAdapterWithWithdraw.sol";

contract CompoundV2Adapter is
    ERC165,
    ILendingAdapter,
    ILendingAdapterWithWithdraw,
    ILendingAdapterWithAccrualTrigger,
    ILendingAdapterWithRawSupplyRate
{
    using SafeERC20 for IERC20;

    error MintFailed();
    error RedeemUnderlyingFailed();
    error RedeemResidualFailed();
    error ResidualCTokens();
    error ResidualTokens();
    error CTokenNotFound(address token);
    event InterestAccrued(address indexed token, uint256 interestAccrued);

    address public immutable comptroller;
    string public adapterName;

    constructor(address _comptroller, string memory name_) {
        comptroller = _comptroller;
        adapterName = name_;
    }

    function supportsInterface(
        bytes4 interfaceId
    ) public view virtual override returns (bool) {
        return
            interfaceId == type(ILendingAdapter).interfaceId ||
            interfaceId == type(ILendingAdapterWithWithdraw).interfaceId ||
            interfaceId == type(ILendingAdapterWithRawSupplyRate).interfaceId ||
            super.supportsInterface(interfaceId);
    }

    function name() external view override returns (string memory) {
        return adapterName;
    }

    function getRawSupplyRate(
        address token
    ) external view override returns (uint256 rate, uint8 rateDecimals) {
        address cToken = getDepositToken(token);
        rate = ICToken(cToken).supplyRatePerBlock(); // scaled to 1e18
        rateDecimals = 18;
    }

    function getTokens() external view override returns (TokenInfo[] memory) {
        address[] memory cTokens = IComptroller(comptroller).getAllMarkets();
        TokenInfo[] memory tokens = new TokenInfo[](cTokens.length);
        uint256 count;

        for (uint256 i = 0; i < cTokens.length; i++) {
            try ICToken(cTokens[i]).underlying() returns (address) {
                tokens[count++] = _parseCToken(cTokens[i]);
            } catch {
                // Skip cETH
            }
        }

        assembly {
            mstore(tokens, count)
        }

        return tokens;
    }

    function _parseCToken(
        address cToken
    ) internal view returns (TokenInfo memory info) {
        address underlying = ICToken(cToken).underlying();

        (, uint256 collateralFactorMantissa) = IComptroller(comptroller)
            .markets(cToken);

        uint256 blocksPerYear = IInterestRateModel(
            ICToken(cToken).interestRateModel()
        ).blocksPerYear();
        uint256 supplyRate = ICToken(cToken).supplyRatePerBlock() *
            blocksPerYear;

        return
            TokenInfo({
                token: underlying,
                isCollateral: collateralFactorMantissa > 0,
                ltvBps: collateralFactorMantissa / 1e14,
                rate: supplyRate,
                rateDecimals: 18,
                liquidationThresholdBps: 0
            });
    }

    function getTokenInfo(
        address token
    ) external view override returns (TokenInfo memory) {
        address cToken = getDepositToken(token);
        return _parseCToken(cToken);
    }

    function supply(address token, uint256 amount, address) external override {
        address cToken = getDepositToken(token);

        IERC20(token).safeTransferFrom(msg.sender, address(this), amount);
        IERC20(token).approve(cToken, 0);
        IERC20(token).approve(cToken, amount);

        if (ICToken(cToken).mint(amount) != 0) revert MintFailed();

        uint256 cTokenBalance = ICToken(cToken).balanceOf(address(this));
        ICToken(cToken).transfer(msg.sender, cTokenBalance);
    }

    function withdraw(address token, address user) internal {
        address cToken = getDepositToken(token);

        uint256 cTokenBalance = ICToken(cToken).balanceOf(address(this));
        if (cTokenBalance == 0) return;

        uint256 exchangeRate = ICToken(cToken).exchangeRateCurrent();
        uint256 maxRedeemable = (cTokenBalance * exchangeRate) / 1e18;

        if (ICToken(cToken).redeemUnderlying(maxRedeemable) != 0) {
            revert RedeemUnderlyingFailed();
        }

        cTokenBalance = ICToken(cToken).balanceOf(address(this));
        if (cTokenBalance > 0) {
            if (ICToken(cToken).redeem(cTokenBalance) != 0) {
                revert RedeemResidualFailed();
            }
        }

        uint256 baseTokenAmount = IERC20(token).balanceOf(address(this));
        if (baseTokenAmount > 0) {
            IERC20(token).safeTransfer(user, baseTokenAmount);
        }

        if (ICToken(cToken).balanceOf(address(this)) != 0) {
            revert ResidualCTokens();
        }

        if (IERC20(token).balanceOf(address(this)) != 0) {
            revert ResidualTokens();
        }
    }

    function withdrawExternal(address token, address user) external {
        withdraw(token, user);
    }

    function accrueInterest(address token) external override {
        address cToken = getDepositToken(token);

        uint256 before = ICToken(cToken).exchangeRateStored();
        uint256 current = ICToken(cToken).exchangeRateCurrent();
        emit InterestAccrued(token, current > before ? current - before : 0);
    }

    function viewAccruedInterest(
        address token,
        address user,
        uint256 principal
    )
        external
        view
        override
        returns (uint256 current, uint256 interest, bool isAccurate)
    {
        address cToken = getDepositToken(token);

        uint256 cBalance = ICToken(cToken).balanceOf(user);
        uint256 exchangeRate = ICToken(cToken).exchangeRateStored();

        current = (cBalance * exchangeRate) / 1e18;
        interest = current > principal ? current - principal : 0;
        isAccurate = false; // Exchange rate stored can be outdated
    }

    function getWithdrawCallData(
        address token,
        address user
    )
        external
        view
        override
        returns (
            address target,
            bytes memory callData,
            address[] memory tokensToTransfer,
            uint256[] memory amounts
        )
    {
        address cToken = getDepositToken(token);
        uint256 cTokenBalance = ICToken(cToken).balanceOf(user);

        if (cTokenBalance == 0) {
            return (
                address(this),
                abi.encodeWithSelector(
                    CompoundV2Adapter.withdrawExternal.selector,
                    token,
                    user
                ),
                new address[](0),
                new uint256[](0)
            );
        }

        address[] memory tokens_ = new address[](1);
        tokens_[0] = cToken;

        uint256[] memory amounts_ = new uint256[](1);
        amounts_[0] = cTokenBalance;

        return (
            address(this),
            abi.encodeWithSelector(
                CompoundV2Adapter.withdrawExternal.selector,
                token,
                user
            ),
            tokens_,
            amounts_
        );
    }

    function getSupplyBalance(
        address token,
        address user
    ) external view override returns (uint256) {
        address cToken = getDepositToken(token);
        return ICToken(cToken).balanceOfUnderlying(user);
    }

    function getSupplyBalanceView(
        address token,
        address user
    ) external view override returns (uint256) {
        address cToken = getDepositToken(token);
        try ICToken(cToken).balanceOf(user) returns (uint256 cTokenBalance) {
            uint256 exchangeRate = ICToken(cToken).exchangeRateStored();
            return (cTokenBalance * exchangeRate) / 1e18;
        } catch {
            return 0;
        }
    }

    function getTokenPriceUsd(
        address token
    ) external view override returns (uint256, uint8) {
        address cToken = getDepositToken(token);
        uint256 price = IPriceOracle(IComptroller(comptroller).oracle())
            .getUnderlyingPrice(cToken);
        uint8 decimals = IERC20Metadata(token).decimals();
        uint8 priceDecimals = 36 - decimals;
        return (price, priceDecimals);
    }

    function getDepositToken(
        address token
    ) public view override returns (address) {
        address[] memory cTokens = IComptroller(comptroller).getAllMarkets();
        for (uint256 i = 0; i < cTokens.length; i++) {
            try ICToken(cTokens[i]).underlying() returns (address u) {
                if (u == token) return cTokens[i];
            } catch {
                // Skip cETH
            }
        }
        revert CTokenNotFound(token);
    }

    function getAllDepositTokens()
        external
        view
        override
        returns (address[] memory)
    {
        return IComptroller(comptroller).getAllMarkets();
    }

    function getSupplyCaps(
        address token
    ) external view override returns (uint256 borrowCap, uint256 supplyCap) {
        address cToken = getDepositToken(token);
        try ICToken(cToken).getCash() returns (uint256 cash) {
            return (type(uint256).max, cash);
        } catch {
            return (type(uint256).max, 0);
        }
    }
}

File 2 of 18 : SafeERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC20/utils/SafeERC20.sol)

pragma solidity ^0.8.0;

import "../IERC20.sol";
import "../extensions/draft-IERC20Permit.sol";
import "../../../utils/Address.sol";

/**
 * @title SafeERC20
 * @dev Wrappers around ERC20 operations that throw on failure (when the token
 * contract returns false). Tokens that return no value (and instead revert or
 * throw on failure) are also supported, non-reverting calls are assumed to be
 * successful.
 * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,
 * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
 */
library SafeERC20 {
    using Address for address;

    function safeTransfer(
        IERC20 token,
        address to,
        uint256 value
    ) internal {
        _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
    }

    function safeTransferFrom(
        IERC20 token,
        address from,
        address to,
        uint256 value
    ) internal {
        _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
    }

    /**
     * @dev Deprecated. This function has issues similar to the ones found in
     * {IERC20-approve}, and its usage is discouraged.
     *
     * Whenever possible, use {safeIncreaseAllowance} and
     * {safeDecreaseAllowance} instead.
     */
    function safeApprove(
        IERC20 token,
        address spender,
        uint256 value
    ) internal {
        // safeApprove should only be called when setting an initial allowance,
        // or when resetting it to zero. To increase and decrease it, use
        // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'
        require(
            (value == 0) || (token.allowance(address(this), spender) == 0),
            "SafeERC20: approve from non-zero to non-zero allowance"
        );
        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
    }

    function safeIncreaseAllowance(
        IERC20 token,
        address spender,
        uint256 value
    ) internal {
        uint256 newAllowance = token.allowance(address(this), spender) + value;
        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
    }

    function safeDecreaseAllowance(
        IERC20 token,
        address spender,
        uint256 value
    ) internal {
        unchecked {
            uint256 oldAllowance = token.allowance(address(this), spender);
            require(oldAllowance >= value, "SafeERC20: decreased allowance below zero");
            uint256 newAllowance = oldAllowance - value;
            _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
        }
    }

    function safePermit(
        IERC20Permit token,
        address owner,
        address spender,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) internal {
        uint256 nonceBefore = token.nonces(owner);
        token.permit(owner, spender, value, deadline, v, r, s);
        uint256 nonceAfter = token.nonces(owner);
        require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed");
    }

    /**
     * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
     * on the return value: the return value is optional (but if data is returned, it must not be false).
     * @param token The token targeted by the call.
     * @param data The call data (encoded using abi.encode or one of its variants).
     */
    function _callOptionalReturn(IERC20 token, bytes memory data) private {
        // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
        // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that
        // the target address contains contract code and also asserts for success in the low-level call.

        bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed");
        if (returndata.length > 0) {
            // Return data is optional
            require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
        }
    }
}

File 3 of 18 : Strings.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/Strings.sol)

pragma solidity ^0.8.0;

import "./math/Math.sol";

/**
 * @dev String operations.
 */
library Strings {
    bytes16 private constant _SYMBOLS = "0123456789abcdef";
    uint8 private constant _ADDRESS_LENGTH = 20;

    /**
     * @dev Converts a `uint256` to its ASCII `string` decimal representation.
     */
    function toString(uint256 value) internal pure returns (string memory) {
        unchecked {
            uint256 length = Math.log10(value) + 1;
            string memory buffer = new string(length);
            uint256 ptr;
            /// @solidity memory-safe-assembly
            assembly {
                ptr := add(buffer, add(32, length))
            }
            while (true) {
                ptr--;
                /// @solidity memory-safe-assembly
                assembly {
                    mstore8(ptr, byte(mod(value, 10), _SYMBOLS))
                }
                value /= 10;
                if (value == 0) break;
            }
            return buffer;
        }
    }

    /**
     * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.
     */
    function toHexString(uint256 value) internal pure returns (string memory) {
        unchecked {
            return toHexString(value, Math.log256(value) + 1);
        }
    }

    /**
     * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.
     */
    function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {
        bytes memory buffer = new bytes(2 * length + 2);
        buffer[0] = "0";
        buffer[1] = "x";
        for (uint256 i = 2 * length + 1; i > 1; --i) {
            buffer[i] = _SYMBOLS[value & 0xf];
            value >>= 4;
        }
        require(value == 0, "Strings: hex length insufficient");
        return string(buffer);
    }

    /**
     * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.
     */
    function toHexString(address addr) internal pure returns (string memory) {
        return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);
    }
}

File 4 of 18 : IERC20Metadata.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)

pragma solidity ^0.8.0;

import "../IERC20.sol";

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

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

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

File 5 of 18 : ERC165.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)

pragma solidity ^0.8.0;

import "./IERC165.sol";

/**
 * @dev Implementation of the {IERC165} interface.
 *
 * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check
 * for the additional interface id that will be supported. For example:
 *
 * ```solidity
 * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
 *     return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);
 * }
 * ```
 *
 * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.
 */
abstract contract ERC165 is IERC165 {
    /**
     * @dev See {IERC165-supportsInterface}.
     */
    function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
        return interfaceId == type(IERC165).interfaceId;
    }
}

File 6 of 18 : IERC165.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC165 standard, as defined in the
 * https://eips.ethereum.org/EIPS/eip-165[EIP].
 *
 * Implementers can declare support of contract interfaces, which can then be
 * queried by others ({ERC165Checker}).
 *
 * For an implementation, see {ERC165}.
 */
interface IERC165 {
    /**
     * @dev Returns true if this contract implements the interface defined by
     * `interfaceId`. See the corresponding
     * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]
     * to learn more about how these ids are created.
     *
     * This function call must use less than 30 000 gas.
     */
    function supportsInterface(bytes4 interfaceId) external view returns (bool);
}

File 7 of 18 : IComptroller.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.19;

/// @title IComptroller - Interface for Compound V2 Comptroller
interface IComptroller {
    /// @notice Returns the list of all cToken markets
    /// @return Array of cToken addresses
    function getAllMarkets() external view returns (address[] memory);

    /// @notice Returns the current price oracle address
    /// @return Address of the price oracle contract
    function oracle() external view returns (address);

    /// @notice Returns market data for a given cToken
    /// @param cToken Address of the cToken
    /// @return isListed Whether the market is listed
    /// @return collateralFactorMantissa Collateral factor (scaled by 1e18)
    function markets(
        address cToken
    ) external view returns (bool isListed, uint256 collateralFactorMantissa);
}

File 8 of 18 : IPriceOracle.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.19;

/// @title IPriceOracle - Interface for Compound V2 price oracle
interface IPriceOracle {
    /// @notice Returns the price of the underlying asset for a given cToken
    /// @param cToken Address of the cToken
    /// @return Price of the underlying asset in USD, scaled by 1e18
    function getUnderlyingPrice(address cToken) external view returns (uint256);
}

File 9 of 18 : ICToken.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.19;

/// @title ICToken - Interface for Compound V2 cTokens
interface ICToken {
    /// @notice Returns the supply rate per block (in 1e18 scale)
    function supplyRatePerBlock() external view returns (uint256);

    /// @notice Mints cTokens by supplying underlying asset
    /// @param mintAmount Amount of the underlying asset to supply
    /// @return Error code (0 = success)
    function mint(uint256 mintAmount) external returns (uint256);

    /// @notice Redeems specified amount of cTokens
    /// @param redeemTokens Amount of cTokens to redeem
    /// @return Error code (0 = success)
    function redeem(uint256 redeemTokens) external returns (uint256);

    /// @notice Redeems underlying tokens from specified amount
    /// @param redeemAmount Amount of underlying tokens to redeem
    /// @return Error code (0 = success)
    function redeemUnderlying(uint256 redeemAmount) external returns (uint256);

    /// @notice Returns the address of the underlying token
    function underlying() external view returns (address);

    /// @notice Returns the current balance in underlying for a user
    function balanceOfUnderlying(address owner) external view returns (uint256);

    /// @notice Returns the current balance in cTokens for a user
    function getCash() external view returns (uint);

    /// @notice Returns the current balance in cTokens for a user
    function balanceOf(address owner) external view returns (uint256);

    /// @notice Returns the current cached exchange rate between cTokens and underlying
    function exchangeRateStored() external view returns (uint);

    /// @notice Returns the current exchange rate between cTokens and underlying
    function exchangeRateCurrent() external returns (uint);

    function transfer(address dst, uint256 amount) external returns (bool);

    function transferFrom(
        address src,
        address dst,
        uint256 amount
    ) external returns (bool);

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

File 10 of 18 : IInterestRateModel.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.19;

interface IInterestRateModel {
    function blocksPerYear() external view returns (uint256);
}

File 11 of 18 : ILendingAdapter.sol
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.19;

/// @title ILendingAdapter - Universal interface for lending protocols (Aave, Compound, etc.)
interface ILendingAdapter {
    /// @notice Metadata about a supported token in the lending protocol
    struct TokenInfo {
        address token;
        bool isCollateral; // Whether the token can be used as collateral
        uint256 ltvBps; // Loan-to-value ratio (optional:  0 if unsupported, or equal to liquidationThresholdBps)
        uint256 liquidationThresholdBps; // Liquidation threshold (optional: 0 if unsupported)
        uint256 rate; // Interest rate
        uint8 rateDecimals; // Interest rate decimals
    }

    /// @notice Returns all tokens supported by this adapter, with metadata
    function getTokens() external view returns (TokenInfo[] memory);

    /// @notice Returns the token info for a specific token
    function getTokenInfo(
        address token
    ) external view returns (TokenInfo memory);

    /// @notice Supplies a token into the protocol
    function supply(address token, uint256 amount, address onBehalfOf) external;

    /// @notice Returns current borrow/supply caps for a token
    function getSupplyCaps(
        address token
    ) external view returns (uint256 borrowCap, uint256 supplyCap);

    /// @notice Returns the raw supply rate of a token (in 1e18 scale)
    function getSupplyBalance(
        address token,
        address user
    ) external returns (uint256);

    /// @notice Returns current supply balance of a user in underlying token units
    function getSupplyBalanceView(
        address token,
        address user
    ) external view returns (uint256);

    /// @notice Returns USD price of a token, scaled to `decimals`
    function getTokenPriceUsd(
        address token
    ) external view returns (uint256 price, uint8 decimals);

    /// @notice Returns the protocol-specific "deposit token" (like aToken or cToken)
    function getDepositToken(address asset) external view returns (address);

    /// @notice Returns all deposit tokens supported by this adapter
    function getAllDepositTokens() external view returns (address[] memory);

    /// @notice Human-readable name of the adapter
    function name() external view returns (string memory);

    /// @notice Returns the accrued interest (requires current on-chain state)
    function viewAccruedInterest(
        address token,
        address user,
        uint256 principal
    )
        external
        view
        returns (uint256 current, uint256 interest, bool isAccurate);
}

File 12 of 18 : ILendingAdapterWithRawSupplyRate.sol
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.19;

interface ILendingAdapterWithRawSupplyRate {
    function getRawSupplyRate(
        address token
    ) external view returns (uint256 rate, uint8 rateDecimals);
}

File 13 of 18 : ILendingAdapterWithAccrualTrigger.sol
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.19;

interface ILendingAdapterWithAccrualTrigger {
    function accrueInterest(address token) external;
}

File 14 of 18 : ILendingAdapterWithWithdraw.sol
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.19;

interface ILendingAdapterWithWithdraw {
    /// @notice Returns calldata needed to perform withdrawal via external agent
    /// @dev Used in protocols like Aave that require withdrawals to be initiated by the depositor contract
    function getWithdrawCallData(
        address token,
        address user
    )
        external
        view
        returns (
            address target,
            bytes memory callData,
            address[] memory tokensToTransfer,
            uint256[] memory amounts
        );
}

File 15 of 18 : IERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC20 standard as defined in the EIP.
 */
interface IERC20 {
    /**
     * @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);

    /**
     * @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 `to`.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transfer(address to, uint256 amount) external returns (bool);

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

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

    /**
     * @dev Moves `amount` tokens from `from` to `to` 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 from,
        address to,
        uint256 amount
    ) external returns (bool);
}

File 16 of 18 : draft-IERC20Permit.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol)

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in
 * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].
 *
 * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by
 * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't
 * need to send a transaction, and thus is not required to hold Ether at all.
 */
interface IERC20Permit {
    /**
     * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,
     * given ``owner``'s signed approval.
     *
     * IMPORTANT: The same issues {IERC20-approve} has related to transaction
     * ordering also apply here.
     *
     * Emits an {Approval} event.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     * - `deadline` must be a timestamp in the future.
     * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`
     * over the EIP712-formatted function arguments.
     * - the signature must use ``owner``'s current nonce (see {nonces}).
     *
     * For more information on the signature format, see the
     * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP
     * section].
     */
    function permit(
        address owner,
        address spender,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) external;

    /**
     * @dev Returns the current nonce for `owner`. This value must be
     * included whenever a signature is generated for {permit}.
     *
     * Every successful call to {permit} increases ``owner``'s nonce by one. This
     * prevents a signature from being used multiple times.
     */
    function nonces(address owner) external view returns (uint256);

    /**
     * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.
     */
    // solhint-disable-next-line func-name-mixedcase
    function DOMAIN_SEPARATOR() external view returns (bytes32);
}

File 17 of 18 : Address.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol)

pragma solidity ^0.8.1;

/**
 * @dev Collection of functions related to the address type
 */
library Address {
    /**
     * @dev Returns true if `account` is a contract.
     *
     * [IMPORTANT]
     * ====
     * It is unsafe to assume that an address for which this function returns
     * false is an externally-owned account (EOA) and not a contract.
     *
     * Among others, `isContract` will return false for the following
     * types of addresses:
     *
     *  - an externally-owned account
     *  - a contract in construction
     *  - an address where a contract will be created
     *  - an address where a contract lived, but was destroyed
     * ====
     *
     * [IMPORTANT]
     * ====
     * You shouldn't rely on `isContract` to protect against flash loan attacks!
     *
     * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets
     * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract
     * constructor.
     * ====
     */
    function isContract(address account) internal view returns (bool) {
        // This method relies on extcodesize/address.code.length, which returns 0
        // for contracts in construction, since the code is only stored at the end
        // of the constructor execution.

        return account.code.length > 0;
    }

    /**
     * @dev Replacement for Solidity's `transfer`: sends `amount` wei to
     * `recipient`, forwarding all available gas and reverting on errors.
     *
     * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
     * of certain opcodes, possibly making contracts go over the 2300 gas limit
     * imposed by `transfer`, making them unable to receive funds via
     * `transfer`. {sendValue} removes this limitation.
     *
     * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
     *
     * IMPORTANT: because control is transferred to `recipient`, care must be
     * taken to not create reentrancy vulnerabilities. Consider using
     * {ReentrancyGuard} or the
     * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
     */
    function sendValue(address payable recipient, uint256 amount) internal {
        require(address(this).balance >= amount, "Address: insufficient balance");

        (bool success, ) = recipient.call{value: amount}("");
        require(success, "Address: unable to send value, recipient may have reverted");
    }

    /**
     * @dev Performs a Solidity function call using a low level `call`. A
     * plain `call` is an unsafe replacement for a function call: use this
     * function instead.
     *
     * If `target` reverts with a revert reason, it is bubbled up by this
     * function (like regular Solidity function calls).
     *
     * Returns the raw returned data. To convert to the expected return value,
     * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
     *
     * Requirements:
     *
     * - `target` must be a contract.
     * - calling `target` with `data` must not revert.
     *
     * _Available since v3.1._
     */
    function functionCall(address target, bytes memory data) internal returns (bytes memory) {
        return functionCallWithValue(target, data, 0, "Address: low-level call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
     * `errorMessage` as a fallback revert reason when `target` reverts.
     *
     * _Available since v3.1._
     */
    function functionCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal returns (bytes memory) {
        return functionCallWithValue(target, data, 0, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but also transferring `value` wei to `target`.
     *
     * Requirements:
     *
     * - the calling contract must have an ETH balance of at least `value`.
     * - the called Solidity function must be `payable`.
     *
     * _Available since v3.1._
     */
    function functionCallWithValue(
        address target,
        bytes memory data,
        uint256 value
    ) internal returns (bytes memory) {
        return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
    }

    /**
     * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
     * with `errorMessage` as a fallback revert reason when `target` reverts.
     *
     * _Available since v3.1._
     */
    function functionCallWithValue(
        address target,
        bytes memory data,
        uint256 value,
        string memory errorMessage
    ) internal returns (bytes memory) {
        require(address(this).balance >= value, "Address: insufficient balance for call");
        (bool success, bytes memory returndata) = target.call{value: value}(data);
        return verifyCallResultFromTarget(target, success, returndata, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but performing a static call.
     *
     * _Available since v3.3._
     */
    function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
        return functionStaticCall(target, data, "Address: low-level static call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
     * but performing a static call.
     *
     * _Available since v3.3._
     */
    function functionStaticCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal view returns (bytes memory) {
        (bool success, bytes memory returndata) = target.staticcall(data);
        return verifyCallResultFromTarget(target, success, returndata, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but performing a delegate call.
     *
     * _Available since v3.4._
     */
    function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
        return functionDelegateCall(target, data, "Address: low-level delegate call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
     * but performing a delegate call.
     *
     * _Available since v3.4._
     */
    function functionDelegateCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal returns (bytes memory) {
        (bool success, bytes memory returndata) = target.delegatecall(data);
        return verifyCallResultFromTarget(target, success, returndata, errorMessage);
    }

    /**
     * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling
     * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.
     *
     * _Available since v4.8._
     */
    function verifyCallResultFromTarget(
        address target,
        bool success,
        bytes memory returndata,
        string memory errorMessage
    ) internal view returns (bytes memory) {
        if (success) {
            if (returndata.length == 0) {
                // only check isContract if the call was successful and the return data is empty
                // otherwise we already know that it was a contract
                require(isContract(target), "Address: call to non-contract");
            }
            return returndata;
        } else {
            _revert(returndata, errorMessage);
        }
    }

    /**
     * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the
     * revert reason or using the provided one.
     *
     * _Available since v4.3._
     */
    function verifyCallResult(
        bool success,
        bytes memory returndata,
        string memory errorMessage
    ) internal pure returns (bytes memory) {
        if (success) {
            return returndata;
        } else {
            _revert(returndata, errorMessage);
        }
    }

    function _revert(bytes memory returndata, string memory errorMessage) private pure {
        // Look for revert reason and bubble it up if present
        if (returndata.length > 0) {
            // The easiest way to bubble the revert reason is using memory via assembly
            /// @solidity memory-safe-assembly
            assembly {
                let returndata_size := mload(returndata)
                revert(add(32, returndata), returndata_size)
            }
        } else {
            revert(errorMessage);
        }
    }
}

File 18 of 18 : Math.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/Math.sol)

pragma solidity ^0.8.0;

/**
 * @dev Standard math utilities missing in the Solidity language.
 */
library Math {
    enum Rounding {
        Down, // Toward negative infinity
        Up, // Toward infinity
        Zero // Toward zero
    }

    /**
     * @dev Returns the largest of two numbers.
     */
    function max(uint256 a, uint256 b) internal pure returns (uint256) {
        return a > b ? a : b;
    }

    /**
     * @dev Returns the smallest of two numbers.
     */
    function min(uint256 a, uint256 b) internal pure returns (uint256) {
        return a < b ? a : b;
    }

    /**
     * @dev Returns the average of two numbers. The result is rounded towards
     * zero.
     */
    function average(uint256 a, uint256 b) internal pure returns (uint256) {
        // (a + b) / 2 can overflow.
        return (a & b) + (a ^ b) / 2;
    }

    /**
     * @dev Returns the ceiling of the division of two numbers.
     *
     * This differs from standard division with `/` in that it rounds up instead
     * of rounding down.
     */
    function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {
        // (a + b - 1) / b can overflow on addition, so we distribute.
        return a == 0 ? 0 : (a - 1) / b + 1;
    }

    /**
     * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0
     * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)
     * with further edits by Uniswap Labs also under MIT license.
     */
    function mulDiv(
        uint256 x,
        uint256 y,
        uint256 denominator
    ) internal pure returns (uint256 result) {
        unchecked {
            // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use
            // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256
            // variables such that product = prod1 * 2^256 + prod0.
            uint256 prod0; // Least significant 256 bits of the product
            uint256 prod1; // Most significant 256 bits of the product
            assembly {
                let mm := mulmod(x, y, not(0))
                prod0 := mul(x, y)
                prod1 := sub(sub(mm, prod0), lt(mm, prod0))
            }

            // Handle non-overflow cases, 256 by 256 division.
            if (prod1 == 0) {
                return prod0 / denominator;
            }

            // Make sure the result is less than 2^256. Also prevents denominator == 0.
            require(denominator > prod1);

            ///////////////////////////////////////////////
            // 512 by 256 division.
            ///////////////////////////////////////////////

            // Make division exact by subtracting the remainder from [prod1 prod0].
            uint256 remainder;
            assembly {
                // Compute remainder using mulmod.
                remainder := mulmod(x, y, denominator)

                // Subtract 256 bit number from 512 bit number.
                prod1 := sub(prod1, gt(remainder, prod0))
                prod0 := sub(prod0, remainder)
            }

            // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.
            // See https://cs.stackexchange.com/q/138556/92363.

            // Does not overflow because the denominator cannot be zero at this stage in the function.
            uint256 twos = denominator & (~denominator + 1);
            assembly {
                // Divide denominator by twos.
                denominator := div(denominator, twos)

                // Divide [prod1 prod0] by twos.
                prod0 := div(prod0, twos)

                // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.
                twos := add(div(sub(0, twos), twos), 1)
            }

            // Shift in bits from prod1 into prod0.
            prod0 |= prod1 * twos;

            // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such
            // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for
            // four bits. That is, denominator * inv = 1 mod 2^4.
            uint256 inverse = (3 * denominator) ^ 2;

            // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works
            // in modular arithmetic, doubling the correct bits in each step.
            inverse *= 2 - denominator * inverse; // inverse mod 2^8
            inverse *= 2 - denominator * inverse; // inverse mod 2^16
            inverse *= 2 - denominator * inverse; // inverse mod 2^32
            inverse *= 2 - denominator * inverse; // inverse mod 2^64
            inverse *= 2 - denominator * inverse; // inverse mod 2^128
            inverse *= 2 - denominator * inverse; // inverse mod 2^256

            // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.
            // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is
            // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1
            // is no longer required.
            result = prod0 * inverse;
            return result;
        }
    }

    /**
     * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.
     */
    function mulDiv(
        uint256 x,
        uint256 y,
        uint256 denominator,
        Rounding rounding
    ) internal pure returns (uint256) {
        uint256 result = mulDiv(x, y, denominator);
        if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {
            result += 1;
        }
        return result;
    }

    /**
     * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.
     *
     * Inspired by Henry S. Warren, Jr.'s "Hacker's Delight" (Chapter 11).
     */
    function sqrt(uint256 a) internal pure returns (uint256) {
        if (a == 0) {
            return 0;
        }

        // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.
        //
        // We know that the "msb" (most significant bit) of our target number `a` is a power of 2 such that we have
        // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.
        //
        // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`
        // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`
        // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`
        //
        // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.
        uint256 result = 1 << (log2(a) >> 1);

        // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,
        // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at
        // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision
        // into the expected uint128 result.
        unchecked {
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            return min(result, a / result);
        }
    }

    /**
     * @notice Calculates sqrt(a), following the selected rounding direction.
     */
    function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {
        unchecked {
            uint256 result = sqrt(a);
            return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);
        }
    }

    /**
     * @dev Return the log in base 2, rounded down, of a positive value.
     * Returns 0 if given 0.
     */
    function log2(uint256 value) internal pure returns (uint256) {
        uint256 result = 0;
        unchecked {
            if (value >> 128 > 0) {
                value >>= 128;
                result += 128;
            }
            if (value >> 64 > 0) {
                value >>= 64;
                result += 64;
            }
            if (value >> 32 > 0) {
                value >>= 32;
                result += 32;
            }
            if (value >> 16 > 0) {
                value >>= 16;
                result += 16;
            }
            if (value >> 8 > 0) {
                value >>= 8;
                result += 8;
            }
            if (value >> 4 > 0) {
                value >>= 4;
                result += 4;
            }
            if (value >> 2 > 0) {
                value >>= 2;
                result += 2;
            }
            if (value >> 1 > 0) {
                result += 1;
            }
        }
        return result;
    }

    /**
     * @dev Return the log in base 2, following the selected rounding direction, of a positive value.
     * Returns 0 if given 0.
     */
    function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {
        unchecked {
            uint256 result = log2(value);
            return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);
        }
    }

    /**
     * @dev Return the log in base 10, rounded down, of a positive value.
     * Returns 0 if given 0.
     */
    function log10(uint256 value) internal pure returns (uint256) {
        uint256 result = 0;
        unchecked {
            if (value >= 10**64) {
                value /= 10**64;
                result += 64;
            }
            if (value >= 10**32) {
                value /= 10**32;
                result += 32;
            }
            if (value >= 10**16) {
                value /= 10**16;
                result += 16;
            }
            if (value >= 10**8) {
                value /= 10**8;
                result += 8;
            }
            if (value >= 10**4) {
                value /= 10**4;
                result += 4;
            }
            if (value >= 10**2) {
                value /= 10**2;
                result += 2;
            }
            if (value >= 10**1) {
                result += 1;
            }
        }
        return result;
    }

    /**
     * @dev Return the log in base 10, following the selected rounding direction, of a positive value.
     * Returns 0 if given 0.
     */
    function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {
        unchecked {
            uint256 result = log10(value);
            return result + (rounding == Rounding.Up && 10**result < value ? 1 : 0);
        }
    }

    /**
     * @dev Return the log in base 256, rounded down, of a positive value.
     * Returns 0 if given 0.
     *
     * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.
     */
    function log256(uint256 value) internal pure returns (uint256) {
        uint256 result = 0;
        unchecked {
            if (value >> 128 > 0) {
                value >>= 128;
                result += 16;
            }
            if (value >> 64 > 0) {
                value >>= 64;
                result += 8;
            }
            if (value >> 32 > 0) {
                value >>= 32;
                result += 4;
            }
            if (value >> 16 > 0) {
                value >>= 16;
                result += 2;
            }
            if (value >> 8 > 0) {
                result += 1;
            }
        }
        return result;
    }

    /**
     * @dev Return the log in base 10, following the selected rounding direction, of a positive value.
     * Returns 0 if given 0.
     */
    function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {
        unchecked {
            uint256 result = log256(value);
            return result + (rounding == Rounding.Up && 1 << (result * 8) < value ? 1 : 0);
        }
    }
}

Settings
{
  "remappings": [
    "aave-v3-core/=lib/aave-v3-core/",
    "aave-v3-periphery/=lib/aave-v3-periphery/contracts/",
    "chainlink-brownie-contracts/=lib/chainlink-brownie-contracts/",
    "compound-protocol/=lib/compound-protocol/",
    "ds-test/=lib/openzeppelin-contracts/lib/forge-std/lib/ds-test/src/",
    "forge-std/=lib/forge-std/src/",
    "openzeppelin-contracts/=lib/openzeppelin-contracts/"
  ],
  "optimizer": {
    "enabled": false,
    "runs": 200
  },
  "metadata": {
    "useLiteralContent": false,
    "bytecodeHash": "ipfs",
    "appendCBOR": true
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  },
  "evmVersion": "paris",
  "viaIR": false,
  "libraries": {}
}

Contract Security Audit

Contract ABI

API
[{"inputs":[{"internalType":"address","name":"_comptroller","type":"address"},{"internalType":"string","name":"name_","type":"string"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"CTokenNotFound","type":"error"},{"inputs":[],"name":"MintFailed","type":"error"},{"inputs":[],"name":"RedeemResidualFailed","type":"error"},{"inputs":[],"name":"RedeemUnderlyingFailed","type":"error"},{"inputs":[],"name":"ResidualCTokens","type":"error"},{"inputs":[],"name":"ResidualTokens","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"interestAccrued","type":"uint256"}],"name":"InterestAccrued","type":"event"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"accrueInterest","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"adapterName","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"comptroller","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getAllDepositTokens","outputs":[{"internalType":"address[]","name":"","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"getDepositToken","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"getRawSupplyRate","outputs":[{"internalType":"uint256","name":"rate","type":"uint256"},{"internalType":"uint8","name":"rateDecimals","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"address","name":"user","type":"address"}],"name":"getSupplyBalance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"address","name":"user","type":"address"}],"name":"getSupplyBalanceView","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"getSupplyCaps","outputs":[{"internalType":"uint256","name":"borrowCap","type":"uint256"},{"internalType":"uint256","name":"supplyCap","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"getTokenInfo","outputs":[{"components":[{"internalType":"address","name":"token","type":"address"},{"internalType":"bool","name":"isCollateral","type":"bool"},{"internalType":"uint256","name":"ltvBps","type":"uint256"},{"internalType":"uint256","name":"liquidationThresholdBps","type":"uint256"},{"internalType":"uint256","name":"rate","type":"uint256"},{"internalType":"uint8","name":"rateDecimals","type":"uint8"}],"internalType":"struct ILendingAdapter.TokenInfo","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"getTokenPriceUsd","outputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getTokens","outputs":[{"components":[{"internalType":"address","name":"token","type":"address"},{"internalType":"bool","name":"isCollateral","type":"bool"},{"internalType":"uint256","name":"ltvBps","type":"uint256"},{"internalType":"uint256","name":"liquidationThresholdBps","type":"uint256"},{"internalType":"uint256","name":"rate","type":"uint256"},{"internalType":"uint8","name":"rateDecimals","type":"uint8"}],"internalType":"struct ILendingAdapter.TokenInfo[]","name":"","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"address","name":"user","type":"address"}],"name":"getWithdrawCallData","outputs":[{"internalType":"address","name":"target","type":"address"},{"internalType":"bytes","name":"callData","type":"bytes"},{"internalType":"address[]","name":"tokensToTransfer","type":"address[]"},{"internalType":"uint256[]","name":"amounts","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"address","name":"","type":"address"}],"name":"supply","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"address","name":"user","type":"address"},{"internalType":"uint256","name":"principal","type":"uint256"}],"name":"viewAccruedInterest","outputs":[{"internalType":"uint256","name":"current","type":"uint256"},{"internalType":"uint256","name":"interest","type":"uint256"},{"internalType":"bool","name":"isAccurate","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"address","name":"user","type":"address"}],"name":"withdrawExternal","outputs":[],"stateMutability":"nonpayable","type":"function"}]

60a06040523480156200001157600080fd5b5060405162003c5538038062003c5583398181016040528101906200003791906200027d565b8173ffffffffffffffffffffffffffffffffffffffff1660808173ffffffffffffffffffffffffffffffffffffffff168152505080600090816200007c91906200052e565b50505062000615565b6000604051905090565b600080fd5b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000620000c68262000099565b9050919050565b620000d881620000b9565b8114620000e457600080fd5b50565b600081519050620000f881620000cd565b92915050565b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b620001538262000108565b810181811067ffffffffffffffff8211171562000175576200017462000119565b5b80604052505050565b60006200018a62000085565b905062000198828262000148565b919050565b600067ffffffffffffffff821115620001bb57620001ba62000119565b5b620001c68262000108565b9050602081019050919050565b60005b83811015620001f3578082015181840152602081019050620001d6565b60008484015250505050565b60006200021662000210846200019d565b6200017e565b90508281526020810184848401111562000235576200023462000103565b5b62000242848285620001d3565b509392505050565b600082601f830112620002625762000261620000fe565b5b815162000274848260208601620001ff565b91505092915050565b600080604083850312156200029757620002966200008f565b5b6000620002a785828601620000e7565b925050602083015167ffffffffffffffff811115620002cb57620002ca62000094565b5b620002d9858286016200024a565b9150509250929050565b600081519050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b600060028204905060018216806200033657607f821691505b6020821081036200034c576200034b620002ee565b5b50919050565b60008190508160005260206000209050919050565b60006020601f8301049050919050565b600082821b905092915050565b600060088302620003b67fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8262000377565b620003c2868362000377565b95508019841693508086168417925050509392505050565b6000819050919050565b6000819050919050565b60006200040f620004096200040384620003da565b620003e4565b620003da565b9050919050565b6000819050919050565b6200042b83620003ee565b620004436200043a8262000416565b84845462000384565b825550505050565b600090565b6200045a6200044b565b6200046781848462000420565b505050565b5b818110156200048f576200048360008262000450565b6001810190506200046d565b5050565b601f821115620004de57620004a88162000352565b620004b38462000367565b81016020851015620004c3578190505b620004db620004d28562000367565b8301826200046c565b50505b505050565b600082821c905092915050565b60006200050360001984600802620004e3565b1980831691505092915050565b60006200051e8383620004f0565b9150826002028217905092915050565b6200053982620002e3565b67ffffffffffffffff81111562000555576200055462000119565b5b6200056182546200031d565b6200056e82828562000493565b600060209050601f831160018114620005a6576000841562000591578287015190505b6200059d858262000510565b8655506200060d565b601f198416620005b68662000352565b60005b82811015620005e057848901518255600182019150602085019450602081019050620005b9565b86831015620006005784890151620005fc601f891682620004f0565b8355505b6001600288020188555050505b505050505050565b60805161360162000654600039600081816105ce015281816107a9015281816109ca01528181610a000152818161114601526119d001526136016000f3fe608060405234801561001057600080fd5b50600436106101165760003560e01c80638b2a4df5116100a2578063b32ccb4611610071578063b32ccb4614610320578063b52da7e31461033c578063ba2865781461036c578063ba3777311461038a578063bd4e5331146103ba57610116565b80638b2a4df5146102985780638bba2e37146102b45780639198e515146102e6578063aa6ca8081461030257610116565b80631f69565f116100e95780631f69565f146101b75780632b1e0666146101e75780635a7d035b146102185780635fe3b56714610249578063782e580d1461026757610116565b806301ffc9a71461011b57806306fdde031461014b57806310c4bfb3146101695780631508bd2414610199575b600080fd5b610135600480360381019061013091906125d7565b6103ed565b604051610142919061261f565b60405180910390f35b610153610537565b60405161016091906126ca565b60405180910390f35b610183600480360381019061017e919061274a565b6105c9565b6040516101909190612786565b60405180910390f35b6101a16107a5565b6040516101ae919061285f565b60405180910390f35b6101d160048036038101906101cc919061274a565b610840565b6040516101de9190612940565b60405180910390f35b61020160048036038101906101fc919061274a565b610866565b60405161020f929190612979565b60405180910390f35b610232600480360381019061022d919061274a565b6108f1565b6040516102409291906129a2565b60405180910390f35b6102516109c8565b60405161025e9190612786565b60405180910390f35b610281600480360381019061027c919061274a565b6109ec565b60405161028f929190612979565b60405180910390f35b6102b260048036038101906102ad91906129f7565b610b9b565b005b6102ce60048036038101906102c99190612a4a565b610e8d565b6040516102dd93929190612a9d565b60405180910390f35b61030060048036038101906102fb919061274a565b610fdd565b005b61030a611140565b6040516103179190612bfe565b60405180910390f35b61033a60048036038101906103359190612c20565b61133a565b005b61035660048036038101906103519190612c20565b611348565b6040516103639190612c60565b60405180910390f35b610374611475565b60405161038191906126ca565b60405180910390f35b6103a4600480360381019061039f9190612c20565b611503565b6040516103b19190612c60565b60405180910390f35b6103d460048036038101906103cf9190612c20565b611594565b6040516103e49493929190612d7f565b60405180910390f35b60007f9bedca85000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614806104b857507fbd4e5331000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916145b8061052057507f2b1e0666000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916145b80610530575061052f826118e7565b5b9050919050565b60606000805461054690612e08565b80601f016020809104026020016040519081016040528092919081815260200182805461057290612e08565b80156105bf5780601f10610594576101008083540402835291602001916105bf565b820191906000526020600020905b8154815290600101906020018083116105a257829003601f168201915b5050505050905090565b6000807f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1663b0772d0b6040518163ffffffff1660e01b8152600401600060405180830381865afa158015610637573d6000803e3d6000fd5b505050506040513d6000823e3d601f19601f820116820180604052508101906106609190612f96565b905060005b81518110156107625781818151811061068157610680612fdf565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff16636f307dc36040518163ffffffff1660e01b8152600401602060405180830381865afa9250505080156106f057506040513d601f19601f820116820180604052508101906106ed919061300e565b60015b1561074f578473ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff160361074d5782828151811061073b5761073a612fdf565b5b602002602001015193505050506107a0565b505b808061075a9061306a565b915050610665565b50826040517f465233c20000000000000000000000000000000000000000000000000000000081526004016107979190612786565b60405180910390fd5b919050565b60607f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1663b0772d0b6040518163ffffffff1660e01b8152600401600060405180830381865afa158015610812573d6000803e3d6000fd5b505050506040513d6000823e3d601f19601f8201168201806040525081019061083b9190612f96565b905090565b61084861251a565b6000610853836105c9565b905061085e81611951565b915050919050565b6000806000610874846105c9565b90508073ffffffffffffffffffffffffffffffffffffffff1663ae9d70b06040518163ffffffff1660e01b8152600401602060405180830381865afa1580156108c1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108e591906130c7565b92506012915050915091565b60008060006108ff846105c9565b90508073ffffffffffffffffffffffffffffffffffffffff16633b1d21a26040518163ffffffff1660e01b8152600401602060405180830381865afa92505050801561096957506040513d601f19601f8201168201806040525081019061096691906130c7565b60015b61099a577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff600092509250506109c3565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff819350935050505b915091565b7f000000000000000000000000000000000000000000000000000000000000000081565b60008060006109fa846105c9565b905060007f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff16637dc0d1d06040518163ffffffff1660e01b8152600401602060405180830381865afa158015610a69573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a8d919061300e565b73ffffffffffffffffffffffffffffffffffffffff1663fc57d4df836040518263ffffffff1660e01b8152600401610ac59190612786565b602060405180830381865afa158015610ae2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b0691906130c7565b905060008573ffffffffffffffffffffffffffffffffffffffff1663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa158015610b55573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b799190613120565b90506000816024610b8a919061314d565b905082819550955050505050915091565b6000610ba6846105c9565b9050610bd53330858773ffffffffffffffffffffffffffffffffffffffff16611c32909392919063ffffffff16565b8373ffffffffffffffffffffffffffffffffffffffff1663095ea7b38260006040518363ffffffff1660e01b8152600401610c119291906131c7565b6020604051808303816000875af1158015610c30573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c54919061321c565b508373ffffffffffffffffffffffffffffffffffffffff1663095ea7b382856040518363ffffffff1660e01b8152600401610c90929190613249565b6020604051808303816000875af1158015610caf573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cd3919061321c565b5060008173ffffffffffffffffffffffffffffffffffffffff1663a0712d68856040518263ffffffff1660e01b8152600401610d0f9190612c60565b6020604051808303816000875af1158015610d2e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d5291906130c7565b14610d89576040517f07637bd800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60008173ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401610dc49190612786565b602060405180830381865afa158015610de1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e0591906130c7565b90508173ffffffffffffffffffffffffffffffffffffffff1663a9059cbb33836040518363ffffffff1660e01b8152600401610e42929190613249565b6020604051808303816000875af1158015610e61573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e85919061321c565b505050505050565b600080600080610e9c876105c9565b905060008173ffffffffffffffffffffffffffffffffffffffff166370a08231886040518263ffffffff1660e01b8152600401610ed99190612786565b602060405180830381865afa158015610ef6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f1a91906130c7565b905060008273ffffffffffffffffffffffffffffffffffffffff1663182df0f56040518163ffffffff1660e01b8152600401602060405180830381865afa158015610f69573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f8d91906130c7565b9050670de0b6b3a76400008183610fa49190613272565b610fae91906132e3565b9550868611610fbe576000610fcb565b8686610fca9190613314565b5b94506000935050505093509350939050565b6000610fe8826105c9565b905060008173ffffffffffffffffffffffffffffffffffffffff1663182df0f56040518163ffffffff1660e01b8152600401602060405180830381865afa158015611037573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061105b91906130c7565b905060008273ffffffffffffffffffffffffffffffffffffffff1663bd6d894d6040518163ffffffff1660e01b81526004016020604051808303816000875af11580156110ac573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110d091906130c7565b90508373ffffffffffffffffffffffffffffffffffffffff167f5e804d42ae3b860f881d11cb44a4bb1f2f0d5b3d081f5539a32d6f97b629d978838311611118576000611125565b83836111249190613314565b5b6040516111329190612c60565b60405180910390a250505050565b606060007f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1663b0772d0b6040518163ffffffff1660e01b8152600401600060405180830381865afa1580156111af573d6000803e3d6000fd5b505050506040513d6000823e3d601f19601f820116820180604052508101906111d89190612f96565b90506000815167ffffffffffffffff8111156111f7576111f6612e3e565b5b60405190808252806020026020018201604052801561123057816020015b61121d61251a565b8152602001906001900390816112155790505b509050600080600090505b835181101561132d5783818151811061125757611256612fdf565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff16636f307dc36040518163ffffffff1660e01b8152600401602060405180830381865afa9250505080156112c657506040513d601f19601f820116820180604052508101906112c3919061300e565b60015b1561131a576112ee8583815181106112e1576112e0612fdf565b5b6020026020010151611951565b8484806112fa9061306a565b95508151811061130d5761130c612fdf565b5b6020026020010181905250505b80806113259061306a565b91505061123b565b5080825281935050505090565b6113448282611cbb565b5050565b600080611354846105c9565b90508073ffffffffffffffffffffffffffffffffffffffff166370a08231846040518263ffffffff1660e01b815260040161138f9190612786565b602060405180830381865afa9250505080156113c957506040513d601f19601f820116820180604052508101906113c691906130c7565b60015b6113d757600091505061146f565b60008273ffffffffffffffffffffffffffffffffffffffff1663182df0f56040518163ffffffff1660e01b8152600401602060405180830381865afa158015611424573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061144891906130c7565b9050670de0b6b3a7640000818361145f9190613272565b61146991906132e3565b93505050505b92915050565b6000805461148290612e08565b80601f01602080910402602001604051908101604052809291908181526020018280546114ae90612e08565b80156114fb5780601f106114d0576101008083540402835291602001916114fb565b820191906000526020600020905b8154815290600101906020018083116114de57829003601f168201915b505050505081565b60008061150f846105c9565b90508073ffffffffffffffffffffffffffffffffffffffff16633af9e669846040518263ffffffff1660e01b815260040161154a9190612786565b602060405180830381865afa158015611567573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061158b91906130c7565b91505092915050565b6000606080606060006115a6876105c9565b905060008173ffffffffffffffffffffffffffffffffffffffff166370a08231886040518263ffffffff1660e01b81526004016115e39190612786565b602060405180830381865afa158015611600573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061162491906130c7565b90506000810361174a573063b32ccb4660e01b898960405160240161164a929190613348565b604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050600067ffffffffffffffff8111156116c2576116c1612e3e565b5b6040519080825280602002602001820160405280156116f05781602001602082028036833780820191505090505b50600067ffffffffffffffff81111561170c5761170b612e3e565b5b60405190808252806020026020018201604052801561173a5781602001602082028036833780820191505090505b50955095509550955050506118de565b6000600167ffffffffffffffff81111561176757611766612e3e565b5b6040519080825280602002602001820160405280156117955781602001602082028036833780820191505090505b50905082816000815181106117ad576117ac612fdf565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250506000600167ffffffffffffffff81111561180457611803612e3e565b5b6040519080825280602002602001820160405280156118325781602001602082028036833780820191505090505b509050828160008151811061184a57611849612fdf565b5b6020026020010181815250503063b32ccb4660e01b8b8b604051602401611872929190613348565b604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff838183161783525050505083839750975097509750505050505b92959194509250565b60007f01ffc9a7000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916149050919050565b61195961251a565b60008273ffffffffffffffffffffffffffffffffffffffff16636f307dc36040518163ffffffff1660e01b8152600401602060405180830381865afa1580156119a6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119ca919061300e565b905060007f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff16638e8f294b856040518263ffffffff1660e01b8152600401611a279190612786565b6040805180830381865afa158015611a43573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a679190613371565b91505060008473ffffffffffffffffffffffffffffffffffffffff1663f3fdb15a6040518163ffffffff1660e01b8152600401602060405180830381865afa158015611ab7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611adb919061300e565b73ffffffffffffffffffffffffffffffffffffffff1663a385fb966040518163ffffffff1660e01b8152600401602060405180830381865afa158015611b25573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b4991906130c7565b90506000818673ffffffffffffffffffffffffffffffffffffffff1663ae9d70b06040518163ffffffff1660e01b8152600401602060405180830381865afa158015611b99573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611bbd91906130c7565b611bc79190613272565b90506040518060c001604052808573ffffffffffffffffffffffffffffffffffffffff1681526020016000851115158152602001655af3107a400085611c0d91906132e3565b815260200160008152602001828152602001601260ff16815250945050505050919050565b611cb5846323b872dd60e01b858585604051602401611c53939291906133b1565b604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050612200565b50505050565b6000611cc6836105c9565b905060008173ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401611d039190612786565b602060405180830381865afa158015611d20573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d4491906130c7565b905060008103611d555750506121fc565b60008273ffffffffffffffffffffffffffffffffffffffff1663bd6d894d6040518163ffffffff1660e01b81526004016020604051808303816000875af1158015611da4573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611dc891906130c7565b90506000670de0b6b3a76400008284611de19190613272565b611deb91906132e3565b905060008473ffffffffffffffffffffffffffffffffffffffff1663852a12e3836040518263ffffffff1660e01b8152600401611e289190612c60565b6020604051808303816000875af1158015611e47573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e6b91906130c7565b14611ea2576040517fa083842d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8373ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401611edb9190612786565b602060405180830381865afa158015611ef8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f1c91906130c7565b92506000831115611fdd5760008473ffffffffffffffffffffffffffffffffffffffff1663db006a75856040518263ffffffff1660e01b8152600401611f629190612c60565b6020604051808303816000875af1158015611f81573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611fa591906130c7565b14611fdc576040517fb4d512fc00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5b60008673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b81526004016120189190612786565b602060405180830381865afa158015612035573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061205991906130c7565b905060008111156120905761208f86828973ffffffffffffffffffffffffffffffffffffffff166122c79092919063ffffffff16565b5b60008573ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b81526004016120cb9190612786565b602060405180830381865afa1580156120e8573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061210c91906130c7565b14612143576040517f8a9fbe3900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60008773ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b815260040161217e9190612786565b602060405180830381865afa15801561219b573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906121bf91906130c7565b146121f6576040517f0f8f1b3300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b50505050505b5050565b6000612262826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff1661234d9092919063ffffffff16565b90506000815111156122c25780806020019051810190612282919061321c565b6122c1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016122b89061345a565b60405180910390fd5b5b505050565b6123488363a9059cbb60e01b84846040516024016122e6929190613249565b604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050612200565b505050565b606061235c8484600085612365565b90509392505050565b6060824710156123aa576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016123a1906134ec565b60405180910390fd5b6000808673ffffffffffffffffffffffffffffffffffffffff1685876040516123d39190613548565b60006040518083038185875af1925050503d8060008114612410576040519150601f19603f3d011682016040523d82523d6000602084013e612415565b606091505b509150915061242687838387612432565b92505050949350505050565b6060831561249457600083510361248c5761244c856124a7565b61248b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612482906135ab565b60405180910390fd5b5b82905061249f565b61249e83836124ca565b5b949350505050565b6000808273ffffffffffffffffffffffffffffffffffffffff163b119050919050565b6000825111156124dd5781518083602001fd5b806040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161251191906126ca565b60405180910390fd5b6040518060c00160405280600073ffffffffffffffffffffffffffffffffffffffff168152602001600015158152602001600081526020016000815260200160008152602001600060ff1681525090565b6000604051905090565b600080fd5b600080fd5b60007fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b6125b48161257f565b81146125bf57600080fd5b50565b6000813590506125d1816125ab565b92915050565b6000602082840312156125ed576125ec612575565b5b60006125fb848285016125c2565b91505092915050565b60008115159050919050565b61261981612604565b82525050565b60006020820190506126346000830184612610565b92915050565b600081519050919050565b600082825260208201905092915050565b60005b83811015612674578082015181840152602081019050612659565b60008484015250505050565b6000601f19601f8301169050919050565b600061269c8261263a565b6126a68185612645565b93506126b6818560208601612656565b6126bf81612680565b840191505092915050565b600060208201905081810360008301526126e48184612691565b905092915050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000612717826126ec565b9050919050565b6127278161270c565b811461273257600080fd5b50565b6000813590506127448161271e565b92915050565b6000602082840312156127605761275f612575565b5b600061276e84828501612735565b91505092915050565b6127808161270c565b82525050565b600060208201905061279b6000830184612777565b92915050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b6127d68161270c565b82525050565b60006127e883836127cd565b60208301905092915050565b6000602082019050919050565b600061280c826127a1565b61281681856127ac565b9350612821836127bd565b8060005b8381101561285257815161283988826127dc565b9750612844836127f4565b925050600181019050612825565b5085935050505092915050565b600060208201905081810360008301526128798184612801565b905092915050565b61288a81612604565b82525050565b6000819050919050565b6128a381612890565b82525050565b600060ff82169050919050565b6128bf816128a9565b82525050565b60c0820160008201516128db60008501826127cd565b5060208201516128ee6020850182612881565b506040820151612901604085018261289a565b506060820151612914606085018261289a565b506080820151612927608085018261289a565b5060a082015161293a60a08501826128b6565b50505050565b600060c08201905061295560008301846128c5565b92915050565b61296481612890565b82525050565b612973816128a9565b82525050565b600060408201905061298e600083018561295b565b61299b602083018461296a565b9392505050565b60006040820190506129b7600083018561295b565b6129c4602083018461295b565b9392505050565b6129d481612890565b81146129df57600080fd5b50565b6000813590506129f1816129cb565b92915050565b600080600060608486031215612a1057612a0f612575565b5b6000612a1e86828701612735565b9350506020612a2f868287016129e2565b9250506040612a4086828701612735565b9150509250925092565b600080600060608486031215612a6357612a62612575565b5b6000612a7186828701612735565b9350506020612a8286828701612735565b9250506040612a93868287016129e2565b9150509250925092565b6000606082019050612ab2600083018661295b565b612abf602083018561295b565b612acc6040830184612610565b949350505050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b60c082016000820151612b1660008501826127cd565b506020820151612b296020850182612881565b506040820151612b3c604085018261289a565b506060820151612b4f606085018261289a565b506080820151612b62608085018261289a565b5060a0820151612b7560a08501826128b6565b50505050565b6000612b878383612b00565b60c08301905092915050565b6000602082019050919050565b6000612bab82612ad4565b612bb58185612adf565b9350612bc083612af0565b8060005b83811015612bf1578151612bd88882612b7b565b9750612be383612b93565b925050600181019050612bc4565b5085935050505092915050565b60006020820190508181036000830152612c188184612ba0565b905092915050565b60008060408385031215612c3757612c36612575565b5b6000612c4585828601612735565b9250506020612c5685828601612735565b9150509250929050565b6000602082019050612c75600083018461295b565b92915050565b600081519050919050565b600082825260208201905092915050565b6000612ca282612c7b565b612cac8185612c86565b9350612cbc818560208601612656565b612cc581612680565b840191505092915050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b6000612d08838361289a565b60208301905092915050565b6000602082019050919050565b6000612d2c82612cd0565b612d368185612cdb565b9350612d4183612cec565b8060005b83811015612d72578151612d598882612cfc565b9750612d6483612d14565b925050600181019050612d45565b5085935050505092915050565b6000608082019050612d946000830187612777565b8181036020830152612da68186612c97565b90508181036040830152612dba8185612801565b90508181036060830152612dce8184612d21565b905095945050505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b60006002820490506001821680612e2057607f821691505b602082108103612e3357612e32612dd9565b5b50919050565b600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b612e7682612680565b810181811067ffffffffffffffff82111715612e9557612e94612e3e565b5b80604052505050565b6000612ea861256b565b9050612eb48282612e6d565b919050565b600067ffffffffffffffff821115612ed457612ed3612e3e565b5b602082029050602081019050919050565b600080fd5b600081519050612ef98161271e565b92915050565b6000612f12612f0d84612eb9565b612e9e565b90508083825260208201905060208402830185811115612f3557612f34612ee5565b5b835b81811015612f5e5780612f4a8882612eea565b845260208401935050602081019050612f37565b5050509392505050565b600082601f830112612f7d57612f7c612e39565b5b8151612f8d848260208601612eff565b91505092915050565b600060208284031215612fac57612fab612575565b5b600082015167ffffffffffffffff811115612fca57612fc961257a565b5b612fd684828501612f68565b91505092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60006020828403121561302457613023612575565b5b600061303284828501612eea565b91505092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b600061307582612890565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82036130a7576130a661303b565b5b600182019050919050565b6000815190506130c1816129cb565b92915050565b6000602082840312156130dd576130dc612575565b5b60006130eb848285016130b2565b91505092915050565b6130fd816128a9565b811461310857600080fd5b50565b60008151905061311a816130f4565b92915050565b60006020828403121561313657613135612575565b5b60006131448482850161310b565b91505092915050565b6000613158826128a9565b9150613163836128a9565b9250828203905060ff81111561317c5761317b61303b565b5b92915050565b6000819050919050565b6000819050919050565b60006131b16131ac6131a784613182565b61318c565b612890565b9050919050565b6131c181613196565b82525050565b60006040820190506131dc6000830185612777565b6131e960208301846131b8565b9392505050565b6131f981612604565b811461320457600080fd5b50565b600081519050613216816131f0565b92915050565b60006020828403121561323257613231612575565b5b600061324084828501613207565b91505092915050565b600060408201905061325e6000830185612777565b61326b602083018461295b565b9392505050565b600061327d82612890565b915061328883612890565b925082820261329681612890565b915082820484148315176132ad576132ac61303b565b5b5092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b60006132ee82612890565b91506132f983612890565b925082613309576133086132b4565b5b828204905092915050565b600061331f82612890565b915061332a83612890565b92508282039050818111156133425761334161303b565b5b92915050565b600060408201905061335d6000830185612777565b61336a6020830184612777565b9392505050565b6000806040838503121561338857613387612575565b5b600061339685828601613207565b92505060206133a7858286016130b2565b9150509250929050565b60006060820190506133c66000830186612777565b6133d36020830185612777565b6133e0604083018461295b565b949350505050565b7f5361666545524332303a204552433230206f7065726174696f6e20646964206e60008201527f6f74207375636365656400000000000000000000000000000000000000000000602082015250565b6000613444602a83612645565b915061344f826133e8565b604082019050919050565b6000602082019050818103600083015261347381613437565b9050919050565b7f416464726573733a20696e73756666696369656e742062616c616e636520666f60008201527f722063616c6c0000000000000000000000000000000000000000000000000000602082015250565b60006134d6602683612645565b91506134e18261347a565b604082019050919050565b60006020820190508181036000830152613505816134c9565b9050919050565b600081905092915050565b600061352282612c7b565b61352c818561350c565b935061353c818560208601612656565b80840191505092915050565b60006135548284613517565b915081905092915050565b7f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000600082015250565b6000613595601d83612645565b91506135a08261355f565b602082019050919050565b600060208201905081810360008301526135c481613588565b905091905056fea2646970667358221220154fca2b3df2ac9f0279a2756125eba60103bd249945f4a12d962e9f6c5f8efa64736f6c634300081300330000000000000000000000001b4d3b0421ddc1eb216d230bc01527422fb93103000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000054d616c6461000000000000000000000000000000000000000000000000000000

Deployed Bytecode

0x608060405234801561001057600080fd5b50600436106101165760003560e01c80638b2a4df5116100a2578063b32ccb4611610071578063b32ccb4614610320578063b52da7e31461033c578063ba2865781461036c578063ba3777311461038a578063bd4e5331146103ba57610116565b80638b2a4df5146102985780638bba2e37146102b45780639198e515146102e6578063aa6ca8081461030257610116565b80631f69565f116100e95780631f69565f146101b75780632b1e0666146101e75780635a7d035b146102185780635fe3b56714610249578063782e580d1461026757610116565b806301ffc9a71461011b57806306fdde031461014b57806310c4bfb3146101695780631508bd2414610199575b600080fd5b610135600480360381019061013091906125d7565b6103ed565b604051610142919061261f565b60405180910390f35b610153610537565b60405161016091906126ca565b60405180910390f35b610183600480360381019061017e919061274a565b6105c9565b6040516101909190612786565b60405180910390f35b6101a16107a5565b6040516101ae919061285f565b60405180910390f35b6101d160048036038101906101cc919061274a565b610840565b6040516101de9190612940565b60405180910390f35b61020160048036038101906101fc919061274a565b610866565b60405161020f929190612979565b60405180910390f35b610232600480360381019061022d919061274a565b6108f1565b6040516102409291906129a2565b60405180910390f35b6102516109c8565b60405161025e9190612786565b60405180910390f35b610281600480360381019061027c919061274a565b6109ec565b60405161028f929190612979565b60405180910390f35b6102b260048036038101906102ad91906129f7565b610b9b565b005b6102ce60048036038101906102c99190612a4a565b610e8d565b6040516102dd93929190612a9d565b60405180910390f35b61030060048036038101906102fb919061274a565b610fdd565b005b61030a611140565b6040516103179190612bfe565b60405180910390f35b61033a60048036038101906103359190612c20565b61133a565b005b61035660048036038101906103519190612c20565b611348565b6040516103639190612c60565b60405180910390f35b610374611475565b60405161038191906126ca565b60405180910390f35b6103a4600480360381019061039f9190612c20565b611503565b6040516103b19190612c60565b60405180910390f35b6103d460048036038101906103cf9190612c20565b611594565b6040516103e49493929190612d7f565b60405180910390f35b60007f9bedca85000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614806104b857507fbd4e5331000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916145b8061052057507f2b1e0666000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916145b80610530575061052f826118e7565b5b9050919050565b60606000805461054690612e08565b80601f016020809104026020016040519081016040528092919081815260200182805461057290612e08565b80156105bf5780601f10610594576101008083540402835291602001916105bf565b820191906000526020600020905b8154815290600101906020018083116105a257829003601f168201915b5050505050905090565b6000807f0000000000000000000000001b4d3b0421ddc1eb216d230bc01527422fb9310373ffffffffffffffffffffffffffffffffffffffff1663b0772d0b6040518163ffffffff1660e01b8152600401600060405180830381865afa158015610637573d6000803e3d6000fd5b505050506040513d6000823e3d601f19601f820116820180604052508101906106609190612f96565b905060005b81518110156107625781818151811061068157610680612fdf565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff16636f307dc36040518163ffffffff1660e01b8152600401602060405180830381865afa9250505080156106f057506040513d601f19601f820116820180604052508101906106ed919061300e565b60015b1561074f578473ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff160361074d5782828151811061073b5761073a612fdf565b5b602002602001015193505050506107a0565b505b808061075a9061306a565b915050610665565b50826040517f465233c20000000000000000000000000000000000000000000000000000000081526004016107979190612786565b60405180910390fd5b919050565b60607f0000000000000000000000001b4d3b0421ddc1eb216d230bc01527422fb9310373ffffffffffffffffffffffffffffffffffffffff1663b0772d0b6040518163ffffffff1660e01b8152600401600060405180830381865afa158015610812573d6000803e3d6000fd5b505050506040513d6000823e3d601f19601f8201168201806040525081019061083b9190612f96565b905090565b61084861251a565b6000610853836105c9565b905061085e81611951565b915050919050565b6000806000610874846105c9565b90508073ffffffffffffffffffffffffffffffffffffffff1663ae9d70b06040518163ffffffff1660e01b8152600401602060405180830381865afa1580156108c1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108e591906130c7565b92506012915050915091565b60008060006108ff846105c9565b90508073ffffffffffffffffffffffffffffffffffffffff16633b1d21a26040518163ffffffff1660e01b8152600401602060405180830381865afa92505050801561096957506040513d601f19601f8201168201806040525081019061096691906130c7565b60015b61099a577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff600092509250506109c3565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff819350935050505b915091565b7f0000000000000000000000001b4d3b0421ddc1eb216d230bc01527422fb9310381565b60008060006109fa846105c9565b905060007f0000000000000000000000001b4d3b0421ddc1eb216d230bc01527422fb9310373ffffffffffffffffffffffffffffffffffffffff16637dc0d1d06040518163ffffffff1660e01b8152600401602060405180830381865afa158015610a69573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a8d919061300e565b73ffffffffffffffffffffffffffffffffffffffff1663fc57d4df836040518263ffffffff1660e01b8152600401610ac59190612786565b602060405180830381865afa158015610ae2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b0691906130c7565b905060008573ffffffffffffffffffffffffffffffffffffffff1663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa158015610b55573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b799190613120565b90506000816024610b8a919061314d565b905082819550955050505050915091565b6000610ba6846105c9565b9050610bd53330858773ffffffffffffffffffffffffffffffffffffffff16611c32909392919063ffffffff16565b8373ffffffffffffffffffffffffffffffffffffffff1663095ea7b38260006040518363ffffffff1660e01b8152600401610c119291906131c7565b6020604051808303816000875af1158015610c30573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c54919061321c565b508373ffffffffffffffffffffffffffffffffffffffff1663095ea7b382856040518363ffffffff1660e01b8152600401610c90929190613249565b6020604051808303816000875af1158015610caf573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cd3919061321c565b5060008173ffffffffffffffffffffffffffffffffffffffff1663a0712d68856040518263ffffffff1660e01b8152600401610d0f9190612c60565b6020604051808303816000875af1158015610d2e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d5291906130c7565b14610d89576040517f07637bd800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60008173ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401610dc49190612786565b602060405180830381865afa158015610de1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e0591906130c7565b90508173ffffffffffffffffffffffffffffffffffffffff1663a9059cbb33836040518363ffffffff1660e01b8152600401610e42929190613249565b6020604051808303816000875af1158015610e61573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e85919061321c565b505050505050565b600080600080610e9c876105c9565b905060008173ffffffffffffffffffffffffffffffffffffffff166370a08231886040518263ffffffff1660e01b8152600401610ed99190612786565b602060405180830381865afa158015610ef6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f1a91906130c7565b905060008273ffffffffffffffffffffffffffffffffffffffff1663182df0f56040518163ffffffff1660e01b8152600401602060405180830381865afa158015610f69573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f8d91906130c7565b9050670de0b6b3a76400008183610fa49190613272565b610fae91906132e3565b9550868611610fbe576000610fcb565b8686610fca9190613314565b5b94506000935050505093509350939050565b6000610fe8826105c9565b905060008173ffffffffffffffffffffffffffffffffffffffff1663182df0f56040518163ffffffff1660e01b8152600401602060405180830381865afa158015611037573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061105b91906130c7565b905060008273ffffffffffffffffffffffffffffffffffffffff1663bd6d894d6040518163ffffffff1660e01b81526004016020604051808303816000875af11580156110ac573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110d091906130c7565b90508373ffffffffffffffffffffffffffffffffffffffff167f5e804d42ae3b860f881d11cb44a4bb1f2f0d5b3d081f5539a32d6f97b629d978838311611118576000611125565b83836111249190613314565b5b6040516111329190612c60565b60405180910390a250505050565b606060007f0000000000000000000000001b4d3b0421ddc1eb216d230bc01527422fb9310373ffffffffffffffffffffffffffffffffffffffff1663b0772d0b6040518163ffffffff1660e01b8152600401600060405180830381865afa1580156111af573d6000803e3d6000fd5b505050506040513d6000823e3d601f19601f820116820180604052508101906111d89190612f96565b90506000815167ffffffffffffffff8111156111f7576111f6612e3e565b5b60405190808252806020026020018201604052801561123057816020015b61121d61251a565b8152602001906001900390816112155790505b509050600080600090505b835181101561132d5783818151811061125757611256612fdf565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff16636f307dc36040518163ffffffff1660e01b8152600401602060405180830381865afa9250505080156112c657506040513d601f19601f820116820180604052508101906112c3919061300e565b60015b1561131a576112ee8583815181106112e1576112e0612fdf565b5b6020026020010151611951565b8484806112fa9061306a565b95508151811061130d5761130c612fdf565b5b6020026020010181905250505b80806113259061306a565b91505061123b565b5080825281935050505090565b6113448282611cbb565b5050565b600080611354846105c9565b90508073ffffffffffffffffffffffffffffffffffffffff166370a08231846040518263ffffffff1660e01b815260040161138f9190612786565b602060405180830381865afa9250505080156113c957506040513d601f19601f820116820180604052508101906113c691906130c7565b60015b6113d757600091505061146f565b60008273ffffffffffffffffffffffffffffffffffffffff1663182df0f56040518163ffffffff1660e01b8152600401602060405180830381865afa158015611424573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061144891906130c7565b9050670de0b6b3a7640000818361145f9190613272565b61146991906132e3565b93505050505b92915050565b6000805461148290612e08565b80601f01602080910402602001604051908101604052809291908181526020018280546114ae90612e08565b80156114fb5780601f106114d0576101008083540402835291602001916114fb565b820191906000526020600020905b8154815290600101906020018083116114de57829003601f168201915b505050505081565b60008061150f846105c9565b90508073ffffffffffffffffffffffffffffffffffffffff16633af9e669846040518263ffffffff1660e01b815260040161154a9190612786565b602060405180830381865afa158015611567573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061158b91906130c7565b91505092915050565b6000606080606060006115a6876105c9565b905060008173ffffffffffffffffffffffffffffffffffffffff166370a08231886040518263ffffffff1660e01b81526004016115e39190612786565b602060405180830381865afa158015611600573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061162491906130c7565b90506000810361174a573063b32ccb4660e01b898960405160240161164a929190613348565b604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050600067ffffffffffffffff8111156116c2576116c1612e3e565b5b6040519080825280602002602001820160405280156116f05781602001602082028036833780820191505090505b50600067ffffffffffffffff81111561170c5761170b612e3e565b5b60405190808252806020026020018201604052801561173a5781602001602082028036833780820191505090505b50955095509550955050506118de565b6000600167ffffffffffffffff81111561176757611766612e3e565b5b6040519080825280602002602001820160405280156117955781602001602082028036833780820191505090505b50905082816000815181106117ad576117ac612fdf565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250506000600167ffffffffffffffff81111561180457611803612e3e565b5b6040519080825280602002602001820160405280156118325781602001602082028036833780820191505090505b509050828160008151811061184a57611849612fdf565b5b6020026020010181815250503063b32ccb4660e01b8b8b604051602401611872929190613348565b604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff838183161783525050505083839750975097509750505050505b92959194509250565b60007f01ffc9a7000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916149050919050565b61195961251a565b60008273ffffffffffffffffffffffffffffffffffffffff16636f307dc36040518163ffffffff1660e01b8152600401602060405180830381865afa1580156119a6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119ca919061300e565b905060007f0000000000000000000000001b4d3b0421ddc1eb216d230bc01527422fb9310373ffffffffffffffffffffffffffffffffffffffff16638e8f294b856040518263ffffffff1660e01b8152600401611a279190612786565b6040805180830381865afa158015611a43573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a679190613371565b91505060008473ffffffffffffffffffffffffffffffffffffffff1663f3fdb15a6040518163ffffffff1660e01b8152600401602060405180830381865afa158015611ab7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611adb919061300e565b73ffffffffffffffffffffffffffffffffffffffff1663a385fb966040518163ffffffff1660e01b8152600401602060405180830381865afa158015611b25573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b4991906130c7565b90506000818673ffffffffffffffffffffffffffffffffffffffff1663ae9d70b06040518163ffffffff1660e01b8152600401602060405180830381865afa158015611b99573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611bbd91906130c7565b611bc79190613272565b90506040518060c001604052808573ffffffffffffffffffffffffffffffffffffffff1681526020016000851115158152602001655af3107a400085611c0d91906132e3565b815260200160008152602001828152602001601260ff16815250945050505050919050565b611cb5846323b872dd60e01b858585604051602401611c53939291906133b1565b604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050612200565b50505050565b6000611cc6836105c9565b905060008173ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401611d039190612786565b602060405180830381865afa158015611d20573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d4491906130c7565b905060008103611d555750506121fc565b60008273ffffffffffffffffffffffffffffffffffffffff1663bd6d894d6040518163ffffffff1660e01b81526004016020604051808303816000875af1158015611da4573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611dc891906130c7565b90506000670de0b6b3a76400008284611de19190613272565b611deb91906132e3565b905060008473ffffffffffffffffffffffffffffffffffffffff1663852a12e3836040518263ffffffff1660e01b8152600401611e289190612c60565b6020604051808303816000875af1158015611e47573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e6b91906130c7565b14611ea2576040517fa083842d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8373ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401611edb9190612786565b602060405180830381865afa158015611ef8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f1c91906130c7565b92506000831115611fdd5760008473ffffffffffffffffffffffffffffffffffffffff1663db006a75856040518263ffffffff1660e01b8152600401611f629190612c60565b6020604051808303816000875af1158015611f81573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611fa591906130c7565b14611fdc576040517fb4d512fc00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5b60008673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b81526004016120189190612786565b602060405180830381865afa158015612035573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061205991906130c7565b905060008111156120905761208f86828973ffffffffffffffffffffffffffffffffffffffff166122c79092919063ffffffff16565b5b60008573ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b81526004016120cb9190612786565b602060405180830381865afa1580156120e8573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061210c91906130c7565b14612143576040517f8a9fbe3900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60008773ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b815260040161217e9190612786565b602060405180830381865afa15801561219b573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906121bf91906130c7565b146121f6576040517f0f8f1b3300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b50505050505b5050565b6000612262826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff1661234d9092919063ffffffff16565b90506000815111156122c25780806020019051810190612282919061321c565b6122c1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016122b89061345a565b60405180910390fd5b5b505050565b6123488363a9059cbb60e01b84846040516024016122e6929190613249565b604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050612200565b505050565b606061235c8484600085612365565b90509392505050565b6060824710156123aa576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016123a1906134ec565b60405180910390fd5b6000808673ffffffffffffffffffffffffffffffffffffffff1685876040516123d39190613548565b60006040518083038185875af1925050503d8060008114612410576040519150601f19603f3d011682016040523d82523d6000602084013e612415565b606091505b509150915061242687838387612432565b92505050949350505050565b6060831561249457600083510361248c5761244c856124a7565b61248b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612482906135ab565b60405180910390fd5b5b82905061249f565b61249e83836124ca565b5b949350505050565b6000808273ffffffffffffffffffffffffffffffffffffffff163b119050919050565b6000825111156124dd5781518083602001fd5b806040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161251191906126ca565b60405180910390fd5b6040518060c00160405280600073ffffffffffffffffffffffffffffffffffffffff168152602001600015158152602001600081526020016000815260200160008152602001600060ff1681525090565b6000604051905090565b600080fd5b600080fd5b60007fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b6125b48161257f565b81146125bf57600080fd5b50565b6000813590506125d1816125ab565b92915050565b6000602082840312156125ed576125ec612575565b5b60006125fb848285016125c2565b91505092915050565b60008115159050919050565b61261981612604565b82525050565b60006020820190506126346000830184612610565b92915050565b600081519050919050565b600082825260208201905092915050565b60005b83811015612674578082015181840152602081019050612659565b60008484015250505050565b6000601f19601f8301169050919050565b600061269c8261263a565b6126a68185612645565b93506126b6818560208601612656565b6126bf81612680565b840191505092915050565b600060208201905081810360008301526126e48184612691565b905092915050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000612717826126ec565b9050919050565b6127278161270c565b811461273257600080fd5b50565b6000813590506127448161271e565b92915050565b6000602082840312156127605761275f612575565b5b600061276e84828501612735565b91505092915050565b6127808161270c565b82525050565b600060208201905061279b6000830184612777565b92915050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b6127d68161270c565b82525050565b60006127e883836127cd565b60208301905092915050565b6000602082019050919050565b600061280c826127a1565b61281681856127ac565b9350612821836127bd565b8060005b8381101561285257815161283988826127dc565b9750612844836127f4565b925050600181019050612825565b5085935050505092915050565b600060208201905081810360008301526128798184612801565b905092915050565b61288a81612604565b82525050565b6000819050919050565b6128a381612890565b82525050565b600060ff82169050919050565b6128bf816128a9565b82525050565b60c0820160008201516128db60008501826127cd565b5060208201516128ee6020850182612881565b506040820151612901604085018261289a565b506060820151612914606085018261289a565b506080820151612927608085018261289a565b5060a082015161293a60a08501826128b6565b50505050565b600060c08201905061295560008301846128c5565b92915050565b61296481612890565b82525050565b612973816128a9565b82525050565b600060408201905061298e600083018561295b565b61299b602083018461296a565b9392505050565b60006040820190506129b7600083018561295b565b6129c4602083018461295b565b9392505050565b6129d481612890565b81146129df57600080fd5b50565b6000813590506129f1816129cb565b92915050565b600080600060608486031215612a1057612a0f612575565b5b6000612a1e86828701612735565b9350506020612a2f868287016129e2565b9250506040612a4086828701612735565b9150509250925092565b600080600060608486031215612a6357612a62612575565b5b6000612a7186828701612735565b9350506020612a8286828701612735565b9250506040612a93868287016129e2565b9150509250925092565b6000606082019050612ab2600083018661295b565b612abf602083018561295b565b612acc6040830184612610565b949350505050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b60c082016000820151612b1660008501826127cd565b506020820151612b296020850182612881565b506040820151612b3c604085018261289a565b506060820151612b4f606085018261289a565b506080820151612b62608085018261289a565b5060a0820151612b7560a08501826128b6565b50505050565b6000612b878383612b00565b60c08301905092915050565b6000602082019050919050565b6000612bab82612ad4565b612bb58185612adf565b9350612bc083612af0565b8060005b83811015612bf1578151612bd88882612b7b565b9750612be383612b93565b925050600181019050612bc4565b5085935050505092915050565b60006020820190508181036000830152612c188184612ba0565b905092915050565b60008060408385031215612c3757612c36612575565b5b6000612c4585828601612735565b9250506020612c5685828601612735565b9150509250929050565b6000602082019050612c75600083018461295b565b92915050565b600081519050919050565b600082825260208201905092915050565b6000612ca282612c7b565b612cac8185612c86565b9350612cbc818560208601612656565b612cc581612680565b840191505092915050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b6000612d08838361289a565b60208301905092915050565b6000602082019050919050565b6000612d2c82612cd0565b612d368185612cdb565b9350612d4183612cec565b8060005b83811015612d72578151612d598882612cfc565b9750612d6483612d14565b925050600181019050612d45565b5085935050505092915050565b6000608082019050612d946000830187612777565b8181036020830152612da68186612c97565b90508181036040830152612dba8185612801565b90508181036060830152612dce8184612d21565b905095945050505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b60006002820490506001821680612e2057607f821691505b602082108103612e3357612e32612dd9565b5b50919050565b600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b612e7682612680565b810181811067ffffffffffffffff82111715612e9557612e94612e3e565b5b80604052505050565b6000612ea861256b565b9050612eb48282612e6d565b919050565b600067ffffffffffffffff821115612ed457612ed3612e3e565b5b602082029050602081019050919050565b600080fd5b600081519050612ef98161271e565b92915050565b6000612f12612f0d84612eb9565b612e9e565b90508083825260208201905060208402830185811115612f3557612f34612ee5565b5b835b81811015612f5e5780612f4a8882612eea565b845260208401935050602081019050612f37565b5050509392505050565b600082601f830112612f7d57612f7c612e39565b5b8151612f8d848260208601612eff565b91505092915050565b600060208284031215612fac57612fab612575565b5b600082015167ffffffffffffffff811115612fca57612fc961257a565b5b612fd684828501612f68565b91505092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60006020828403121561302457613023612575565b5b600061303284828501612eea565b91505092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b600061307582612890565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82036130a7576130a661303b565b5b600182019050919050565b6000815190506130c1816129cb565b92915050565b6000602082840312156130dd576130dc612575565b5b60006130eb848285016130b2565b91505092915050565b6130fd816128a9565b811461310857600080fd5b50565b60008151905061311a816130f4565b92915050565b60006020828403121561313657613135612575565b5b60006131448482850161310b565b91505092915050565b6000613158826128a9565b9150613163836128a9565b9250828203905060ff81111561317c5761317b61303b565b5b92915050565b6000819050919050565b6000819050919050565b60006131b16131ac6131a784613182565b61318c565b612890565b9050919050565b6131c181613196565b82525050565b60006040820190506131dc6000830185612777565b6131e960208301846131b8565b9392505050565b6131f981612604565b811461320457600080fd5b50565b600081519050613216816131f0565b92915050565b60006020828403121561323257613231612575565b5b600061324084828501613207565b91505092915050565b600060408201905061325e6000830185612777565b61326b602083018461295b565b9392505050565b600061327d82612890565b915061328883612890565b925082820261329681612890565b915082820484148315176132ad576132ac61303b565b5b5092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b60006132ee82612890565b91506132f983612890565b925082613309576133086132b4565b5b828204905092915050565b600061331f82612890565b915061332a83612890565b92508282039050818111156133425761334161303b565b5b92915050565b600060408201905061335d6000830185612777565b61336a6020830184612777565b9392505050565b6000806040838503121561338857613387612575565b5b600061339685828601613207565b92505060206133a7858286016130b2565b9150509250929050565b60006060820190506133c66000830186612777565b6133d36020830185612777565b6133e0604083018461295b565b949350505050565b7f5361666545524332303a204552433230206f7065726174696f6e20646964206e60008201527f6f74207375636365656400000000000000000000000000000000000000000000602082015250565b6000613444602a83612645565b915061344f826133e8565b604082019050919050565b6000602082019050818103600083015261347381613437565b9050919050565b7f416464726573733a20696e73756666696369656e742062616c616e636520666f60008201527f722063616c6c0000000000000000000000000000000000000000000000000000602082015250565b60006134d6602683612645565b91506134e18261347a565b604082019050919050565b60006020820190508181036000830152613505816134c9565b9050919050565b600081905092915050565b600061352282612c7b565b61352c818561350c565b935061353c818560208601612656565b80840191505092915050565b60006135548284613517565b915081905092915050565b7f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000600082015250565b6000613595601d83612645565b91506135a08261355f565b602082019050919050565b600060208201905081810360008301526135c481613588565b905091905056fea2646970667358221220154fca2b3df2ac9f0279a2756125eba60103bd249945f4a12d962e9f6c5f8efa64736f6c63430008130033

Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)

0000000000000000000000001b4d3b0421ddc1eb216d230bc01527422fb93103000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000054d616c6461000000000000000000000000000000000000000000000000000000

-----Decoded View---------------
Arg [0] : _comptroller (address): 0x1b4d3b0421dDc1eB216D230Bc01527422Fb93103
Arg [1] : name_ (string): Malda

-----Encoded View---------------
4 Constructor Arguments found :
Arg [0] : 0000000000000000000000001b4d3b0421ddc1eb216d230bc01527422fb93103
Arg [1] : 0000000000000000000000000000000000000000000000000000000000000040
Arg [2] : 0000000000000000000000000000000000000000000000000000000000000005
Arg [3] : 4d616c6461000000000000000000000000000000000000000000000000000000


Block Transaction Gas Used Reward
view all blocks sequenced

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
[ 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.