MarketPlace
Annotated source code of the MarketPlace.sol smart contract
Functions
setSwivelAddress
We only allow this to be set once
Parameters:
Name | Type | Description |
---|---|---|
| address | Address of the deployed swivel contract |
transferAdmin
Parameters:
Name | Type | Description |
---|---|---|
| address | Address of a new admin |
createMarket
Allows the owner to create new markets
Parameters:
Name | Type | Description |
---|---|---|
| uint256 | Maturity timestamp of the new market |
| address | cToken address associated with underlying for the new market |
| string | Name of the new zcToken market |
| string | Symbol of the new zcToken market |
matureMarket
Can be called after maturity, allowing all of the zcTokens to earn floating interest on Compound until they release their funds
Parameters:
Name | Type | Description |
---|---|---|
| address | Underlying token address associated with the market |
| uint256 | Maturity timestamp of the market |
mintZcTokenAddingNotional
Allows Swivel caller to deposit their underlying, in the process splitting it - minting both zcTokens and vault notional.
Parameters:
Name | Type | Description |
---|---|---|
| address | Underlying token address associated with the market |
| uint256 | Maturity timestamp of the market |
| address | Address of the depositing user |
| uint256 | Amount of notional being added |
burnZcTokenRemovingNotional
Allows Swivel caller to deposit/burn both zcTokens + vault notional. This process is "combining" the two and redeeming underlying.
Parameters:
Name | Type | Description |
---|---|---|
| address | Underlying token address associated with the market |
| uint256 | Maturity timestamp of the market |
| address | Address of the combining/redeeming user |
| uint256 | Amount of zcTokens being burned |
redeemZcToken
Allows (via swivel) zcToken holders to redeem their tokens for underlying tokens after maturity has been reached.
Parameters:
Name | Type | Description |
---|---|---|
| address | Underlying token address associated with the market |
| uint256 | Maturity timestamp of the market |
| address | Address of the redeeming user |
| uint256 | Amount of zcTokens being redeemed |
redeemVaultInterest
Allows Vault owners (via Swivel) to redeem any currently accrued interest
Parameters:
Name | Type | Description |
---|---|---|
| address | Underlying token address associated with the market |
| uint256 | Maturity timestamp of the market |
| address | Address of the redeeming user |
calculateReturn
Calculates the total amount of underlying returned including interest generated since the matureMarket
function has been called
Parameters:
Name | Type | Description |
---|---|---|
| address | Underlying token address associated with the market |
| uint256 | Maturity timestamp of the market |
| uint256 | Amount of zcTokens being redeemed |
cTokenAddress
Return the ctoken address for a given market
Parameters:
Name | Type | Description |
---|---|---|
| address | Underlying token address associated with the market |
| uint256 | Maturity timestamp of the market |
custodialInitiate
Called by swivel IVFZI && IZFVI
Call with underlying, maturity, mint-target, add-notional-target and an amount
Parameters:
Name | Type | Description |
---|---|---|
| address | Underlying token address associated with the market |
| uint256 | Maturity timestamp of the market |
| address | Recipient of the minted zcToken |
| address | Recipient of the added notional |
| uint256 | Amount of zcToken minted and notional added |
custodialExit
Called by swivel EVFZE FF EZFVE
Call with underlying, maturity, burn-target, remove-notional-target and an amount
Parameters:
Name | Type | Description |
---|---|---|
| address | Underlying token address associated with the market |
| uint256 | Maturity timestamp of the market |
| address | Owner of the zcToken to be burned |
| address | Target to remove notional from |
| uint256 | Amount of zcToken burned and notional removed |
p2pZcTokenExchange
Called by swivel IZFZE, EZFZI
Call with underlying, maturity, transfer-from, transfer-to, amount
Parameters:
Name | Type | Description |
---|---|---|
| address | Underlying token address associated with the market |
| uint256 | Maturity timestamp of the market |
| address | Owner of the zcToken to be burned |
| address | Target to be minted to |
| uint256 | Amount of zcToken transfer |
p2pVaultExchange
Called by swivel IVFVE, EVFVI
Call with underlying, maturity, remove-from, add-to, amount
Parameters:
Name | Type | Description |
---|---|---|
| address | Underlying token address associated with the market |
| uint256 | Maturity timestamp of the market |
| address | Owner of the notional to be transferred |
| address | Target to be transferred to |
| uint256 | Amount of notional transfer |
transferVaultNotional
External method giving access to this functionality within a given vault
Note that this method calculates yield and interest as well
Parameters:
Name | Type | Description |
---|---|---|
| address | Underlying token address associated with the market |
| uint256 | Maturity timestamp of the market |
| address | Target to be transferred to |
| uint256 | Amount of notional to be transferred |
transferVaultNotionalFee
Transfers notional fee to the Swivel contract without recalculating marginal interest for from
Parameters:
Name | Type | Description |
---|---|---|
| address | Underlying token address associated with the market |
| uint256 | Maturity timestamp of the market |
| address | Owner of the amount |
| uint256 | Amount to transfer |
pause
Called by admin at any point to pause / unpause market transactions
Parameters:
Name | Type | Description |
---|---|---|
| bool | Boolean which indicates the markets paused status |
Events
Create
Mature
RedeemZcToken
RedeemVaultInterest
CustodialInitiate
CustodialExit
P2pZcTokenExchange
P2pVaultExchange
TransferVaultNotional
Last updated