MarketPlace
Annotated source code of the MarketPlace.sol smart contract
MarketPlace
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
unpaused
Returns whether a given market is paused or not
Declaration
Functions
constructor
Declaration
Modifiers:
No modifiers
Args:
setSwivel
We only allow this to be set once
there is no emit here as it's only done once post deploy by the deploying admin
Declaration
Modifiers:
Args:
setAdmin
No description
Declaration
Modifiers:
Args:
createMarket
Allows the owner to create new markets
the memory allocation of
s
is for alleviating STD err, there's no clearly superior scoping or abstracting alternative.
Declaration
Modifiers:
Args:
matureMarket
Can be called after maturity, allowing all of the zcTokens to earn floating interest on Compound until they release their funds
Declaration
Modifiers:
Args:
mintZcTokenAddingNotional
Allows Swivel caller to deposit their underlying, in the process splitting it - minting both zcTokens and vault notional.
Declaration
Modifiers:
Args:
burnZcTokenRemovingNotional
Allows Swivel caller to deposit/burn both zcTokens + vault notional. This process is "combining" the two and redeeming underlying.
Declaration
Modifiers:
Args:
authRedeem
Implementation of authRedeem to fulfill the IRedeemer interface for ERC5095
Declaration
Modifiers:
Args:
Returns:
redeemZcToken
Allows (via swivel) zcToken holders to redeem their tokens for underlying tokens after maturity has been reached.
Declaration
Modifiers:
Args:
redeemVaultInterest
Allows Vault owners (via Swivel) to redeem any currently accrued interest
Declaration
Modifiers:
Args:
calculateReturn
Calculates the total amount of underlying returned including interest generated since the matureMarket
function has been called
Declaration
Modifiers:
No modifiers
Args:
cTokenAddress
Return the compounding token address for a given market
Declaration
Modifiers:
No modifiers
Args:
exchangeRate
Return the exchange rate for a given protocol's compounding token
Declaration
Modifiers:
No modifiers
Args:
rates
Return current rates (maturity, exchange) for a given vault. See VaultTracker.rates for details
While it's true that Compounding exchange rate is not strictly affiliated with a vault, the 2 data points are usually needed together.
Declaration
Modifiers:
No modifiers
Args:
custodialInitiate
Called by swivel IVFZI && IZFVI
Call with protocol, underlying, maturity, mint-target, add-notional-target and an amount
Declaration
Modifiers:
Args:
custodialExit
Called by swivel EVFZE FF EZFVE
Call with protocol, underlying, maturity, burn-target, remove-notional-target and an amount
Declaration
Modifiers:
Args:
p2pZcTokenExchange
Called by swivel IZFZE, EZFZI
Call with underlying, maturity, transfer-from, transfer-to, amount
Declaration
Modifiers:
Args:
p2pVaultExchange
Called by swivel IVFVE, EVFVI
Call with protocol, underlying, maturity, remove-from, add-to, amount
Declaration
Modifiers:
Args:
transferVaultNotional
External method giving access to this functionality within a given vault
Note that this method calculates yield and interest as well
Declaration
Modifiers:
Args:
transferVaultNotionalFee
Transfers notional fee to the Swivel contract without recalculating marginal interest for from
Declaration
Modifiers:
Args:
pause
Called by admin at any point to pause / unpause market transactions in a specified protocol
Declaration
Modifiers:
Args:
Events
Create
Emitted upon the creation of a market
Mature
Emitted upon the maturation of a market
RedeemZcToken
Emitted upon the redemption of a ZC token
RedeemVaultInterest
Emitted upon the redemption of vault interest
CustodialInitiate
Emitted upon a custodial initiate
CustodialExit
Emitted upon a custodial exit
P2pZcTokenExchange
Emitted upon a P2P ZC token swap
P2pVaultExchange
Emitted upon a vault swap
TransferVaultNotional
Emitted upon a transfer of notional from a vault
SetAdmin
Emitted on a change of the admin