diff --git a/docs/contracts/v2/reference/core/abstracts/abstract.Adminable.md b/docs/contracts/v2/reference/core/abstracts/abstract.Adminable.md index 9e4316b9..899bba72 100644 --- a/docs/contracts/v2/reference/core/abstracts/abstract.Adminable.md +++ b/docs/contracts/v2/reference/core/abstracts/abstract.Adminable.md @@ -1,6 +1,6 @@ # Adminable -[Git Source](https://github.com/sablier-labs/v2-core/blob/release/src/abstracts/Adminable.sol) +[Git Source](https://github.com/sablier-labs/v2-core/blob/a4bf69cf7024006b9a324eef433f20b74597eaaf/src/abstracts/Adminable.sol) **Inherits:** [IAdminable](/docs/contracts/v2/reference/core/interfaces/interface.IAdminable.md) diff --git a/docs/contracts/v2/reference/core/abstracts/abstract.NoDelegateCall.md b/docs/contracts/v2/reference/core/abstracts/abstract.NoDelegateCall.md index 84689227..8c0be329 100644 --- a/docs/contracts/v2/reference/core/abstracts/abstract.NoDelegateCall.md +++ b/docs/contracts/v2/reference/core/abstracts/abstract.NoDelegateCall.md @@ -1,6 +1,6 @@ # NoDelegateCall -[Git Source](https://github.com/sablier-labs/v2-core/blob/release/src/abstracts/NoDelegateCall.sol) +[Git Source](https://github.com/sablier-labs/v2-core/blob/a4bf69cf7024006b9a324eef433f20b74597eaaf/src/abstracts/NoDelegateCall.sol) This contract implements logic to prevent delegate calls. diff --git a/docs/contracts/v2/reference/core/abstracts/abstract.SablierV2Base.md b/docs/contracts/v2/reference/core/abstracts/abstract.SablierV2Base.md index 5c4f0cd0..20771603 100644 --- a/docs/contracts/v2/reference/core/abstracts/abstract.SablierV2Base.md +++ b/docs/contracts/v2/reference/core/abstracts/abstract.SablierV2Base.md @@ -1,6 +1,6 @@ # SablierV2Base -[Git Source](https://github.com/sablier-labs/v2-core/blob/release/src/abstracts/SablierV2Base.sol) +[Git Source](https://github.com/sablier-labs/v2-core/blob/a4bf69cf7024006b9a324eef433f20b74597eaaf/src/abstracts/SablierV2Base.sol) **Inherits:** [NoDelegateCall](/docs/contracts/v2/reference/core/abstracts/abstract.NoDelegateCall.md), [ISablierV2Base](/docs/contracts/v2/reference/core/interfaces/interface.ISablierV2Base.md), diff --git a/docs/contracts/v2/reference/core/abstracts/abstract.SablierV2FlashLoan.md b/docs/contracts/v2/reference/core/abstracts/abstract.SablierV2FlashLoan.md index df6e332b..79f04e8c 100644 --- a/docs/contracts/v2/reference/core/abstracts/abstract.SablierV2FlashLoan.md +++ b/docs/contracts/v2/reference/core/abstracts/abstract.SablierV2FlashLoan.md @@ -1,6 +1,6 @@ # SablierV2FlashLoan -[Git Source](https://github.com/sablier-labs/v2-core/blob/release/src/abstracts/SablierV2FlashLoan.sol) +[Git Source](https://github.com/sablier-labs/v2-core/blob/a4bf69cf7024006b9a324eef433f20b74597eaaf/src/abstracts/SablierV2FlashLoan.sol) **Inherits:** [IERC3156FlashLender](/docs/contracts/v2/reference/core/interfaces/erc3156/interface.IERC3156FlashLender.md), @@ -75,7 +75,8 @@ function maxFlashLoan(address asset) external view override returns (uint256 amo Allows smart contracts to access the entire liquidity of the Sablier V2 contract within one transaction as long as the principal plus a flash fee is returned. -Emits a {FlashLoan} event. Requirements: +Emits a [FlashLoan](/docs/contracts/v2/reference/core/abstracts/abstract.SablierV2FlashLoan.md#flashloan) event. +Requirements: - Must not be delegate called. - Refer to the requirements in {flashFee}. @@ -129,3 +130,14 @@ event FlashLoan( bytes data ); ``` + +**Parameters** + +| Name | Type | Description | +| ----------- | ----------------------- | ----------------------------------------------------------- | +| `initiator` | `address` | The address of the flash loan initiator. | +| `receiver` | `IERC3156FlashBorrower` | The address of the flash borrower. | +| `asset` | `IERC20` | The address of the ERC-20 asset that has been flash loaned. | +| `amount` | `uint256` | The amount of `asset` flash loaned. | +| `feeAmount` | `uint256` | The fee amount of `asset` charged by the protocol. | +| `data` | `bytes` | The data passed to the flash borrower. | diff --git a/docs/contracts/v2/reference/core/abstracts/abstract.SablierV2Lockup.md b/docs/contracts/v2/reference/core/abstracts/abstract.SablierV2Lockup.md index cba4e02e..d2d3e548 100644 --- a/docs/contracts/v2/reference/core/abstracts/abstract.SablierV2Lockup.md +++ b/docs/contracts/v2/reference/core/abstracts/abstract.SablierV2Lockup.md @@ -1,12 +1,9 @@ # SablierV2Lockup -[Git Source](https://github.com/sablier-labs/v2-core/blob/release/src/abstracts/SablierV2Lockup.sol) +[Git Source](https://github.com/sablier-labs/v2-core/blob/a4bf69cf7024006b9a324eef433f20b74597eaaf/src/abstracts/SablierV2Lockup.sol) -**Inherits:** -[IERC4906](https://github.com/OpenZeppelin/openzeppelin-contracts/blob/e50c24f5839db17f46991478384bfda14acfb830/contracts/interfaces/IERC4906.sol), -[SablierV2Base](/docs/contracts/v2/reference/core/abstracts/abstract.SablierV2Base.md), -[ISablierV2Lockup](/docs/contracts/v2/reference/core/interfaces/interface.ISablierV2Lockup.md), -[ERC721](https://github.com/OpenZeppelin/openzeppelin-contracts/blob/e50c24f5839db17f46991478384bfda14acfb830/contracts/token/ERC721/ERC721.sol) +**Inherits:** IERC4906, [SablierV2Base](/docs/contracts/v2/reference/core/abstracts/abstract.SablierV2Base.md), +[ISablierV2Lockup](/docs/contracts/v2/reference/core/interfaces/interface.ISablierV2Lockup.md), ERC721 See the documentation in [ISablierV2Lockup](/docs/contracts/v2/reference/core/interfaces/interface.ISablierV2Lockup.md). @@ -59,7 +56,7 @@ modifier notNull(uint256 streamId); ### updateMetadata -_Emits an `ERC-4906` event to trigger an update of the NFT metadata._ +_Emits an ERC-4906 event to trigger an update of the NFT metadata._ ```solidity modifier updateMetadata(uint256 streamId); @@ -188,6 +185,22 @@ function withdrawableAmountOf(uint256 streamId) | ---------- | --------- | ---------------------------- | | `streamId` | `uint256` | The stream id for the query. | +### isTransferable + +Retrieves a flag indicating whether the stream NFT can be transferred. + +_Reverts if `streamId` references a null stream._ + +```solidity +function isTransferable(uint256 streamId) public view virtual returns (bool); +``` + +**Parameters** + +| Name | Type | Description | +| ---------- | --------- | ---------------------------- | +| `streamId` | `uint256` | The stream id for the query. | + ### burn Burns the NFT associated with the stream. @@ -370,8 +383,7 @@ function withdrawMaxAndTransfer( external override noDelegateCall - notNull(streamId) - updateMetadata(streamId); + notNull(streamId); ``` **Parameters** @@ -413,61 +425,28 @@ function withdrawMultiple( ### \_afterTokenTransfer -Overrides the internal `ERC-721` transfer function to emit an `ERC-4906` event upon transfer. The goal is to refresh the -NFT metadata on external platforms. This event is also emitted when the NFT is minted or burned. +Overrides the internal ERC-721 transfer function to emit an ERC-4906 event upon transfer. The goal is to refresh the NFT +metadata on external platforms. + +_This event is also emitted when the NFT is minted or burned._ ```solidity -function _afterTokenTransfer( - address, /* from */ - address, /* to */ - uint256 streamId, - uint256 /* batchSize */ -) - internal - override - updateMetadata(streamId) -{ } +function _afterTokenTransfer(address, address, uint256 streamId, uint256) internal override updateMetadata(streamId); ``` -**Parameters** - -| Name | Type | Description | -| ----------- | --------- | ---------------------------- | -| `from` | `address` | Ignored. | -| `to` | `address` | Ignored. | -| `streamId` | `uint256` | The stream id for the query. | -| `batchSize` | `uint256` | Ignored. | - ### \_beforeTokenTransfer -Overrides the internal `ERC-721` transfer function to check that the stream is transferable. There are two cases when -the transferable flag is ignored: +Overrides the internal ERC-721 transfer function to check that the stream is transferable. + +There are two cases when the transferable flag is ignored: - If `from` is 0, then the transfer is a mint and is allowed. - If `to` is 0, then the transfer is a burn and is also allowed. ```solidity -function _beforeTokenTransfer( - address from, - address to, - uint256 streamId, - uint256 /* batchSize */ -) - internal - view - override -{ } +function _beforeTokenTransfer(address from, address to, uint256 streamId, uint256) internal view override; ``` -**Parameters** - -| Name | Type | Description | -| ----------- | --------- | ----------------------------- | -| `from` | `address` | The address to transfer from. | -| `to` | `address` | The address to transfer to. | -| `streamId` | `uint256` | The stream id for the query. | -| `batchSize` | `uint256` | Ignored. | - ### \_isCallerStreamRecipientOrApproved Checks whether `msg.sender` is the stream's recipient or an approved third party. diff --git a/docs/contracts/v2/reference/core/contract.SablierV2Comptroller.md b/docs/contracts/v2/reference/core/contract.SablierV2Comptroller.md index f69c9b71..bc62dcf3 100644 --- a/docs/contracts/v2/reference/core/contract.SablierV2Comptroller.md +++ b/docs/contracts/v2/reference/core/contract.SablierV2Comptroller.md @@ -4,7 +4,7 @@ sidebar_position: 4 # SablierV2Comptroller -[Git Source](https://github.com/sablier-labs/v2-core/blob/release/src/SablierV2Comptroller.sol) +[Git Source](https://github.com/sablier-labs/v2-core/blob/a4bf69cf7024006b9a324eef433f20b74597eaaf/src/SablierV2Comptroller.sol) **Inherits:** [ISablierV2Comptroller](/docs/contracts/v2/reference/core/interfaces/interface.ISablierV2Comptroller.md), [Adminable](/docs/contracts/v2/reference/core/abstracts/abstract.Adminable.md) diff --git a/docs/contracts/v2/reference/core/contract.SablierV2LockupDynamic.md b/docs/contracts/v2/reference/core/contract.SablierV2LockupDynamic.md index f596abaa..5a7074c5 100644 --- a/docs/contracts/v2/reference/core/contract.SablierV2LockupDynamic.md +++ b/docs/contracts/v2/reference/core/contract.SablierV2LockupDynamic.md @@ -4,7 +4,7 @@ sidebar_position: 2 # SablierV2LockupDynamic -[Git Source](https://github.com/sablier-labs/v2-core/blob/release/src/SablierV2LockupDynamic.sol) +[Git Source](https://github.com/sablier-labs/v2-core/blob/a4bf69cf7024006b9a324eef433f20b74597eaaf/src/SablierV2LockupDynamic.sol) **Inherits:** [ISablierV2LockupDynamic](/docs/contracts/v2/reference/core/interfaces/interface.ISablierV2LockupDynamic.md), @@ -33,9 +33,7 @@ _Sablier V2 Lockup Dynamic streams mapped by unsigned integer ids._ mapping(uint256 id => LockupDynamic.Stream stream) private _streams; ``` -See the struct `LockupDynamic.Stream` in [Types](/contracts/v2/reference/core/types/library.LockupDynamic#stream). - -## User Facing Functions +## Functions ### constructor @@ -63,7 +61,7 @@ constructor( ### getAsset -Retrieves the address of the `ERC-20` asset used for streaming. +Retrieves the address of the ERC-20 asset used for streaming. _Reverts if `streamId` references a null stream._ @@ -269,6 +267,17 @@ function isCancelable(uint256 streamId) external view override notNull(streamId) | ---------- | --------- | ---------------------------- | | `streamId` | `uint256` | The stream id for the query. | +### isTransferable + +```solidity +function isTransferable(uint256 streamId) + public + view + override(ISablierV2Lockup, SablierV2Lockup) + notNull(streamId) + returns (bool result); +``` + ### isDepleted Retrieves a flag indicating whether the stream is depleted. @@ -306,22 +315,6 @@ function isStream(uint256 streamId) public view override(ISablierV2Lockup, Sabli | ---------- | --------- | ---------------------------- | | `streamId` | `uint256` | The stream id for the query. | -### isTransferable - -Retrieves a flag indicating whether the stream NFT can be transferred. - -_Reverts if `streamId` references a null stream._ - -```solidity -function isTransferable(uint256 streamId) external view returns (bool result); -``` - -**Parameters** - -| Name | Type | Description | -| ---------- | --------- | ---------------------------- | -| `streamId` | `uint256` | The stream id for the query. | - ### refundableAmountOf Calculates the amount that the sender would be refunded if the stream were canceled, denoted in units of the asset's @@ -418,7 +411,7 @@ function wasCanceled(uint256 streamId) Creates a stream by setting the start time to `block.timestamp`, and the end time to the sum of `block.timestamp` and all specified time deltas. The segment milestones are derived from these deltas. The stream is funded by `msg.sender` -and is wrapped in an `ERC-721` NFT. +and is wrapped in an ERC-721 NFT. Emits a {Transfer} and {CreateLockupDynamicStream} event. Requirements: @@ -434,9 +427,9 @@ function createWithDeltas(LockupDynamic.CreateWithDeltas calldata params) **Parameters** -| Name | Type | Description | -| -------- | -------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `params` | `LockupDynamic.CreateWithDeltas` | Struct encapsulating the function parameters, which are documented in [Types](/contracts/v2/reference/core/types/library.LockupDynamic#createwithdeltas). | +| Name | Type | Description | +| -------- | -------------------------------- | ---------------------------------------------------------------------------------- | +| `params` | `LockupDynamic.CreateWithDeltas` | Struct encapsulating the function parameters, which are documented in {DataTypes}. | **Returns** @@ -447,7 +440,7 @@ function createWithDeltas(LockupDynamic.CreateWithDeltas calldata params) ### createWithMilestones Creates a stream with the provided segment milestones, implying the end time from the last milestone. The stream is -funded by `msg.sender` and is wrapped in an `ERC-721` NFT. +funded by `msg.sender` and is wrapped in an ERC-721 NFT. Emits a {Transfer} and {CreateLockupDynamicStream} event. Notes: @@ -474,9 +467,9 @@ function createWithMilestones(LockupDynamic.CreateWithMilestones calldata params **Parameters** -| Name | Type | Description | -| -------- | ------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `params` | `LockupDynamic.CreateWithMilestones` | Struct encapsulating the function parameters, which are documented in [Types](/contracts/v2/reference/core/types/library.LockupDynamic#createwithmilestones). | +| Name | Type | Description | +| -------- | ------------------------------------ | ---------------------------------------------------------------------------------- | +| `params` | `LockupDynamic.CreateWithMilestones` | Struct encapsulating the function parameters, which are documented in {DataTypes}. | **Returns** @@ -484,8 +477,6 @@ function createWithMilestones(LockupDynamic.CreateWithMilestones calldata params | ---------- | --------- | ----------------------------------- | | `streamId` | `uint256` | The id of the newly created stream. | -## Internal Functions - ### \_calculateStreamedAmount _Calculates the streamed amount without looking up the stream's status._ @@ -540,8 +531,7 @@ function _statusOf(uint256 streamId) internal view override returns (Lockup.Stat ### \_streamedAmountOf -_Implements the internal logic for -[streamedAmountOf](/contracts/v2/reference/core/contract.SablierV2LockupLinear#streamedamountof)._ +_See the documentation for the user-facing functions that call this internal function._ ```solidity function _streamedAmountOf(uint256 streamId) internal view returns (uint128); @@ -549,8 +539,7 @@ function _streamedAmountOf(uint256 streamId) internal view returns (uint128); ### \_withdrawableAmountOf -_Implements the internal logic for -[withdrawableAmountOf](/contracts/v2/reference/core/abstracts/abstract.SablierV2Lockup#withdrawableamountof)._ +_See the documentation for the user-facing functions that call this internal function._ ```solidity function _withdrawableAmountOf(uint256 streamId) internal view override returns (uint128); @@ -558,7 +547,7 @@ function _withdrawableAmountOf(uint256 streamId) internal view override returns ### \_cancel -_Implements the internal logic for [cancel](/contracts/v2/reference/core/abstracts/abstract.SablierV2Lockup#cancel)._ +_See the documentation for the user-facing functions that call this internal function._ ```solidity function _cancel(uint256 streamId) internal override; @@ -574,8 +563,7 @@ function _createWithMilestones(LockupDynamic.CreateWithMilestones memory params) ### \_renounce -_Implements the internal logic for -[renounce](/contracts/v2/reference/core/abstracts/abstract.SablierV2Lockup#renounce)._ +_See the documentation for the user-facing functions that call this internal function._ ```solidity function _renounce(uint256 streamId) internal override; @@ -583,8 +571,7 @@ function _renounce(uint256 streamId) internal override; ### \_withdraw -_Implements the internal logic for -[\_withdraw](/contracts/v2/reference/core/abstracts/abstract.SablierV2Lockup#_withdraw)._ +_See the documentation for the user-facing functions that call this internal function._ ```solidity function _withdraw(uint256 streamId, address to, uint128 amount) internal override; diff --git a/docs/contracts/v2/reference/core/contract.SablierV2LockupLinear.md b/docs/contracts/v2/reference/core/contract.SablierV2LockupLinear.md index 9fad39ad..07f036f7 100644 --- a/docs/contracts/v2/reference/core/contract.SablierV2LockupLinear.md +++ b/docs/contracts/v2/reference/core/contract.SablierV2LockupLinear.md @@ -4,7 +4,7 @@ sidebar_position: 1 # SablierV2LockupLinear -[Git Source](https://github.com/sablier-labs/v2-core/blob/release/src/SablierV2LockupLinear.sol) +[Git Source](https://github.com/sablier-labs/v2-core/blob/a4bf69cf7024006b9a324eef433f20b74597eaaf/src/SablierV2LockupLinear.sol) **Inherits:** [ISablierV2LockupLinear](/docs/contracts/v2/reference/core/interfaces/interface.ISablierV2LockupLinear.md), @@ -23,9 +23,7 @@ _Sablier V2 Lockup Linear streams mapped by unsigned integers._ mapping(uint256 id => LockupLinear.Stream stream) private _streams; ``` -See the struct `LockupLinear.Stream` in [Types](/contracts/v2/reference/core/types/library.LockupLinear#stream). - -## User Facing Functions +## Functions ### constructor @@ -51,7 +49,7 @@ constructor( ### getAsset -Retrieves the address of the `ERC-20` asset used for streaming. +Retrieves the address of the ERC-20 asset used for streaming. _Reverts if `streamId` references a null stream._ @@ -252,6 +250,17 @@ function isCancelable(uint256 streamId) external view override notNull(streamId) | ---------- | --------- | ---------------------------- | | `streamId` | `uint256` | The stream id for the query. | +### isTransferable + +```solidity +function isTransferable(uint256 streamId) + public + view + override(ISablierV2Lockup, SablierV2Lockup) + notNull(streamId) + returns (bool result); +``` + ### isDepleted Retrieves a flag indicating whether the stream is depleted. @@ -289,22 +298,6 @@ function isStream(uint256 streamId) public view override(ISablierV2Lockup, Sabli | ---------- | --------- | ---------------------------- | | `streamId` | `uint256` | The stream id for the query. | -### isTransferable - -Retrieves a flag indicating whether the stream NFT can be transferred. - -_Reverts if `streamId` references a null stream._ - -```solidity -function isTransferable(uint256 streamId) external view returns (bool result); -``` - -**Parameters** - -| Name | Type | Description | -| ---------- | --------- | ---------------------------- | -| `streamId` | `uint256` | The stream id for the query. | - ### refundableAmountOf Calculates the amount that the sender would be refunded if the stream were canceled, denoted in units of the asset's @@ -399,7 +392,7 @@ function wasCanceled(uint256 streamId) ### createWithDurations Creates a stream by setting the start time to `block.timestamp`, and the end time to the sum of `block.timestamp` and -`params.durations.total`. The stream is funded by `msg.sender` and is wrapped in an `ERC-721` NFT. +`params.durations.total`. The stream is funded by `msg.sender` and is wrapped in an ERC-721 NFT. Emits a {Transfer} and {CreateLockupLinearStream} event. Requirements: @@ -415,9 +408,9 @@ function createWithDurations(LockupLinear.CreateWithDurations calldata params) **Parameters** -| Name | Type | Description | -| -------- | ---------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `params` | `LockupLinear.CreateWithDurations` | Struct encapsulating the function parameters, which are documented in [Types](/contracts/v2/reference/core/types/library.LockupLinear#createwithdurations). | +| Name | Type | Description | +| -------- | ---------------------------------- | ---------------------------------------------------------------------------------- | +| `params` | `LockupLinear.CreateWithDurations` | Struct encapsulating the function parameters, which are documented in {DataTypes}. | **Returns** @@ -428,7 +421,7 @@ function createWithDurations(LockupLinear.CreateWithDurations calldata params) ### createWithRange Creates a stream with the provided start time and end time as the range. The stream is funded by `msg.sender` and is -wrapped in an `ERC-721` NFT. +wrapped in an ERC-721 NFT. Emits a {Transfer} and {CreateLockupLinearStream} event. Notes: @@ -452,9 +445,9 @@ function createWithRange(LockupLinear.CreateWithRange calldata params) **Parameters** -| Name | Type | Description | -| -------- | ------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `params` | `LockupLinear.CreateWithRange` | Struct encapsulating the function parameters, which are documented in [Types](/contracts/v2/reference/core/types/library.LockupLinear#createwithrange). | +| Name | Type | Description | +| -------- | ------------------------------ | ---------------------------------------------------------------------------------- | +| `params` | `LockupLinear.CreateWithRange` | Struct encapsulating the function parameters, which are documented in {DataTypes}. | **Returns** @@ -462,8 +455,6 @@ function createWithRange(LockupLinear.CreateWithRange calldata params) | ---------- | --------- | ----------------------------------- | | `streamId` | `uint256` | The id of the newly created stream. | -## Internal Functions - ### \_calculateStreamedAmount _Calculates the streamed amount without looking up the stream's status._ @@ -496,8 +487,7 @@ function _statusOf(uint256 streamId) internal view override returns (Lockup.Stat ### \_streamedAmountOf -_Implements the internal logic for -[streamedAmountOf](/contracts/v2/reference/core/contract.SablierV2LockupLinear#streamedamountof)._ +_See the documentation for the user-facing functions that call this internal function._ ```solidity function _streamedAmountOf(uint256 streamId) internal view returns (uint128); @@ -505,8 +495,7 @@ function _streamedAmountOf(uint256 streamId) internal view returns (uint128); ### \_withdrawableAmountOf -_Implements the internal logic for -[withdrawableAmountOf](/contracts/v2/reference/core/abstracts/abstract.SablierV2Lockup#withdrawableamountof)._ +_See the documentation for the user-facing functions that call this internal function._ ```solidity function _withdrawableAmountOf(uint256 streamId) internal view override returns (uint128); @@ -514,7 +503,7 @@ function _withdrawableAmountOf(uint256 streamId) internal view override returns ### \_cancel -_Implements the internal logic for [cancel](/contracts/v2/reference/core/abstracts/abstract.SablierV2Lockup#cancel)._ +_See the documentation for the user-facing functions that call this internal function._ ```solidity function _cancel(uint256 streamId) internal override; @@ -522,8 +511,7 @@ function _cancel(uint256 streamId) internal override; ### \_createWithRange -_Implements the internal logic for -[createWithRange](/contracts/v2/reference/core/contract.SablierV2LockupLinear#createwithrange)._ +_See the documentation for the user-facing functions that call this internal function._ ```solidity function _createWithRange(LockupLinear.CreateWithRange memory params) internal returns (uint256 streamId); @@ -531,8 +519,7 @@ function _createWithRange(LockupLinear.CreateWithRange memory params) internal r ### \_renounce -_Implements the internal logic for -[renounce](/contracts/v2/reference/core/abstracts/abstract.SablierV2Lockup#renounce)._ +_See the documentation for the user-facing functions that call this internal function._ ```solidity function _renounce(uint256 streamId) internal override; @@ -540,8 +527,7 @@ function _renounce(uint256 streamId) internal override; ### \_withdraw -_Implements the internal logic for -[\_withdraw](/contracts/v2/reference/core/abstracts/abstract.SablierV2Lockup#_withdraw)._ +_See the documentation for the user-facing functions that call this internal function._ ```solidity function _withdraw(uint256 streamId, address to, uint128 amount) internal override; diff --git a/docs/contracts/v2/reference/core/contract.SablierV2NFTDescriptor.md b/docs/contracts/v2/reference/core/contract.SablierV2NFTDescriptor.md index 54a9f72e..01e2f2f4 100644 --- a/docs/contracts/v2/reference/core/contract.SablierV2NFTDescriptor.md +++ b/docs/contracts/v2/reference/core/contract.SablierV2NFTDescriptor.md @@ -4,7 +4,7 @@ sidebar_position: 3 # SablierV2NFTDescriptor -[Git Source](https://github.com/sablier-labs/v2-core/blob/release/src/SablierV2NFTDescriptor.sol) +[Git Source](https://github.com/sablier-labs/v2-core/blob/a4bf69cf7024006b9a324eef433f20b74597eaaf/src/SablierV2NFTDescriptor.sol) **Inherits:** [ISablierV2NFTDescriptor](/docs/contracts/v2/reference/core/interfaces/interface.ISablierV2NFTDescriptor.md) @@ -61,9 +61,9 @@ function abbreviateAmount(uint256 amount, uint256 decimals) internal pure return **Returns** -| Name | Type | Description | -| -------- | -------- | ------------------------------------------------------------------- | -| `` | `string` | The abbreviated representation of the provided amount, as a string. | +| Name | Type | Description | +| -------- | -------- | -------------------------------------------------------------------------------- | +| `` | `string` | abbreviation The abbreviated representation of the provided amount, as a string. | ### calculateDurationInDays diff --git a/docs/contracts/v2/reference/core/interfaces/erc3156/interface.IERC3156FlashBorrower.md b/docs/contracts/v2/reference/core/interfaces/erc3156/interface.IERC3156FlashBorrower.md index cf6a37c6..45ebab47 100644 --- a/docs/contracts/v2/reference/core/interfaces/erc3156/interface.IERC3156FlashBorrower.md +++ b/docs/contracts/v2/reference/core/interfaces/erc3156/interface.IERC3156FlashBorrower.md @@ -1,6 +1,6 @@ # IERC3156FlashBorrower -[Git Source](https://github.com/sablier-labs/v2-core/blob/release/src/interfaces/erc3156/IERC3156FlashBorrower.sol) +[Git Source](https://github.com/sablier-labs/v2-core/blob/a4bf69cf7024006b9a324eef433f20b74597eaaf/src/interfaces/erc3156/IERC3156FlashBorrower.sol) Interface for ERC-3156 flash borrowers. diff --git a/docs/contracts/v2/reference/core/interfaces/erc3156/interface.IERC3156FlashLender.md b/docs/contracts/v2/reference/core/interfaces/erc3156/interface.IERC3156FlashLender.md index bff79c80..82b69976 100644 --- a/docs/contracts/v2/reference/core/interfaces/erc3156/interface.IERC3156FlashLender.md +++ b/docs/contracts/v2/reference/core/interfaces/erc3156/interface.IERC3156FlashLender.md @@ -1,6 +1,6 @@ # IERC3156FlashLender -[Git Source](https://github.com/sablier-labs/v2-core/blob/release/src/interfaces/erc3156/IERC3156FlashLender.sol) +[Git Source](https://github.com/sablier-labs/v2-core/blob/a4bf69cf7024006b9a324eef433f20b74597eaaf/src/interfaces/erc3156/IERC3156FlashLender.sol) Interface for ERC-3156 flash lenders. diff --git a/docs/contracts/v2/reference/core/interfaces/hooks/interface.ISablierV2LockupRecipient.md b/docs/contracts/v2/reference/core/interfaces/hooks/interface.ISablierV2LockupRecipient.md index 19eb8bc9..5b587196 100644 --- a/docs/contracts/v2/reference/core/interfaces/hooks/interface.ISablierV2LockupRecipient.md +++ b/docs/contracts/v2/reference/core/interfaces/hooks/interface.ISablierV2LockupRecipient.md @@ -1,6 +1,6 @@ # ISablierV2LockupRecipient -[Git Source](https://github.com/sablier-labs/v2-core/blob/release/src/interfaces/hooks/ISablierV2LockupRecipient.sol) +[Git Source](https://github.com/sablier-labs/v2-core/blob/a4bf69cf7024006b9a324eef433f20b74597eaaf/src/interfaces/hooks/ISablierV2LockupRecipient.sol) Interface for recipient contracts capable of reacting to cancellations, renouncements, and withdrawals. diff --git a/docs/contracts/v2/reference/core/interfaces/interface.IAdminable.md b/docs/contracts/v2/reference/core/interfaces/interface.IAdminable.md index 31197634..840f0f44 100644 --- a/docs/contracts/v2/reference/core/interfaces/interface.IAdminable.md +++ b/docs/contracts/v2/reference/core/interfaces/interface.IAdminable.md @@ -1,6 +1,6 @@ # IAdminable -[Git Source](https://github.com/sablier-labs/v2-core/blob/release/src/interfaces/IAdminable.sol) +[Git Source](https://github.com/sablier-labs/v2-core/blob/a4bf69cf7024006b9a324eef433f20b74597eaaf/src/interfaces/IAdminable.sol) Contract module that provides a basic access control mechanism, with an admin that can be granted exclusive access to specific functions. The inheriting contract must set the initial admin in the constructor. @@ -45,3 +45,10 @@ Emitted when the admin is transferred. ```solidity event TransferAdmin(address indexed oldAdmin, address indexed newAdmin); ``` + +**Parameters** + +| Name | Type | Description | +| ---------- | --------- | ----------------------------- | +| `oldAdmin` | `address` | The address of the old admin. | +| `newAdmin` | `address` | The address of the new admin. | diff --git a/docs/contracts/v2/reference/core/interfaces/interface.ISablierV2Base.md b/docs/contracts/v2/reference/core/interfaces/interface.ISablierV2Base.md index b879511b..78e8ae9f 100644 --- a/docs/contracts/v2/reference/core/interfaces/interface.ISablierV2Base.md +++ b/docs/contracts/v2/reference/core/interfaces/interface.ISablierV2Base.md @@ -1,6 +1,6 @@ # ISablierV2Base -[Git Source](https://github.com/sablier-labs/v2-core/blob/release/src/interfaces/ISablierV2Base.sol) +[Git Source](https://github.com/sablier-labs/v2-core/blob/a4bf69cf7024006b9a324eef433f20b74597eaaf/src/interfaces/ISablierV2Base.sol) **Inherits:** [IAdminable](/docs/contracts/v2/reference/core/interfaces/interface.IAdminable.md) @@ -45,7 +45,9 @@ function protocolRevenues(IERC20 asset) external view returns (uint128 revenues) Claims all accumulated protocol revenues for the provided ERC-20 asset. -Emits a {ClaimProtocolRevenues} event. Requirements: +Emits a +[ClaimProtocolRevenues](/docs/contracts/v2/reference/core/interfaces/interface.ISablierV2Base.md#claimprotocolrevenues) +event. Requirements: - `msg.sender` must be the contract admin. @@ -63,7 +65,8 @@ function claimProtocolRevenues(IERC20 asset) external; Assigns a new comptroller contract responsible for the protocol configuration. -Emits a {SetComptroller} event. Notes: +Emits a [SetComptroller](/docs/contracts/v2/reference/core/interfaces/interface.ISablierV2Base.md#setcomptroller) event. +Notes: - Does not revert if the comptroller is the same. Requirements: - `msg.sender` must be the contract admin. @@ -88,6 +91,14 @@ Emitted when the admin claims all protocol revenues accrued for a particular ERC event ClaimProtocolRevenues(address indexed admin, IERC20 indexed asset, uint128 protocolRevenues); ``` +**Parameters** + +| Name | Type | Description | +| ------------------ | --------- | ------------------------------------------------------------------------------------- | +| `admin` | `address` | The address of the contract admin. | +| `asset` | `IERC20` | The contract address of the ERC-20 asset the protocol revenues have been claimed for. | +| `protocolRevenues` | `uint128` | The amount of protocol revenues claimed, denoted in units of the asset's decimals. | + ### SetComptroller Emitted when the admin sets a new comptroller contract. @@ -95,3 +106,11 @@ Emitted when the admin sets a new comptroller contract. ```solidity event SetComptroller(address indexed admin, ISablierV2Comptroller oldComptroller, ISablierV2Comptroller newComptroller); ``` + +**Parameters** + +| Name | Type | Description | +| ---------------- | ----------------------- | -------------------------------------------- | +| `admin` | `address` | The address of the contract admin. | +| `oldComptroller` | `ISablierV2Comptroller` | The address of the old comptroller contract. | +| `newComptroller` | `ISablierV2Comptroller` | The address of the new comptroller contract. | diff --git a/docs/contracts/v2/reference/core/interfaces/interface.ISablierV2Comptroller.md b/docs/contracts/v2/reference/core/interfaces/interface.ISablierV2Comptroller.md index a4623732..1e657a63 100644 --- a/docs/contracts/v2/reference/core/interfaces/interface.ISablierV2Comptroller.md +++ b/docs/contracts/v2/reference/core/interfaces/interface.ISablierV2Comptroller.md @@ -1,6 +1,6 @@ # ISablierV2Comptroller -[Git Source](https://github.com/sablier-labs/v2-core/blob/release/src/interfaces/ISablierV2Comptroller.sol) +[Git Source](https://github.com/sablier-labs/v2-core/blob/a4bf69cf7024006b9a324eef433f20b74597eaaf/src/interfaces/ISablierV2Comptroller.sol) **Inherits:** [IAdminable](/docs/contracts/v2/reference/core/interfaces/interface.IAdminable.md) @@ -60,7 +60,8 @@ function protocolFees(IERC20 asset) external view returns (UD60x18 fee); Updates the flash fee charged on all flash loans made with any ERC-20 asset. -Emits a {SetFlashFee} event. Notes: +Emits a [SetFlashFee](/docs/contracts/v2/reference/core/interfaces/interface.ISablierV2Comptroller.md#setflashfee) +event. Notes: - Does not revert if the fee is the same. Requirements: - `msg.sender` must be the contract admin. @@ -79,7 +80,8 @@ function setFlashFee(UD60x18 newFlashFee) external; Sets a new protocol fee that will be charged on all streams created with the provided ERC-20 asset. -Emits a {SetProtocolFee} event. Notes: +Emits a [SetProtocolFee](/docs/contracts/v2/reference/core/interfaces/interface.ISablierV2Comptroller.md#setprotocolfee) +event. Notes: - The fee is not denoted in units of the asset's decimals; it is a fixed-point number. Refer to the PRBMath documentation for more detail on the logic of UD60x18. @@ -101,7 +103,9 @@ function setProtocolFee(IERC20 asset, UD60x18 newProtocolFee) external; Toggles the flash loanability of an ERC-20 asset. -Emits a {ToggleFlashAsset} event. Requirements: +Emits a +[ToggleFlashAsset](/docs/contracts/v2/reference/core/interfaces/interface.ISablierV2Comptroller.md#toggleflashasset) +event. Requirements: - `msg.sender` must be the admin. @@ -125,6 +129,14 @@ Emitted when the admin sets a new flash fee. event SetFlashFee(address indexed admin, UD60x18 oldFlashFee, UD60x18 newFlashFee); ``` +**Parameters** + +| Name | Type | Description | +| ------------- | --------- | --------------------------------------------------- | +| `admin` | `address` | The address of the contract admin. | +| `oldFlashFee` | `UD60x18` | The old flash fee, denoted as a fixed-point number. | +| `newFlashFee` | `UD60x18` | The new flash fee, denoted as a fixed-point number. | + ### SetProtocolFee Emitted when the admin sets a new protocol fee for the provided ERC-20 asset. @@ -133,6 +145,15 @@ Emitted when the admin sets a new protocol fee for the provided ERC-20 asset. event SetProtocolFee(address indexed admin, IERC20 indexed asset, UD60x18 oldProtocolFee, UD60x18 newProtocolFee); ``` +**Parameters** + +| Name | Type | Description | +| ---------------- | --------- | ------------------------------------------------------------------------------- | +| `admin` | `address` | The address of the contract admin. | +| `asset` | `IERC20` | The contract address of the ERC-20 asset the new protocol fee has been set for. | +| `oldProtocolFee` | `UD60x18` | The old protocol fee, denoted as a fixed-point number. | +| `newProtocolFee` | `UD60x18` | The new protocol fee, denoted as a fixed-point number. | + ### ToggleFlashAsset Emitted when the admin enables or disables an ERC-20 asset for flash loaning. @@ -140,3 +161,11 @@ Emitted when the admin enables or disables an ERC-20 asset for flash loaning. ```solidity event ToggleFlashAsset(address indexed admin, IERC20 indexed asset, bool newFlag); ``` + +**Parameters** + +| Name | Type | Description | +| --------- | --------- | --------------------------------------------------- | +| `admin` | `address` | The address of the contract admin. | +| `asset` | `IERC20` | The contract address of the ERC-20 asset to toggle. | +| `newFlag` | `bool` | Whether the ERC-20 asset can be flash loaned. | diff --git a/docs/contracts/v2/reference/core/interfaces/interface.ISablierV2Lockup.md b/docs/contracts/v2/reference/core/interfaces/interface.ISablierV2Lockup.md index 760a45e1..9c126286 100644 --- a/docs/contracts/v2/reference/core/interfaces/interface.ISablierV2Lockup.md +++ b/docs/contracts/v2/reference/core/interfaces/interface.ISablierV2Lockup.md @@ -1,11 +1,11 @@ # ISablierV2Lockup -[Git Source](https://github.com/sablier-labs/v2-core/blob/release/src/interfaces/ISablierV2Lockup.sol) +[Git Source](https://github.com/sablier-labs/v2-core/blob/a4bf69cf7024006b9a324eef433f20b74597eaaf/src/interfaces/ISablierV2Lockup.sol) **Inherits:** [ISablierV2Base](/docs/contracts/v2/reference/core/interfaces/interface.ISablierV2Base.md), -[IERC721Metadata](https://github.com/OpenZeppelin/openzeppelin-contracts/blob/e50c24f5839db17f46991478384bfda14acfb830/contracts/token/ERC721/extensions/IERC721Metadata.sol) +IERC721Metadata -Common logic between all Sablier V2 lockup streaming contracts. +Common logic between all Sablier V2 Lockup streaming contracts. ## Functions @@ -388,7 +388,9 @@ function cancelMultiple(uint256[] calldata streamIds) external; Removes the right of the stream's sender to cancel the stream. -Emits a {RenounceLockupStream} and {MetadataUpdate} event. Notes: +Emits a +[RenounceLockupStream](/docs/contracts/v2/reference/core/interfaces/interface.ISablierV2Lockup.md#renouncelockupstream) +and {MetadataUpdate} event. Notes: - This is an irreversible operation. - This function attempts to invoke a hook on the stream's recipient, provided that the recipient is a contract. @@ -412,7 +414,8 @@ function renounce(uint256 streamId) external; Sets a new NFT descriptor contract, which produces the URI describing the Sablier stream NFTs. -Emits a {SetNFTDescriptor} and {BatchMetadataUpdate} event. Notes: +Emits a [SetNFTDescriptor](/docs/contracts/v2/reference/core/interfaces/interface.ISablierV2Lockup.md#setnftdescriptor) +and {BatchMetadataUpdate} event. Notes: - Does not revert if the NFT descriptor is the same. Requirements: - `msg.sender` must be the contract admin. @@ -479,7 +482,9 @@ function withdrawMax(uint256 streamId, address to) external; Withdraws the maximum withdrawable amount from the stream to the current recipient, and transfers the NFT to `newRecipient`. -Emits a {WithdrawFromLockupStream} and a {Transfer} event. Notes: +Emits a +[WithdrawFromLockupStream](/docs/contracts/v2/reference/core/interfaces/interface.ISablierV2Lockup.md#withdrawfromlockupstream) +and a {Transfer} event. Notes: - If the withdrawable amount is zero, the withdrawal is skipped. - Refer to the notes in {withdraw}. Requirements: @@ -532,12 +537,23 @@ event CancelLockupStream( uint256 streamId, address indexed sender, address indexed recipient, - address indexed asset, + IERC20 indexed asset, uint128 senderAmount, uint128 recipientAmount ); ``` +**Parameters** + +| Name | Type | Description | +| ----------------- | --------- | ----------------------------------------------------------------------------------------------------------- | +| `streamId` | `uint256` | The id of the stream. | +| `sender` | `address` | The address of the stream's sender. | +| `recipient` | `address` | The address of the stream's recipient. | +| `asset` | `IERC20` | The contract address of the ERC-20 asset used for streaming. | +| `senderAmount` | `uint128` | The amount of assets refunded to the stream's sender, denoted in units of the asset's decimals. | +| `recipientAmount` | `uint128` | The amount of assets left for the stream's recipient to withdraw, denoted in units of the asset's decimals. | + ### RenounceLockupStream Emitted when a sender gives up the right to cancel a stream. @@ -546,6 +562,12 @@ Emitted when a sender gives up the right to cancel a stream. event RenounceLockupStream(uint256 indexed streamId); ``` +**Parameters** + +| Name | Type | Description | +| ---------- | --------- | --------------------- | +| `streamId` | `uint256` | The id of the stream. | + ### SetNFTDescriptor Emitted when the admin sets a new NFT descriptor contract. @@ -556,10 +578,27 @@ event SetNFTDescriptor( ); ``` +**Parameters** + +| Name | Type | Description | +| ------------------ | ------------------------- | ----------------------------------------------- | +| `admin` | `address` | The address of the current contract admin. | +| `oldNFTDescriptor` | `ISablierV2NFTDescriptor` | The address of the old NFT descriptor contract. | +| `newNFTDescriptor` | `ISablierV2NFTDescriptor` | The address of the new NFT descriptor contract. | + ### WithdrawFromLockupStream Emitted when assets are withdrawn from a stream. ```solidity -event WithdrawFromLockupStream(uint256 indexed streamId, address indexed to, address indexed asset, uint128 amount); +event WithdrawFromLockupStream(uint256 indexed streamId, address indexed to, IERC20 indexed asset, uint128 amount); ``` + +**Parameters** + +| Name | Type | Description | +| ---------- | --------- | ------------------------------------------------------------------------- | +| `streamId` | `uint256` | The id of the stream. | +| `to` | `address` | The address that has received the withdrawn assets. | +| `asset` | `IERC20` | The contract address of the ERC-20 asset used for streaming. | +| `amount` | `uint128` | The amount of assets withdrawn, denoted in units of the asset's decimals. | diff --git a/docs/contracts/v2/reference/core/interfaces/interface.ISablierV2LockupDynamic.md b/docs/contracts/v2/reference/core/interfaces/interface.ISablierV2LockupDynamic.md index 335fcc40..705eaee0 100644 --- a/docs/contracts/v2/reference/core/interfaces/interface.ISablierV2LockupDynamic.md +++ b/docs/contracts/v2/reference/core/interfaces/interface.ISablierV2LockupDynamic.md @@ -1,10 +1,10 @@ # ISablierV2LockupDynamic -[Git Source](https://github.com/sablier-labs/v2-core/blob/bca1d9ea0485b065544486bb01f4148d44289644/docs/contracts/v2/reference/core/interfaces) +[Git Source](https://github.com/sablier-labs/v2-core/blob/a4bf69cf7024006b9a324eef433f20b74597eaaf/src/interfaces/ISablierV2LockupDynamic.sol) **Inherits:** [ISablierV2Lockup](/docs/contracts/v2/reference/core/interfaces/interface.ISablierV2Lockup.md) -Creates and manages lockup streams with dynamic streaming functions. +Creates and manages Lockup streams with dynamic streaming functions. ## Functions @@ -180,3 +180,19 @@ event CreateLockupDynamicStream( address broker ); ``` + +**Parameters** + +| Name | Type | Description | +| -------------- | ------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `streamId` | `uint256` | The id of the newly created stream. | +| `funder` | `address` | The address which has funded the stream. | +| `sender` | `address` | The address from which to stream the assets, who will have the ability to cancel the stream. | +| `recipient` | `address` | The address toward which to stream the assets. | +| `amounts` | `Lockup.CreateAmounts` | Struct containing (i) the deposit amount, (ii) the protocol fee amount, and (iii) the broker fee amount, all denoted in units of the asset's decimals. | +| `asset` | `IERC20` | The contract address of the ERC-20 asset used for streaming. | +| `cancelable` | `bool` | Boolean indicating whether the stream will be cancelable or not. | +| `transferable` | `bool` | Boolean indicating whether the stream NFT is transferable or not. | +| `segments` | `LockupDynamic.Segment[]` | The segments the protocol uses to compose the custom streaming curve. | +| `range` | `LockupDynamic.Range` | Struct containing (i) the stream's start time and (ii) end time, both as Unix timestamps. | +| `broker` | `address` | The address of the broker who has helped create the stream, e.g. a front-end website. | diff --git a/docs/contracts/v2/reference/core/interfaces/interface.ISablierV2LockupLinear.md b/docs/contracts/v2/reference/core/interfaces/interface.ISablierV2LockupLinear.md index 82d6cc8f..d0b6208e 100644 --- a/docs/contracts/v2/reference/core/interfaces/interface.ISablierV2LockupLinear.md +++ b/docs/contracts/v2/reference/core/interfaces/interface.ISablierV2LockupLinear.md @@ -1,10 +1,10 @@ # ISablierV2LockupLinear -[Git Source](https://github.com/sablier-labs/v2-core/blob/bca1d9ea0485b065544486bb01f4148d44289644/docs/contracts/v2/reference/core/interfaces) +[Git Source](https://github.com/sablier-labs/v2-core/blob/a4bf69cf7024006b9a324eef433f20b74597eaaf/src/interfaces/ISablierV2LockupLinear.sol) **Inherits:** [ISablierV2Lockup](/docs/contracts/v2/reference/core/interfaces/interface.ISablierV2Lockup.md) -Creates and manages lockup streams with a linear streaming function. +Creates and manages Lockup streams with linear streaming functions. ## Functions @@ -164,3 +164,18 @@ event CreateLockupLinearStream( address broker ); ``` + +**Parameters** + +| Name | Type | Description | +| -------------- | ---------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `streamId` | `uint256` | The id of the newly created stream. | +| `funder` | `address` | The address which funded the stream. | +| `sender` | `address` | The address streaming the assets, with the ability to cancel the stream. | +| `recipient` | `address` | The address receiving the assets. | +| `amounts` | `Lockup.CreateAmounts` | Struct containing (i) the deposit amount, (ii) the protocol fee amount, and (iii) the broker fee amount, all denoted in units of the asset's decimals. | +| `asset` | `IERC20` | The contract address of the ERC-20 asset used for streaming. | +| `cancelable` | `bool` | Boolean indicating whether the stream will be cancelable or not. | +| `transferable` | `bool` | Boolean indicating whether the stream NFT is transferable or not. | +| `range` | `LockupLinear.Range` | Struct containing (i) the stream's start time, (ii) cliff time, and (iii) end time, all as Unix timestamps. | +| `broker` | `address` | The address of the broker who has helped create the stream, e.g. a front-end website. | diff --git a/docs/contracts/v2/reference/core/interfaces/interface.ISablierV2NftDescriptor.md b/docs/contracts/v2/reference/core/interfaces/interface.ISablierV2NftDescriptor.md index f9430e18..f48118fd 100644 --- a/docs/contracts/v2/reference/core/interfaces/interface.ISablierV2NftDescriptor.md +++ b/docs/contracts/v2/reference/core/interfaces/interface.ISablierV2NftDescriptor.md @@ -1,6 +1,6 @@ # ISablierV2NFTDescriptor -[Git Source](https://github.com/sablier-labs/v2-core/blob/release/src/interfaces/ISablierV2NFTDescriptor.sol) +[Git Source](https://github.com/sablier-labs/v2-core/blob/a4bf69cf7024006b9a324eef433f20b74597eaaf/src/interfaces/ISablierV2NFTDescriptor.sol) This contract generates the URI describing the Sablier V2 stream NFTs. diff --git a/docs/contracts/v2/reference/core/libraries/library.Errors.md b/docs/contracts/v2/reference/core/libraries/library.Errors.md index c4ed9422..0e559063 100644 --- a/docs/contracts/v2/reference/core/libraries/library.Errors.md +++ b/docs/contracts/v2/reference/core/libraries/library.Errors.md @@ -1,6 +1,6 @@ # Errors -[Git Source](https://github.com/sablier-labs/v2-core/blob/release/src/libraries/Errors.sol) +[Git Source](https://github.com/sablier-labs/v2-core/blob/a4bf69cf7024006b9a324eef433f20b74597eaaf/src/libraries/Errors.sol) Library containing all custom errors the protocol may revert with. @@ -94,12 +94,12 @@ Thrown when the stream's sender tries to withdraw to an address other than the r error SablierV2Lockup_InvalidSenderWithdrawal(uint256 streamId, address sender, address to); ``` -### SablierV2Lockup_NotTransferrable +### SablierV2Lockup_NotTransferable Thrown when trying to transfer Stream NFT when transferability is disabled. ```solidity -error SablierV2Lockup_NotTransferrable(uint256 tokenId); +error SablierV2Lockup_NotTransferable(uint256 tokenId); ``` ### SablierV2Lockup_Null diff --git a/docs/contracts/v2/reference/core/libraries/library.Helpers.md b/docs/contracts/v2/reference/core/libraries/library.Helpers.md index 24f05de5..cefd8e78 100644 --- a/docs/contracts/v2/reference/core/libraries/library.Helpers.md +++ b/docs/contracts/v2/reference/core/libraries/library.Helpers.md @@ -1,6 +1,6 @@ # Helpers -[Git Source](https://github.com/sablier-labs/v2-core/blob/release/src/libraries/Helpers.sol) +[Git Source](https://github.com/sablier-labs/v2-core/blob/a4bf69cf7024006b9a324eef433f20b74597eaaf/src/libraries/Helpers.sol) Library with helper functions needed across the Sablier V2 contracts. @@ -40,7 +40,9 @@ function checkCreateWithMilestones( ### checkCreateWithRange -_Checks the parameters of the {SablierV2LockupLinear-\_createWithRange} function._ +_Checks the parameters of the +[SablierV2LockupLinear-\_createWithRange](/docs/contracts/v2/reference/core/contract.SablierV2LockupLinear.md#_createwithrange) +function._ ```solidity function checkCreateWithRange(uint128 depositAmount, LockupLinear.Range memory range) internal view; diff --git a/docs/contracts/v2/reference/core/libraries/library.NFTSVG.md b/docs/contracts/v2/reference/core/libraries/library.NFTSVG.md index 326e2fd8..690daf82 100644 --- a/docs/contracts/v2/reference/core/libraries/library.NFTSVG.md +++ b/docs/contracts/v2/reference/core/libraries/library.NFTSVG.md @@ -1,6 +1,6 @@ # NFTSVG -[Git Source](https://github.com/sablier-labs/v2-core/blob/release/src/libraries/NFTSVG.sol) +[Git Source](https://github.com/sablier-labs/v2-core/blob/a4bf69cf7024006b9a324eef433f20b74597eaaf/src/libraries/NFTSVG.sol) ## State Variables diff --git a/docs/contracts/v2/reference/core/libraries/library.SVGElements.md b/docs/contracts/v2/reference/core/libraries/library.SVGElements.md index 4544a659..f36cb6c7 100644 --- a/docs/contracts/v2/reference/core/libraries/library.SVGElements.md +++ b/docs/contracts/v2/reference/core/libraries/library.SVGElements.md @@ -1,6 +1,6 @@ # SVGElements -[Git Source](https://github.com/sablier-labs/v2-core/blob/release/src/libraries/SVGElements.sol) +[Git Source](https://github.com/sablier-labs/v2-core/blob/a4bf69cf7024006b9a324eef433f20b74597eaaf/src/libraries/SVGElements.sol) ## State Variables diff --git a/docs/contracts/v2/reference/core/types/library.Lockup.md b/docs/contracts/v2/reference/core/types/library.Lockup.md index 511f103b..1bf0d5fa 100644 --- a/docs/contracts/v2/reference/core/types/library.Lockup.md +++ b/docs/contracts/v2/reference/core/types/library.Lockup.md @@ -1,6 +1,6 @@ # Lockup -[Git Source](https://github.com/sablier-labs/v2-core/blob/release/src/types/DataTypes.sol) +[Git Source](https://github.com/sablier-labs/v2-core/blob/a4bf69cf7024006b9a324eef433f20b74597eaaf/src/types/DataTypes.sol) Namespace for the structs used in both [SablierV2LockupLinear](docs/contracts/v2/reference/core/contract.SablierV2LockupLinear.md) and @@ -22,6 +22,14 @@ struct Amounts { } ``` +**Properties** + +| Name | Type | Description | +| ----------- | --------- | --------------------------------------------------------------------------------------- | +| `deposited` | `uint128` | The initial amount deposited in the stream, net of fees. | +| `withdrawn` | `uint128` | The cumulative amount withdrawn from the stream. | +| `refunded` | `uint128` | The amount refunded to the sender. Unless the stream was canceled, this is always zero. | + ### CreateAmounts Struct encapsulating the deposit amount, the protocol fee amount, and the broker fee amount, all denoted in units of the @@ -35,6 +43,14 @@ struct CreateAmounts { } ``` +**Properties** + +| Name | Type | Description | +| ------------- | --------- | ------------------------------------ | +| `deposit` | `uint128` | The amount to deposit in the stream. | +| `protocolFee` | `uint128` | The protocol fee amount. | +| `brokerFee` | `uint128` | The broker fee amount. | + ## Enums ### Status diff --git a/docs/contracts/v2/reference/core/types/library.LockupDynamic.md b/docs/contracts/v2/reference/core/types/library.LockupDynamic.md index c884bf1d..63c5a560 100644 --- a/docs/contracts/v2/reference/core/types/library.LockupDynamic.md +++ b/docs/contracts/v2/reference/core/types/library.LockupDynamic.md @@ -1,6 +1,6 @@ # LockupDynamic -[Git Source](https://github.com/sablier-labs/v2-core/blob/release/src/types/DataTypes.sol) +[Git Source](https://github.com/sablier-labs/v2-core/blob/a4bf69cf7024006b9a324eef433f20b74597eaaf/src/types/DataTypes.sol) Namespace for the structs used in [SablierV2LockupDynamic](docs/contracts/v2/reference/core/contract.SablierV2LockupDynamic.md). @@ -24,7 +24,7 @@ struct CreateWithDeltas { } ``` -**Parameters** +**Properties** | Name | Type | Description | | -------------- | -------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | @@ -32,8 +32,8 @@ struct CreateWithDeltas { | `cancelable` | `bool` | Indicates if the stream is cancelable. | | `transferable` | `bool` | Indicates if the stream NFT is transferable. | | `recipient` | `address` | The address receiving the assets. | -| `totalAmount` | `uint128` | The total amount of `ERC-20` assets to be paid, including the stream deposit and any potential fees, all denoted in units of the asset's decimals. | -| `asset` | `IERC20` | The contract address of the `ERC-20` asset used for streaming. | +| `totalAmount` | `uint128` | The total amount of ERC-20 assets to be paid, including the stream deposit and any potential fees, all denoted in units of the asset's decimals. | +| `asset` | `IERC20` | The contract address of the ERC-20 asset used for streaming. | | `broker` | `Broker` | Struct containing (i) the address of the broker assisting in creating the stream, and (ii) the percentage fee paid to the broker from `totalAmount`, denoted as a fixed-point number. Both can be set to zero. | | `segments` | `SegmentWithDelta[]` | Segments with deltas used to compose the custom streaming curve. Milestones are calculated by starting from `block.timestamp` and adding each delta to the previous milestone. | @@ -55,7 +55,7 @@ struct CreateWithMilestones { } ``` -**Parameters** +**Properties** | Name | Type | Description | | -------------- | ----------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | @@ -64,8 +64,8 @@ struct CreateWithMilestones { | `cancelable` | `bool` | Indicates if the stream is cancelable. | | `transferable` | `bool` | Indicates if the stream NFT is transferable. | | `recipient` | `address` | The address receiving the assets. | -| `totalAmount` | `uint128` | The total amount of `ERC-20` assets to be paid, including the stream deposit and any potential fees, all denoted in units of the asset's decimals. | -| `asset` | `IERC20` | The contract address of the `ERC-20` asset used for streaming. | +| `totalAmount` | `uint128` | The total amount of ERC-20 assets to be paid, including the stream deposit and any potential fees, all denoted in units of the asset's decimals. | +| `asset` | `IERC20` | The contract address of the ERC-20 asset used for streaming. | | `broker` | `Broker` | Struct containing (i) the address of the broker assisting in creating the stream, and (ii) the percentage fee paid to the broker from `totalAmount`, denoted as a fixed-point number. Both can be set to zero. | | `segments` | `Segment[]` | Segments used to compose the custom streaming curve. | @@ -80,6 +80,13 @@ struct Range { } ``` +**Properties** + +| Name | Type | Description | +| ------- | -------- | ------------------------------------------------- | +| `start` | `uint40` | The Unix timestamp indicating the stream's start. | +| `end` | `uint40` | The Unix timestamp indicating the stream's end. | + ### Segment Segment struct used in the Lockup Dynamic stream. @@ -92,7 +99,7 @@ struct Segment { } ``` -**Parameters** +**Properties** | Name | Type | Description | | ----------- | --------- | ---------------------------------------------------------------------------------------------- | @@ -112,13 +119,13 @@ struct SegmentWithDelta { } ``` -**Parameters** +**Properties** -| Name | Type | Description | -| ----------- | --------- | ---------------------------------------------------------------------------------------------- | -| `amount` | `uint128` | The amount of assets to be streamed in this segment, denoted in units of the asset's decimals. | -| `exponent` | `UD2x18` | The exponent of this segment, denoted as a fixed-point number. | -| `milestone` | `uint40` | The time difference in seconds between this segment and the previous one. | +| Name | Type | Description | +| ---------- | --------- | ---------------------------------------------------------------------------------------------- | +| `amount` | `uint128` | The amount of assets to be streamed in this segment, denoted in units of the asset's decimals. | +| `exponent` | `UD2x18` | The exponent of this segment, denoted as a fixed-point number. | +| `delta` | `uint40` | The time difference in seconds between this segment and the previous one. | ### Stream @@ -142,18 +149,18 @@ struct Stream { } ``` -**Parameters** - -| Name | Type | Description | -| ---------------- | ---------------- | ------------------------------------------------------------------------------------------------------------------------ | -| `sender` | `address` | The address streaming the assets, with the ability to cancel the stream. It doesn't have to be the same as `msg.sender`. | -| `startTime` | `uint40` | The Unix timestamp indicating the stream's start. | -| `endTime` | `uint40` | The Unix timestamp indicating the stream's end. | -| `isCancelable` | `bool` | Boolean indicating if the stream is cancelable. | -| `wasCanceled` | `bool` | Boolean indicating if the stream was canceled. | -| `asset` | `IERC20` | The contract address of the `ERC-20` asset used for streaming. | -| `isDepleted` | `bool` | Boolean indicating if the stream is depleted. | -| `isStream` | `bool` | Boolean indicating if the struct entity exists. | -| `isTransferable` | `bool` | Boolean indicating if the stream NFT is transferable. | -| `amounts` | `Lockup.Amounts` | Struct containing the deposit, withdrawn, and refunded amounts, all denoted in units of the asset's decimals. | -| `segments` | `Segment[]` | Segments used to compose the custom streaming curve. | +**Properties** + +| Name | Type | Description | +| ---------------- | ---------------- | ------------------------------------------------------------------------------------------------------------- | +| `sender` | `address` | The address streaming the assets, with the ability to cancel the stream. | +| `startTime` | `uint40` | The Unix timestamp indicating the stream's start. | +| `endTime` | `uint40` | The Unix timestamp indicating the stream's end. | +| `isCancelable` | `bool` | Boolean indicating if the stream is cancelable. | +| `wasCanceled` | `bool` | Boolean indicating if the stream was canceled. | +| `asset` | `IERC20` | The contract address of the ERC-20 asset used for streaming. | +| `isDepleted` | `bool` | Boolean indicating if the stream is depleted. | +| `isStream` | `bool` | Boolean indicating if the struct entity exists. | +| `isTransferable` | `bool` | Boolean indicating if the stream NFT is transferable. | +| `amounts` | `Lockup.Amounts` | Struct containing the deposit, withdrawn, and refunded amounts, all denoted in units of the asset's decimals. | +| `segments` | `Segment[]` | Segments used to compose the custom streaming curve. | diff --git a/docs/contracts/v2/reference/core/types/library.LockupLinear.md b/docs/contracts/v2/reference/core/types/library.LockupLinear.md index 3c789b8c..983b4688 100644 --- a/docs/contracts/v2/reference/core/types/library.LockupLinear.md +++ b/docs/contracts/v2/reference/core/types/library.LockupLinear.md @@ -1,6 +1,6 @@ # LockupLinear -[Git Source](https://github.com/sablier-labs/v2-core/blob/release/src/types/DataTypes.sol) +[Git Source](https://github.com/sablier-labs/v2-core/blob/a4bf69cf7024006b9a324eef433f20b74597eaaf/src/types/DataTypes.sol) Namespace for the structs used in [SablierV2LockupLinear](docs/contracts/v2/reference/core/contract.SablierV2LockupLinear.md). @@ -24,14 +24,14 @@ struct CreateWithDurations { } ``` -**Parameters** +**Properties** | Name | Type | Description | | -------------- | ----------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `sender` | `address` | The address streaming the assets, with the ability to cancel the stream. It doesn't have to be the same as `msg.sender`. | | `recipient` | `address` | The address receiving the assets. | -| `totalAmount` | `uint128` | The total amount of `ERC-20` assets to be paid, including the stream deposit and any potential fees, all denoted in units of the asset's decimals. | -| `asset` | `IERC20` | The contract address of the `ERC-20` asset used for streaming. | +| `totalAmount` | `uint128` | The total amount of ERC-20 assets to be paid, including the stream deposit and any potential fees, all denoted in units of the asset's decimals. | +| `asset` | `IERC20` | The contract address of the ERC-20 asset used for streaming. | | `cancelable` | `bool` | Indicates if the stream is cancelable. | | `transferable` | `bool` | Indicates if the stream NFT is transferable. | | `durations` | `Durations` | Struct containing (i) cliff period duration and (ii) total stream duration, both in seconds. | @@ -54,14 +54,14 @@ struct CreateWithRange { } ``` -**Parameters** +**Properties** | Name | Type | Description | | -------------- | --------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `sender` | `address` | The address streaming the assets, with the ability to cancel the stream. It doesn't have to be the same as `msg.sender`. | | `recipient` | `address` | The address receiving the assets. | -| `totalAmount` | `uint128` | The total amount of `ERC-20` assets to be paid, including the stream deposit and any potential fees, all denoted in units of the asset's decimals. | -| `asset` | `IERC20` | The contract address of the `ERC-20` asset used for streaming. | +| `totalAmount` | `uint128` | The total amount of ERC-20 assets to be paid, including the stream deposit and any potential fees, all denoted in units of the asset's decimals. | +| `asset` | `IERC20` | The contract address of the ERC-20 asset used for streaming. | | `cancelable` | `bool` | Indicates if the stream is cancelable. | | `transferable` | `bool` | Indicates if the stream NFT is transferable. | | `range` | `Range` | Struct containing (i) the stream's start time, (ii) cliff time, and (iii) end time, all as Unix timestamps. | @@ -78,6 +78,13 @@ struct Durations { } ``` +**Properties** + +| Name | Type | Description | +| ------- | -------- | ------------------------------ | +| `cliff` | `uint40` | The cliff duration in seconds. | +| `total` | `uint40` | The total duration in seconds. | + ### Range Struct encapsulating the time range. @@ -90,6 +97,14 @@ struct Range { } ``` +**Properties** + +| Name | Type | Description | +| ------- | -------- | ---------------------------------------------- | +| `start` | `uint40` | The Unix timestamp for the stream's start. | +| `cliff` | `uint40` | The Unix timestamp for the cliff period's end. | +| `end` | `uint40` | The Unix timestamp for the stream's end. | + ### Stream Lockup Linear stream. @@ -112,18 +127,18 @@ struct Stream { } ``` -**Parameters** - -| Name | Type | Description | -| ---------------- | ---------------- | ------------------------------------------------------------------------------------------------------------------------ | -| `sender` | `address` | The address streaming the assets, with the ability to cancel the stream. It doesn't have to be the same as `msg.sender`. | -| `startTime` | `uint40` | The Unix timestamp indicating the stream's start. | -| `cliffTime` | `uint40` | The Unix timestamp indicating the cliff period's end. | -| `isCancelable` | `bool` | Boolean indicating if the stream is cancelable. | -| `wasCanceled` | `bool` | Boolean indicating if the stream was canceled. | -| `asset` | `IERC20` | The contract address of the `ERC-20` asset used for streaming. | -| `endTime` | `uint40` | The Unix timestamp indicating the stream's end. | -| `isDepleted` | `bool` | Boolean indicating if the stream is depleted. | -| `isStream` | `bool` | Boolean indicating if the struct entity exists. | -| `isTransferable` | `bool` | Boolean indicating if the stream NFT is transferable. | -| `amounts` | `Lockup.Amounts` | Struct containing the deposit, withdrawn, and refunded amounts, all denoted in units of the asset's decimals. | +**Properties** + +| Name | Type | Description | +| ---------------- | ---------------- | ------------------------------------------------------------------------------------------------------------- | +| `sender` | `address` | The address streaming the assets, with the ability to cancel the stream. | +| `startTime` | `uint40` | The Unix timestamp indicating the stream's start. | +| `cliffTime` | `uint40` | The Unix timestamp indicating the cliff period's end. | +| `isCancelable` | `bool` | Boolean indicating if the stream is cancelable. | +| `wasCanceled` | `bool` | Boolean indicating if the stream was canceled. | +| `asset` | `IERC20` | The contract address of the ERC-20 asset used for streaming. | +| `endTime` | `uint40` | The Unix timestamp indicating the stream's end. | +| `isDepleted` | `bool` | Boolean indicating if the stream is depleted. | +| `isStream` | `bool` | Boolean indicating if the struct entity exists. | +| `isTransferable` | `bool` | Boolean indicating if the stream NFT is transferable. | +| `amounts` | `Lockup.Amounts` | Struct containing the deposit, withdrawn, and refunded amounts, all denoted in units of the asset's decimals. | diff --git a/docs/contracts/v2/reference/core/types/struct.Broker.md b/docs/contracts/v2/reference/core/types/struct.Broker.md index fffbfbe8..d1f956f4 100644 --- a/docs/contracts/v2/reference/core/types/struct.Broker.md +++ b/docs/contracts/v2/reference/core/types/struct.Broker.md @@ -1,6 +1,6 @@ # Broker -[Git Source](https://github.com/sablier-labs/v2-core/blob/release/src/types/DataTypes.sol) +[Git Source](https://github.com/sablier-labs/v2-core/blob/a4bf69cf7024006b9a324eef433f20b74597eaaf/src/types/DataTypes.sol) Struct encapsulating the broker parameters passed to the create functions. Both can be set to zero. @@ -10,3 +10,10 @@ struct Broker { UD60x18 fee; } ``` + +**Properties** + +| Name | Type | Description | +| --------- | --------- | ------------------------------------------------------------------------------------------------------ | +| `account` | `address` | The address receiving the broker's fee. | +| `fee` | `UD60x18` | The broker's percentage fee from the total amount, denoted as a fixed-point number where 1e18 is 100%. | diff --git a/docs/contracts/v2/reference/periphery/abstracts/abstract.SablierV2MerkleStreamer.md b/docs/contracts/v2/reference/periphery/abstracts/abstract.SablierV2MerkleStreamer.md index 804eb8b1..5b725ecc 100644 --- a/docs/contracts/v2/reference/periphery/abstracts/abstract.SablierV2MerkleStreamer.md +++ b/docs/contracts/v2/reference/periphery/abstracts/abstract.SablierV2MerkleStreamer.md @@ -1,16 +1,21 @@ # SablierV2MerkleStreamer -[Git Source](https://github.com/sablier-labs/v2-periphery/blob/release/src/abstracts/SablierV2MerkleStreamer.sol) +[Git Source](https://github.com/sablier-labs/v2-periphery/blob/53e259087984ff748fca6fb932fdb9c663c2b365/src/abstracts/SablierV2MerkleStreamer.sol) **Inherits:** -[ISablierV2MerkleStreamer](/docs/contracts/v2/reference/periphery/interfaces/interface.ISablierV2MerkleStreamer.md) -[Adminable](/docs/contracts/v2/reference/core/abstracts/abstract.Adminable.md) +[ISablierV2MerkleStreamer](/docs/contracts/v2/reference/periphery/interfaces/interface.ISablierV2MerkleStreamer.md), +Adminable + +See the documentation in +[ISablierV2MerkleStreamer](/docs/contracts/v2/reference/periphery/interfaces/interface.ISablierV2MerkleStreamer.md). ## State Variables ### ASSET -_The streamed ERC-20 asset._ +The streamed ERC-20 asset. + +_This is an immutable state variable._ ```solidity IERC20 public immutable override ASSET; @@ -18,7 +23,9 @@ IERC20 public immutable override ASSET; ### CANCELABLE -_A flag indicating whether the streams can be canceled._ +A flag indicating whether the streams can be canceled. + +_This is an immutable state variable._ ```solidity bool public immutable override CANCELABLE; @@ -26,7 +33,9 @@ bool public immutable override CANCELABLE; ### EXPIRATION -_The cut-off point for the Merkle streamer, as a Unix timestamp. A value of zero means there is no expiration._ +The cut-off point for the Merkle streamer, as a Unix timestamp. A value of zero means there is no expiration. + +_This is an immutable state variable._ ```solidity uint40 public immutable override EXPIRATION; @@ -34,7 +43,7 @@ uint40 public immutable override EXPIRATION; ### LOCKUP -_The address of the {SablierV2Lockup} contract._ +The address of the [SablierV2Lockup](/docs/contracts/v2/reference/periphery/contract.SablierV2Lockup.md) contract. ```solidity ISablierV2Lockup public immutable override LOCKUP; @@ -42,7 +51,9 @@ ISablierV2Lockup public immutable override LOCKUP; ### MERKLE_ROOT -_The root of the Merkle tree used to validate the claims._ +The root of the Merkle tree used to validate the claims. + +_This is an immutable state variable._ ```solidity bytes32 public immutable override MERKLE_ROOT; @@ -50,13 +61,15 @@ bytes32 public immutable override MERKLE_ROOT; ### TRANSFERABLE -_A flag indicating whether the stream NFTs are transferable._ +A flag indicating whether the stream NFTs are transferable. + +_This is an immutable state variable._ ```solidity bool public immutable override TRANSFERABLE; ``` -### \_claimedBitMap; +### \_claimedBitMap _Packed booleans that record the history of claims._ @@ -64,15 +77,11 @@ _Packed booleans that record the history of claims._ BitMaps.BitMap internal _claimedBitMap; ``` -We are using -[BitMaps](https://github.com/OpenZeppelin/openzeppelin-contracts/blob/e50c24f5839db17f46991478384bfda14acfb830/contracts/utils/structs/BitMaps.sol) -OpenZeppelin's library. - -## User Facing Functions +## Functions ### constructor -_Sets the immutable state variables._ +_Constructs the contract by initializing the immutable state variables._ ```solidity constructor( @@ -88,10 +97,12 @@ constructor( ### hasClaimed -Returns a flag indicating whether a claim has been made for a given index. Uses a bitmap to save gas. +Returns a flag indicating whether a claim has been made for a given index. + +_Uses a bitmap to save gas._ ```solidity -function hasClaimed(uint256 index) external returns (bool); +function hasClaimed(uint256 index) public view override returns (bool); ``` **Parameters** @@ -105,20 +116,21 @@ function hasClaimed(uint256 index) external returns (bool); Returns a flag indicating whether the Merkle streamer has expired. ```solidity -function hasExpired() external returns (bool); +function hasExpired() public view override returns (bool); ``` ### clawback Claws back the unclaimed tokens from the Merkle streamer. -Emits a {Clawback} event. Requirements: +Emits a {Clawback} event. Notes: -- `msg.sender` must be the contract admin. -- The Merkle streamer must have expired. +- If the protocol is not zero, the expiration check is not made. Requirements: +- The caller must be the admin. +- The campaign must either be expired or not have an expiration. ```solidity -function clawback(address to, uint128 amount) external; +function clawback(address to, uint128 amount) external override onlyAdmin; ``` **Parameters** @@ -128,9 +140,9 @@ function clawback(address to, uint128 amount) external; | `to` | `address` | The address to receive the tokens. | | `amount` | `uint128` | The amount of tokens to claw back. | -## Internal Functions +### \_checkClaim -Validates the parameters of the `claim` function, which is implemented by child contracts. +_Validates the parameters of the `claim` function, which is implemented by child contracts._ ```solidity function _checkClaim(uint256 index, bytes32 leaf, bytes32[] calldata merkleProof) internal view; diff --git a/docs/contracts/v2/reference/periphery/contract.SablierV2Batch.md b/docs/contracts/v2/reference/periphery/contract.SablierV2Batch.md index ff5a6164..c58a9e71 100644 --- a/docs/contracts/v2/reference/periphery/contract.SablierV2Batch.md +++ b/docs/contracts/v2/reference/periphery/contract.SablierV2Batch.md @@ -1,23 +1,26 @@ +--- +sidebar_position: 1 +--- + # SablierV2Batch -[Git Source](https://github.com/sablier-labs/v2-periphery/blob/release/src/SablierV2Batch.sol) +[Git Source](https://github.com/sablier-labs/v2-periphery/blob/53e259087984ff748fca6fb932fdb9c663c2b365/src/SablierV2Batch.sol) -**Inherits:** [ISablierV2Batch](/contracts/v2/reference/periphery/interfaces/interface.ISablierV2Batch) +**Inherits:** [ISablierV2Batch](/docs/contracts/v2/reference/periphery/interfaces/interface.ISablierV2Batch.md) -_See the documentation in [ISablierV2Batch](/contracts/v2/reference/periphery/interfaces/interface.ISablierV2Batch)._ +See the documentation in +[ISablierV2Batch](/docs/contracts/v2/reference/periphery/interfaces/interface.ISablierV2Batch.md). -## User Facing Functions +## Functions -### createMerkleStreamerLL +### createWithDurations Creates a batch of Lockup Linear streams using `createWithDurations`. Requirements: - There must be at least one element in `batch`. -- All requirements from - [ISablierV2LockupLinear.createWithDurations](/contracts/v2/reference/core/interfaces/interface.ISablierV2LockupLinear#createwithdurations) - must be met for each stream. +- All requirements from {ISablierV2LockupLinear.createWithDurations} must be met for each stream. ```solidity function createWithDurations( @@ -26,16 +29,23 @@ function createWithDurations( Batch.CreateWithDurations[] calldata batch ) external + override returns (uint256[] memory streamIds); ``` **Parameters** -| Name | Type | Description | -| -------------- | ----------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `lockupLinear` | `ISablierV2LockupLinear` | The address of the {SablierV2LockupLinear} contract. | -| `asset` | `IERC20` | The address of the `ERC-20` asset. | -| `batch` | `Batch.CreateWithDurations[]` | An array of structs, each encapsulating a subset of the parameters of [SablierV2LockupLinear.createWithDurations](/contracts/v2/reference/core/types/library.LockupLinear#createwithdurations). | +| Name | Type | Description | +| -------------- | ----------------------------- | ------------------------------------------------------------------------------------------------------------------------ | +| `lockupLinear` | `ISablierV2LockupLinear` | The address of the [SablierV2LockupLinear](docs/contracts/v2/reference/core/contract.SablierV2LockupLinear.md) contract. | +| `asset` | `IERC20` | The contract address of the ERC-20 asset used for streaming. | +| `batch` | `Batch.CreateWithDurations[]` | An array of structs, each encapsulating a subset of the parameters of {SablierV2LockupLinear.createWithDurations}. | + +**Returns** + +| Name | Type | Description | +| ----------- | ----------- | ------------------------------------- | +| `streamIds` | `uint256[]` | The ids of the newly created streams. | ### createWithRange @@ -44,27 +54,32 @@ Creates a batch of Lockup Linear streams using `createWithRange`. Requirements: - There must be at least one element in `batch`. -- All requirements from - [ISablierV2LockupLinear.createWithRange](/contracts/v2/reference/core/interfaces/interface.ISablierV2LockupLinear#createwithrange) - must be met for each stream. +- All requirements from {ISablierV2LockupLinear.createWithRange} must be met for each stream. ```solidity function createWithRange( ISablierV2LockupLinear lockupLinear, IERC20 asset, - Batch.createWithRange[] calldata batch + Batch.CreateWithRange[] calldata batch ) external + override returns (uint256[] memory streamIds); ``` **Parameters** -| Name | Type | Description | -| -------------- | ------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `lockupLinear` | `ISablierV2LockupLinear` | The address of the {SablierV2LockupLinear} contract. | -| `asset` | `IERC20` | The address of the `ERC-20` asset. | -| `batch` | `Batch.CreateWithRange[]` | An array of structs, each encapsulating a subset of the parameters of [SablierV2LockupLinear.createWithRange](/contracts/v2/reference/core/types/library.LockupLinear#createwithrange). | +| Name | Type | Description | +| -------------- | ------------------------- | ------------------------------------------------------------------------------------------------------------------------ | +| `lockupLinear` | `ISablierV2LockupLinear` | The address of the [SablierV2LockupLinear](docs/contracts/v2/reference/core/contract.SablierV2LockupLinear.md) contract. | +| `asset` | `IERC20` | The contract address of the ERC-20 asset used for streaming. | +| `batch` | `Batch.CreateWithRange[]` | An array of structs, each encapsulating a subset of the parameters of {SablierV2LockupLinear.createWithRange}. | + +**Returns** + +| Name | Type | Description | +| ----------- | ----------- | ------------------------------------- | +| `streamIds` | `uint256[]` | The ids of the newly created streams. | ### createWithDeltas @@ -73,9 +88,7 @@ Creates a batch of Lockup Dynamic streams using `createWithDeltas`. Requirements: - There must be at least one element in `batch`. -- All requirements from - [ISablierV2LockupDynamic.createWithDeltas](/contracts/v2/reference/core/interfaces/interface.ISablierV2LockupDynamic#createwithdeltas) - must be met for each stream. +- All requirements from {ISablierV2LockupDynamic.createWithDeltas} must be met for each stream. ```solidity function createWithDeltas( @@ -84,16 +97,23 @@ function createWithDeltas( Batch.CreateWithDeltas[] calldata batch ) external + override returns (uint256[] memory streamIds); ``` **Parameters** -| Name | Type | Description | -| --------------- | -------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `lockupDynamic` | `ISablierV2LockupDynamic` | The address of the {SablierV2LockupDynamic} contract. | -| `asset` | `IERC20` | The address of the `ERC-20` asset. | -| `batch` | `Batch.CreateWithDeltas[]` | An array of structs, each encapsulating a subset of the parameters of [SablierV2LockupDynamic.createWithDeltas](/contracts/v2/reference/core/types/library.LockupDynamic#createwithdeltas). | +| Name | Type | Description | +| --------------- | -------------------------- | -------------------------------------------------------------------------------------------------------------------------- | +| `lockupDynamic` | `ISablierV2LockupDynamic` | The address of the [SablierV2LockupDynamic](docs/contracts/v2/reference/core/contract.SablierV2LockupDynamic.md) contract. | +| `asset` | `IERC20` | The contract address of the ERC-20 asset used for streaming. | +| `batch` | `Batch.CreateWithDeltas[]` | An array of structs, each encapsulating a subset of the parameters of {SablierV2LockupDynamic.createWithDeltas}. | + +**Returns** + +| Name | Type | Description | +| ----------- | ----------- | ------------------------------------- | +| `streamIds` | `uint256[]` | The ids of the newly created streams. | ### createWithMilestones @@ -102,9 +122,7 @@ Creates a batch of Lockup Dynamic streams using `createWithMilestones`. Requirements: - There must be at least one element in `batch`. -- All requirements from - [ISablierV2LockupDynamic.createWithMilestones](/contracts/v2/reference/core/interfaces/interface.ISablierV2LockupDynamic#createwithmilestones) - must be met for each stream. +- All requirements from {ISablierV2LockupDynamic.createWithMilestones} must be met for each stream. ```solidity function createWithMilestones( @@ -113,49 +131,38 @@ function createWithMilestones( Batch.CreateWithMilestones[] calldata batch ) external + override returns (uint256[] memory streamIds); ``` **Parameters** -| Name | Type | Description | -| --------------- | ------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `lockupDynamic` | `ISablierV2LockupDynamic` | The address of the {SablierV2LockupDynamic} contract. | -| `asset` | `IERC20` | The address of the `ERC-20` asset. | -| `batch` | `Batch.CreateWithMilestones[]` | An array of structs, each encapsulating a subset of the parameters of [SablierV2LockupDynamic.createWithMilestones](/contracts/v2/reference/core/types/library.LockupDynamic#createwithmilestones). | +| Name | Type | Description | +| --------------- | ------------------------------ | -------------------------------------------------------------------------------------------------------------------------- | +| `lockupDynamic` | `ISablierV2LockupDynamic` | The address of the [SablierV2LockupDynamic](docs/contracts/v2/reference/core/contract.SablierV2LockupDynamic.md) contract. | +| `asset` | `IERC20` | The contract address of the ERC-20 asset used for streaming. | +| `batch` | `Batch.CreateWithMilestones[]` | An array of structs, each encapsulating a subset of the parameters of {SablierV2LockupDynamic.createWithMilestones}. | -## Internal Functions +**Returns** + +| Name | Type | Description | +| ----------- | ----------- | ------------------------------------- | +| `streamIds` | `uint256[]` | The ids of the newly created streams. | ### \_approve -Helper function to approve a Sablier contract to spend funds from the batch. If the current allowance is insufficient, +_Helper function to approve a Sablier contract to spend funds from the batch. If the current allowance is insufficient, this function approves Sablier to spend the exact `amount`. The {SafeERC20.forceApprove} function is used to handle -special `ERC-20 assets` (e.g. USDT) that require the current allowance to be zero before setting it to a non-zero value. +special ERC-20 assets (e.g. USDT) that require the current allowance to be zero before setting it to a non-zero value._ ```solidity function _approve(address sablierContract, IERC20 asset, uint256 amount) internal; ``` -**Parameters** - -| Name | Type | Description | -| ----------------- | --------- | ----------------------------------------------- | -| `sablierContract` | `address` | The address of the Sablier contract to approve. | -| `asset` | `IERC20` | The address of the `ERC-20` asset. | -| `amount` | `uint256` | The amount of tokens to approve. | - ### \_handleTransfer -Helper function to transfer assets from the caller to the batch contract and approve the Sablier contract. +_Helper function to transfer assets from the caller to the batch contract and approve the Sablier contract._ ```solidity function _handleTransfer(address sablierContract, IERC20 asset, uint256 amount) internal; ``` - -**Parameters** - -| Name | Type | Description | -| ----------------- | --------- | ----------------------------------------------------- | -| `sablierContract` | `address` | The address of the Sablier contract to transfer from. | -| `asset` | `IERC20` | The address of the `ERC-20` asset. | -| `amount` | `uint256` | The amount of tokens to transfer. | diff --git a/docs/contracts/v2/reference/periphery/contract.SablierV2MerkleStreamerFactory.md b/docs/contracts/v2/reference/periphery/contract.SablierV2MerkleStreamerFactory.md index 4adadce1..da46141a 100644 --- a/docs/contracts/v2/reference/periphery/contract.SablierV2MerkleStreamerFactory.md +++ b/docs/contracts/v2/reference/periphery/contract.SablierV2MerkleStreamerFactory.md @@ -1,51 +1,37 @@ +--- +sidebar_position: 2 +--- + # SablierV2MerkleStreamerFactory -[Git Source](https://github.com/sablier-labs/v2-periphery/blob/release/src/SablierV2MerkleStreamerFactory.sol) +[Git Source](https://github.com/sablier-labs/v2-periphery/blob/53e259087984ff748fca6fb932fdb9c663c2b365/src/SablierV2MerkleStreamerFactory.sol) **Inherits:** -[ISablierV2MerkleStreamerFactory](/contracts/v2/reference/periphery/interfaces/interface.ISablierV2MerkleStreamerFactory) +[ISablierV2MerkleStreamerFactory](/docs/contracts/v2/reference/periphery/interfaces/interface.ISablierV2MerkleStreamerFactory.md) -_See the documentation in -[ISablierV2MerkleStreamerFactory](/contracts/v2/reference/periphery/interfaces/interface.ISablierV2MerkleStreamerFactory)._ +See the documentation in +[ISablierV2MerkleStreamerFactory](/docs/contracts/v2/reference/periphery/interfaces/interface.ISablierV2MerkleStreamerFactory.md). -## User Facing Functions +## Functions ### createMerkleStreamerLL -Creates a new Merkle streamer that uses Lockup Linear. - -Emits a {CreateMerkleStreamerLL} event. +inheritdoc ISablierV2MerkleStreamerFactory ```solidity function createMerkleStreamerLL( - address initialAdmin, - ISablierV2LockupLinear lockupLinear, - IERC20 asset, - bytes32 merkleRoot, - uint40 expiration, - LockupLinear.Durations memory streamDurations, - bool cancelable, - bool transferable, - string memory ipfsCID, - uint256 aggregateAmount, - uint256 recipientsCount - ) - external - returns (ISablierV2MerkleStreamerLL merkleStreamerLL); + address initialAdmin, + ISablierV2LockupLinear lockupLinear, + IERC20 asset, + bytes32 merkleRoot, + uint40 expiration, + LockupLinear.Durations memory streamDurations, + bool cancelable, + bool transferable, + string memory ipfsCID, + uint256 aggregateAmount, + uint256 recipientsCount +) + external + returns (ISablierV2MerkleStreamerLL merkleStreamerLL); ``` - -**Parameters** - -| Name | Type | Description | -| ----------------- | ------------------------ | ----------------------------------------------------------------- | -| `initialAdmin` | `address` | The initial admin of the Merkle streamer contract. | -| `lockupLinear` | `ISablierV2LockupLinear` | The address of the {SablierV2LockupLinear} contract. | -| `asset` | `IERC20` | The address of the `ERC-20` asset. | -| `merkleRoot` | `bytes32` | The Merkle root of the claim data. | -| `expiration` | `uint40` | The expiration of the streaming campaign, as a Unix timestamp. | -| `streamDurations` | `LockupLinear.Durations` | The durations for each stream due to the recipient. | -| `cancelable` | `bool` | Indicates if each stream will be cancelable. | -| `transferable` | `bool` | Indicates if each stream NFT will be transferable. | -| `ipfsCID` | `string` | Metadata parameter emitted for indexing purposes. | -| `aggregateAmount` | `uint256` | Total amount of `ERC-20` assets to be streamed to all recipients. | -| `recipientsCount` | `uint256` | Total number of recipients eligible to claim. | diff --git a/docs/contracts/v2/reference/periphery/contract.SablierV2MerkleStreamerLL.md b/docs/contracts/v2/reference/periphery/contract.SablierV2MerkleStreamerLL.md index f5c31566..94937388 100644 --- a/docs/contracts/v2/reference/periphery/contract.SablierV2MerkleStreamerLL.md +++ b/docs/contracts/v2/reference/periphery/contract.SablierV2MerkleStreamerLL.md @@ -1,19 +1,23 @@ +--- +sidebar_position: 3 +--- + # SablierV2MerkleStreamerLL -[Git Source](https://github.com/sablier-labs/v2-periphery/blob/release/src/SablierV2MerkleStreamerLL.sol) +[Git Source](https://github.com/sablier-labs/v2-periphery/blob/53e259087984ff748fca6fb932fdb9c663c2b365/src/SablierV2MerkleStreamerLL.sol) **Inherits:** -[ISablierV2MerkleStreamerLL](/contracts/v2/reference/periphery/interfaces/interface.ISablierV2MerkleStreamerLL) -[SablierV2MerkleStreamer](/contracts/v2/reference/periphery/abstracts/abstract.SablierV2MerkleStreamer) +[ISablierV2MerkleStreamerLL](/docs/contracts/v2/reference/periphery/interfaces/interface.ISablierV2MerkleStreamerLL.md), +[SablierV2MerkleStreamer](/docs/contracts/v2/reference/periphery/abstracts/abstract.SablierV2MerkleStreamer.md) -_See the documentation in -[ISablierV2MerkleStreamerLL](/contracts/v2/reference/periphery/interfaces/interface.ISablierV2MerkleStreamerLL)._ +See the documentation in +[ISablierV2MerkleStreamerLL](/docs/contracts/v2/reference/periphery/interfaces/interface.ISablierV2MerkleStreamerLL.md). ## State Variables ### LOCKUP_LINEAR -The address of the {SablierV2LockupLinear} contract. +The address of the [SablierV2LockupLinear](docs/contracts/v2/reference/core/contract.SablierV2LockupLinear.md) contract. ```solidity ISablierV2LockupLinear public immutable override LOCKUP_LINEAR; @@ -21,17 +25,17 @@ ISablierV2LockupLinear public immutable override LOCKUP_LINEAR; ### streamDurations -The total streaming duration of each stream, after claim. +The total streaming duration of each stream. ```solidity LockupLinear.Durations public override streamDurations; ``` -## User Facing Functions +## Functions ### constructor -Constructs the contract by initializing the immutable state variables, and max approving the Sablier contract. +_Constructs the contract by initializing the immutable state variables, and max approving the Sablier contract._ ```solidity constructor( @@ -44,8 +48,7 @@ constructor( bool cancelable, bool transferable ) - SablierV2MerkleStreamer(initialAdmin, asset, lockupLinear, merkleRoot, expiration, cancelable, transferable) -{} + SablierV2MerkleStreamer(initialAdmin, asset, lockupLinear, merkleRoot, expiration, cancelable, transferable); ``` ### claim @@ -54,9 +57,9 @@ Makes the claim by creating a Lockup Linear stream to the recipient. Emits a {Claim} event. Requirements: -- The protocol fee must be zero. - The campaign must not have expired. - The stream must not have been claimed already. +- The protocol fee must be zero. - The Merkle proof must be valid. ```solidity @@ -67,12 +70,21 @@ function claim( bytes32[] calldata merkleProof ) external + override returns (uint256 streamId); ``` -| Name | Type | Description | -| --------- | ------------- | ---------------------------------------------- | -| `index` | `uint256` | The index of the recipient in the Merkle tree. | -| `address` | `recipient` | The address of the stream holder. | -| `amount` | `uint128` | The amount of tokens to be streamed. | -| `bytes32` | `merkleProof` | The Merkle proof of inclusion in the stream. | +**Parameters** + +| Name | Type | Description | +| ------------- | ----------- | ---------------------------------------------- | +| `index` | `uint256` | The index of the recipient in the Merkle tree. | +| `recipient` | `address` | The address of the stream holder. | +| `amount` | `uint128` | The amount of tokens to be streamed. | +| `merkleProof` | `bytes32[]` | The Merkle proof of inclusion in the stream. | + +**Returns** + +| Name | Type | Description | +| ---------- | --------- | ----------------------------------- | +| `streamId` | `uint256` | The id of the newly created stream. | diff --git a/docs/contracts/v2/reference/periphery/interfaces/interface.ISablierV2Batch.md b/docs/contracts/v2/reference/periphery/interfaces/interface.ISablierV2Batch.md index d5352724..4b07971c 100644 --- a/docs/contracts/v2/reference/periphery/interfaces/interface.ISablierV2Batch.md +++ b/docs/contracts/v2/reference/periphery/interfaces/interface.ISablierV2Batch.md @@ -1,10 +1,8 @@ # ISablierV2Batch -[Git Source](https://github.com/sablier-labs/v2-periphery/blob/release/src/interfaces/ISablierV2Batch.sol) +[Git Source](https://github.com/sablier-labs/v2-periphery/blob/53e259087984ff748fca6fb932fdb9c663c2b365/src/interfaces/ISablierV2Batch.sol) -**Inherits:** [IAdminable](/docs/contracts/v2/reference/core/interfaces/interface.IAdminable.md) - -_Helper to batch create Sablier V2 Lockup streams._ +Helper to batch create Sablier V2 Lockup streams. ## Functions @@ -15,9 +13,7 @@ Creates a batch of Lockup Linear streams using `createWithDurations`. Requirements: - There must be at least one element in `batch`. -- All requirements from - [ISablierV2LockupLinear.createWithDurations](/contracts/v2/reference/core/interfaces/interface.ISablierV2LockupLinear#createwithdurations) - must be met for each stream. +- All requirements from {ISablierV2LockupLinear.createWithDurations} must be met for each stream. ```solidity function createWithDurations( @@ -31,11 +27,17 @@ function createWithDurations( **Parameters** -| Name | Type | Description | -| -------------- | ----------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `lockupLinear` | `ISablierV2LockupLinear` | The address of the {SablierV2LockupLinear} contract. | -| `asset` | `IERC20` | The address of the `ERC-20` asset. | -| `batch` | `Batch.CreateWithDurations[]` | An array of structs, each encapsulating a subset of the parameters of [SablierV2LockupLinear.createWithDurations](/contracts/v2/reference/core/types/library.LockupLinear#createwithdurations). | +| Name | Type | Description | +| -------------- | ----------------------------- | ------------------------------------------------------------------------------------------------------------------------ | +| `lockupLinear` | `ISablierV2LockupLinear` | The address of the [SablierV2LockupLinear](docs/contracts/v2/reference/core/contract.SablierV2LockupLinear.md) contract. | +| `asset` | `IERC20` | The contract address of the ERC-20 asset used for streaming. | +| `batch` | `Batch.CreateWithDurations[]` | An array of structs, each encapsulating a subset of the parameters of {SablierV2LockupLinear.createWithDurations}. | + +**Returns** + +| Name | Type | Description | +| ----------- | ----------- | ------------------------------------- | +| `streamIds` | `uint256[]` | The ids of the newly created streams. | ### createWithRange @@ -44,15 +46,13 @@ Creates a batch of Lockup Linear streams using `createWithRange`. Requirements: - There must be at least one element in `batch`. -- All requirements from - [ISablierV2LockupLinear.createWithRange](/contracts/v2/reference/core/interfaces/interface.ISablierV2LockupLinear#createwithrange) - must be met for each stream. +- All requirements from {ISablierV2LockupLinear.createWithRange} must be met for each stream. ```solidity function createWithRange( ISablierV2LockupLinear lockupLinear, IERC20 asset, - Batch.createWithRange[] calldata batch + Batch.CreateWithRange[] calldata batch ) external returns (uint256[] memory streamIds); @@ -60,11 +60,17 @@ function createWithRange( **Parameters** -| Name | Type | Description | -| -------------- | ------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `lockupLinear` | `ISablierV2LockupLinear` | The address of the {SablierV2LockupLinear} contract. | -| `asset` | `IERC20` | The address of the `ERC-20` asset. | -| `batch` | `Batch.CreateWithRange[]` | An array of structs, each encapsulating a subset of the parameters of [SablierV2LockupLinear.createWithRange](/contracts/v2/reference/core/types/library.LockupLinear#createwithrange). | +| Name | Type | Description | +| -------------- | ------------------------- | ------------------------------------------------------------------------------------------------------------------------ | +| `lockupLinear` | `ISablierV2LockupLinear` | The address of the [SablierV2LockupLinear](docs/contracts/v2/reference/core/contract.SablierV2LockupLinear.md) contract. | +| `asset` | `IERC20` | The contract address of the ERC-20 asset used for streaming. | +| `batch` | `Batch.CreateWithRange[]` | An array of structs, each encapsulating a subset of the parameters of {SablierV2LockupLinear.createWithRange}. | + +**Returns** + +| Name | Type | Description | +| ----------- | ----------- | ------------------------------------- | +| `streamIds` | `uint256[]` | The ids of the newly created streams. | ### createWithDeltas @@ -73,9 +79,7 @@ Creates a batch of Lockup Dynamic streams using `createWithDeltas`. Requirements: - There must be at least one element in `batch`. -- All requirements from - [ISablierV2LockupDynamic.createWithDeltas](/contracts/v2/reference/core/interfaces/interface.ISablierV2LockupDynamic#createwithdeltas) - must be met for each stream. +- All requirements from {ISablierV2LockupDynamic.createWithDeltas} must be met for each stream. ```solidity function createWithDeltas( @@ -89,11 +93,17 @@ function createWithDeltas( **Parameters** -| Name | Type | Description | -| --------------- | -------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `lockupDynamic` | `ISablierV2LockupDynamic` | The address of the {SablierV2LockupDynamic} contract. | -| `asset` | `IERC20` | The address of the `ERC-20` asset. | -| `batch` | `Batch.CreateWithDeltas[]` | An array of structs, each encapsulating a subset of the parameters of [SablierV2LockupDynamic.createWithDeltas](/contracts/v2/reference/core/types/library.LockupDynamic#createwithdeltas). | +| Name | Type | Description | +| --------------- | -------------------------- | -------------------------------------------------------------------------------------------------------------------------- | +| `lockupDynamic` | `ISablierV2LockupDynamic` | The address of the [SablierV2LockupDynamic](docs/contracts/v2/reference/core/contract.SablierV2LockupDynamic.md) contract. | +| `asset` | `IERC20` | The contract address of the ERC-20 asset used for streaming. | +| `batch` | `Batch.CreateWithDeltas[]` | An array of structs, each encapsulating a subset of the parameters of {SablierV2LockupDynamic.createWithDeltas}. | + +**Returns** + +| Name | Type | Description | +| ----------- | ----------- | ------------------------------------- | +| `streamIds` | `uint256[]` | The ids of the newly created streams. | ### createWithMilestones @@ -102,9 +112,7 @@ Creates a batch of Lockup Dynamic streams using `createWithMilestones`. Requirements: - There must be at least one element in `batch`. -- All requirements from - [ISablierV2LockupDynamic.createWithMilestones](/contracts/v2/reference/core/interfaces/interface.ISablierV2LockupDynamic#createwithmilestones) - must be met for each stream. +- All requirements from {ISablierV2LockupDynamic.createWithMilestones} must be met for each stream. ```solidity function createWithMilestones( @@ -118,8 +126,14 @@ function createWithMilestones( **Parameters** -| Name | Type | Description | -| --------------- | ------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `lockupDynamic` | `ISablierV2LockupDynamic` | The address of the {SablierV2LockupDynamic} contract. | -| `asset` | `IERC20` | The address of the `ERC-20` asset. | -| `batch` | `Batch.CreateWithMilestones[]` | An array of structs, each encapsulating a subset of the parameters of [SablierV2LockupDynamic.createWithMilestones](/contracts/v2/reference/core/types/library.LockupDynamic#createwithmilestones). | +| Name | Type | Description | +| --------------- | ------------------------------ | -------------------------------------------------------------------------------------------------------------------------- | +| `lockupDynamic` | `ISablierV2LockupDynamic` | The address of the [SablierV2LockupDynamic](docs/contracts/v2/reference/core/contract.SablierV2LockupDynamic.md) contract. | +| `asset` | `IERC20` | The contract address of the ERC-20 asset used for streaming. | +| `batch` | `Batch.CreateWithMilestones[]` | An array of structs, each encapsulating a subset of the parameters of {SablierV2LockupDynamic.createWithMilestones}. | + +**Returns** + +| Name | Type | Description | +| ----------- | ----------- | ------------------------------------- | +| `streamIds` | `uint256[]` | The ids of the newly created streams. | diff --git a/docs/contracts/v2/reference/periphery/interfaces/interface.ISablierV2MerkleStreamer.md b/docs/contracts/v2/reference/periphery/interfaces/interface.ISablierV2MerkleStreamer.md index 2450cac2..f622e0c1 100644 --- a/docs/contracts/v2/reference/periphery/interfaces/interface.ISablierV2MerkleStreamer.md +++ b/docs/contracts/v2/reference/periphery/interfaces/interface.ISablierV2MerkleStreamer.md @@ -1,12 +1,15 @@ # ISablierV2MerkleStreamer -[Git Source](https://github.com/sablier-labs/v2-periphery/blob/release/src/interfaces/ISablierV2MerkleStreamer.sol) +[Git Source](https://github.com/sablier-labs/v2-periphery/blob/53e259087984ff748fca6fb932fdb9c663c2b365/src/interfaces/ISablierV2MerkleStreamer.sol) -**Inherits:** [IAdminable](/docs/contracts/v2/reference/core/interfaces/interface.IAdminable.md) +**Inherits:** IAdminable -_A contract that lets user claim Sablier streams using Merkle proofs. An interesting use case for MerkleStream is +A contract that lets user claim Sablier streams using Merkle proofs. An interesting use case for MerkleStream is airstreams, which is a portmanteau of "airdrop" and "stream". This is an airdrop model where the tokens are distributed -over time, as opposed to all at once. This is the base interface for MerkleStreamer contracts._ +over time, as opposed to all at once. + +_This is the base interface for MerkleStreamer contracts. See the Sablier docs for more guidance on how streaming works: +https://docs.sablier.com/._ ## Functions @@ -14,6 +17,8 @@ over time, as opposed to all at once. This is the base interface for MerkleStrea The streamed ERC-20 asset. +_This is an immutable state variable._ + ```solidity function ASSET() external returns (IERC20); ``` @@ -22,6 +27,8 @@ function ASSET() external returns (IERC20); A flag indicating whether the streams can be canceled. +_This is an immutable state variable._ + ```solidity function CANCELABLE() external returns (bool); ``` @@ -30,22 +37,18 @@ function CANCELABLE() external returns (bool); The cut-off point for the Merkle streamer, as a Unix timestamp. A value of zero means there is no expiration. -```solidity -function EXPIRATION() external returns (uint40); -``` - -### LOCKUP - -_The address of the {SablierV2Lockup} contract._ +_This is an immutable state variable._ ```solidity -function LOCKUP() external returns (ISablierV2Lockup); +function EXPIRATION() external returns (uint40); ``` ### hasClaimed Returns a flag indicating whether a claim has been made for a given index. +_Uses a bitmap to save gas._ + ```solidity function hasClaimed(uint256 index) external returns (bool); ``` @@ -64,10 +67,20 @@ Returns a flag indicating whether the Merkle streamer has expired. function hasExpired() external view returns (bool); ``` +### LOCKUP + +The address of the [SablierV2Lockup](/docs/contracts/v2/reference/periphery/contract.SablierV2Lockup.md) contract. + +```solidity +function LOCKUP() external returns (ISablierV2Lockup); +``` + ### MERKLE_ROOT The root of the Merkle tree used to validate the claims. +_This is an immutable state variable._ + ```solidity function MERKLE_ROOT() external returns (bytes32); ``` @@ -76,6 +89,8 @@ function MERKLE_ROOT() external returns (bytes32); A flag indicating whether the stream NFTs are transferable. +_This is an immutable state variable._ + ```solidity function TRANSFERABLE() external returns (bool); ``` @@ -84,15 +99,19 @@ function TRANSFERABLE() external returns (bool); Claws back the unclaimed tokens from the Merkle streamer. -Emits a {Clawback} event. Requirements: +Emits a [Clawback](/docs/contracts/v2/reference/periphery/interfaces/interface.ISablierV2MerkleStreamer.md#clawback) +event. Notes: -- `msg.sender` must be the contract admin. -- The Merkle streamer must have expired. +- If the protocol is not zero, the expiration check is not made. Requirements: +- The caller must be the admin. +- The campaign must either be expired or not have an expiration. ```solidity function clawback(address to, uint128 amount) external; ``` +**Parameters** + | Name | Type | Description | | -------- | --------- | ---------------------------------- | | `to` | `address` | The address to receive the tokens. | @@ -105,8 +124,7 @@ function clawback(address to, uint128 amount) external; Emitted when a recipient claims a stream. ```solidity -event Claim(uint256 index, address indexed recipient, uint128 amount, uint256 -indexed streamId); +event Claim(uint256 index, address indexed recipient, uint128 amount, uint256 indexed streamId); ``` ### Clawback diff --git a/docs/contracts/v2/reference/periphery/interfaces/interface.ISablierV2MerkleStreamerFactory.md b/docs/contracts/v2/reference/periphery/interfaces/interface.ISablierV2MerkleStreamerFactory.md index 629f046b..6818bb51 100644 --- a/docs/contracts/v2/reference/periphery/interfaces/interface.ISablierV2MerkleStreamerFactory.md +++ b/docs/contracts/v2/reference/periphery/interfaces/interface.ISablierV2MerkleStreamerFactory.md @@ -1,8 +1,8 @@ # ISablierV2MerkleStreamerFactory -[Git Source](https://github.com/sablier-labs/v2-periphery/blob/release/src/interfaces/ISablierV2MerkleStreamerFactory.sol) +[Git Source](https://github.com/sablier-labs/v2-periphery/blob/53e259087984ff748fca6fb932fdb9c663c2b365/src/interfaces/ISablierV2MerkleStreamerFactory.sol) -_Deploys new Lockup Linear Merkle streamers via CREATE2._ +Deploys new Lockup Linear Merkle streamers via CREATE2. ## Functions @@ -10,41 +10,49 @@ _Deploys new Lockup Linear Merkle streamers via CREATE2._ Creates a new Merkle streamer that uses Lockup Linear. -Emits a {CreateMerkleStreamerLL} event. +_Emits a +[CreateMerkleStreamerLL](/docs/contracts/v2/reference/periphery/interfaces/interface.ISablierV2MerkleStreamerFactory.md#createmerklestreamerll) +event._ ```solidity function createMerkleStreamerLL( - address initialAdmin, - ISablierV2LockupLinear lockupLinear, - IERC20 asset, - bytes32 merkleRoot, - uint40 expiration, - LockupLinear.Durations memory streamDurations, - bool cancelable, - bool transferable, - string memory ipfsCID, - uint256 aggregateAmount, - uint256 recipientsCount - ) - external - returns (ISablierV2MerkleStreamerLL merkleStreamerLL); + address initialAdmin, + ISablierV2LockupLinear lockupLinear, + IERC20 asset, + bytes32 merkleRoot, + uint40 expiration, + LockupLinear.Durations memory streamDurations, + bool cancelable, + bool transferable, + string memory ipfsCID, + uint256 aggregateAmount, + uint256 recipientsCount +) + external + returns (ISablierV2MerkleStreamerLL merkleStreamerLL); ``` **Parameters** -| Name | Type | Description | -| ----------------- | ------------------------ | --------------------------------------------------------------- | -| `initialAdmin` | `address` | The initial admin of the Merkle streamer contract. | -| `lockupLinear` | `ISablierV2LockupLinear` | The address of the {SablierV2LockupLinear} contract. | -| `asset` | `IERC20` | The address of the `ERC-20` asset. | -| `merkleRoot` | `bytes32` | The Merkle root of the claim data. | -| `expiration` | `uint40` | The expiration of the streaming campaign, as a Unix timestamp. | -| `streamDurations` | `LockupLinear.Durations` | The durations for each stream due to the recipient. | -| `cancelable` | `bool` | Indicates if each stream will be cancelable. | -| `transferable` | `bool` | Indicates if each stream NFT will be transferable. | -| `ipfsCID` | `string` | Metadata parameter emitted for indexing purposes. | -| `aggregateAmount` | `uint256` | Total amount of ERC-20 assets to be streamed to all recipients. | -| `recipientsCount` | `uint256` | Total number of recipients eligible to claim. | +| Name | Type | Description | +| ----------------- | ------------------------ | ------------------------------------------------------------------------------------------------------------------------ | +| `initialAdmin` | `address` | The initial admin of the Merkle streamer contract. | +| `lockupLinear` | `ISablierV2LockupLinear` | The address of the [SablierV2LockupLinear](docs/contracts/v2/reference/core/contract.SablierV2LockupLinear.md) contract. | +| `asset` | `IERC20` | The address of the streamed ERC-20 asset. | +| `merkleRoot` | `bytes32` | The Merkle root of the claim data. | +| `expiration` | `uint40` | The expiration of the streaming campaign, as a Unix timestamp. | +| `streamDurations` | `LockupLinear.Durations` | The durations for each stream due to the recipient. | +| `cancelable` | `bool` | Indicates if each stream will be cancelable. | +| `transferable` | `bool` | Indicates if each stream NFT will be transferable. | +| `ipfsCID` | `string` | Metadata parameter emitted for indexing purposes. | +| `aggregateAmount` | `uint256` | Total amount of ERC-20 assets to be streamed to all recipients. | +| `recipientsCount` | `uint256` | Total number of recipients eligible to claim. | + +**Returns** + +| Name | Type | Description | +| ------------------ | ---------------------------- | ---------------------------------------------------------- | +| `merkleStreamerLL` | `ISablierV2MerkleStreamerLL` | The address of the newly created Merkle streamer contract. | ## Events diff --git a/docs/contracts/v2/reference/periphery/interfaces/interface.ISablierV2MerkleStreamerLL.md b/docs/contracts/v2/reference/periphery/interfaces/interface.ISablierV2MerkleStreamerLL.md index 239c00bb..d1de4b3e 100644 --- a/docs/contracts/v2/reference/periphery/interfaces/interface.ISablierV2MerkleStreamerLL.md +++ b/docs/contracts/v2/reference/periphery/interfaces/interface.ISablierV2MerkleStreamerLL.md @@ -1,31 +1,28 @@ # ISablierV2MerkleStreamerLL -[Git Source](https://github.com/sablier-labs/v2-periphery/blob/release/src/interfaces/ISablierV2MerkleStreamerLL.sol) +[Git Source](https://github.com/sablier-labs/v2-periphery/blob/53e259087984ff748fca6fb932fdb9c663c2b365/src/interfaces/ISablierV2MerkleStreamerLL.sol) **Inherits:** -[ISablierV2MerkleStreamer](/contracts/v2/reference/periphery/interfaces/interface.ISablierV2MerkleStreamer) +[ISablierV2MerkleStreamer](/docs/contracts/v2/reference/periphery/interfaces/interface.ISablierV2MerkleStreamer.md) -_See the documentation in -[ISablierV2MerkleStreamer](/contracts/v2/reference/periphery/interfaces/interface.ISablierV2MerkleStreamer)._ - -_Merkle streamer that creates Lockup Linear streams._ +Merkle streamer that creates Lockup Linear streams. ## Functions ### LOCKUP_LINEAR -The address of the {SablierV2LockupLinear} contract. +The address of the [SablierV2LockupLinear](docs/contracts/v2/reference/core/contract.SablierV2LockupLinear.md) contract. ```solidity -function LOCKUP_LINEAR() external returns (ISablierV2LockupLinear); +function LOCKUP_LINEAR() external view returns (ISablierV2LockupLinear); ``` ### streamDurations -The total streaming duration of each stream, after claim. +The total streaming duration of each stream. ```solidity -function streamDurations() external returns (uint40 cliff, uint40 duration); +function streamDurations() external view returns (uint40 cliff, uint40 duration); ``` ### claim @@ -34,9 +31,9 @@ Makes the claim by creating a Lockup Linear stream to the recipient. Emits a {Claim} event. Requirements: -- The protocol fee must be zero. - The campaign must not have expired. - The stream must not have been claimed already. +- The protocol fee must be zero. - The Merkle proof must be valid. ```solidity @@ -50,9 +47,17 @@ function claim( returns (uint256 streamId); ``` -| Name | Type | Description | -| --------- | ------------- | ---------------------------------------------- | -| `index` | `uint256` | The index of the recipient in the Merkle tree. | -| `address` | `recipient` | The address of the stream holder. | -| `amount` | `uint128` | The amount of tokens to be streamed. | -| `bytes32` | `merkleProof` | The Merkle proof of inclusion in the stream. | +**Parameters** + +| Name | Type | Description | +| ------------- | ----------- | ---------------------------------------------- | +| `index` | `uint256` | The index of the recipient in the Merkle tree. | +| `recipient` | `address` | The address of the stream holder. | +| `amount` | `uint128` | The amount of tokens to be streamed. | +| `merkleProof` | `bytes32[]` | The Merkle proof of inclusion in the stream. | + +**Returns** + +| Name | Type | Description | +| ---------- | --------- | ----------------------------------- | +| `streamId` | `uint256` | The id of the newly created stream. | diff --git a/docs/contracts/v2/reference/periphery/libraries/library.Errors.md b/docs/contracts/v2/reference/periphery/libraries/library.Errors.md index 6d8c8480..f059e150 100644 --- a/docs/contracts/v2/reference/periphery/libraries/library.Errors.md +++ b/docs/contracts/v2/reference/periphery/libraries/library.Errors.md @@ -1,6 +1,6 @@ # Errors -[Git Source](https://github.com/sablier-labs/v2-periphery/blob/release/src/libraries/Errors.sol) +[Git Source](https://github.com/sablier-labs/v2-periphery/blob/53e259087984ff748fca6fb932fdb9c663c2b365/src/libraries/Errors.sol) Library containing all custom errors the protocol may revert with. @@ -8,8 +8,6 @@ Library containing all custom errors the protocol may revert with. ### SablierV2Batch_BatchSizeZero -Thrown when trying to create a batch with zero elements. - ```solidity error SablierV2Batch_BatchSizeZero(); ``` @@ -24,7 +22,7 @@ error SablierV2MerkleStreamer_CampaignExpired(uint256 currentTime, uint40 expira ### SablierV2MerkleStreamer_CampaignNotExpired -Thrown when trying to claim when Merkle streamer has not expired. +Thrown when trying to clawback when the campaign has not expired. ```solidity error SablierV2MerkleStreamer_CampaignNotExpired(uint256 currentTime, uint40 expiration); @@ -38,12 +36,6 @@ Thrown when trying to claim with an invalid Merkle proof. error SablierV2MerkleStreamer_InvalidProof(); ``` -Thrown when trying to clawback when the protocol fee is zero. - -```solidity -error SablierV2MerkleStreamer_ProtocolFeeZero(); -``` - ### SablierV2MerkleStreamer_ProtocolFeeNotZero Thrown when trying to claim when the protocol fee is not zero. diff --git a/docs/contracts/v2/reference/periphery/types/library.Batch.md b/docs/contracts/v2/reference/periphery/types/library.Batch.md index 22a480c5..6eedacca 100644 --- a/docs/contracts/v2/reference/periphery/types/library.Batch.md +++ b/docs/contracts/v2/reference/periphery/types/library.Batch.md @@ -1,6 +1,6 @@ # Batch -[Git Source](https://github.com/sablier-labs/v2-periphery/blob/05c331e79e05886c7837dfda1bc21197c1c3c748/src/types/DataTypes.sol) +[Git Source](https://github.com/sablier-labs/v2-periphery/blob/53e259087984ff748fca6fb932fdb9c663c2b365/src/types/DataTypes.sol) ## Structs @@ -17,14 +17,13 @@ struct CancelMultiple { ### CreateWithDeltas -A struct encapsulating all parameters of -[SablierV2LockupDynamic.createWithDelta](/contracts/v2/reference/core/types/library.LockupDynamic#createwithdeltas) -except for the asset. +A struct encapsulating all parameters of {SablierV2LockupDynamic.createWithDelta} except for the asset. ```solidity struct CreateWithDeltas { address sender; bool cancelable; + bool transferable; address recipient; uint128 totalAmount; Broker broker; @@ -34,9 +33,7 @@ struct CreateWithDeltas { ### CreateWithDurations -A struct encapsulating all parameters of -[SablierV2LockupLinear.createWithDurations](/contracts/v2/reference/core/types/library.LockupLinear#createwithdurations) -except for the asset. +A struct encapsulating all parameters of {SablierV2LockupLinear.createWithDurations} except for the asset. ```solidity struct CreateWithDurations { @@ -44,6 +41,7 @@ struct CreateWithDurations { address recipient; uint128 totalAmount; bool cancelable; + bool transferable; LockupLinear.Durations durations; Broker broker; } @@ -51,15 +49,14 @@ struct CreateWithDurations { ### CreateWithMilestones -A struct encapsulating all parameters of -[SablierV2LockupDynamic.createWithMilestones](/contracts/v2/reference/core/types/library.LockupDynamic#createwithmilestones) -except for the asset. +A struct encapsulating all parameters of {SablierV2LockupDynamic.createWithMilestones} except for the asset. ```solidity struct CreateWithMilestones { address sender; uint40 startTime; bool cancelable; + bool transferable; address recipient; uint128 totalAmount; Broker broker; @@ -69,9 +66,7 @@ struct CreateWithMilestones { ### CreateWithRange -A struct encapsulating all parameters of -[SablierV2LockupLinear.createWithRange](/contracts/v2/reference/core/types/library.LockupLinear#createwithrange)) except -for the asset. +A struct encapsulating all parameters of {SablierV2LockupLinear.createWithRange} except for the asset. ```solidity struct CreateWithRange { @@ -79,6 +74,7 @@ struct CreateWithRange { address recipient; uint128 totalAmount; bool cancelable; + bool transferable; LockupLinear.Range range; Broker broker; } diff --git a/scripts/autogen.sh b/scripts/autogen.sh index c2ba425e..6c9756cf 100755 --- a/scripts/autogen.sh +++ b/scripts/autogen.sh @@ -22,7 +22,6 @@ periphery=docs/contracts/v2/reference/periphery find $core -type f -name "*.md" -delete find $periphery -type f -name "*.md" -delete - run() { # This is either "core" or "periphery" repo=$1 @@ -78,10 +77,11 @@ run() { run "core" # Update the hyperlinks to use the directory structure of the docs website -sd "src/abstracts/\w+\.sol" $core/abstracts $(find $core -type f -name "*.md") -sd "src/interfaces/erc3156/\w+\.sol" $core/interfaces/erc3156 $(find $core -type f -name "*.md") -sd "src/interfaces/\w+\.sol" $core/interfaces $(find $core -type f -name "*.md") -sd "src/\w+\.sol" $core $(find $core -type f -name "*.md") +# We need the capturing group to avoid replacing the "Git Source" URLs +sd "src/abstracts/\w+\.sol/([\w.]+)" $core'/abstracts/$1' $(find $core -type f -name "*.md") +sd "src/interfaces/erc3156/\w+\.sol/([\w.]+)" $core'/interfaces/erc3156/$1' $(find $core -type f -name "*.md") +sd "src/interfaces/\w+\.sol/([\w.]+)" $core'/interfaces/$1' $(find $core -type f -name "*.md") +sd "src/\w+\.sol/([\w.]+)" $core/'$1' $(find $core -type f -name "*.md") # Reorder the contracts in the sidebar contract=$core/contract.SablierV2LockupLinear.md @@ -104,18 +104,18 @@ echo "$(echo -en '---\nsidebar_position: 4\n---\n'; cat $contract)" > $contract run "periphery" # Update the hyperlinks to use the directory structure of the docs website -sd "src/abstracts/\w+\.sol" $periphery/abstracts $(find $periphery -type f -name "*.md") -sd "src/interfaces/\w+\.sol" $periphery/interfaces $(find $periphery -type f -name "*.md") -sd "src/\w+\.sol" $periphery $(find $periphery -type f -name "*.md") +sd "src/abstracts/\w+\.sol/([\w.]+)" $periphery'/abstracts/$1' $(find $periphery -type f -name "*.md") +sd "src/interfaces/\w+\.sol/([\w.]+)" $periphery'/interfaces/$1' $(find $periphery -type f -name "*.md") +sd "src/\w+\.sol/([\w.]+)" $periphery'/$1' $(find $periphery -type f -name "*.md") # Reorder the contracts in the sidebar -contract=$periphery/contract.SablierV2Archive.md +contract=$periphery/contract.SablierV2Batch.md echo "$(echo -en '---\nsidebar_position: 1\n---\n'; cat $contract)" > $contract -contract=$periphery/contract.SablierV2ProxyPlugin.md +contract=$periphery/contract.SablierV2MerkleStreamerFactory.md echo "$(echo -en '---\nsidebar_position: 2\n---\n'; cat $contract)" > $contract -contract=$periphery/contract.SablierV2ProxyTarget.md +contract=$periphery/contract.SablierV2MerkleStreamerLL.md echo "$(echo -en '---\nsidebar_position: 3\n---\n'; cat $contract)" > $contract # ---------------------------------------------------------------------------- # @@ -123,10 +123,10 @@ echo "$(echo -en '---\nsidebar_position: 3\n---\n'; cat $contract)" > $contract # ---------------------------------------------------------------------------- # # Format the docs with Prettier -bun prettier --loglevel silent --write $all +bun prettier --log-level silent --write $all # Remove the italic asterisks added by `forge doc`: https://github.com/foundry-rs/foundry/issues/4540 sd --string-mode "\*" "" $(find $all -type f -name "*.md") # Re-format the docs with Prettier -bun prettier --loglevel silent --write $all +bun prettier --log-level silent --write $all