Skip to content
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

Hyperdrive Matching Engine #1201

Merged
merged 16 commits into from
Nov 26, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Wrote a working example of the OTC trade on cbBTC/USDC using flash loans
  • Loading branch information
jalextowle committed Nov 22, 2024
commit cc966a4ddfd3b297dc4a82544f7ab4143e8079dd
2 changes: 1 addition & 1 deletion contracts/src/instances/morpho-blue/MorphoBlueBase.sol
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: Apache-2.0
pragma solidity 0.8.22;

import { IMorpho, MarketParams } from "morpho-blue/src/interfaces/IMorpho.sol";
import { IMorpho, MarketParams, Id } from "morpho-blue/src/interfaces/IMorpho.sol";
jalextowle marked this conversation as resolved.
Show resolved Hide resolved
import { MarketParamsLib } from "morpho-blue/src/libraries/MarketParamsLib.sol";
import { SharesMathLib } from "morpho-blue/src/libraries/SharesMathLib.sol";
import { MorphoBalancesLib } from "morpho-blue/src/libraries/periphery/MorphoBalancesLib.sol";
Expand Down
7 changes: 0 additions & 7 deletions contracts/src/internal/HyperdriveLP.sol
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
// SPDX-License-Identifier: Apache-2.0
pragma solidity 0.8.22;

// FIXME
import { console2 as console } from "forge-std/console2.sol";
import { Lib } from "test/utils/Lib.sol";

import { IHyperdrive } from "../interfaces/IHyperdrive.sol";
import { IHyperdriveEvents } from "../interfaces/IHyperdriveEvents.sol";
import { AssetId } from "../libraries/AssetId.sol";
Expand All @@ -26,9 +22,6 @@ abstract contract HyperdriveLP is
HyperdriveBase,
HyperdriveMultiToken
{
// FIXME
using Lib for *;

using FixedPointMath for uint256;
using FixedPointMath for int256;
using LPMath for LPMath.PresentValueParams;
Expand Down
16 changes: 0 additions & 16 deletions contracts/src/internal/HyperdriveShort.sol
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
// SPDX-License-Identifier: Apache-2.0
pragma solidity 0.8.22;

// FIXME
import { console2 as console } from "forge-std/console2.sol";
import { Lib } from "test/utils/Lib.sol";

import { IHyperdrive } from "../interfaces/IHyperdrive.sol";
import { IHyperdriveEvents } from "../interfaces/IHyperdriveEvents.sol";
import { AssetId } from "../libraries/AssetId.sol";
Expand All @@ -22,9 +18,6 @@ import { HyperdriveLP } from "./HyperdriveLP.sol";
/// only, and is not intended to, and does not, have any
/// particular legal or regulatory significance.
abstract contract HyperdriveShort is IHyperdriveEvents, HyperdriveLP {
// FIXME
using Lib for *;

using FixedPointMath for uint256;
using FixedPointMath for int256;
using SafeCast for uint256;
Expand All @@ -49,25 +42,17 @@ abstract contract HyperdriveShort is IHyperdriveEvents, HyperdriveLP {
uint256 _minVaultSharePrice,
IHyperdrive.Options calldata _options
) internal nonReentrant isNotPaused returns (uint256, uint256) {
// FIXME
console.log("openShort: 1");

// Check that the message value is valid.
_checkMessageValue();

// Check that the provided options are valid.
_checkOptions(_options);
// FIXME
console.log("openShort: 2");

// Ensure that the bond amount is greater than or equal to the minimum
// transaction amount.
if (_bondAmount < _minimumTransactionAmount) {
revert IHyperdrive.MinimumTransactionAmount();
}

// FIXME
console.log("openShort: 3");
// Perform a checkpoint and compute the amount of interest the short
// would have received if they opened at the beginning of the checkpoint.
// Since the short will receive interest from the beginning of the
Expand Down Expand Up @@ -140,7 +125,6 @@ abstract contract HyperdriveShort is IHyperdriveEvents, HyperdriveLP {
vaultSharePrice,
_options
);
console.log("deposit = %s", deposit.toString(6));
if (_maxDeposit < deposit) {
revert IHyperdrive.OutputLimit();
}
Expand Down
Loading