Skip to main content

SablierV2BatchLockup

Git Source

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

NameTypeDescription
lockupDynamicISablierV2LockupDynamicThe address of the SablierV2LockupDynamic contract.
assetIERC20The contract address of the ERC-20 asset to be distributed.
batchBatchLockup.CreateWithDurationsLD[]An array of structs, each encapsulating a subset of the parameters of {SablierV2LockupDynamic.createWithDurations}.

Returns

NameTypeDescription
streamIdsuint256[]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

NameTypeDescription
lockupDynamicISablierV2LockupDynamicThe address of the SablierV2LockupDynamic contract.
assetIERC20The contract address of the ERC-20 asset to be distributed.
batchBatchLockup.CreateWithTimestampsLD[]An array of structs, each encapsulating a subset of the parameters of {SablierV2LockupDynamic.createWithTimestamps}.

Returns

NameTypeDescription
streamIdsuint256[]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

NameTypeDescription
lockupLinearISablierV2LockupLinearThe address of the SablierV2LockupLinear contract.
assetIERC20The contract address of the ERC-20 asset to be distributed.
batchBatchLockup.CreateWithDurationsLL[]An array of structs, each encapsulating a subset of the parameters of {SablierV2LockupLinear.createWithDurations}.

Returns

NameTypeDescription
streamIdsuint256[]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

NameTypeDescription
lockupLinearISablierV2LockupLinearThe address of the SablierV2LockupLinear contract.
assetIERC20The contract address of the ERC-20 asset to be distributed.
batchBatchLockup.CreateWithTimestampsLL[]An array of structs, each encapsulating a subset of the parameters of {SablierV2LockupLinear.createWithTimestamps}.

Returns

NameTypeDescription
streamIdsuint256[]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

NameTypeDescription
lockupTranchedISablierV2LockupTranchedThe address of the SablierV2LockupTranched contract.
assetIERC20The contract address of the ERC-20 asset to be distributed.
batchBatchLockup.CreateWithDurationsLT[]An array of structs, each encapsulating a subset of the parameters of {SablierV2LockupTranched.createWithDurations}.

Returns

NameTypeDescription
streamIdsuint256[]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

NameTypeDescription
lockupTranchedISablierV2LockupTranchedThe address of the SablierV2LockupTranched contract.
assetIERC20The contract address of the ERC-20 asset to be distributed.
batchBatchLockup.CreateWithTimestampsLT[]An array of structs, each encapsulating a subset of the parameters of {SablierV2LockupTranched.createWithTimestamps}.

Returns

NameTypeDescription
streamIdsuint256[]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;