⚖️Multipool
This section describes the Multipool core contract.
Visit GitHub to see full implementation
Multipool
State Variables
assets
prices
deviationParam
deviationLimit
depegBaseFee
baseFee
totalTargetShares
totalCollectedCashbacks
collectedFees
initialSharePrice
sharePriceValidityDuration
isPriceSetter
isTargetShareSetter
developerAddress
developerBaseFee
collectedDeveloperFees
isPaused
signatureThershold
Functions
constructor
initialize
_authorizeUpgrade
notPaused
getSharePriceParams
Gets several share prive params
Fetches data by reading a single slot
Returns
getPriceFeed
Gets price feed data
Parameters
Returns
getPrice
Gets current asset price
Parameters
Returns
getFeeParams
getAsset
Gets asset related info
Reads exacly two storage slots
Parameters
Returns
getContext
Assembles context for swappping
tries to apply force pushed share price if provided address matches otherwhise ignores struct
Parameters
Returns
getPricesAndSumQuotes
Assembles context for swappping
Also checks that assets are unique via asserting that they are sorted and each element address is stricly bigger
Parameters
Returns
transferAsset
Proceeses asset transfer
Handles multipool share with no contract calls
Parameters
receiveAsset
Asserts there is enough token balance and makes left value refund
Handles multipool share with no contract calls
Parameters
swap
Method that executes every trading in multipool
This is a low level method that works via direct token transfer on contract and method execution. Should be used in other contracts only Fees are charged in native token equivalend via transferring them before invocation or in msg.value
Parameters
checkSwap
Method that dry runs swap execution and provides estimated fees and amounts
To avoid calculation errors don't provide small values to amount
Parameters
Returns
increaseCashback
Method that dry runs swap execution and provides estimated fees and amounts
Method is permissionless so anyone can boos incentives. Native token value can be transferred directly if used iva contract or via msg.value with any method
Parameters
Returns
updatePrices
Updates price feeds for multiple tokens.
Values in each of these arrays should match with indexes (e.g. index 1 contains all data for asset 1)
Parameters
updateTargetShares
Updates target shares for multiple tokens.
Values in each of these arrays should match with indexes (e.g. index 1 contains all data for asset 1)
Parameters
withdrawFees
Method that allows to withdraw collected to owner fees. May be only called by owner
Sends all collected values at once
Parameters
Returns
withdrawDeveloperFees
Method that allows to withdraw developer fees from contract
Can be invoked by anyone but is still safe as recepient is always developer address
Returns
togglePause
Method that stops or launches contract. Used in case of freezing (e.g hacks or temprorary stopping contract)
setFeeParams
Method to change fee charging rules. All ratios are Q32 values.
Remember to always update every value as this function overrides all variables
Parameters
setSharePriceParams
This method allows to chenge time for wich force pushed share price is valid and minimal number of unique signatures required for price force push
Called only by owner. This mechanism allow you to manage price volatility by changing valid price timeframes
Parameters
setAuthorityRights
Method that changes permissions of accounts
Remember to always update every value as this function overrides all variables
Parameters
Last updated