Skip to content

Commit

Permalink
comments
Browse files Browse the repository at this point in the history
  • Loading branch information
hensha256 committed Sep 12, 2024
1 parent 6fb40dd commit c6c108e
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/libraries/QuoterRevert.sol
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,11 @@ library QuoterRevert {
return reason.parseAmountUnpecified();
}

/// @notice extracts the amountUnspecified from an encoded QuoteSwap(amountUnspecified)
function parseAmountUnpecified(bytes memory reason) internal pure returns (uint256 amountUnspecified) {
// reason -> reason+0x1f is the length of the reason string
// reason+0x20 -> reason+0x23 is the selector of QuoteSwap
// reason+0x24 -> reason+0x43 is the amountSpecified
// reason+0x24 -> reason+0x43 is the amountUnspecified
assembly ("memory-safe") {
amountUnspecified := mload(add(reason, 0x24))
}
Expand Down

0 comments on commit c6c108e

Please sign in to comment.