SablierV2BatchLockup
Inherits: ISablierV2BatchLockup
See the documentation in ISablierV2BatchLockup.
Functions
createWithDurationsLD
Creates a batch of Lockup Dynamic streams using createWithDurations
.
Requirements:
- There must be at least one element in
batch
. - All requirements from {ISablierV2LockupDynamic.createWithDurations} must be met for each stream.
function createWithDurationsLD(
ISablierV2LockupDynamic lockupDynamic,
IERC20 asset,
BatchLockup.CreateWithDurationsLD[] calldata batch
)
external
override
returns (uint256[] memory streamIds);
Parameters
Name | Type | Description |
---|---|---|
lockupDynamic | ISablierV2LockupDynamic | The address of the SablierV2LockupDynamic contract. |
asset | IERC20 | The contract address of the ERC-20 asset to be distributed. |
batch | BatchLockup.CreateWithDurationsLD[] | An array of structs, each encapsulating a subset of the parameters of {SablierV2LockupDynamic.createWithDurations}. |
Returns
Name | Type | Description |
---|---|---|
streamIds | uint256[] | The ids of the newly created streams. |
createWithTimestampsLD
Creates a batch of Lockup Dynamic streams using createWithTimestamps
.
Requirements:
- There must be at least one element in
batch
. - All requirements from {ISablierV2LockupDynamic.createWithTimestamps} must be met for each stream.
function createWithTimestampsLD(
ISablierV2LockupDynamic lockupDynamic,
IERC20 asset,
BatchLockup.CreateWithTimestampsLD[] calldata batch
)
external
override
returns (uint256[] memory streamIds);
Parameters
Name | Type | Description |
---|---|---|
lockupDynamic | ISablierV2LockupDynamic | The address of the SablierV2LockupDynamic contract. |
asset | IERC20 | The contract address of the ERC-20 asset to be distributed. |
batch | BatchLockup.CreateWithTimestampsLD[] | An array of structs, each encapsulating a subset of the parameters of {SablierV2LockupDynamic.createWithTimestamps}. |
Returns
Name | Type | Description |
---|---|---|
streamIds | uint256[] | The ids of the newly created streams. |
createWithDurationsLL
Creates a batch of LockupLinear streams using createWithDurations
.
Requirements:
- There must be at least one element in
batch
. - All requirements from {ISablierV2LockupLinear.createWithDurations} must be met for each stream.
function createWithDurationsLL(
ISablierV2LockupLinear lockupLinear,
IERC20 asset,
BatchLockup.CreateWithDurationsLL[] calldata batch
)
external
override
returns (uint256[] memory streamIds);
Parameters
Name | Type | Description |
---|---|---|
lockupLinear | ISablierV2LockupLinear | The address of the SablierV2LockupLinear contract. |
asset | IERC20 | The contract address of the ERC-20 asset to be distributed. |
batch | BatchLockup.CreateWithDurationsLL[] | 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. |
createWithTimestampsLL
Creates a batch of LockupLinear streams using createWithTimestamps
.
Requirements:
- There must be at least one element in
batch
. - All requirements from {ISablierV2LockupLinear.createWithTimestamps} must be met for each stream.
function createWithTimestampsLL(
ISablierV2LockupLinear lockupLinear,
IERC20 asset,
BatchLockup.CreateWithTimestampsLL[] calldata batch
)
external
override
returns (uint256[] memory streamIds);
Parameters
Name | Type | Description |
---|---|---|
lockupLinear | ISablierV2LockupLinear | The address of the SablierV2LockupLinear contract. |
asset | IERC20 | The contract address of the ERC-20 asset to be distributed. |
batch | BatchLockup.CreateWithTimestampsLL[] | An array of structs, each encapsulating a subset of the parameters of {SablierV2LockupLinear.createWithTimestamps}. |
Returns
Name | Type | Description |
---|---|---|
streamIds | uint256[] | The ids of the newly created streams. |
createWithDurationsLT
Creates a batch of LockupTranched streams using createWithDurations
.
Requirements:
- There must be at least one element in
batch
. - All requirements from {ISablierV2LockupTranched.createWithDurations} must be met for each stream.
function createWithDurationsLT(
ISablierV2LockupTranched lockupTranched,
IERC20 asset,
BatchLockup.CreateWithDurationsLT[] calldata batch
)
external
override
returns (uint256[] memory streamIds);
Parameters
Name | Type | Description |
---|---|---|
lockupTranched | ISablierV2LockupTranched | The address of the SablierV2LockupTranched contract. |
asset | IERC20 | The contract address of the ERC-20 asset to be distributed. |
batch | BatchLockup.CreateWithDurationsLT[] | An array of structs, each encapsulating a subset of the parameters of {SablierV2LockupTranched.createWithDurations}. |
Returns
Name | Type | Description |
---|---|---|
streamIds | uint256[] | The ids of the newly created streams. |
createWithTimestampsLT
Creates a batch of LockupTranched streams using createWithTimestamps
.
Requirements:
- There must be at least one element in
batch
. - All requirements from {ISablierV2LockupTranched.createWithTimestamps} must be met for each stream.
function createWithTimestampsLT(
ISablierV2LockupTranched lockupTranched,
IERC20 asset,
BatchLockup.CreateWithTimestampsLT[] calldata batch
)
external
override
returns (uint256[] memory streamIds);
Parameters
Name | Type | Description |
---|---|---|
lockupTranched | ISablierV2LockupTranched | The address of the SablierV2LockupTranched contract. |
asset | IERC20 | The contract address of the ERC-20 asset to be distributed. |
batch | BatchLockup.CreateWithTimestampsLT[] | An array of structs, each encapsulating a subset of the parameters of {SablierV2LockupTranched.createWithTimestamps}. |
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 batchLockup. 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.
function _approve(address sablierContract, IERC20 asset, uint256 amount) internal;
_handleTransfer
Helper function to transfer assets from the caller to the batchLockup contract and approve the Sablier contract.
function _handleTransfer(address sablierContract, IERC20 asset, uint256 amount) internal;