Skip to content

Commit

Permalink
fix: remove MetadataUpdate event from renounce functions
Browse files Browse the repository at this point in the history
docs: add MetadataUpdate event in create functions natspecs
  • Loading branch information
smol-ninja authored and andreivladbrg committed Jan 7, 2025
1 parent 8b91935 commit 60c0707
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 26 deletions.
3 changes: 0 additions & 3 deletions src/abstracts/SablierLockupBase.sol
Original file line number Diff line number Diff line change
Expand Up @@ -357,9 +357,6 @@ abstract contract SablierLockupBase is

// Log the renouncement.
emit ISablierLockupBase.RenounceLockupStream(streamId);

// Emit an ERC-4906 event to trigger an update of the NFT metadata.
emit MetadataUpdate({ _tokenId: streamId });
}

/// @inheritdoc ISablierLockupBase
Expand Down
12 changes: 6 additions & 6 deletions src/interfaces/ISablierLockup.sol
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ interface ISablierLockup is ISablierLockupBase {
/// `block.timestamp` and all specified time durations. The segment timestamps are derived from these
/// durations. The stream is funded by `msg.sender` and is wrapped in an ERC-721 NFT.
///
/// @dev Emits a {Transfer} and {CreateLockupDynamicStream} event.
/// @dev Emits a {Transfer}, {CreateLockupDynamicStream}, and {MetadataUpdate} event.
///
/// Requirements:
/// - All requirements in {createWithTimestampsLD} must be met for the calculated parameters.
Expand All @@ -103,7 +103,7 @@ interface ISablierLockup is ISablierLockupBase {
/// the sum of `block.timestamp` and `durations.total`. The stream is funded by `msg.sender` and is wrapped in an
/// ERC-721 NFT.
///
/// @dev Emits a {Transfer} and {CreateLockupLinearStream} event.
/// @dev Emits a {Transfer}, {CreateLockupLinearStream}, and {MetadataUpdate} event.
///
/// Requirements:
/// - All requirements in {createWithTimestampsLL} must be met for the calculated parameters.
Expand All @@ -126,7 +126,7 @@ interface ISablierLockup is ISablierLockupBase {
/// `block.timestamp` and all specified time durations. The tranche timestamps are derived from these
/// durations. The stream is funded by `msg.sender` and is wrapped in an ERC-721 NFT.
///
/// @dev Emits a {Transfer} and {CreateLockupTrancheStream} event.
/// @dev Emits a {Transfer}, {CreateLockupTrancheStream}, and {MetadataUpdate} event.
///
/// Requirements:
/// - All requirements in {createWithTimestampsLT} must be met for the calculated parameters.
Expand All @@ -146,7 +146,7 @@ interface ISablierLockup is ISablierLockupBase {
/// @notice Creates a stream with the provided segment timestamps, implying the end time from the last timestamp.
/// The stream is funded by `msg.sender` and is wrapped in an ERC-721 NFT.
///
/// @dev Emits a {Transfer} and {CreateLockupDynamicStream} event.
/// @dev Emits a {Transfer}, {CreateLockupDynamicStream}, and {MetadataUpdate} event.
///
/// Notes:
/// - As long as the segment timestamps are arranged in ascending order, it is not an error for some
Expand Down Expand Up @@ -180,7 +180,7 @@ interface ISablierLockup is ISablierLockupBase {
/// @notice Creates a stream with the provided start time and end time. The stream is funded by `msg.sender` and is
/// wrapped in an ERC-721 NFT.
///
/// @dev Emits a {Transfer} and {CreateLockupLinearStream} event.
/// @dev Emits a {Transfer}, {CreateLockupLinearStream}, and {MetadataUpdate} event.
///
/// Notes:
/// - A cliff time of zero means there is no cliff.
Expand Down Expand Up @@ -218,7 +218,7 @@ interface ISablierLockup is ISablierLockupBase {
/// @notice Creates a stream with the provided tranche timestamps, implying the end time from the last timestamp.
/// The stream is funded by `msg.sender` and is wrapped in an ERC-721 NFT.
///
/// @dev Emits a {Transfer} and {CreateLockupTrancheStream} event.
/// @dev Emits a {Transfer}, {CreateLockupTrancheStream}, and {MetadataUpdate} event.
///
/// Notes:
/// - As long as the tranche timestamps are arranged in ascending order, it is not an error for some
Expand Down
8 changes: 4 additions & 4 deletions src/interfaces/ISablierLockupBase.sol
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ interface ISablierLockupBase is

/// @notice Burns the NFT associated with the stream.
///
/// @dev Emits a {Transfer} event.
/// @dev Emits a {Transfer}, and {MetadataUpdate} event.
///
/// Requirements:
/// - Must not be delegate called.
Expand Down Expand Up @@ -279,7 +279,7 @@ interface ISablierLockupBase is

/// @notice Removes the right of the stream's sender to cancel the stream.
///
/// @dev Emits a {RenounceLockupStream} and {MetadataUpdate} event.
/// @dev Emits a {RenounceLockupStream} event.
///
/// Notes:
/// - This is an irreversible operation.
Expand All @@ -295,7 +295,7 @@ interface ISablierLockupBase is

/// @notice Renounces multiple streams.
///
/// @dev Emits multiple {RenounceLockupStream} and {MetadataUpdate} events.
/// @dev Emits multiple {RenounceLockupStream} events.
///
/// Notes:
/// - Refer to the notes in {renounce}.
Expand Down Expand Up @@ -357,7 +357,7 @@ interface ISablierLockupBase is
/// @notice Withdraws the maximum withdrawable amount from the stream to the current recipient, and transfers the
/// NFT to `newRecipient`.
///
/// @dev Emits a {WithdrawFromLockupStream} and a {Transfer} event.
/// @dev Emits a {WithdrawFromLockupStream}, {Transfer} and {MetadataUpdate} event.
///
/// Notes:
/// - If the withdrawable amount is zero, the withdrawal is skipped.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity >=0.8.22 <0.9.0;

import { IERC4906 } from "@openzeppelin/contracts/interfaces/IERC4906.sol";
import { Solarray } from "solarray/src/Solarray.sol";

import { ISablierLockupBase } from "src/interfaces/ISablierLockupBase.sol";
Expand Down Expand Up @@ -90,15 +89,11 @@ contract RenounceMultiple_Integration_Concrete_Test is Integration_Test {
givenNoColdStreams
whenCallerAuthorizedForAllStreams
{
// It should emit {MetadataUpdate} and {RenounceLockupStream} events for both the streams.
// It should emit {RenounceLockupStream} events for both the streams.
vm.expectEmit({ emitter: address(lockup) });
emit ISablierLockupBase.RenounceLockupStream(streamIds[0]);
vm.expectEmit({ emitter: address(lockup) });
emit IERC4906.MetadataUpdate({ _tokenId: streamIds[0] });
vm.expectEmit({ emitter: address(lockup) });
emit ISablierLockupBase.RenounceLockupStream(streamIds[1]);
vm.expectEmit({ emitter: address(lockup) });
emit IERC4906.MetadataUpdate({ _tokenId: streamIds[1] });

// Renounce the streams.
lockup.renounceMultiple(streamIds);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@ RenounceMultiple_Integration_Concrete_Test
├── given at least one non cancelable stream
│ └── it should revert
└── given all streams cancelable
├── it should emit {MetadataUpdate} and {RenounceLockupStream} events
├── it should emit {RenounceLockupStream} events
└── it should make streams non cancelable
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity >=0.8.22 <0.9.0;

import { IERC4906 } from "@openzeppelin/contracts/interfaces/IERC4906.sol";

import { ISablierLockupBase } from "src/interfaces/ISablierLockupBase.sol";
import { Errors } from "src/libraries/Errors.sol";

Expand Down Expand Up @@ -66,11 +64,9 @@ abstract contract Renounce_Integration_Concrete_Test is Integration_Test {
givenWarmStreamRenounce
whenCallerSender
{
// It should emit {MetadataUpdate} and {RenounceLockupStream} events.
// It should emit {RenounceLockupStream} event.
vm.expectEmit({ emitter: address(lockup) });
emit ISablierLockupBase.RenounceLockupStream(streamId);
vm.expectEmit({ emitter: address(lockup) });
emit IERC4906.MetadataUpdate({ _tokenId: streamId });

// Renounce the stream.
lockup.renounce(streamId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,5 @@ Renounce_Integration_Concrete_Test
├── given non cancelable stream
│ └── it should revert
└── given cancelable stream
├── it should emit {MetadataUpdate} and {RenounceLockupStream} events
├── it should emit {RenounceLockupStream} event
└── it should make stream non cancelable

0 comments on commit 60c0707

Please sign in to comment.