Technical ReferenceContract Functions

Spectra4626Wrapper

The Spectra4626Wrapper contract implements a wrapper to facilitate compliance of an interest-bearing vault with the ERC-4626 standard, making it compatible for deploying a Spectra Principal Token.

ERC-4626

This contract is compatible with the ERC-4626 standard and implements its interface. However, depending on the functionalities supported by the wrapped vault, some functions may revert by default (e.g. redeem() / withdraw()).

Methods

wrap

Deposits vault shares into the wrapper.

function wrap(uint256 vaultShares, address receiver) external returns (uint256)
Input ParameterTypeDescription
vaultSharesuint256The amount of vault shares to deposit
receiveraddressThe address to receive the wrapper shares
Return ParameterTypeDescription
wrapperSharesuint256The amount of minted wrapper shares

wrap

Deposits vault shares into the wrapper, with support for slippage protection.

function wrap(
    uint256 vaultShares,
    address receiver,
    uint256 minShares
) external returns (uint256)
Input ParameterTypeDescription
vaultSharesuint256The amount of vault shares to deposit
receiveraddressThe address to receive the wrapper shares
minSharesuint256The minimum allowed wrapper shares from this deposit
Return ParameterTypeDescription
sharesuint256The amount of minted wrapper shares

unwrap

Withdraws vault shares from the wrapper.

function unwrap(uint256 shares, address receiver, address owner) external returns (uint256)

msg.sender must approve the relevant allowance of the vault token before calling this method.

Input ParameterTypeDescription
sharesuint256The amount of wrapper shares to redeem
receiveraddressThe address to receive the vault shares
owneraddressThe address of the owner of the wrapper shares
Return ParameterTypeDescription
vaultSharesuint256The amount of withdrawn vault shares

unwrap

Withdraws vault shares from the wrapper, with support for slippage protection.

function unwrap(
    uint256 shares,
    address receiver,
    address owner,
    uint256 minVaultShares
) external returns (uint256)
Input ParameterTypeDescription
sharesuint256The amount of wrapper shares to redeem
receiveraddressThe address to receive the vault shares
owneraddressThe address of the owner of the wrapper shares
minVaultSharesuint256The minimum vault shares that should be returned
Return ParameterTypeDescription
vaultSharesuint256The amount of withdrawn vault shares

View Methods

previewWrap

Calculates the amount of minted wrapper shares for a given amount of deposited vault shares.

function previewWrap(uint256 vaultShares) external view returns (uint256)

previewUnwrap

Calculates the amount of withdrawn vault shares for a given amount of redeemed wrapper shares.

function previewUnwrap(uint256 shares) external view returns (uint256)

vault

Returns the address of the wrapped vault.

function vault() external view returns (address)

totalVaultShares

Returns the vault balance of the wrapper.

function totalVaultShares() external view returns (uint256)

On this page