Skip to main content

SablierBatchLockup

Git Source

Inherits: ISablierBatchLockup

See the documentation in ISablierBatchLockup.

Functions

createWithDurationsLD

Creates a batch of Lockup Dynamic streams using createWithDurationsLD.

Requirements:

  • There must be at least one element in batch.
  • All requirements from {ISablierLockup.createWithDurationsLD} must be met for each stream.
function createWithDurationsLD(
ISablierLockup lockup,
IERC20 token,
BatchLockup.CreateWithDurationsLD[] calldata batch
)
external
override
returns (uint256[] memory streamIds);

Parameters

NameTypeDescription
lockupISablierLockupThe address of the SablierLockup contract.
tokenIERC20The contract address of the ERC-20 token to be distributed.
batchBatchLockup.CreateWithDurationsLD[]An array of structs, each encapsulating a subset of the parameters of {SablierLockup.createWithDurationsLD}.

Returns

NameTypeDescription
streamIdsuint256[]The ids of the newly created streams.

createWithTimestampsLD

Creates a batch of Lockup Dynamic streams using createWithTimestampsLD.

Requirements:

  • There must be at least one element in batch.
  • All requirements from {ISablierLockup.createWithTimestampsLD} must be met for each stream.
function createWithTimestampsLD(
ISablierLockup lockup,
IERC20 token,
BatchLockup.CreateWithTimestampsLD[] calldata batch
)
external
override
returns (uint256[] memory streamIds);

Parameters

NameTypeDescription
lockupISablierLockupThe address of the SablierLockup contract.
tokenIERC20The contract address of the ERC-20 token to be distributed.
batchBatchLockup.CreateWithTimestampsLD[]An array of structs, each encapsulating a subset of the parameters of {SablierLockup.createWithTimestampsLD}.

Returns

NameTypeDescription
streamIdsuint256[]The ids of the newly created streams.

createWithDurationsLL

Creates a batch of Lockup Linear streams using createWithDurationsLL.

Requirements:

  • There must be at least one element in batch.
  • All requirements from {ISablierLockup.createWithDurationsLL} must be met for each stream.
function createWithDurationsLL(
ISablierLockup lockup,
IERC20 token,
BatchLockup.CreateWithDurationsLL[] calldata batch
)
external
override
returns (uint256[] memory streamIds);

Parameters

NameTypeDescription
lockupISablierLockupThe address of the SablierLockup contract.
tokenIERC20The contract address of the ERC-20 token to be distributed.
batchBatchLockup.CreateWithDurationsLL[]An array of structs, each encapsulating a subset of the parameters of {SablierLockup.createWithDurationsLL}.

Returns

NameTypeDescription
streamIdsuint256[]The ids of the newly created streams.

createWithTimestampsLL

Creates a batch of Lockup Linear streams using createWithTimestampsLL.

Requirements:

  • There must be at least one element in batch.
  • All requirements from {ISablierLockup.createWithTimestampsLL} must be met for each stream.
function createWithTimestampsLL(
ISablierLockup lockup,
IERC20 token,
BatchLockup.CreateWithTimestampsLL[] calldata batch
)
external
override
returns (uint256[] memory streamIds);

Parameters

NameTypeDescription
lockupISablierLockupThe address of the SablierLockup contract.
tokenIERC20The contract address of the ERC-20 token to be distributed.
batchBatchLockup.CreateWithTimestampsLL[]An array of structs, each encapsulating a subset of the parameters of {SablierLockup.createWithTimestampsLL}.

Returns

NameTypeDescription
streamIdsuint256[]The ids of the newly created streams.

createWithDurationsLT

Creates a batch of Lockup Tranched streams using createWithDurationsLT.

Requirements:

  • There must be at least one element in batch.
  • All requirements from {ISablierLockup.createWithDurationsLT} must be met for each stream.
function createWithDurationsLT(
ISablierLockup lockup,
IERC20 token,
BatchLockup.CreateWithDurationsLT[] calldata batch
)
external
override
returns (uint256[] memory streamIds);

Parameters

NameTypeDescription
lockupISablierLockupThe address of the SablierLockup contract.
tokenIERC20The contract address of the ERC-20 token to be distributed.
batchBatchLockup.CreateWithDurationsLT[]An array of structs, each encapsulating a subset of the parameters of {SablierLockup.createWithDurationsLT}.

Returns

NameTypeDescription
streamIdsuint256[]The ids of the newly created streams.

createWithTimestampsLT

Creates a batch of Lockup Tranched streams using createWithTimestampsLT.

Requirements:

  • There must be at least one element in batch.
  • All requirements from {ISablierLockup.createWithTimestampsLT} must be met for each stream.
function createWithTimestampsLT(
ISablierLockup lockup,
IERC20 token,
BatchLockup.CreateWithTimestampsLT[] calldata batch
)
external
override
returns (uint256[] memory streamIds);

Parameters

NameTypeDescription
lockupISablierLockupThe address of the SablierLockup contract.
tokenIERC20The contract address of the ERC-20 token to be distributed.
batchBatchLockup.CreateWithTimestampsLT[]An array of structs, each encapsulating a subset of the parameters of {SablierLockup.createWithTimestampsLT}.

Returns

NameTypeDescription
streamIdsuint256[]The ids of the newly created streams.

_approve

Helper function to approve a Lockup contract to spend funds from the batchLockup. If the current allowance is insufficient, this function approves Lockup to spend the exact amount. The {SafeERC20.forceApprove} function is used to handle special ERC-20 tokens (e.g. USDT) that require the current allowance to be zero before setting it to a non-zero value.

function _approve(address lockup, IERC20 token, uint256 amount) internal;

_handleTransfer

Helper function to transfer tokens from the caller to the batchLockup contract and approve the Lockup contract.

function _handleTransfer(address lockup, IERC20 token, uint256 amount) internal;