SablierBobState
Inherits: ISablierBobState
Title: SablierBobState
See the documentation in ISablierBobState.
State Variables
_defaultAdapters
Default adapters mapped by token address.
mapping(IERC20 token => ISablierBobAdapter adapter) internal _defaultAdapters
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.
address public override nativeToken
nextVaultId
Counter for vault IDs, incremented every time a new vault is created.
uint256 public override nextVaultId
_vaults
Vaults mapped by unsigned integers.
mapping(uint256 vaultId => Bob.Vault vault) internal _vaults
Functions
notNull
Checks that vaultId does not reference a null vault.
modifier notNull(uint256 vaultId) ;
constructor
Initializes the state variables.
constructor() ;
getAdapter
Returns the adapter configured for a specific vault.
Reverts if vaultId references a null vault.
function getAdapter(uint256 vaultId) external view override notNull(vaultId) returns (ISablierBobAdapter adapter);
getDefaultAdapterFor
Returns the default adapter for a given token.
Zero address means no adapter is set.
function getDefaultAdapterFor(IERC20 token) external view override returns (ISablierBobAdapter adapter);
Parameters
| Name | Type | Description |
|---|---|---|
token | IERC20 | The ERC-20 token to query the default adapter for. |
Returns
| Name | Type | Description |
|---|---|---|
adapter | ISablierBobAdapter | The default adapter for the token. |
getExpiry
Returns the timestamp when the vault expires.
Reverts if vaultId references a null vault.
function getExpiry(uint256 vaultId) external view override notNull(vaultId) returns (uint40 expiry);
getLastSyncedAt
Returns the timestamp when the oracle price was last synced for a vault.
Reverts if vaultId references a null vault.
function getLastSyncedAt(uint256 vaultId) external view override notNull(vaultId) returns (uint40 lastSyncedAt);
getLastSyncedPrice
Returns the oracle price stored for a vault.
Reverts if vaultId references a null vault.
function getLastSyncedPrice(uint256 vaultId)
external
view
override
notNull(vaultId)
returns (uint128 lastSyncedPrice);
getOracle
Returns the oracle address set for a vault.
Reverts if vaultId references a null vault.
function getOracle(uint256 vaultId) external view override notNull(vaultId) returns (AggregatorV3Interface oracle);
getShareToken
Returns the address of the ERC-20 share token for a vault.
Reverts if vaultId references a null vault.
function getShareToken(uint256 vaultId)
external
view
override
notNull(vaultId)
returns (IBobVaultShare shareToken);
getTargetPrice
Returns the target price at which the vault settles.
Reverts if vaultId references a null vault.
function getTargetPrice(uint256 vaultId) external view override notNull(vaultId) returns (uint128 targetPrice);
getUnderlyingToken
Returns the ERC-20 token accepted for deposits in a vault.
Reverts if vaultId references a null vault.
function getUnderlyingToken(uint256 vaultId) external view override notNull(vaultId) returns (IERC20 token);
isStakedInAdapter
Returns whether the vault tokens are staked in an adapter.
Reverts if vaultId references a null vault.
function isStakedInAdapter(uint256 vaultId) external view override notNull(vaultId) returns (bool stakedInAdapter);
statusOf
Returns the vault status.
Reverts if vaultId references a null vault.
function statusOf(uint256 vaultId) external view override notNull(vaultId) returns (Bob.Status status);
_statusOf
Retrieves the vault's status without performing a null check.
function _statusOf(uint256 vaultId) internal view returns (Bob.Status);