MNT Price: $0.87 (+2.06%)

Contract

0x0921D7B5677E9Fb4178b5235CE061A2Ba028c7A5
 

Overview

MNT Balance

Mantle Mainnet Network LogoMantle Mainnet Network LogoMantle Mainnet Network Logo0 MNT

MNT Value

$0.00

More Info

Private Name Tags

Multichain Info

No addresses found
Transaction Hash
Block
From
To

There are no matching entries

Please try again later

View more zero value Internal Transactions in Advanced View mode

Advanced mode:

Cross-Chain Transactions
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
DelegatedLenderVault

Compiler Version
v0.8.19+commit.7dd6d404

Optimization Enabled:
Yes with 1002 runs

Other Settings:
paris EvmVersion
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.19;

import "@openzeppelin/contracts/security/Pausable.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/utils/Multicall.sol";
import {DataTypes} from "../libraries/DataTypes.sol";
import {IERC20Decimals} from "../interfaces/IERC20Decimals.sol";
import {Errors} from "../libraries/Errors.sol";
import {ILoanTaker} from "../interfaces/ILoanTaker.sol";
import {IIntentStrategy} from "../interfaces/IIntentStrategy.sol";
import {IRegistryV2} from "./interfaces/IRegistryV2.sol";
import {IDLV} from "./interfaces/IDLV.sol";

/**
 * IDEA: Make a lender vault with only one intent at any given time
 * this intent has a strike price coming from another "strategy" contract
 * that relies on an oracle to get spot price of a token and applying
 * a discount factor on it.
 */
contract DelegatedLenderVault is IDLV, ReentrancyGuard, Pausable, Ownable, Multicall {
  using SafeERC20 for IERC20Decimals;

  event CreateLoan(
    address indexed loan,
    address borrower,
    uint256 borrowAmtReceived,
    DataTypes.LoanData data,
    DataTypes.BorrowParams borrowParams
  );
  event Withdraw(address token, uint256 amount);
  event Deposit(uint256 amount);
  event UpgradeLoanImplementation(address newImplementation);

  uint256 internal constant INTEREST_BASE_UNIT = 1e18;

  DataTypes.IntentCollectionV2 internal baseCollection;

  uint8 internal collTokenDecimals;
  bool internal initialized;
  IIntentStrategy public strategy;
  IRegistryV2 public registry;
  address public loanImpl;

  function initialize(address _loanImpl, address _strategy, address _owner) public {
    if (initialized) revert Errors.DLV_AlreadyInitialized();

    initialized = true;
    loanImpl = _loanImpl;
    strategy = IIntentStrategy(_strategy);
    registry = IRegistryV2(msg.sender);

    baseCollection.collToken = strategy.collToken();
    baseCollection.borrowToken = strategy.borrowToken();

    collTokenDecimals = IERC20Decimals(baseCollection.collToken).decimals();

    _transferOwnership(_owner);
  }

  /* -------------------------- Owner only functions -------------------------- */

  /// @notice Pauses the vault
  /// @dev Can only be called by the owner or the pauseGuardian
  function pauseVault() external onlyOwner {
    _pause();
  }

  /// @notice Unpauses the vault
  /// @dev Can only be called by the owner or the unpauseGuardian
  function unpauseVault() external onlyOwner {
    _unpause();
  }

  function withdraw(address token, uint256 amount) external nonReentrant onlyOwner {
    if (amount == 0) revert Errors.ZeroAmtProvided();

    uint256 balance = IERC20Decimals(token).balanceOf(address(this));

    if (amount > balance) revert Errors.AmtExceedsBalance();

    emit Withdraw(token, amount);

    IERC20Decimals(token).safeTransfer(owner(), amount);
  }

  function deposit(uint256 amount) external nonReentrant onlyOwner {
    if (amount == 0) revert Errors.ZeroAmtProvided();

    emit Deposit(amount);

    IERC20Decimals(baseCollection.borrowToken).safeTransferFrom(msg.sender, address(this), amount);
  }

  function upgradeLoanImplementation(address newImplementation) external nonReentrant onlyOwner {
    if (newImplementation == address(0)) revert Errors.ZeroAddressProvided();
    if (newImplementation == loanImpl) revert Errors.DLV_SameLoanImplementation();

    registry.loanImplUpgradeHook(loanImpl, newImplementation);

    emit UpgradeLoanImplementation(newImplementation);

    loanImpl = newImplementation;
  }

  /* --------------------------- Loan creation logic -------------------------- */

  /// @notice Creates a new loan contract and transfers the loan amount to the borrower.
  /// @dev The function first matches the borrow parameters with the intent and calculates the loan amount.
  ///      It then creates a new loan contract and transfers the loan amount to the borrower.
  ///      If the borrower has provided data, it calls the sourceCollateral function on the borrower.
  ///      Finally, it transfers the collateral amount from the borrower to the loan contract.
  /// @param bParams The borrow parameters provided by the borrower.
  /// @param data The data provided by the borrower for sourcing collateral.
  /// @return loanContract The address of the newly created loan contract.
  function createLoan(DataTypes.BorrowParams calldata bParams, bytes calldata data)
    external
    whenNotPaused
    nonReentrant
    returns (address loanContract)
  {
    /// @dev match the borrow parameters with the intent and calculate the loan amount
    (DataTypes.IntentCollectionV2 memory c, uint256 loanAmount) = _matchBorrowParams(bParams);

    /// @dev apply the premium, platformFee on the loan and calculate the amount the borrower should receive
    (uint256 borrowAmtReceived, uint256 takerPlusMakerFee) =
      _getBorrowAmountMinusPremFee(loanAmount, c.intents[0].interestRate);

    if (borrowAmtReceived == 0) revert Errors.InvalidBorrowAmtReceived();

    /// @dev create a new loan
    DataTypes.LoanData memory loanData = DataTypes.LoanData({
      borrower: msg.sender,
      lenderVault: address(this),
      collToken: c.collToken,
      borrowToken: c.borrowToken,
      collAmt: bParams.collAmt,
      borrowAmt: loanAmount,
      repaidAmt: 0,
      expiresAt: block.timestamp + c.intents[0].duration
    });

    /// @dev transfer the borrow amount to the borrower
    IERC20Decimals(c.borrowToken).safeTransfer(msg.sender, borrowAmtReceived); // optimistically transfer tokens

    /// @notice only transfer fee, if there is fee
    if (takerPlusMakerFee > 0) {
      /// @dev transfer the takerPlusMakerFee to registry
      IERC20Decimals(c.borrowToken).safeTransfer(address(registry), takerPlusMakerFee);
    }

    /// @dev deploy the loan contract
    loanContract = registry.deployLoan(loanImpl, loanData);

    emit CreateLoan(loanContract, msg.sender, borrowAmtReceived, loanData, bParams);

    /// @dev if any data is passed, we do a callback to the msg.sender, for sourcing collateral
    if (data.length != 0) {
      ILoanTaker(msg.sender).sourceCollateral(loanContract, data);
    }

    /// @dev transfer the collateral amount from the borrower to the loan contract
    /// @dev in case this fails the entire tx fails, serves as a check too
    IERC20Decimals(c.collToken).safeTransferFrom(msg.sender, loanContract, bParams.collAmt);
  }

  /* --------------------------- Internal Functions --------------------------- */

  /// @notice Matches the borrow parameters with the intent and calculates the loan amount
  /// @dev This function is used to calculate the loan amount based on the borrow parameters and intent
  /// @param bParams The borrow parameters
  /// @return c The intent collection
  /// @return loanAmount The calculated loan amount
  function _matchBorrowParams(DataTypes.BorrowParams calldata bParams)
    internal
    view
    returns (DataTypes.IntentCollectionV2 memory, uint256)
  {
    if (bParams.collectionId != 1) revert Errors.CollectionDoesNotExist();
    if (bParams.intentId != 0) revert Errors.InvalidIntent();

    (bool invalidHealth, DataTypes.IntentCollectionV2 memory c) = getPopulatedCollection();

    if (invalidHealth) revert Errors.StrategyUnhealthy();

    uint256 loanAmount = (bParams.collAmt * c.intents[0].strikePrice) / (10 ** uint256(collTokenDecimals));

    return (c, loanAmount);
  }

  /// @notice Calculates the borrow amount minus the premium fee
  /// @dev This function calculates the amount the borrower will receive after subtracting the premium fee. It also calculates the sum of taker and maker fees.
  /// @param loanAmount The total loan amount
  /// @param interestRate The interest rate for the loan
  /// @return borrowAmtReceived The amount the borrower will receive after subtracting the premium fee
  /// @return takerPlusMakerFee The sum of taker and maker fees
  function _getBorrowAmountMinusPremFee(uint256 loanAmount, uint256 interestRate)
    internal
    view
    returns (uint256 borrowAmtReceived, uint256 takerPlusMakerFee)
  {
    /// @dev calculate the premium on the loan using the interest rate for the tenure
    /// @notice totalPremium is substracted from loanAmount, thus being charged to the borrower.
    /// @notice only taker fee is charged to borrower, not maker fee.
    uint256 totalPremium = (loanAmount * interestRate) / INTEREST_BASE_UNIT;

    (uint256 _makerFee, uint256 _takerFee) = registry.getMakerTakerFee();

    /// @dev calculate the takerFee
    uint256 takerFee = (totalPremium * _takerFee) / INTEREST_BASE_UNIT;

    /// @dev calculate the makerFee
    /// @notice we don't need a check for makerFee > lenderPremium, because makerFee is always <= premium
    uint256 makerFee = (totalPremium * _makerFee) / INTEREST_BASE_UNIT;

    /// @dev add takerFee to totalPremium, since it is charged to borrower
    totalPremium += takerFee;

    /// @dev check if the totalPremium is greater than the loan amount
    if (totalPremium > loanAmount) revert Errors.PremiumGtLoanAmt();

    /// @dev calculate the amount the borrower will receive. loanAmount - totalPremium
    borrowAmtReceived = loanAmount - totalPremium;
    takerPlusMakerFee = takerFee + makerFee;
  }

  function getPopulatedCollection() public view returns (bool invalidHealth, DataTypes.IntentCollectionV2 memory c) {
    DataTypes.Intent[] memory intents = new DataTypes.Intent[](1);

    (invalidHealth, intents[0]) = strategy.getIntentData();

    invalidHealth = invalidHealth || paused();

    c = baseCollection;
    c.intents = intents;
  }

  function collection(uint256 collectionId) external view returns (DataTypes.IntentCollectionV2 memory c) {
    if (collectionId != 1) revert Errors.CollectionDoesNotExist();

    (, c) = getPopulatedCollection();
  }

  function intent(uint256 collectionId, uint256 intentId)
    external
    view
    returns (address, address, bool, DataTypes.Intent memory)
  {
    if (collectionId != 1) revert Errors.CollectionDoesNotExist();
    if (intentId != 0) revert Errors.InvalidIntent();

    (bool invalidHealth, DataTypes.IntentCollectionV2 memory c) = getPopulatedCollection();

    bool isEnabled = !invalidHealth;
    return (c.collToken, c.borrowToken, isEnabled, c.intents[intentId]);
  }

  /* -------------------------- Integratoor's Getters ------------------------- */

  function reentrancyGuardEntered() external view returns (bool) {
    return _reentrancyGuardEntered();
  }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)

