Skip to content

Commit

Permalink
Updated MorphoBlueHyperdrive to include 32 bytes of pass-through data
Browse files Browse the repository at this point in the history
  • Loading branch information
jalextowle committed Aug 7, 2024
1 parent 9606421 commit c18c47d
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
8 changes: 7 additions & 1 deletion contracts/src/instances/morpho-blue/MorphoBlueBase.sol
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,12 @@ abstract contract MorphoBlueBase is HyperdriveBase {
address(_vault),
_baseAmount + 1
);
// NOTE: The last 32 bytes of the extra data is passed through to the
// event without being passed to morpho.
bytes memory data;
if (_extraData.length > 32) {
data = _extraData[:_extraData.length - 32];
}
(, sharesMinted) = _vault.supply(
MarketParams({
loanToken: address(_baseToken),
Expand All @@ -101,7 +107,7 @@ abstract contract MorphoBlueBase is HyperdriveBase {
_baseAmount,
0,
address(this),
_extraData
data
);

// NOTE: Since this yield source isn't payable, the value must be zero.
Expand Down
4 changes: 3 additions & 1 deletion contracts/src/interfaces/IHyperdrive.sol
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,9 @@ interface IHyperdrive is
/// settled in base if true and in the yield source shares if false.
bool asBase;
/// @dev Additional data that can be used to implement custom logic in
/// implementation contracts.
/// implementation contracts. By convention, the last 32 bytes of
/// extra data are ignored by instances and "passed through" to the
/// event. This can be used to pass metadata through transactions.
bytes extraData;
}

Expand Down
2 changes: 1 addition & 1 deletion contracts/src/libraries/Constants.sol
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ pragma solidity ^0.8.20;
address constant ETH = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE;

/// @dev The version of the contracts.
string constant VERSION = "v1.0.16";
string constant VERSION = "v1.0.17";

/// @dev The number of targets that must be deployed for a full deployment.
uint256 constant NUM_TARGETS = 5;
Expand Down

0 comments on commit c18c47d

Please sign in to comment.