Skip to content

Commit

Permalink
refactor: update references
Browse files Browse the repository at this point in the history
fix: close #123
refactor: update autogen script for Sablier V2.1
  • Loading branch information
PaulRBerg committed Jan 1, 2024
1 parent 8383e9b commit 4ddedd1
Show file tree
Hide file tree
Showing 38 changed files with 689 additions and 503 deletions.
Original file line number Diff line number Diff line change
@@ -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)

Expand Down
Original file line number Diff line number Diff line change
@@ -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.

Expand Down
Original file line number Diff line number Diff line change
@@ -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),
Expand Down
Original file line number Diff line number Diff line change
@@ -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),
Expand Down Expand Up @@ -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}.
Expand Down Expand Up @@ -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. |
Original file line number Diff line number Diff line change
@@ -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).

Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -370,8 +383,7 @@ function withdrawMaxAndTransfer(
external
override
noDelegateCall
notNull(streamId)
updateMetadata(streamId);
notNull(streamId);
```

**Parameters**
Expand Down Expand Up @@ -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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
67 changes: 27 additions & 40 deletions docs/contracts/v2/reference/core/contract.SablierV2LockupDynamic.md
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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._

Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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:

Expand All @@ -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**

Expand All @@ -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:

Expand All @@ -474,18 +467,16 @@ 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**

| Name | Type | Description |
| ---------- | --------- | ----------------------------------- |
| `streamId` | `uint256` | The id of the newly created stream. |

## Internal Functions

### \_calculateStreamedAmount

_Calculates the streamed amount without looking up the stream's status._
Expand Down Expand Up @@ -540,25 +531,23 @@ 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);
```

### \_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);
```

### \_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;
Expand All @@ -574,17 +563,15 @@ 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;
```

### \_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;
Expand Down
Loading

0 comments on commit 4ddedd1

Please sign in to comment.