diff --git a/src/SablierFlow.sol b/src/SablierFlow.sol index 6ded6da4..3353ba1b 100644 --- a/src/SablierFlow.sol +++ b/src/SablierFlow.sol @@ -33,7 +33,7 @@ contract SablierFlow is CONSTRUCTOR //////////////////////////////////////////////////////////////////////////*/ - /// @dev Emits a {TransferAdmin} event. + /// @dev Emits {TransferAdmin} event. /// @param initialAdmin The address of the initial contract admin. /// @param initialNFTDescriptor The address of the initial NFT descriptor. constructor( diff --git a/src/abstracts/SablierFlowBase.sol b/src/abstracts/SablierFlowBase.sol index d6bf5b06..3a52c7cf 100644 --- a/src/abstracts/SablierFlowBase.sol +++ b/src/abstracts/SablierFlowBase.sol @@ -52,7 +52,7 @@ abstract contract SablierFlowBase is CONSTRUCTOR //////////////////////////////////////////////////////////////////////////*/ - /// @dev Emits a {TransferAdmin} event. + /// @dev Emits {TransferAdmin} event. /// @param initialAdmin The address of the initial contract admin. /// @param initialNFTDescriptor The address of the initial NFT descriptor. constructor(address initialAdmin, IFlowNFTDescriptor initialNFTDescriptor) { @@ -277,6 +277,9 @@ abstract contract SablierFlowBase is oldProtocolFee: oldProtocolFee, newProtocolFee: newProtocolFee }); + + // Refresh the NFT metadata for all streams. + emit BatchMetadataUpdate({ _fromTokenId: 1, _toTokenId: nextStreamId - 1 }); } /*////////////////////////////////////////////////////////////////////////// diff --git a/src/interfaces/ISablierFlow.sol b/src/interfaces/ISablierFlow.sol index 771462b5..35859c38 100644 --- a/src/interfaces/ISablierFlow.sol +++ b/src/interfaces/ISablierFlow.sol @@ -159,7 +159,7 @@ interface ISablierFlow is /// @notice Changes the stream's rate per second. /// - /// @dev Emits an {AdjustFlowStream} and {MetadataUpdate} event. + /// @dev Emits {AdjustFlowStream} and {MetadataUpdate} events. /// /// Notes: /// - Performs a debt snapshot. @@ -178,7 +178,7 @@ interface ISablierFlow is /// @notice Creates a new Flow stream by setting the snapshot time to `block.timestamp` and leaving the balance to /// zero. The stream is wrapped in an ERC-721 NFT. /// - /// @dev Emits a {CreateFlowStream} event. + /// @dev Emits {CreateFlowStream} event. /// /// Requirements: /// - Must not be delegate called. @@ -208,7 +208,7 @@ interface ISablierFlow is /// @notice Creates a new Flow stream by setting the snapshot time to `block.timestamp` and the balance to `amount`. /// The stream is wrapped in an ERC-721 NFT. /// - /// @dev Emits a {Transfer}, {CreateFlowStream}, and {DepositFlowStream} event. + /// @dev Emits {Transfer}, {CreateFlowStream}, and {DepositFlowStream} events. /// /// Notes: /// - Refer to the notes in {deposit}. @@ -238,7 +238,7 @@ interface ISablierFlow is /// @notice Makes a deposit in a stream. /// - /// @dev Emits a {Transfer} and {DepositFlowStream} event. + /// @dev Emits {Transfer} and {DepositFlowStream} events. /// /// Requirements: /// - Must not be delegate called. @@ -251,7 +251,7 @@ interface ISablierFlow is /// @notice Deposits tokens in a stream and pauses it. /// - /// @dev Emits a {Transfer}, {DepositFlowStream} and {PauseFlowStream} event. + /// @dev Emits {Transfer}, {DepositFlowStream} and {PauseFlowStream} events. /// /// Notes: /// - Refer to the notes in {deposit} and {pause}. @@ -265,7 +265,7 @@ interface ISablierFlow is /// @notice Deposits tokens in a stream. /// - /// @dev Emits a {Transfer} and {DepositFlowStream} event. + /// @dev Emits {Transfer} and {DepositFlowStream} events. /// /// Notes: /// - Refer to the notes in {deposit}. @@ -285,7 +285,7 @@ interface ISablierFlow is /// @notice Pauses the stream. /// - /// @dev Emits a {PauseFlowStream} event. + /// @dev Emits {PauseFlowStream} event. /// /// Notes: /// - It does not set the snapshot time to the current block timestamp. @@ -302,7 +302,7 @@ interface ISablierFlow is /// @notice Refunds the provided amount of tokens from the stream to the sender's address. /// - /// @dev Emits a {Transfer} and {RefundFromFlowStream} event. + /// @dev Emits {Transfer} and {RefundFromFlowStream} events. /// /// Requirements: /// - Must not be delegate called. @@ -316,7 +316,7 @@ interface ISablierFlow is /// @notice Refunds the provided amount of tokens from the stream to the sender's address. /// - /// @dev Emits a {Transfer}, {RefundFromFlowStream} and {PauseFlowStream} event. + /// @dev Emits {Transfer}, {RefundFromFlowStream} and {PauseFlowStream} events. /// /// Notes: /// - Refer to the notes in {pause}. @@ -330,7 +330,7 @@ interface ISablierFlow is /// @notice Restarts the stream with the provided rate per second. /// - /// @dev Emits a {RestartFlowStream} event. + /// @dev Emits {RestartFlowStream} event. /// - This function updates stream's `snapshotTime` to the current block timestamp. /// /// Notes: @@ -349,7 +349,7 @@ interface ISablierFlow is /// @notice Restarts the stream with the provided rate per second, and makes a deposit. /// - /// @dev Emits a {RestartFlowStream}, {Transfer}, and {DepositFlowStream} event. + /// @dev Emits {RestartFlowStream}, {Transfer}, and {DepositFlowStream} events. /// /// Notes: /// - Refer to the notes in {restart} and {deposit}. @@ -366,7 +366,7 @@ interface ISablierFlow is /// @notice Voids a stream. /// - /// @dev Emits a {VoidFlowStream} event. + /// @dev Emits {VoidFlowStream} event. /// /// Notes: /// - It sets snapshot time to the `block.timestamp` @@ -386,7 +386,7 @@ interface ISablierFlow is /// @notice Withdraws the provided `amount` minus the protocol fee to the provided `to` address. /// - /// @dev Emits a {Transfer} and {WithdrawFromFlowStream} event. + /// @dev Emits {Transfer} and {WithdrawFromFlowStream} events. /// /// Notes: /// - It sets the snapshot time to the `block.timestamp` if `amount` is greater than snapshot debt. @@ -415,7 +415,7 @@ interface ISablierFlow is /// @notice Withdraws the entire withdrawable amount minus the protocol fee to the provided `to` address. /// - /// @dev Emits a {Transfer} and {WithdrawFromFlowStream} event. + /// @dev Emits {Transfer} and {WithdrawFromFlowStream} events. /// /// Notes: /// - Refer to the notes in {withdraw}. diff --git a/src/interfaces/ISablierFlowBase.sol b/src/interfaces/ISablierFlowBase.sol index d6411b7d..d6278eca 100644 --- a/src/interfaces/ISablierFlowBase.sol +++ b/src/interfaces/ISablierFlowBase.sol @@ -148,7 +148,7 @@ interface ISablierFlowBase is /// @notice Collect the protocol revenue accrued for the provided ERC-20 token. /// - /// @dev Emits a {CollectProtocolRevenue} event. + /// @dev Emits {CollectProtocolRevenue} event. /// /// Requirements: /// - `msg.sender` must be the contract admin. @@ -160,7 +160,7 @@ interface ISablierFlowBase is /// @notice Recover the surplus amount of tokens. /// - /// @dev Emits a {Recover} event. + /// @dev Emits {Recover} event. /// /// Notes: /// - The surplus amount is defined as the difference between the total balance of the contract for the provided @@ -176,7 +176,7 @@ interface ISablierFlowBase is /// @notice Sets a new NFT descriptor contract, which produces the URI describing the Sablier stream NFTs. /// - /// @dev Emits a {SetNFTDescriptor} and {BatchMetadataUpdate} event. + /// @dev Emits {SetNFTDescriptor} and {BatchMetadataUpdate} events. /// /// Notes: /// - Does not revert if the NFT descriptor is the same. @@ -190,7 +190,7 @@ interface ISablierFlowBase is /// @notice Sets a new protocol fee that will be charged on all the withdrawals from streams created with the /// provided ERC-20 token. /// - /// @dev Emits a {SetProtocolFee} event. + /// @dev Emits {SetProtocolFee} and {BatchMetadataUpdate} events. /// /// Notes: /// - Does not revert if the fee is the same. diff --git a/tests/integration/concrete/set-protocol-fee/setProtocolFee.t.sol b/tests/integration/concrete/set-protocol-fee/setProtocolFee.t.sol index 840bde54..917f0668 100644 --- a/tests/integration/concrete/set-protocol-fee/setProtocolFee.t.sol +++ b/tests/integration/concrete/set-protocol-fee/setProtocolFee.t.sol @@ -1,6 +1,7 @@ // SPDX-License-Identifier: UNLICENSED pragma solidity >=0.8.22; +import { IERC4906 } from "@openzeppelin/contracts/interfaces/IERC4906.sol"; import { UD60x18, UNIT } from "@prb/math/src/UD60x18.sol"; import { ISablierFlowBase } from "src/interfaces/ISablierFlowBase.sol"; @@ -28,9 +29,11 @@ contract SetProtocolFee_Integration_Concrete_Test is Integration_Test { } function test_WhenNewAndOldProtocolFeeAreSame() external whenCallerAdmin whenNewProtocolFeeNotExceedMaxFee { - // It should emit {SetProtocolFee} event. + // It should emit {SetProtocolFee} and {BatchMetadataUpdate} events. vm.expectEmit({ emitter: address(flow) }); emit ISablierFlowBase.SetProtocolFee(users.admin, tokenWithProtocolFee, PROTOCOL_FEE, PROTOCOL_FEE); + vm.expectEmit({ emitter: address(flow) }); + emit IERC4906.BatchMetadataUpdate({ _fromTokenId: 1, _toTokenId: flow.nextStreamId() - 1 }); flow.setProtocolFee(tokenWithProtocolFee, PROTOCOL_FEE); @@ -41,9 +44,11 @@ contract SetProtocolFee_Integration_Concrete_Test is Integration_Test { function test_WhenNewAndOldProtocolFeeAreNotSame() external whenCallerAdmin whenNewProtocolFeeNotExceedMaxFee { UD60x18 newProtocolFee = PROTOCOL_FEE + UD60x18.wrap(0.01e18); - // It should emit {SetProtocolFee} event. + // It should emit {SetProtocolFee} and {BatchMetadataUpdate} events. vm.expectEmit({ emitter: address(flow) }); emit ISablierFlowBase.SetProtocolFee(users.admin, tokenWithProtocolFee, PROTOCOL_FEE, newProtocolFee); + vm.expectEmit({ emitter: address(flow) }); + emit IERC4906.BatchMetadataUpdate({ _fromTokenId: 1, _toTokenId: flow.nextStreamId() - 1 }); flow.setProtocolFee(tokenWithProtocolFee, newProtocolFee); diff --git a/tests/integration/concrete/set-protocol-fee/setProtocolFee.tree b/tests/integration/concrete/set-protocol-fee/setProtocolFee.tree index bd8bdca6..6ebf9f5b 100644 --- a/tests/integration/concrete/set-protocol-fee/setProtocolFee.tree +++ b/tests/integration/concrete/set-protocol-fee/setProtocolFee.tree @@ -7,7 +7,7 @@ SetProtocolFee_Integration_Concrete_Test └── when new protocol fee not exceed max fee ├── when new and old protocol fee are same │ ├── it should re-set the protocol fee - │ └── it should emit {SetProtocolFee} event + │ └── it should emit {SetProtocolFee} and {BatchMetadataUpdate} events └── when new and old protocol fee are not same ├── it should set the new protocol fee - └── it should emit {SetProtocolFee} event + └── it should emit {SetProtocolFee} and {BatchMetadataUpdate} events