pragma solidity ^0.8.0;

/**
 * @dev Provides information about the current execution context, including the
 * sender of the transaction and its data. While these are generally available
 * via msg.sender and msg.data, they should not be accessed in such a direct
 * manner, since when dealing with meta-transactions the account sending and
 * paying for execution may not be the actual sender (as far as an application
 * is concerned).
 *
 * This contract is only required for intermediate, library-like contracts.
 */
abstract contract Context {
    function _msgSender() internal view virtual returns (address) {
        return msg.sender;
    }

    function _msgData() internal view virtual returns (bytes calldata) {
        return msg.data;
    }
}

File 3 of 17 : Multicall.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/Multicall.sol)

pragma solidity ^0.8.0;

import "./Address.sol";

/**
 * @dev Provides a function to batch together multiple calls in a single external call.
 *
 * _Available since v4.1._
 */
abstract contract Multicall {
    /**
     * @dev Receives and executes a batch of function calls on this contract.
     * @custom:oz-upgrades-unsafe-allow-reachable delegatecall
     */
    function multicall(bytes[] calldata data) external virtual returns (bytes[] memory results) {
        results = new bytes[](data.length);
        for (uint256 i = 0; i < data.length; i++) {
            results[i] = Address.functionDelegateCall(address(this), data[i]);
        }
        return results;
    }
}

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.19;

import {DataTypes} from "./../../libraries/DataTypes.sol";

interface IDLV {
  function initialize(address _loanImpl, address _strategy, address _owner) external;

  function collection(uint256 collectionId) external view returns (DataTypes.IntentCollectionV2 memory);

  function createLoan(DataTypes.BorrowParams calldata borrowParams, bytes calldata data) external returns (address);
}

// SPDX-License-Identifier: Unlicense
pragma solidity ^0.8.19;

import {DataTypes} from "./../../libraries/DataTypes.sol";

interface IRegistryV2 {
  function vaultExists(address vault) external view returns (bool);
  function loanExists(address loan) external view returns (bool);

  function makerFee() external view returns (uint256);
  function takerFee() external view returns (uint256);
  function getMakerTakerFee() external view returns (uint256, uint256);

  function deployVault(address strategy) external returns (address);

  function deployLoan(address impl, DataTypes.LoanData calldata loanData) external returns (address);

  function loanImplUpgradeHook(address oldImpl, address newImpl) external view;
}

// SPDX-License-Identifier: UNLICENSED

pragma solidity ^0.8.19;

import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";

interface IERC20Decimals is IERC20 {
  function decimals() external view returns (uint8);
}

// SPDX-License-Identifier: Unlicense
pragma solidity ^0.8.19;

import {DataTypes} from "./../libraries/DataTypes.sol";

interface IIntentStrategy {
  function collToken() external view returns (address);
  function borrowToken() external view returns (address);
  function getIntentData() external view returns (bool health, DataTypes.Intent memory intent);
}

// SPDX-License-Identifier: Unlicense
pragma solidity ^0.8.19;

interface ILoanTaker {
  function sourceCollateral(address loanContract, bytes calldata data) external;
  function sourcePrincipal(uint256 repayAmt, uint256 reclaimedAmt, bytes calldata data) external;
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol)

pragma solidity ^0.8.0;

import "../utils/Context.sol";

/**
 * @dev Contract module which provides a basic access control mechanism, where
 * there is an account (an owner) that can be granted exclusive access to
 * specific functions.
 *
 * By default, the owner account will be the one that deploys the contract. This
 * can later be changed with {transferOwnership}.
 *
 * This module is used through inheritance. It will make available the modifier
 * `onlyOwner`, which can be applied to your functions to restrict their use to
 * the owner.
 */
