Swivel

Annotated source of the Swivel.sol smart contract

Swivel

Contents

Globals

Note this list contains both internal and external attributes

Modifiers

authorized

Restricts msg.sender as the only viable caller of a method

Declaration

modifier authorized

Functions

constructor

Declaration

function constructor(
address m,
address a
) public

Modifiers:

No modifiers

Args:

initiate

Allows a user to initiate a position

Declaration

function initiate(
struct Hash.Order[] o,
uint256[] a,
struct Sig.Components[] c
) external returns
(bool)

Modifiers:

No modifiers

Args:

initiateVaultFillingZcTokenInitiate

Allows a user to initiate a Vault by filling an offline zcToken initiate order

This method should pass (underlying, maturity, maker, sender, principalFilled) to MarketPlace.custodialInitiate

Declaration

function initiateVaultFillingZcTokenInitiate(
struct Hash.Order o,
uint256 a,
struct Sig.Components c
) internal

Modifiers:

No modifiers

Args:

initiateZcTokenFillingVaultInitiate

Allows a user to initiate a zcToken by filling an offline vault initiate order

This method should pass (underlying, maturity, sender, maker, a) to MarketPlace.custodialInitiate

Declaration

function initiateZcTokenFillingVaultInitiate(
struct Hash.Order o,
uint256 a,
struct Sig.Components c
) internal

Modifiers:

No modifiers

Args:

initiateZcTokenFillingZcTokenExit

Allows a user to initiate zcToken? by filling an offline zcToken exit order

This method should pass (underlying, maturity, maker, sender, a) to MarketPlace.p2pZcTokenExchange

Declaration

function initiateZcTokenFillingZcTokenExit(
struct Hash.Order o,
uint256 a,
struct Sig.Components c
) internal

Modifiers:

No modifiers

Args:

initiateVaultFillingVaultExit

Allows a user to initiate a Vault by filling an offline vault exit order

This method should pass (underlying, maturity, maker, sender, principalFilled) to MarketPlace.p2pVaultExchange

Declaration

function initiateVaultFillingVaultExit(
struct Hash.Order o,
uint256 a,
struct Sig.Components c
) internal

Modifiers:

No modifiers

Args:

exit

Allows a user to exit (sell) a currently held position to the marketplace.

Declaration

function exit(
struct Hash.Order[] o,
uint256[] a,
struct Sig.Components[] c
) external returns
(bool)

Modifiers:

No modifiers

Args:

exitZcTokenFillingZcTokenInitiate

Allows a user to exit their zcTokens by filling an offline zcToken initiate order

This method should pass (underlying, maturity, sender, maker, principalFilled) to MarketPlace.p2pZcTokenExchange

Declaration

function exitZcTokenFillingZcTokenInitiate(
struct Hash.Order o,
uint256 a,
struct Sig.Components c
) internal

Modifiers:

No modifiers

Args:

exitVaultFillingVaultInitiate

Allows a user to exit their Vault by filling an offline vault initiate order

This method should pass (underlying, maturity, sender, maker, a) to MarketPlace.p2pVaultExchange

Declaration

function exitVaultFillingVaultInitiate(
struct Hash.Order o,
uint256 a,
struct Sig.Components c
) internal

Modifiers:

No modifiers

Args:

exitVaultFillingZcTokenExit

Allows a user to exit their Vault filling an offline zcToken exit order

This method should pass (underlying, maturity, maker, sender, a) to MarketPlace.exitFillingExit

Declaration

function exitVaultFillingZcTokenExit(
struct Hash.Order o,
uint256 a,
struct Sig.Components c
) internal

Modifiers:

No modifiers

Args:

exitZcTokenFillingVaultExit

Allows a user to exit their zcTokens by filling an offline vault exit order

This method should pass (underlying, maturity, sender, maker, principalFilled) to MarketPlace.exitFillingExit

Declaration

function exitZcTokenFillingVaultExit(
struct Hash.Order o,
uint256 a,
struct Sig.Components c
) internal

Modifiers:

No modifiers

Args:

cancel

Allows a user to cancel an order, preventing it from being filled in the future

Declaration

function cancel(
struct Hash.Order[] o
) external returns
(bool)

Modifiers:

No modifiers

Args:

setAdmin

Sets the admin

Declaration

function setAdmin(
address a
) external authorized returns
(bool)

Modifiers:

Args:

scheduleWithdrawal

Allows the admin to schedule the withdrawal of tokens

Declaration

function scheduleWithdrawal(
address e
) external authorized returns
(bool)

Modifiers:

Args:

scheduleApproval

Allows the admin to schedule the approval of tokens

Declaration

function scheduleApproval(
address e,
address a
) external authorized returns
(bool)

Modifiers:

Args:

scheduleFeeChange

allows the admin to schedule a change to the fee denominators

Declaration

function scheduleFeeChange(
uint16[4] f
) external authorized returns
(bool)

Modifiers:

Args:

blockWithdrawal

Emergency function to block unplanned withdrawals

