8000 Put market in IBlue.sol by MathisGD · Pull Request #211 · morpho-org/morpho-blue · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Put market in IBlue.sol #211

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/Blue.sol
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ import {
IBlueSupplyCallback,
IBlueSupplyCollateralCallback
} from "./interfaces/IBlueCallbacks.sol";
import {IBlue} from "./interfaces/IBlue.sol";
import {Id, Market, Signature, IBlue} from "./interfaces/IBlue.sol";
import {IIrm} from "./interfaces/IIrm.sol";
import {IERC20} from "./interfaces/IERC20.sol";
import {IFlashBorrower} from "./interfaces/IFlashBorrower.sol";

import {Errors} from "./libraries/Errors.sol";
import {SharesMath} from "./libraries/SharesMath.sol";
import {FixedPointMathLib} from "./libraries/FixedPointMathLib.sol";
import {Id, Market, MarketLib} from "./libraries/MarketLib.sol";
import {MarketLib} from "./libraries/MarketLib.sol";
import {SafeTransferLib} from "./libraries/SafeTransferLib.sol";

uint256 constant MAX_FEE = 0.25e18;
Expand Down
26 changes: 18 additions & 8 deletions src/interfaces/IBlue.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,29 @@
pragma solidity >=0.5.0;

import {IIrm} from "./IIrm.sol";
import {IOracle} from "./IOracle.sol";
import {IFlashLender} from "./IFlashLender.sol";
import {IFlashBorrower} from "./IFlashBorrower.sol";

import {Id, Market} from "../libraries/MarketLib.sol";
type Id is bytes32;

interface IBlue is IFlashLender {
/// @notice Contains the `v`, `r` and `s` parameters of an ECDSA signature.
struct Signature {
uint8 v;
bytes32 r;
bytes32 s;
}
struct Market {
address borrowableAsset;
address collateralAsset;
IOracle borrowableOracle;
IOracle collateralOracle;
IIrm irm;
uint256 lltv;
}

/// @notice Contains the `v`, `r` and `s` parameters of an ECDSA signature.
struct Signature {
uint8 v;
10000 bytes32 r;
bytes32 s;
}

interface IBlue is IFlashLender {
function DOMAIN_SEPARATOR() external view returns (bytes32);

function owner() external view returns (address);
Expand Down
2 changes: 1 addition & 1 deletion src/interfaces/IIrm.sol
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity >=0.5.0;

import {Market} from "../libraries/MarketLib.sol";
import {Market} from "../interfaces/IBlue.sol";

interface IIrm {
function borrowRate(Market memory market) external returns (uint256);
Expand Down
14 changes: 1 addition & 13 deletions src/libraries/MarketLib.sol
Original file line number Diff line number Diff line change
@@ -1,19 +1,7 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.0;

import {IIrm} from "../interfaces/IIrm.sol";
import {IOracle} from "../interfaces/IOracle.sol";

type Id is bytes32;

struct Market {
address borrowableAsset;
address collateralAsset;
IOracle borrowableOracle;
IOracle collateralOracle;
IIrm irm;
uint256 lltv;
}
import {Id, Market, IBlue} from "../interfaces/IBlue.sol";

library MarketLib {
function id(Market memory market) internal pure returns (Id) {
Expand Down
4 changes: 2 additions & 2 deletions src/mocks/IrmMock.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
pragma solidity ^0.8.0;
< 8000 span class='blob-code-inner blob-code-marker ' data-code-marker=" ">
import {IIrm} from "../interfaces/IIrm.sol";
import {IBlue} from "../interfaces/IBlue.sol";
import {Id, Market, IBlue} from "../interfaces/IBlue.sol";

import {FixedPointMathLib} from "../libraries/FixedPointMathLib.sol";
import {Id, Market, MarketLib} from "../libraries/MarketLib.sol";
import {MarketLib} from "../libraries/MarketLib.sol";

contract IrmMock is IIrm {
using FixedPointMathLib for uint256;
Expand Down
2 changes: 1 addition & 1 deletion test/forge/Blue.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -718,7 +718,7 @@ contract BlueTest is

bytes32 digest = SigUtils.getTypedDataHash(blue.DOMAIN_SEPARATOR(), authorization);

IBlue.Signature memory sig;
Signature memory sig;
(sig.v, sig.r, sig.s) = vm.sign(privateKey, digest);

blue.setAuthorization(
Expand Down
0