Skip to main content

ISablierLockupState

Git Source

Contract with state variables (storage and constants) for the SablierLockup contract, their respective getters and helpful modifiers.

Functions

aggregateAmount

Retrieves the aggregate amount across all streams, denoted in units of the token's decimals.

If tokens are directly transferred to the contract without using the stream creation functions, the ERC-20 balance may be greater than the aggregate amount.

function aggregateAmount(IERC20 token) external view returns (uint256);

Parameters

NameTypeDescription
tokenIERC20The ERC-20 token for the query.

getCliffTime

Retrieves the stream's cliff time, which is a Unix timestamp. A value of zero means there is no cliff.

Reverts if streamId references either a null stream or a non-LL stream.

function getCliffTime(uint256 streamId) external view returns (uint40 cliffTime);

Parameters

NameTypeDescription
streamIduint256The stream ID for the query.

getDepositedAmount

Retrieves the amount deposited in the stream, denoted in units of the token's decimals.

Reverts if streamId references a null stream.

function getDepositedAmount(uint256 streamId) external view returns (uint128 depositedAmount);

Parameters

NameTypeDescription
streamIduint256The stream ID for the query.

getEndTime

Retrieves the stream's end time, which is a Unix timestamp.

Reverts if streamId references a null stream.

function getEndTime(uint256 streamId) external view returns (uint40 endTime);

Parameters

NameTypeDescription
streamIduint256The stream ID for the query.

getLockupModel

Retrieves the distribution models used to create the stream.

Reverts if streamId references a null stream.

function getLockupModel(uint256 streamId) external view returns (Lockup.Model lockupModel);

Parameters

NameTypeDescription
streamIduint256The stream ID for the query.

getRefundedAmount

Retrieves the amount refunded to the sender after a cancellation, denoted in units of the token's decimals. This amount is always zero unless the stream was canceled.

Reverts if streamId references a null stream.

function getRefundedAmount(uint256 streamId) external view returns (uint128 refundedAmount);

Parameters

NameTypeDescription
streamIduint256The stream ID for the query.

getSegments

Retrieves the segments used to compose the dynamic distribution function.

Reverts if streamId references either a null stream or a non-LD stream.

function getSegments(uint256 streamId) external view returns (LockupDynamic.Segment[] memory segments);

Parameters

NameTypeDescription
streamIduint256The stream ID for the query.

Returns

NameTypeDescription
segmentsLockupDynamic.Segment[]See the documentation in {LockupDynamic} type.

getSender

Retrieves the stream's sender.

Reverts if streamId references a null stream.

function getSender(uint256 streamId) external view returns (address sender);

Parameters

NameTypeDescription
streamIduint256The stream ID for the query.

getStartTime

Retrieves the stream's start time, which is a Unix timestamp.

Reverts if streamId references a null stream.

function getStartTime(uint256 streamId) external view returns (uint40 startTime);

Parameters

NameTypeDescription
streamIduint256The stream ID for the query.

getTranches

Retrieves the tranches used to compose the tranched distribution function.

Reverts if streamId references either a null stream or a non-LT stream.

function getTranches(uint256 streamId) external view returns (LockupTranched.Tranche[] memory tranches);

Parameters

NameTypeDescription
streamIduint256The stream ID for the query.

Returns

NameTypeDescription
tranchesLockupTranched.Tranche[]See the documentation in {LockupTranched} type.

getUnderlyingToken

Retrieves the address of the underlying ERC-20 token being distributed.

Reverts if streamId references a null stream.

function getUnderlyingToken(uint256 streamId) external view returns (IERC20 token);

Parameters

NameTypeDescription
streamIduint256The stream ID for the query.

getUnlockAmounts

Retrieves the unlock amounts used to compose the linear distribution function.

Reverts if streamId references either a null stream or a non-LL stream.

function getUnlockAmounts(uint256 streamId) external view returns (LockupLinear.UnlockAmounts memory unlockAmounts);

Parameters

NameTypeDescription
streamIduint256The stream ID for the query.

Returns

NameTypeDescription
unlockAmountsLockupLinear.UnlockAmountsSee the documentation in {LockupLinear} type.

getWithdrawnAmount

Retrieves the amount withdrawn from the stream, denoted in units of the token's decimals.

Reverts if streamId references a null stream.

function getWithdrawnAmount(uint256 streamId) external view returns (uint128 withdrawnAmount);

Parameters

NameTypeDescription
streamIduint256The stream ID for the query.

isAllowedToHook

Retrieves a flag indicating whether the provided address is a contract allowed to hook to Sablier when a stream is canceled or when tokens are withdrawn.

See ISablierLockupRecipient for more information.

function isAllowedToHook(address recipient) external view returns (bool result);

isCancelable

Retrieves a flag indicating whether the stream can be canceled. When the stream is cold, this flag is always false.

Reverts if streamId references a null stream.

function isCancelable(uint256 streamId) external view returns (bool result);

Parameters

NameTypeDescription
streamIduint256The stream ID for the query.

isDepleted

Retrieves a flag indicating whether the stream is depleted.

Reverts if streamId references a null stream.

function isDepleted(uint256 streamId) external view returns (bool result);

Parameters

NameTypeDescription
streamIduint256The stream ID for the query.

isStream

Retrieves a flag indicating whether the stream exists.

Does not revert if streamId references a null stream.

function isStream(uint256 streamId) external view returns (bool result);

Parameters

NameTypeDescription
streamIduint256The stream ID for the query.

isTransferable

Retrieves a flag indicating whether the stream NFT can be transferred.

Reverts if streamId references a null stream.

function isTransferable(uint256 streamId) external view returns (bool result);

Parameters

NameTypeDescription
streamIduint256The stream ID for the query.

nativeToken

Retrieves the address of the ERC-20 interface of the native token, if it exists.

The native tokens on some chains have a dual interface as ERC-20. For example, on Polygon the $POL token is the native token and has an ERC-20 version at 0x0000000000000000000000000000000000001010. This means that address(this).balance returns the same value as balanceOf(address(this)). To avoid any unintended behavior, these tokens cannot be used in Sablier. As an alternative, users can use the Wrapped version of the token, i.e. WMATIC, which is a standard ERC-20 token.

function nativeToken() external view returns (address);

nextStreamId

Counter for stream IDs, used in the create functions.

function nextStreamId() external view returns (uint256);

nftDescriptor

Contract that generates the non-fungible token URI.

function nftDescriptor() external view returns (ILockupNFTDescriptor);

wasCanceled

Retrieves a flag indicating whether the stream was canceled.

Reverts if streamId references a null stream.

function wasCanceled(uint256 streamId) external view returns (bool result);

Parameters

NameTypeDescription
streamIduint256The stream ID for the query.