SlippageIssuanceModule

The SlippageIssuanceModule is a module that enables users to issue and redeem SetTokens that require a transaction which incurs slippage in order to replicate the Set.

Like the DebtIssuanceModule, module hooks are added to allow for syncing of positions, and component level hooks are added to ensure positions are replicated correctly. The manager can define arbitrary issuance logic in the manager hook, as well as specify issue and redeem fees.

The method getRequiredComponentIssuanceUnits and it's redemption counterpart now also include any changes to the position expected to happen during issuance thus providing much better estimations for positions that are synced or require a trade.

It is worth noting that this module inherits from DebtIssuanceModule, consequently it can also be used for issuances that do NOT require slippage just by calling the issue and redeem endpoints.

Select Methods

issueWithSlippage()

Deposits components to the SetToken, replicates any external module component positions and mints the SetToken. If the token has a debt position all collateral will be transferred in first then debt will be returned to the minting address. If specified, a fee will be charged on issuance.

Issuer can also pass in a max amount of tokens they are willing to pay for each component. They are NOT required to pass in a limit for every component, and may in fact only want to pass in limits for components which incur slippage to replicate (i.e. perpetuals). Passing in empty arrays for _checkComponents and _maxTokenAmountsIn is equivalent to calling issue.

NOTE: not passing in limits for positions that require a trade for replication leaves the issuer open to sandwich attacks!

function issueWithSlippage(
  ISetToken _setToken,
  uint256 _setQuantity,
  address[] memory _checkedComponents,
  uint256[] memory _maxTokenAmountsIn,
  address _to
)

Parameters

Parameter nameTypeDescription

_setToken

ISetToken

Instance of the SetToken

_setQuantity

uint256

Quantity of Set to issue

_checkedComponents

address[]

Array of components to be checked to verify required collateral doesn't exceed defined max. Each entry must be unique

_maxTokenAmountsIn

uint256[]

Maps to same index in _checkedComponents. Max amount of component willing to transfer in to collateralize _setQuantity amount of _setToken

_to

Address

Address to mint SetToken to

redeemWithSlippage()

Returns components from the SetToken, unwinds any external module component positions and burns the SetToken.

If the token has debt positions, the module transfers in the required debt amounts from the caller and uses those funds to repay the debts on behalf of the SetToken. All debt will be paid down first then equity positions will be returned to the minting address. If specified, a fee will be charged on redeem.

Redeemer can also pass in a min amount of tokens they want to receive for each component. They are NOT required to pass in a limit for every component, and may in fact only want to pass in limits for components which incur slippage to replicate (i.e. perpetuals). Passing in empty arrays for _checkComponents and _minTokenAmountsOut is equivalent to calling redeem.

NOTE: not passing in limits for positions that require a trade for replication leaves the redeemer open to sandwich attacks!

function redeemWithSlippage(
  ISetToken _setToken,
  uint256 _setQuantity,
  address[] memory _checkedComponents,
  uint256[] memory _minTokenAmountsOut,
  address _to
)

Parameters

Parameter nameTypeDescription

_setToken

ISetToken

Instance of the SetToken

_setQuantity

uint256

Quantity of Set to issue

_checkedComponents

address[]

Array of comArray of components to be checked to verify received collateral isn't less than defined min. Each entry must be unique

_maxTokenAmountsOut

uint256[]

Maps to same index in _checkedComponents. Min amount of component willing to receive to redeem _setQuantity amount of _setToken

_to

Address

Address to send collateral to

getRequiredComponentIssuanceUnitsOffChain()

Calculates the amount of each component needed to collateralize passed issue quantity plus fees of Sets as well as amount of debt that will be returned to caller. Takes into account position updates from pre action module hooks (manager hooks not included).

NOTE: This getter is non-view to allow module hooks to determine units by simulating state changes in an external protocol and reverting. It should only be called by off-chain methods via static call.

Returns:

  • address[]: Array of component addresses making up the Set

  • uint256[]: Array of equity notional amounts of each component

  • uint256[]: Array of debt notional amounts of each component

function getRequiredComponentIssuanceUnitsOffChain(
    ISetToken _setToken,
    uint256 _quantity
)

Parameters

Parameter nameTypeDescription

_setToken

ISetToken

Instance of the SetToken

_quantity

uint256

Quantity of Set to issue

getRequiredComponentRedemptionUnitsOffChain()

Calculates the amount of each component that will be returned on redemption net of fees as well as how much debt needs to be paid down to redeem. Takes into account position updates from pre action module hooks (manager hooks not included).

NOTE: This getter is non-view to allow module hooks to determine units by simulating state changes in an external protocol and reverting. It should only be called by off-chain methods via static call.

Returns:

  • address[]: Array of component addresses making up the Set

  • uint256[]: Array of equity notional amounts of each component

  • uint256[]: Array of debt notional amounts of each component

function getRequiredComponentRedemptionUnitsOffChain(
    ISetToken _setToken,
    uint256 _quantity
)

Parameters

Parameter nameTypeDescription

_setToken

ISetToken

Instance of the SetToken

_quantity

uint256

Quantity of Set to redeem

Last updated