Skip to main content

BobVaultShare

Git Source

Inherits: ERC20, IBobVaultShare

Title: BobVaultShare

ERC-20 token representing shares in a Bob vault.

Each vault has its own BobVaultShare deployed. Only the SablierBob contract can mint and burn tokens. When shares are transferred, wstETH attribution is updated proportionally via the adapter.

State Variables

SABLIER_BOB

Returns the address of the Bob contract with the authority to mint and burn tokens.

This is an immutable state variable.

address public immutable override SABLIER_BOB

VAULT_ID

Returns the vault ID this share token represents.

This is an immutable state variable.

uint256 public immutable override VAULT_ID

_DECIMALS

The number of decimals.

uint8 internal immutable _DECIMALS

Functions

onlySablierBob

Reverts if caller is not the Bob contract.

modifier onlySablierBob() ;

onlyVault

Reverts if the vault ID is not equal to {VAULT_ID}.

modifier onlyVault(uint256 vaultId) ;

constructor

Deploys the vault share token.

constructor(
string memory name_,
string memory symbol_,
uint8 decimals_,
address sablierBob,
uint256 vaultId
)
ERC20(name_, symbol_);

Parameters

NameTypeDescription
name_stringThe name of the token (e.g., "Sablier Bob WETH Vault #1").
symbol_stringThe symbol of the token (e.g., "WETH-500000000000-1792790393-1" with 5000targetprice)withthefirstnumberbeingthetargetpricedenominatedinChainlinks8decimalformat,where1e8is5000 target price) with the first number being the target price denominated in Chainlink's 8-decimal format, where 1e8 is 1.
decimals_uint8The number of decimals.
sablierBobaddressThe address of the SablierBob contract.
vaultIduint256The ID of the vault this share token represents.

decimals

Returns the number of decimals used by the token.

function decimals() public view override(ERC20, IERC20Metadata) returns (uint8);

mint

Mints amount tokens to to.

Emits a {Transfer} event. Requirements:

  • The caller must be the SablierBob contract.
  • vaultId must be equal to the {VAULT_ID}.
function mint(uint256 vaultId, address to, uint256 amount) external override onlySablierBob onlyVault(vaultId);

Parameters

NameTypeDescription
vaultIduint256The vault ID that this share token represents.
toaddressThe address to mint tokens to.
amountuint256The amount of tokens to mint.

burn

Burns amount tokens from from.

Emits a {Transfer} event. Requirements:

  • The caller must be the SablierBob contract.
  • vaultId must be equal to the {VAULT_ID}.
  • from must have at least amount tokens.
function burn(uint256 vaultId, address from, uint256 amount) external override onlySablierBob onlyVault(vaultId);

Parameters

NameTypeDescription
vaultIduint256The vault ID that this share token represents.
fromaddressThe address to burn tokens from.
amountuint256The amount of tokens to burn.

_update

Override to notify SablierBob when shares are transferred (not minted/burned). This allows the adapter to update wstETH attribution proportionally.

function _update(address from, address to, uint256 amount) internal override;