Declaration

function blockWithdrawal(
address e
) external authorized returns
(bool)

Modifiers:

Args:

blockApproval

Emergency function to block unplanned approvals

Declaration

function blockApproval(
address e,
address a
) external authorized returns
(bool)

Modifiers:

Args:

blockFeeChange

Emergency function to block unplanned changes to fee structure

Declaration

function blockFeeChange(
) external authorized returns
(bool)

Modifiers:

withdraw

Allows the admin to withdraw the given token, provided the holding period has been observed

Declaration

function withdraw(
address e
) external authorized returns
(bool)

Modifiers:

Args:

changeFee

allows the admin to set new fee denominators

note that, since 0 values are allowable the way to leave a feenominator value unchanged is to pass the existing value

Declaration

function changeFee(
uint16[4] f
) external authorized returns
(bool)

Modifiers:

Args:

approveUnderlying

Allows the admin to bulk approve given compounding addresses at the underlying token, saving marginal approvals, providing the holding period has been observed

Declaration

function approveUnderlying(
address[] u,
address[] c
) external authorized returns
(bool)

Modifiers:

Args:

splitUnderlying

Allows users to deposit underlying and in the process split it into/mint zcTokens and vault notional. Calls mPlace.mintZcTokenAddingNotional

Declaration

function splitUnderlying(
uint8 p,
address u,
uint256 m,
uint256 a
) external returns
(bool)

Modifiers:

No modifiers

Args:

combineTokens

Allows users deposit/burn 1-1 amounts of both zcTokens and vault notional, in the process "combining" the two, and redeeming underlying. Calls mPlace.burnZcTokenRemovingNotional.

Declaration

function combineTokens(
uint8 p,
address u,
uint256 m,
uint256 a
) external returns
(bool)

Modifiers:

No modifiers

Args:

authRedeem

Allows MarketPlace to complete its contractual obligation as IRedeemer, redeeming zcTokens and withdrawing underlying p Protocol Enum value associated with this market pair

Note that this bubbles up from the zcToken instead of starting on Swivel (as per the ERC5095)

Declaration

function authRedeem(
uint8 u,
address c,
address t,
address a
) external authorized returns
(bool)

Modifiers:

Args:

redeemZcToken

Allows zcToken holders to redeem their tokens for underlying tokens after maturity has been reached (via MarketPlace).

Declaration

function redeemZcToken(
uint8 p,
address u,
uint256 m,
uint256 a
) external returns
(bool)

Modifiers:

No modifiers

Args:

redeemVaultInterest

Allows Vault owners to redeem any currently accrued interest (via MarketPlace)

Declaration

function redeemVaultInterest(
uint8 p,
address u,
uint256 m
) external returns
(bool)

Modifiers:

No modifiers

Args:

redeemSwivelVaultInterest

Allows Swivel to redeem any currently accrued interest (via MarketPlace)

Declaration

function redeemSwivelVaultInterest(
uint8 p,
address u,
uint256 m
) external returns
(bool)

Modifiers:

No modifiers

Args:

validOrderHash

Verifies the validity of an order and it's signature.

Declaration

function validOrderHash(
struct Hash.Order o,
struct Sig.Components c
) internal returns
(bytes32)

Modifiers:

No modifiers

Args:

Returns:

deposit

Use the Protocol Enum to direct deposit type transactions to their specific library abstraction

This functionality is an abstraction used by IVFZI, IZFVI and splitUnderlying

Declaration

function deposit(
uint8 p,
address u,
address c,
uint256 a
) internal returns
(bool)

Modifiers:

No modifiers

Args:

withdraw

Use the Protocol Enum to direct withdraw type transactions to their specific library abstraction

This functionality is an abstraction used by EVFZE, EZFVE, combineTokens, redeemZcToken and redeemVaultInterest. Note that while there is an external method withdraw also on this contract the unique method signatures (and visibility) exclude any possible clashing

Declaration

function withdraw(
uint8 p,
address u,
address c,
uint256 a
) internal returns
(bool)

Modifiers:

No modifiers

Args:

Events

Cancel

Emitted on order cancellation

Initiate

Emitted on any initiate*

filled is 'principalFilled' when (vault:false, exit:false) && (vault:true, exit:true) filled is 'premiumFilled' when (vault:true, exit:false) && (vault:false, exit:true)

Exit

Emitted on any exit*

filled is 'principalFilled' when (vault:false, exit:false) && (vault:true, exit:true) filled is 'premiumFilled' when (vault:true, exit:false) && (vault:false, exit:true)

ScheduleWithdrawal

Emitted on token withdrawal scheduling

ScheduleApproval

Emitted on token approval scheduling

ScheduleFeeChange

Emitted on fee change scheduling

BlockWithdrawal

Emitted on token withdrawal blocking

BlockApproval

Emitted on token approval blocking

BlockFeeChange

Emitted on fee change blocking

ChangeFee

Emitted on a change to the fee structure

SetAdmin

Emitted on a change of the admin

Last updated