abstract contract Ownable is Context {
    address private _owner;

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

    /**
     * @dev Initializes the contract setting the deployer as the initial owner.
     */
    constructor() {
        _transferOwnership(_msgSender());
    }

    /**
     * @dev Throws if called by any account other than the owner.
     */
    modifier onlyOwner() {
        _checkOwner();
        _;
    }

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

    /**
     * @dev Throws if the sender is not the owner.
     */
    function _checkOwner() internal view virtual {
        require(owner() == _msgSender(), "Ownable: caller is not the owner");
    }

    /**
     * @dev Leaves the contract without owner. It will not be possible to call
     * `onlyOwner` functions. Can only be called by the current owner.
     *
     * NOTE: Renouncing ownership will leave the contract without an owner,
     * thereby disabling any functionality that is only available to the owner.
     */
    function renounceOwnership() public virtual onlyOwner {
        _transferOwnership(address(0));
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Can only be called by the current owner.
     */
    function transferOwnership(address newOwner) public virtual onlyOwner {
        require(newOwner != address(0), "Ownable: new owner is the zero address");
        _transferOwnership(newOwner);
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Internal function without access restriction.
     */
    function _transferOwnership(address newOwner) internal virtual {
        address oldOwner = _owner;
        _owner = newOwner;
        emit OwnershipTransferred(oldOwner, newOwner);
    }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (security/Pausable.sol)

pragma solidity ^0.8.0;

import "../utils/Context.sol";

/**
 * @dev Contract module which allows children to implement an emergency stop
 * mechanism that can be triggered by an authorized account.
 *
 * This module is used through inheritance. It will make available the
 * modifiers `whenNotPaused` and `whenPaused`, which can be applied to
 * the functions of your contract. Note that they will not be pausable by
 * simply including this module, only once the modifiers are put in place.
 */
abstract contract Pausable is Context {
    /**
     * @dev Emitted when the pause is triggered by `account`.
     */
    event Paused(address account);

    /**
     * @dev Emitted when the pause is lifted by `account`.
     */
    event Unpaused(address account);

    bool private _paused;

    /**
     * @dev Initializes the contract in unpaused state.
     */
    constructor() {
        _paused = false;
    }

    /**
     * @dev Modifier to make a function callable only when the contract is not paused.
     *
     * Requirements:
     *
     * - The contract must not be paused.
     */
    modifier whenNotPaused() {
        _requireNotPaused();
        _;
    }

    /**
     * @dev Modifier to make a function callable only when the contract is paused.
     *
     * Requirements:
     *
     * - The contract must be paused.
     */
    modifier whenPaused() {
        _requirePaused();
        _;
    }

    /**
     * @dev Returns true if the contract is paused, and false otherwise.
     */
    function paused() public view virtual returns (bool) {
        return _paused;
    }

    /**
     * @dev Throws if the contract is paused.
     */
    function _requireNotPaused() internal view virtual {
        require(!paused(), "Pausable: paused");
    }

    /**
     * @dev Throws if the contract is not paused.
     */
    function _requirePaused() internal view virtual {
        require(paused(), "Pausable: not paused");
    }

    /**
     * @dev Triggers stopped state.
     *
     * Requirements:
     *
     * - The contract must not be paused.
     */
    function _pause() internal virtual whenNotPaused {
        _paused = true;
        emit Paused(_msgSender());
    }

    /**
     * @dev Returns to normal state.
     *
     * Requirements:
     *
     * - The contract must be paused.
     */
    function _unpause() internal virtual whenPaused {
        _paused = false;
        emit Unpaused(_msgSender());
    }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (security/ReentrancyGuard.sol)

pragma solidity ^0.8.0;

/**
 * @dev Contract module that helps prevent reentrant calls to a function.
 *
 * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier
 * available, which can be applied to functions to make sure there are no nested
 * (reentrant) calls to them.
 *
 * Note that because there is a single `nonReentrant` guard, functions marked as
 * `nonReentrant` may not call one another. This can be worked around by making
 * those functions `private`, and then adding `external` `nonReentrant` entry
 * points to them.
 *
 * TIP: If you would like to learn more about reentrancy and alternative ways
 * to protect against it, check out our blog post
 * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].
 */
abstract contract ReentrancyGuard {
    // Booleans are more expensive than uint256 or any type that takes up a full
    // word because each write operation emits an extra SLOAD to first read the
    // slot's contents, replace the bits taken up by the boolean, and then write
    // back. This is the compiler's defense against contract upgrades and
    // pointer aliasing, and it cannot be disabled.

    // The values being non-zero value makes deployment a bit more expensive,
    // but in exchange the refund on every call to nonReentrant will be lower in
    // amount. Since refunds are capped to a percentage of the total
    // transaction's gas, it is best to keep them low in cases like this one, to
    // increase the likelihood of the full refund coming into effect.
    uint256 private constant _NOT_ENTERED = 1;
    uint256 private constant _ENTERED = 2;

    uint256 private _status;

    constructor() {
        _status = _NOT_ENTERED;
    }

    /**
     * @dev Prevents a contract from calling itself, directly or indirectly.
     * Calling a `nonReentrant` function from another `nonReentrant`
     * function is not supported. It is possible to prevent this from happening
     * by making the `nonReentrant` function external, and making it call a
     * `private` function that does the actual work.
     */
    modifier nonReentrant() {
        _nonReentrantBefore();
        _;
        _nonReentrantAfter();
    }

    function _nonReentrantBefore() private {
        // On the first call to nonReentrant, _status will be _NOT_ENTERED
        require(_status != _ENTERED, "ReentrancyGuard: reentrant call");

        // Any calls to nonReentrant after this point will fail
        _status = _ENTERED;
    }

    function _nonReentrantAfter() private {
        // By storing the original value once again, a refund is triggered (see
        // https://eips.ethereum.org/EIPS/eip-2200)
        _status = _NOT_ENTERED;
    }

    /**
     * @dev Returns true if the reentrancy guard is currently set to "entered", which indicates there is a
     * `nonReentrant` function in the call stack.
     */
    function _reentrancyGuardEntered() internal view returns (bool) {
        return _status == _ENTERED;
    }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.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);
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/extensions/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);
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.3) (token/ERC20/utils/SafeERC20.sol)

pragma solidity ^0.8.0;

import "../IERC20.sol";
import "../extensions/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;

    /**
     * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,
     * non-reverting calls are assumed to be successful.
     */
    function safeTransfer(IERC20 token, address to, uint256 value) internal {
        _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
    }

    /**
     * @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the
     * calling contract. If `token` returns no value, non-reverting calls are assumed to be successful.
     */
    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));
    }

    /**
     * @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value,
     * non-reverting calls are assumed to be successful.
     */
    function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {
        uint256 oldAllowance = token.allowance(address(this), spender);
        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance + value));
    }

    /**
     * @dev Decrease the calling contract's allowance toward `spender` by `value`. If `token` returns no value,
     * non-reverting calls are assumed to be successful.
     */
    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");
            _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance - value));
        }
    }

    /**
     * @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value,
     * non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval
     * to be set to zero before setting it to a non-zero value, such as USDT.
     */
    function forceApprove(IERC20 token, address spender, uint256 value) internal {
        bytes memory approvalCall = abi.encodeWithSelector(token.approve.selector, spender, value);

        if (!_callOptionalReturnBool(token, approvalCall)) {
            _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, 0));
            _callOptionalReturn(token, approvalCall);
        }
    }

    /**
     * @dev Use a ERC-2612 signature to set the `owner` approval toward `spender` on `token`.
     * Revert on invalid signature.
     */
    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");
        require(returndata.length == 0 || abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation 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).
     *
     * This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead.
     */
    function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {
        // 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 cannot use {Address-functionCall} here since this should return false
        // and not revert is the subcall reverts.

        (bool success, bytes memory returndata) = address(token).call(data);
        return
            success && (returndata.length == 0 || abi.decode(returndata, (bool))) && Address.isContract(address(token));
    }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.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
     *
     * Furthermore, `isContract` will also return true if the target contract within
     * the same transaction is already scheduled for destruction by `SELFDESTRUCT`,
     * which only has an effect at the end of a transaction.
     * ====
     *
     * [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://consensys.net/diligence/blog/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.8.0/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 16 of 17 : DataTypes.sol
// SPDX-License-Identifier: UNLICENSED

pragma solidity ^0.8.19;

library DataTypes {
  struct Intent {
    /// @dev strike price of collateral in borrowAsset units
    /// @notice 1 unit collateral = x unit borrowAsset
    uint256 strikePrice;
    uint256 interestRate;
    // uint256 upfrontFee;
    uint256 duration;
  }

  struct IntentCollection {
    address collToken;
    address borrowToken;
    uint256 minSingleLoanAmt;
    uint256 maxSingleLoanAmt;
    uint256 expiresAt;
    bool isEnabled;
    Intent[] intents;
  }

  struct IntentCollectionV2 {
    address collToken;
    address borrowToken;
    Intent[] intents;
  }

  enum IntentCollectionUpdateType {
    CREATE_COLLECTION,
    EXTEND_COLLECTION,
    SET_STATUS_COLLECTION
  }

  struct BorrowParams {
    uint256 collectionId;
    uint256 intentId;
    uint256 collAmt;
  }

  struct LoanData {
    address borrower;
    address lenderVault;
    address collToken;
    address borrowToken;
    uint256 collAmt;
    uint256 borrowAmt;
    uint256 repaidAmt;
    uint256 expiresAt;
  }

  struct LoanExecParams {
    address vault;
    uint256 collSwapAmount;
    BorrowParams borrowParams;
    address swapper;
    bytes swapperData;
  }

  struct LoanRepayParams {
    address loan;
    address swapper;
    uint256 repayAmount;
    bytes swapperData;
  }
}

File 17 of 17 : Errors.sol
// SPDX-License-Identifier: UNLICENSED

pragma solidity ^0.8.19;

library Errors {
  error AlreadyInitalized();
  error ZeroAmtProvided();
  error AmtExceedsBalance();
  error LoanAmtTooLow();
  error LoanAmtTooHigh();
  error AmtReceivedTooLow();
  error IntentExpired();
  error LoanExpired();
  error LoanNotExpired();
  error LoanNotFound();
  error NoSeizableAmt();
  error CollectionDoesNotExist();
  error CollectionDisabled();
  error UnAuthorized();
  error InvalidVault();
  error InvalidIntent();
  error IntentDisabled();
  error ZeroAddressProvided();
  error VaultNotFound();
  error InvalidArrayLength();
  error MiddlewareNotWhitelisted();
  error MiddlewareNotAllowed();
  error NoPairExists();
  error CallerNotPair();
  error SenderNotPair();
  error LeverageTooHigh();
  error HandleCreateLoanFailed();
  error CollTokenDoesntMatch();
  error InvalidCaller();
  error NoIntentsProvided();
  error InvalidExpiryProvided();
  error FeeTooHigh();
  error PremiumTooHigh();
  error PremiumGtLoanAmt();
  error StrategyUnhealthy();
  error InvalidLoanAmtRange();
  error InvalidBorrowAmtReceived();

  /// DLV
  error DLV_AlreadyInitialized();
  error DLV_SameLoanImplementation();

  /// registry
  error Registry_FeeTooHigh();
  error Registry_UnknownStrategy();
  error Registry_InvalidConstructor();
  error Registry_UnauthorizedLoanImplementation();
  error Registry_UnauthorizedLoanUpgrade();

  /// pyth wrapper
  error PythWrapper_FeedAlreadyExists();
  error PythWrapper_FeedDoesNotExist();
  error PythWrapper_InvalidTimeTolerance();
  error PythWrapper_InvalidMaxSkew();

  /// strategy
  error Strategy_InvalidConstructor();
  error Strategy_InvalidSpotPriceRange();
  error Strategy_InvalidLoanDuration();
  error Strategy_InvalidInterestRate();
  error Strategy_InvalidAdjustmentFactor();
  error Strategy_InvalidOracle();
  error Strategy_Unauthorized();
}

Settings
{
  "evmVersion": "paris",
  "libraries": {},
  "metadata": {
    "appendCBOR": true,
    "bytecodeHash": "ipfs",
    "useLiteralContent": false
  },
  "optimizer": {
    "enabled": true,
    "runs": 1002
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  },
  "remappings": [
    "@openzeppelin/=node_modules/@openzeppelin/",
    "@uniswap/=node_modules/@uniswap/",
    "@pythnetwork/pyth-sdk-solidity/=node_modules/@pythnetwork/pyth-sdk-solidity/",
    "base64-sol/=node_modules/base64-sol/",
    "ds-test/=lib/forge-std/lib/ds-test/src/",
    "forge-std/=lib/forge-std/src/"
  ],
  "viaIR": false
}

Contract Security Audit

Contract ABI

API
[{"inputs":[],"name":"AmtExceedsBalance","type":"error"},{"inputs":[],"name":"CollectionDoesNotExist","type":"error"},{"inputs":[],"name":"DLV_AlreadyInitialized","type":"error"},{"inputs":[],"name":"DLV_SameLoanImplementation","type":"error"},{"inputs":[],"name":"InvalidBorrowAmtReceived","type":"error"},{"inputs":[],"name":"InvalidIntent","type":"error"},{"inputs":[],"name":"PremiumGtLoanAmt","type":"error"},{"inputs":[],"name":"StrategyUnhealthy","type":"error"},{"inputs":[],"name":"ZeroAddressProvided","type":"error"},{"inputs":[],"name":"ZeroAmtProvided","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"loan","type":"address"},{"indexed":false,"internalType":"address","name":"borrower","type":"address"},{"indexed":false,"internalType":"uint256","name":"borrowAmtReceived","type":"uint256"},{"components":[{"internalType":"address","name":"borrower","type":"address"},{"internalType":"address","name":"lenderVault","type":"address"},{"internalType":"address","name":"collToken","type":"address"},{"internalType":"address","name":"borrowToken","type":"address"},{"internalType":"uint256","name":"collAmt","type":"uint256"},{"internalType":"uint256","name":"borrowAmt","type":"uint256"},{"internalType":"uint256","name":"repaidAmt","type":"uint256"},{"internalType":"uint256","name":"expiresAt","type":"uint256"}],"indexed":false,"internalType":"struct DataTypes.LoanData","name":"data","type":"tuple"},{"components":[{"internalType":"uint256","name":"collectionId","type":"uint256"},{"internalType":"uint256","name":"intentId","type":"uint256"},{"internalType":"uint256","name":"collAmt","type":"uint256"}],"indexed":false,"internalType":"struct DataTypes.BorrowParams","name":"borrowParams","type":"tuple"}],"name":"CreateLoan","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Deposit","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"newImplementation","type":"address"}],"name":"UpgradeLoanImplementation","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Withdraw","type":"event"},{"inputs":[{"internalType":"uint256","name":"collectionId","type":"uint256"}],"name":"collection","outputs":[{"components":[{"internalType":"address","name":"collToken","type":"address"},{"internalType":"address","name":"borrowToken","type":"address"},{"components":[{"internalType":"uint256","name":"strikePrice","type":"uint256"},{"internalType":"uint256","name":"interestRate","type":"uint256"},{"internalType":"uint256","name":"duration","type":"uint256"}],"internalType":"struct DataTypes.Intent[]","name":"intents","type":"tuple[]"}],"internalType":"struct DataTypes.IntentCollectionV2","name":"c","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"uint256","name":"collectionId","type":"uint256"},{"internalType":"uint256","name":"intentId","type":"uint256"},{"internalType":"uint256","name":"collAmt","type":"uint256"}],"internalType":"struct DataTypes.BorrowParams","name":"bParams","type":"tuple"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"createLoan","outputs":[{"internalType":"address","name":"loanContract","type":"address"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"deposit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"getPopulatedCollection","outputs":[{"internalType":"bool","name":"invalidHealth","type":"bool"},{"components":[{"internalType":"address","name":"collToken","type":"address"},{"internalType":"address","name":"borrowToken","type":"address"},{"components":[{"internalType":"uint256","name":"strikePrice","type":"uint256"},{"internalType":"uint256","name":"interestRate","type":"uint256"},{"internalType":"uint256","name":"duration","type":"uint256"}],"internalType":"struct DataTypes.Intent[]","name":"intents","type":"tuple[]"}],"internalType":"struct DataTypes.IntentCollectionV2","name":"c","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_loanImpl","type":"address"},{"internalType":"address","name":"_strategy","type":"address"},{"internalType":"address","name":"_owner","type":"address"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"collectionId","type":"uint256"},{"internalType":"uint256","name":"intentId","type":"uint256"}],"name":"intent","outputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"},{"internalType":"bool","name":"","type":"bool"},{"components":[{"internalType":"uint256","name":"strikePrice","type":"uint256"},{"internalType":"uint256","name":"interestRate","type":"uint256"},{"internalType":"uint256","name":"duration","type":"uint256"}],"internalType":"struct DataTypes.Intent","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"loanImpl","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes[]","name":"data","type":"bytes[]"}],"name":"multicall","outputs":[{"internalType":"bytes[]","name":"results","type":"bytes[]"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pauseVault","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"reentrancyGuardEntered","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"registry","outputs":[{"internalType":"contract IRegistryV2","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"strategy","outputs":[{"internalType":"contract IIntentStrategy","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"unpauseVault","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newImplementation","type":"address"}],"name":"upgradeLoanImplementation","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"}]

608060405234801561001057600080fd5b5060016000819055805460ff191690556100293361002e565b610088565b600180546001600160a01b03838116610100818102610100600160a81b031985161790945560405193909204169182907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b61221f806100976000396000f3fe608060405234801561001057600080fd5b50600436106101515760003560e01c8063a8c62e76116100cd578063c1a190d011610081578063f077237711610066578063f0772377146102ad578063f2fde38b146102cd578063f3fef3a3146102e057600080fd5b8063c1a190d01461028c578063d2c725e0146102a257600080fd5b8063ac9650d8116100b2578063ac9650d814610246578063b6b55f2514610266578063c0c53b8b1461027957600080fd5b8063a8c62e761461021a578063aab96e221461023357600080fd5b80636c381f68116101245780637b103999116101095780637b103999146101e95780638da5cb5b146101fc5780639e0879c21461021257600080fd5b80636c381f68146101b6578063715018a6146101e157600080fd5b80630b7562be14610156578063368023a5146101605780635acff820146101735780635c975abb1461019f575b600080fd5b61015e6102f3565b005b61015e61016e366004611982565b610305565b61018661018136600461199f565b61048d565b60405161019694939291906119c1565b60405180910390f35b60015460ff165b6040519015158152602001610196565b6007546101c9906001600160a01b031681565b6040516001600160a01b039091168152602001610196565b61015e610548565b6006546101c9906001600160a01b031681565b60015461010090046001600160a01b03166101c9565b61015e61055a565b6005546101c9906201000090046001600160a01b031681565b6101c9610241366004611a0b565b61056a565b610259610254366004611a96565b610858565b6040516101969190611b5b565b61015e610274366004611bbd565b61094e565b61015e610287366004611bd6565b6109d4565b610294610c80565b604051610196929190611ca9565b6000546002146101a6565b6102c06102bb366004611bbd565b610e42565b6040516101969190611cc4565b61015e6102db366004611982565b610e87565b61015e6102ee366004611cd7565b610f19565b6102fb611081565b6103036110e1565b565b61030d611133565b610315611081565b6001600160a01b038116610355576040517f8474420100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6007546001600160a01b039081169082160361039d576040517f0403bdf100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6006546007546040517fb057fe7e0000000000000000000000000000000000000000000000000000000081526001600160a01b039182166004820152838216602482015291169063b057fe7e9060440160006040518083038186803b15801561040557600080fd5b505afa158015610419573d6000803e3d6000fd5b50506040516001600160a01b03841681527f5be2cdcd54920568e1aaf7ef3813f3e60a419851fa065d319af3d2d2a26d91659250602001905060405180910390a16007805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b038316179055600160005550565b50565b60008060006104b660405180606001604052806000815260200160008152602001600081525090565b856001146104d75760405163f9c0f36b60e01b815260040160405180910390fd5b84156104f657604051633edae5df60e11b815260040160405180910390fd5b600080610501610c80565b91509150600082159050816000015182602001518284604001518b8151811061052c5761052c611d03565b6020026020010151965096509650965050505092959194509250565b610550611081565b610303600061118c565b610562611081565b6103036111fd565b6000610574611238565b61057c611133565b6000806105888661128b565b915091506000806105bb8385604001516000815181106105aa576105aa611d03565b602002602001015160200151611390565b91509150816000036105f9576040517f2c26f89b00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000604051806101000160405280336001600160a01b03168152602001306001600160a01b0316815260200186600001516001600160a01b0316815260200186602001516001600160a01b031681526020018a60400135815260200185815260200160008152602001866040015160008151811061067957610679611d03565b602002602001015160400151426106909190611d2f565b905260208601519091506106ae906001600160a01b031633856114ea565b81156106d35760065460208601516106d3916001600160a01b039182169116846114ea565b6006546007546040517f127d43900000000000000000000000000000000000000000000000000000000081526001600160a01b039283169263127d439092610722929116908590600401611d42565b6020604051808303816000875af1158015610741573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107659190611dba565b9550856001600160a01b03167fddac337e03dda5c605afe18fc3a03fa45b5cff72704d919b29e119ee52fce6b63385848d6040516107a69493929190611dd7565b60405180910390a28615610827576040517f53050c2c00000000000000000000000000000000000000000000000000000000815233906353050c2c906107f49089908c908c90600401611e7d565b600060405180830381600087803b15801561080e57600080fd5b505af1158015610822573d6000803e3d6000fd5b505050505b8451610842906001600160a01b0316338860408d0135611593565b50505050506108516001600055565b9392505050565b60608167ffffffffffffffff81111561087357610873611ebc565b6040519080825280602002602001820160405280156108a657816020015b60608152602001906001900390816108915790505b50905060005b8281101561094657610916308585848181106108ca576108ca611d03565b90506020028101906108dc9190611ed2565b8080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152506115ea92505050565b82828151811061092857610928611d03565b6020026020010181905250808061093e90611f20565b9150506108ac565b505b92915050565b610956611133565b61095e611081565b8060000361097f57604051638dcb879560e01b815260040160405180910390fd5b6040518181527f4d6ce1e535dbade1c23defba91e23b8f791ce5edc0cc320257a2b364e4e384269060200160405180910390a16003546109ca906001600160a01b0316333084611593565b61048a6001600055565b600554610100900460ff1615610a16576040517f47378a9e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60058054600780546001600160a01b0380881673ffffffffffffffffffffffffffffffffffffffff1992831617909255858216620100009081027fffffffffffffffffffff000000000000000000000000000000000000000000ff9094169390931761010017938490556006805490911633179055604080517f31b8c94600000000000000000000000000000000000000000000000000000000815290519290930416916331b8c9469160048083019260209291908290030181865afa158015610ae4573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b089190611dba565b6002805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b03928316179055600554604080517f456dc17a0000000000000000000000000000000000000000000000000000000081529051620100009092049092169163456dc17a9160048083019260209291908290030181865afa158015610b92573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bb69190611dba565b6003805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b03928316179055600254604080517f313ce5670000000000000000000000000000000000000000000000000000000081529051919092169163313ce5679160048083019260209291908290030181865afa158015610c3a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c5e9190611f39565b6005805460ff191660ff92909216919091179055610c7b8161118c565b505050565b60408051606080820183526000808352602080840182905283850192909252835160018082528186019095529093849282015b610cd760405180606001604052806000815260200160008152602001600081525090565b815260200190600190039081610cb3579050509050600560029054906101000a90046001600160a01b03166001600160a01b03166318b183616040518163ffffffff1660e01b8152600401608060405180830381865afa158015610d3f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d639190611f71565b82600081518110610d7657610d76611d03565b602090810291909101015292508280610d91575060015460ff165b60408051606081018252600280546001600160a01b0390811683526003541660208084019190915260048054855181840281018401875281815296995093959294860193909160009084015b82821015610e2d5783829060005260206000209060030201604051806060016040529081600082015481526020016001820154815260200160028201548152505081526020019060010190610ddd565b50505091525050604081019190915291929050565b6040805160608082018352600080835260208301529181019190915281600114610e7f5760405163f9c0f36b60e01b815260040160405180910390fd5b610851610c80565b610e8f611081565b6001600160a01b038116610f105760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f646472657373000000000000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b61048a8161118c565b610f21611133565b610f29611081565b80600003610f4a57604051638dcb879560e01b815260040160405180910390fd5b6040517f70a082310000000000000000000000000000000000000000000000000000000081523060048201526000906001600160a01b038416906370a0823190602401602060405180830381865afa158015610faa573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610fce9190611fff565b90508082111561100a576040517f36137e9100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b604080516001600160a01b0385168152602081018490527f884edad9ce6fa2440d8a54cc123490eb96d2768479d49ff9c7366125a9424364910160405180910390a16001546110729061010090046001600160a01b03166001600160a01b03851690846114ea565b5061107d6001600055565b5050565b6001546001600160a01b036101009091041633146103035760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610f07565b6110e961160f565b6001805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b6002600054036111855760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610f07565b6002600055565b600180546001600160a01b038381166101008181027fffffffffffffffffffffff0000000000000000000000000000000000000000ff85161790945560405193909204169182907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b611205611238565b6001805460ff1916811790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a25833611116565b60015460ff16156103035760405162461bcd60e51b815260206004820152601060248201527f5061757361626c653a20706175736564000000000000000000000000000000006044820152606401610f07565b6040805160608082018352600080835260208301819052928201529082356001146112c95760405163f9c0f36b60e01b815260040160405180910390fd5b6020830135156112ec57604051633edae5df60e11b815260040160405180910390fd5b6000806112f7610c80565b915091508115611333576040517fd659c62300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6005546000906113479060ff16600a6120fc565b826040015160008151811061135e5761135e611d03565b60200260200101516000015187604001356113799190612108565b611383919061211f565b9196919550909350505050565b60008080670de0b6b3a76400006113a78587612108565b6113b1919061211f565b600654604080517febac1fbb000000000000000000000000000000000000000000000000000000008152815193945060009384936001600160a01b03169263ebac1fbb92600480820193918290030181865afa158015611415573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114399190612141565b90925090506000670de0b6b3a76400006114538386612108565b61145d919061211f565b90506000670de0b6b3a76400006114748587612108565b61147e919061211f565b905061148a8286611d2f565b9450888511156114c6576040517f9667fc4600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6114d0858a612165565b96506114dc8183611d2f565b955050505050509250929050565b6040516001600160a01b038316602482015260448101829052610c7b9084907fa9059cbb00000000000000000000000000000000000000000000000000000000906064015b60408051601f198184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff0000000000000000000000000000000000000000000000000000000090931692909217909152611661565b6040516001600160a01b03808516602483015283166044820152606481018290526115e49085907f23b872dd000000000000000000000000000000000000000000000000000000009060840161152f565b50505050565b606061085183836040518060600160405280602781526020016121c360279139611749565b60015460ff166103035760405162461bcd60e51b815260206004820152601460248201527f5061757361626c653a206e6f74207061757365640000000000000000000000006044820152606401610f07565b60006116b6826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166117c19092919063ffffffff16565b90508051600014806116d75750808060200190518101906116d79190612178565b610c7b5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152608401610f07565b6060600080856001600160a01b0316856040516117669190612193565b600060405180830381855af49150503d80600081146117a1576040519150601f19603f3d011682016040523d82523d6000602084013e6117a6565b606091505b50915091506117b7868383876117d8565b9695505050505050565b60606117d08484600085611851565b949350505050565b60608315611847578251600003611840576001600160a01b0385163b6118405760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610f07565b50816117d0565b6117d08383611943565b6060824710156118c95760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c00000000000000000000000000000000000000000000000000006064820152608401610f07565b600080866001600160a01b031685876040516118e59190612193565b60006040518083038185875af1925050503d8060008114611922576040519150601f19603f3d011682016040523d82523d6000602084013e611927565b606091505b5091509150611938878383876117d8565b979650505050505050565b8151156119535781518083602001fd5b8060405162461bcd60e51b8152600401610f0791906121af565b6001600160a01b038116811461048a57600080fd5b60006020828403121561199457600080fd5b81356108518161196d565b600080604083850312156119b257600080fd5b50508035926020909101359150565b6001600160a01b03858116825284166020820152821515604082015260c08101611a0260608301848051825260208082015190830152604090810151910152565b95945050505050565b60008060008385036080811215611a2157600080fd5b6060811215611a2f57600080fd5b50839250606084013567ffffffffffffffff80821115611a4e57600080fd5b818601915086601f830112611a6257600080fd5b813581811115611a7157600080fd5b876020828501011115611a8357600080fd5b6020830194508093505050509250925092565b60008060208385031215611aa957600080fd5b823567ffffffffffffffff80821115611ac157600080fd5b818501915085601f830112611ad557600080fd5b813581811115611ae457600080fd5b8660208260051b8501011115611af957600080fd5b60209290920196919550909350505050565b60005b83811015611b26578181015183820152602001611b0e565b50506000910152565b60008151808452611b47816020860160208601611b0b565b601f01601f19169290920160200192915050565b6000602080830181845280855180835260408601915060408160051b870101925083870160005b82811015611bb057603f19888603018452611b9e858351611b2f565b94509285019290850190600101611b82565b5092979650505050505050565b600060208284031215611bcf57600080fd5b5035919050565b600080600060608486031215611beb57600080fd5b8335611bf68161196d565b92506020840135611c068161196d565b91506040840135611c168161196d565b809150509250925092565b80516001600160a01b039081168352602080830151909116818401526040808301516060918501829052805185830181905260009391820191849160808801905b80841015611c9d57611c898286518051825260208082015190830152604090810151910152565b938201936001939093019290850190611c62565b50979650505050505050565b82151581526040602082015260006117d06040830184611c21565b6020815260006108516020830184611c21565b60008060408385031215611cea57600080fd5b8235611cf58161196d565b946020939093013593505050565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b8082018082111561094857610948611d19565b6001600160a01b0383168152610120810161085160208301846001600160a01b03808251168352806020830151166020840152806040830151166040840152806060830151166060840152506080810151608083015260a081015160a083015260c081015160c083015260e081015160e08301525050565b600060208284031215611dcc57600080fd5b81516108518161196d565b6001600160a01b0385168152602081018490526101a08101611e5660408301856001600160a01b03808251168352806020830151166020840152806040830151166040840152806060830151166060840152506080810151608083015260a081015160a083015260c081015160c083015260e081015160e08301525050565b82356101408301526020830135610160830152604083013561018083015295945050505050565b6001600160a01b038416815260406020820152816040820152818360608301376000818301606090810191909152601f909201601f1916010192915050565b634e487b7160e01b600052604160045260246000fd5b6000808335601e19843603018112611ee957600080fd5b83018035915067ffffffffffffffff821115611f0457600080fd5b602001915036819003821315611f1957600080fd5b9250929050565b600060018201611f3257611f32611d19565b5060010190565b600060208284031215611f4b57600080fd5b815160ff8116811461085157600080fd5b80518015158114611f6c57600080fd5b919050565b6000808284036080811215611f8557600080fd5b611f8e84611f5c565b92506060601f1982011215611fa257600080fd5b506040516060810181811067ffffffffffffffff82111715611fd457634e487b7160e01b600052604160045260246000fd5b8060405250602084015181526040840151602082015260608401516040820152809150509250929050565b60006020828403121561201157600080fd5b5051919050565b600181815b8085111561205357816000190482111561203957612039611d19565b8085161561204657918102915b93841c939080029061201d565b509250929050565b60008261206a57506001610948565b8161207757506000610948565b816001811461208d5760028114612097576120b3565b6001915050610948565b60ff8411156120a8576120a8611d19565b50506001821b610948565b5060208310610133831016604e8410600b84101617156120d6575081810a610948565b6120e08383612018565b80600019048211156120f4576120f4611d19565b029392505050565b6000610851838361205b565b808202811582820484141761094857610948611d19565b60008261213c57634e487b7160e01b600052601260045260246000fd5b500490565b6000806040838503121561215457600080fd5b505080516020909101519092909150565b8181038181111561094857610948611d19565b60006020828403121561218a57600080fd5b61085182611f5c565b600082516121a5818460208701611b0b565b9190910192915050565b6020815260006108516020830184611b2f56fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220efe32fa6968d71085d80284b87d735b2ee5bb03a6ff06067d57f57901ff9a25764736f6c63430008130033

Deployed Bytecode

0x608060405234801561001057600080fd5b50600436106101515760003560e01c8063a8c62e76116100cd578063c1a190d011610081578063f077237711610066578063f0772377146102ad578063f2fde38b146102cd578063f3fef3a3146102e057600080fd5b8063c1a190d01461028c578063d2c725e0146102a257600080fd5b8063ac9650d8116100b2578063ac9650d814610246578063b6b55f2514610266578063c0c53b8b1461027957600080fd5b8063a8c62e761461021a578063aab96e221461023357600080fd5b80636c381f68116101245780637b103999116101095780637b103999146101e95780638da5cb5b146101fc5780639e0879c21461021257600080fd5b80636c381f68146101b6578063715018a6146101e157600080fd5b80630b7562be14610156578063368023a5146101605780635acff820146101735780635c975abb1461019f575b600080fd5b61015e6102f3565b005b61015e61016e366004611982565b610305565b61018661018136600461199f565b61048d565b60405161019694939291906119c1565b60405180910390f35b60015460ff165b6040519015158152602001610196565b6007546101c9906001600160a01b031681565b6040516001600160a01b039091168152602001610196565b61015e610548565b6006546101c9906001600160a01b031681565b60015461010090046001600160a01b03166101c9565b61015e61055a565b6005546101c9906201000090046001600160a01b031681565b6101c9610241366004611a0b565b61056a565b610259610254366004611a96565b610858565b6040516101969190611b5b565b61015e610274366004611bbd565b61094e565b61015e610287366004611bd6565b6109d4565b610294610c80565b604051610196929190611ca9565b6000546002146101a6565b6102c06102bb366004611bbd565b610e42565b6040516101969190611cc4565b61015e6102db366004611982565b610e87565b61015e6102ee366004611cd7565b610f19565b6102fb611081565b6103036110e1565b565b61030d611133565b610315611081565b6001600160a01b038116610355576040517f8474420100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6007546001600160a01b039081169082160361039d576040517f0403bdf100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6006546007546040517fb057fe7e0000000000000000000000000000000000000000000000000000000081526001600160a01b039182166004820152838216602482015291169063b057fe7e9060440160006040518083038186803b15801561040557600080fd5b505afa158015610419573d6000803e3d6000fd5b50506040516001600160a01b03841681527f5be2cdcd54920568e1aaf7ef3813f3e60a419851fa065d319af3d2d2a26d91659250602001905060405180910390a16007805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b038316179055600160005550565b50565b60008060006104b660405180606001604052806000815260200160008152602001600081525090565b856001146104d75760405163f9c0f36b60e01b815260040160405180910390fd5b84156104f657604051633edae5df60e11b815260040160405180910390fd5b600080610501610c80565b91509150600082159050816000015182602001518284604001518b8151811061052c5761052c611d03565b6020026020010151965096509650965050505092959194509250565b610550611081565b610303600061118c565b610562611081565b6103036111fd565b6000610574611238565b61057c611133565b6000806105888661128b565b915091506000806105bb8385604001516000815181106105aa576105aa611d03565b602002602001015160200151611390565b91509150816000036105f9576040517f2c26f89b00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000604051806101000160405280336001600160a01b03168152602001306001600160a01b0316815260200186600001516001600160a01b0316815260200186602001516001600160a01b031681526020018a60400135815260200185815260200160008152602001866040015160008151811061067957610679611d03565b602002602001015160400151426106909190611d2f565b905260208601519091506106ae906001600160a01b031633856114ea565b81156106d35760065460208601516106d3916001600160a01b039182169116846114ea565b6006546007546040517f127d43900000000000000000000000000000000000000000000000000000000081526001600160a01b039283169263127d439092610722929116908590600401611d42565b6020604051808303816000875af1158015610741573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107659190611dba565b9550856001600160a01b03167fddac337e03dda5c605afe18fc3a03fa45b5cff72704d919b29e119ee52fce6b63385848d6040516107a69493929190611dd7565b60405180910390a28615610827576040517f53050c2c00000000000000000000000000000000000000000000000000000000815233906353050c2c906107f49089908c908c90600401611e7d565b600060405180830381600087803b15801561080e57600080fd5b505af1158015610822573d6000803e3d6000fd5b505050505b8451610842906001600160a01b0316338860408d0135611593565b50505050506108516001600055565b9392505050565b60608167ffffffffffffffff81111561087357610873611ebc565b6040519080825280602002602001820160405280156108a657816020015b60608152602001906001900390816108915790505b50905060005b8281101561094657610916308585848181106108ca576108ca611d03565b90506020028101906108dc9190611ed2565b8080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152506115ea92505050565b82828151811061092857610928611d03565b6020026020010181905250808061093e90611f20565b9150506108ac565b505b92915050565b610956611133565b61095e611081565b8060000361097f57604051638dcb879560e01b815260040160405180910390fd5b6040518181527f4d6ce1e535dbade1c23defba91e23b8f791ce5edc0cc320257a2b364e4e384269060200160405180910390a16003546109ca906001600160a01b0316333084611593565b61048a6001600055565b600554610100900460ff1615610a16576040517f47378a9e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60058054600780546001600160a01b0380881673ffffffffffffffffffffffffffffffffffffffff1992831617909255858216620100009081027fffffffffffffffffffff000000000000000000000000000000000000000000ff9094169390931761010017938490556006805490911633179055604080517f31b8c94600000000000000000000000000000000000000000000000000000000815290519290930416916331b8c9469160048083019260209291908290030181865afa158015610ae4573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b089190611dba565b6002805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b03928316179055600554604080517f456dc17a0000000000000000000000000000000000000000000000000000000081529051620100009092049092169163456dc17a9160048083019260209291908290030181865afa158015610b92573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bb69190611dba565b6003805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b03928316179055600254604080517f313ce5670000000000000000000000000000000000000000000000000000000081529051919092169163313ce5679160048083019260209291908290030181865afa158015610c3a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c5e9190611f39565b6005805460ff191660ff92909216919091179055610c7b8161118c565b505050565b60408051606080820183526000808352602080840182905283850192909252835160018082528186019095529093849282015b610cd760405180606001604052806000815260200160008152602001600081525090565b815260200190600190039081610cb3579050509050600560029054906101000a90046001600160a01b03166001600160a01b03166318b183616040518163ffffffff1660e01b8152600401608060405180830381865afa158015610d3f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d639190611f71565b82600081518110610d7657610d76611d03565b602090810291909101015292508280610d91575060015460ff165b60408051606081018252600280546001600160a01b0390811683526003541660208084019190915260048054855181840281018401875281815296995093959294860193909160009084015b82821015610e2d5783829060005260206000209060030201604051806060016040529081600082015481526020016001820154815260200160028201548152505081526020019060010190610ddd565b50505091525050604081019190915291929050565b6040805160608082018352600080835260208301529181019190915281600114610e7f5760405163f9c0f36b60e01b815260040160405180910390fd5b610851610c80565b610e8f611081565b6001600160a01b038116610f105760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f646472657373000000000000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b61048a8161118c565b610f21611133565b610f29611081565b80600003610f4a57604051638dcb879560e01b815260040160405180910390fd5b6040517f70a082310000000000000000000000000000000000000000000000000000000081523060048201526000906001600160a01b038416906370a0823190602401602060405180830381865afa158015610faa573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610fce9190611fff565b90508082111561100a576040517f36137e9100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b604080516001600160a01b0385168152602081018490527f884edad9ce6fa2440d8a54cc123490eb96d2768479d49ff9c7366125a9424364910160405180910390a16001546110729061010090046001600160a01b03166001600160a01b03851690846114ea565b5061107d6001600055565b5050565b6001546001600160a01b036101009091041633146103035760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610f07565b6110e961160f565b6001805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b6002600054036111855760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610f07565b6002600055565b600180546001600160a01b038381166101008181027fffffffffffffffffffffff0000000000000000000000000000000000000000ff85161790945560405193909204169182907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b611205611238565b6001805460ff1916811790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a25833611116565b60015460ff16156103035760405162461bcd60e51b815260206004820152601060248201527f5061757361626c653a20706175736564000000000000000000000000000000006044820152606401610f07565b6040805160608082018352600080835260208301819052928201529082356001146112c95760405163f9c0f36b60e01b815260040160405180910390fd5b6020830135156112ec57604051633edae5df60e11b815260040160405180910390fd5b6000806112f7610c80565b915091508115611333576040517fd659c62300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6005546000906113479060ff16600a6120fc565b826040015160008151811061135e5761135e611d03565b60200260200101516000015187604001356113799190612108565b611383919061211f565b9196919550909350505050565b60008080670de0b6b3a76400006113a78587612108565b6113b1919061211f565b600654604080517febac1fbb000000000000000000000000000000000000000000000000000000008152815193945060009384936001600160a01b03169263ebac1fbb92600480820193918290030181865afa158015611415573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114399190612141565b90925090506000670de0b6b3a76400006114538386612108565b61145d919061211f565b90506000670de0b6b3a76400006114748587612108565b61147e919061211f565b905061148a8286611d2f565b9450888511156114c6576040517f9667fc4600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6114d0858a612165565b96506114dc8183611d2f565b955050505050509250929050565b6040516001600160a01b038316602482015260448101829052610c7b9084907fa9059cbb00000000000000000000000000000000000000000000000000000000906064015b60408051601f198184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff0000000000000000000000000000000000000000000000000000000090931692909217909152611661565b6040516001600160a01b03808516602483015283166044820152606481018290526115e49085907f23b872dd000000000000000000000000000000000000000000000000000000009060840161152f565b50505050565b606061085183836040518060600160405280602781526020016121c360279139611749565b60015460ff166103035760405162461bcd60e51b815260206004820152601460248201527f5061757361626c653a206e6f74207061757365640000000000000000000000006044820152606401610f07565b60006116b6826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166117c19092919063ffffffff16565b90508051600014806116d75750808060200190518101906116d79190612178565b610c7b5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152608401610f07565b6060600080856001600160a01b0316856040516117669190612193565b600060405180830381855af49150503d80600081146117a1576040519150601f19603f3d011682016040523d82523d6000602084013e6117a6565b606091505b50915091506117b7868383876117d8565b9695505050505050565b60606117d08484600085611851565b949350505050565b60608315611847578251600003611840576001600160a01b0385163b6118405760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610f07565b50816117d0565b6117d08383611943565b6060824710156118c95760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c00000000000000000000000000000000000000000000000000006064820152608401610f07565b600080866001600160a01b031685876040516118e59190612193565b60006040518083038185875af1925050503d8060008114611922576040519150601f19603f3d011682016040523d82523d6000602084013e611927565b606091505b5091509150611938878383876117d8565b979650505050505050565b8151156119535781518083602001fd5b8060405162461bcd60e51b8152600401610f0791906121af565b6001600160a01b038116811461048a57600080fd5b60006020828403121561199457600080fd5b81356108518161196d565b600080604083850312156119b257600080fd5b50508035926020909101359150565b6001600160a01b03858116825284166020820152821515604082015260c08101611a0260608301848051825260208082015190830152604090810151910152565b95945050505050565b60008060008385036080811215611a2157600080fd5b6060811215611a2f57600080fd5b50839250606084013567ffffffffffffffff80821115611a4e57600080fd5b818601915086601f830112611a6257600080fd5b813581811115611a7157600080fd5b876020828501011115611a8357600080fd5b6020830194508093505050509250925092565b60008060208385031215611aa957600080fd5b823567ffffffffffffffff80821115611ac157600080fd5b818501915085601f830112611ad557600080fd5b813581811115611ae457600080fd5b8660208260051b8501011115611af957600080fd5b60209290920196919550909350505050565b60005b83811015611b26578181015183820152602001611b0e565b50506000910152565b60008151808452611b47816020860160208601611b0b565b601f01601f19169290920160200192915050565b6000602080830181845280855180835260408601915060408160051b870101925083870160005b82811015611bb057603f19888603018452611b9e858351611b2f565b94509285019290850190600101611b82565b5092979650505050505050565b600060208284031215611bcf57600080fd5b5035919050565b600080600060608486031215611beb57600080fd5b8335611bf68161196d565b92506020840135611c068161196d565b91506040840135611c168161196d565b809150509250925092565b80516001600160a01b039081168352602080830151909116818401526040808301516060918501829052805185830181905260009391820191849160808801905b80841015611c9d57611c898286518051825260208082015190830152604090810151910152565b938201936001939093019290850190611c62565b50979650505050505050565b82151581526040602082015260006117d06040830184611c21565b6020815260006108516020830184611c21565b60008060408385031215611cea57600080fd5b8235611cf58161196d565b946020939093013593505050565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b8082018082111561094857610948611d19565b6001600160a01b0383168152610120810161085160208301846001600160a01b03808251168352806020830151166020840152806040830151166040840152806060830151166060840152506080810151608083015260a081015160a083015260c081015160c083015260e081015160e08301525050565b600060208284031215611dcc57600080fd5b81516108518161196d565b6001600160a01b0385168152602081018490526101a08101611e5660408301856001600160a01b03808251168352806020830151166020840152806040830151166040840152806060830151166060840152506080810151608083015260a081015160a083015260c081015160c083015260e081015160e08301525050565b82356101408301526020830135610160830152604083013561018083015295945050505050565b6001600160a01b038416815260406020820152816040820152818360608301376000818301606090810191909152601f909201601f1916010192915050565b634e487b7160e01b600052604160045260246000fd5b6000808335601e19843603018112611ee957600080fd5b83018035915067ffffffffffffffff821115611f0457600080fd5b602001915036819003821315611f1957600080fd5b9250929050565b600060018201611f3257611f32611d19565b5060010190565b600060208284031215611f4b57600080fd5b815160ff8116811461085157600080fd5b80518015158114611f6c57600080fd5b919050565b6000808284036080811215611f8557600080fd5b611f8e84611f5c565b92506060601f1982011215611fa257600080fd5b506040516060810181811067ffffffffffffffff82111715611fd457634e487b7160e01b600052604160045260246000fd5b8060405250602084015181526040840151602082015260608401516040820152809150509250929050565b60006020828403121561201157600080fd5b5051919050565b600181815b8085111561205357816000190482111561203957612039611d19565b8085161561204657918102915b93841c939080029061201d565b509250929050565b60008261206a57506001610948565b8161207757506000610948565b816001811461208d5760028114612097576120b3565b6001915050610948565b60ff8411156120a8576120a8611d19565b50506001821b610948565b5060208310610133831016604e8410600b84101617156120d6575081810a610948565b6120e08383612018565b80600019048211156120f4576120f4611d19565b029392505050565b6000610851838361205b565b808202811582820484141761094857610948611d19565b60008261213c57634e487b7160e01b600052601260045260246000fd5b500490565b6000806040838503121561215457600080fd5b505080516020909101519092909150565b8181038181111561094857610948611d19565b60006020828403121561218a57600080fd5b61085182611f5c565b600082516121a5818460208701611b0b565b9190910192915050565b6020815260006108516020830184611b2f56fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220efe32fa6968d71085d80284b87d735b2ee5bb03a6ff06067d57f57901ff9a25764736f6c63430008130033

Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

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

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
Loading...
Loading

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.