Technical Overview of the PMM
Technical Overview of Entry Points and Contract Functions
A) SuperAdmin Entry Points
%setSuperAdmin
%setSuperAdminParameters: newSuperAdminAddress : address
Entrypoint that can only be called by the superAdmin contract to set a new superAdmin contract.
%claimSuperAdmin
%claimSuperAdminParameters: none
Entrypoint that can only be called by a new superAdmin contract that had previously been set.
B) Admin Entrypoints
%setGuidePrice
%setGuidePriceParameters: setGuidePriceAction : setGuidePriceActionType
type setGuidePriceActionType is [@layout:comb] record [
configType : string;
natOption : option(nat);
stringOption : option(string);
]
// configType:
// "priceModel" -> fixed or dynamic
// "appraisalPrice" -> newAppraisalPrice
// "fixedPricePercent" -> newFixedPricePercent
// "orderbookPricePercent" -> newOrderbookPricePercent
Admin can set the guide price config (price model, appraisal price, fixed price percent, and orderbook price percent.
For the fixed price model, only the appraisal price is used.
For the dynamic price model, appraisal price, fixed price percent, and orderbook price percent is used. The final guide price used will be determined from the last matched price from the corresponding RWA Orderbook and the price configurations.
const lastMatchedPrice : nat = getOrderbookLastMatchedPrice(s);
// adjust for decimals
const adjustedLastMatchedPrice : nat = (lastMatchedPrice * const_REBASE_QUOTE_TOKEN_DECIMALS);
guidePrice := mul(appraisalPrice, fixedPricePercent) + mul(orderbookPricePercent, adjustedLastMatchedPrice);
Decimals used for percentages: 18
%updateGuidePrice
%updateGuidePriceParameters: _ : unit
Admin can call this entrypoint to update the guide price regularly from changes in the RWA Orderbook when the last matched price changes.
%updateMetadata
%updateMetadataParameters: updateMetadataParams : updateMetadataType
type updateMetadataType is [@layout:comb] record [
metadataKey : string;
metadataHash : bytes;
]
Admin can update the contract metadata
%updateConfig
%updateConfigParameters: updateConfigParams : dodoUpdateConfigParamsType
type dodoUpdateConfigParamsType is [@layout:comb] record [
configName : string;
newConfigValue : nat;
];
Admin can update the configurations for LP Fee, maintainer Fee, and fee decimals.
C) Pause / Break Glass Entry points
%togglePauseEntrypoint
%togglePauseEntrypointParameters: togglePauseParams : dodoTogglePauseEntrypointType
type dodoTogglePauseEntrypoinSingleType is [@layout:comb] record [
targetEntrypoint : string;
pauseBool : bool;
];
type dodoTogglePauseEntrypointType is list(dodoTogglePauseEntrypoinSingleType)
// valid target entrypoints:
// buyBaseToken, sellBaseToken, withdrawQuoteToken, withdrawBaseToken,
// withdrawAllQuoteTokens, withdrawAllBaseTokens, depositQuoteToken,
// depositBaseToken
Admin can pause a given entrypoint on the DodoMav contract
D) Dodo Dex Entry Points
%buyBaseToken
%buyBaseTokenParameters: tradeBaseTokenAction : tradeBaseTokenActionType
type tradeBaseTokenActionType is [@layout:comb] record [
amount : nat;
minMaxQuote : nat;
]
Users can buy base tokens (RWA Tokens). Max Pay Quote is used here to determine the maximum amount of Quote Tokens (e.g. USDT) that the buyer wants to use to purchase the given amount of Base Tokens (RWA Tokens)
%sellBaseToken
%sellBaseTokenParameters: tradeBaseTokenAction : tradeBaseTokenActionType
type tradeBaseTokenActionType is [@layout:comb] record [
amount : nat;
minMaxQuote : nat;
]
Users can sell base tokens (RWA Tokens).
Min receive Quote is used here to determine the minimum amount of Quote Tokens (e.g. USDT) that the seller wants to receive from selling the given amount of Base Tokens (RWA Tokens)
%withdrawQuoteToken
%withdrawQuoteTokenParameters: withdrawAmount : nat
User can withdraw Quote Tokens (e.g. USDT) from the DodoMav liquidity pool. Users may incur a withdrawalQuotePenalty if the rStatus is BELOW_ONE to balance the liquidity based on the expected target.
%withdrawBaseToken
%withdrawBaseTokenParameters: withdrawAmount : nat
User can withdraw Base Tokens (RWA Tokens) from the DodoMav liquidity pool. Users may incur a withdrawal Base Penalty if the rStatus is ABOVE_ONE to balance the liquidity based on the expected target.
%withdrawAllQuoteTokens
%withdrawAllQuoteTokensParameters: _ : unit
Users can withdraw all their Quote Tokens (e.g. USDT) from the DodoMav liquidity pool. Users may incur a withdrawalQuotePenalty if the rStatus is BELOW_ONE to balance the liquidity based on the expected target.
%withdrawAllBaseTokens
%withdrawAllBaseTokensParameters: _ : unit
User can withdraw all his Base Tokens (RWA Token) from the DodoMav liquidity pool. Users may incur a withdrawal Base Penalty if the rStatus is ABOVE_ONE to balance the liquidity based on the expected target.
%depositQuoteToken
%depositQuoteTokenParameters: depositAmount : nat
User can deposit Quote Tokens (e.g. USDT) to the DodoMav liquidity pool.
%depositBaseToken
%depositBaseTokenParameters: depositAmount : nat
User can deposit Base Tokens (RWA Tokens) to the DodoMav liquidity pool.
E) Lambda Entry Points
%setLambda
%setLambdaParameters: setLambdaParams : setLambdaType
Admin to set lambdas for contract
Last updated