Skip to content

Commit

Permalink
rephrase comments
Browse files Browse the repository at this point in the history
  • Loading branch information
LeTamanoir committed Sep 24, 2023
1 parent ac4be9f commit 823f681
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 11 deletions.
12 changes: 6 additions & 6 deletions src/AbstractPriceSensor.sol
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,15 @@ abstract contract AbstractPriceSensor is IPriceSensor {
newBestOfferId
);

// newBestOffer.gives order.offer.gives()
// newBestPrice = ------------------ >= oldPrice = -------------------
// newBestOffer.wants order.offer.wants()
// newBestOffer.wants order.offer.wants()
// newBestPrice = ------------------ >= oldPrice = -------------------
// newBestOffer.gives order.offer.gives()
//
// if newBestPrice is greater than oldPrice, then the stop loss was reached
// if newBestPrice is lower than oldPrice, then the stop loss was reached

if (
newBestOffer.gives * order.offer.wants() <
order.offer.gives() * newBestOffer.wants
order.offer.gives() * newBestOffer.wants >=
newBestOffer.gives * order.offer.wants()
) {
__callbackOnStopLoss__(order);
}
Expand Down
5 changes: 0 additions & 5 deletions test/utils/TestImplementation.sol
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ import {IERC20} from "mgv_src/IERC20.sol";
import {AbstractPriceSensor} from "../../src/AbstractPriceSensor.sol";

contract TestImplementation is AbstractPriceSensor, Direct {
event TestEvent(uint256 indexed offerId);

/// The outbound token of the sensor
IERC20 private immutable _outbound_tkn;
/// The inbound token of the sensor
Expand Down Expand Up @@ -68,9 +66,6 @@ contract TestImplementation is AbstractPriceSensor, Direct {
function __callbackOnStopLoss__(
MgvLib.SingleOrder calldata order
) internal virtual override {
// Do something with the sensor data
emit TestEvent(order.offerId);
// Call the default parent function (for logging)
super.__callbackOnStopLoss__(order);
}
}

0 comments on commit 823f681

Please sign in to comment.