Market Making
Current pool types on the DODO platform include:
  • DODO V2 private pool, for professional market makers to make markets
  • DODO V2 public pool, any user can participate, dual currency market making
  • DODO V2 Anchor pool, any user can participate, dual currency market making
  • DODO V1 classic pool, any user can participate, single currency market making

The private pool of DODO V2 can be independently marketed by market makers with their own funds, and the private pool configuration can be flexibly modified during the market making process, including transaction commission rate, current external guide price I, curve slippage factor K, as well as supporting the adjustment of the pool's capital size.
All these modifications are made by the relevant accounts triggering smart contracts for dynamic on-chain market making adjustments.

Market makers can achieve dynamic market making adjustments by calling the resetDODOPrivatePool method in DODO V2Proxy02 (see Contract Information page for address), as defined below:
function resetDODOPrivatePool(
address dppAddress,
uint256[] memory paramList, //0 - newLpFeeRate, 1 - newI, 2 - newK
uint256[] memory amountList, //0 - baseInAmount, 1 - quoteInAmount, 2 - baseOutAmount, 3- quoteOutAmount
uint8 flag, // 0 - ERC20, 1 - baseInETH, 2 - quoteInETH, 3 - baseOutETH, 4 - quoteOutETH
uint256 minBaseReserve,
uint256 minQuoteReserve,
uint256 deadLine
) external;

  • dppAddress: private pool contract address
  • paramList: pass in the transaction fee rate, external guide price, curve slippage factor in order, where:
    • Transaction fee rate: the unit is 18, the range is [0, 1e18], where 1e18 represents 100%
    • External guide price: the unit is 18 - baseToken unit + quoteToken unit, external guide price is the ratio of base/quote two token price.
    • Sliding point system: the unit is 18, the range is [0, 1e18], represents the degree of price curve fluctuation, where 0 is equivalent to the constant price of selling coins, 1e18 is the Uni-like price curve
  • amountList: pass baseInAmount, quoteInAmount, baseOutAmount, quoteOutAmount in order (all considering their respective units), the first two represent the number of base and quote tokens injected into the private pool, before injection, the tokens need to be authorized to the The first two represent the number of base and quote tokens to be injected into the private pool, and the tokens need to be authorized to the DODOApprove contract (see the contract information page for the address) before injection. Thus, the size of the private pool can be adjusted dynamically.
  • flag: mainly used for the interchange between ETH and WETH, where:
    • 0 means both base and quote are ERC20 tokens
    • 1 means the transferred base is ETH, so the contract will automatically convert ETH to WETH
    • 2 means the transferred quote is ETH, so the contract will automatically convert ETH to WETH
    • 3 means the extracted base is WETH, so the contract will automatically convert WETH to ETH
    • 4 means the extracted quote is WETH, so the contract will automatically convert WETH to ETH
  • minBaseReserve and minQuoteReserve are mainly used to reduce arbitrage of robocall transactions. When a market-making account initiates a transaction and modifies the parameters of the private pool, it may cause the price of the pool to change, so the robot may robocall arbitrage during the time interval between the issuance as well as the real transaction on the chain, after these two parameters are set, when the existing funds of the pool when the execution of the chain After these two parameters are set, when one side of the pool is smaller than the set value, the transaction will be contractually revert off to reduce the arbitrage risk.
  • deadline: transaction time limit, after the timeout contract revert
"inputs": [
"internalType": "address",
"name": "dppAddress",
"type": "address"
"internalType": "uint256[]",
"name": "paramList",
"type": "uint256[]"
"internalType": "uint256[]",
"name": "amountList",
"type": "uint256[]"
"internalType": "uint8",
"name": "flag",
"type": "uint8"
"internalType": "uint256",
"name": "minBaseReserve",
"type": "uint256"
"internalType": "uint256",
"name": "minQuoteReserve",
"type": "uint256"
"internalType": "uint256",
"name": "deadLine",
"type": "uint256"
"name": "resetDODOPrivatePool",
"outputs": [],
"stateMutability": "payable",
"type": "function"

The public pool or Pegged pool is a dual currency market making pool that anyone can participate in, and due to the flexible design of DODO, the same pair can have different pools with different parameters, when the user participates in market making, he/she fills the base and quoteassets according to the current ratio of the pool, and gets the amount of shares assets minted by the pool.
Note: shares represent the market maker's share of the asset pool. It is a token in ERC 20 format and can be traded freely. Each public pool corresponds to one type of shares.
function buyShares(
address to
) external returns (uint256 shares, uint256 baseInput, uint256 quoteInput)
This function enables the injection of liquidity into the pool and requires the market maker to construct a transaction with two operations, the first operation is to deposit tokens into the pool contract in proportion to the pool's current base and quote, and the second operation is to take the shares receiving address as an argument to trigger buyShares. before the end of the transaction, it is recommended that the market maker perform a quantity check on the baseInput and quoteInput to ensure that the transaction is executed safely.
function sellShares(
uint256 shareAmount,
address to,
uint256 baseMinAmount,
uint256 quoteMinAmount,
bytes calldata data,
uint256 deadline
) external returns (uint256 baseAmount, uint256 quoteAmount)
This function enables the extraction of liquidity from the pool, the market maker can directly call the pool corresponding to the function to execute the transaction, where the parameters passed in include the number of shares removed, the address of the funds received, and the baseMinAmount (the minimum number of base expected to be received), quoteMinAmount (the minimum number of quote expected to be received) used for slippage protection. data is generally set to empty, if not empty, the function will be executed at the end of the execution, the implementation of external contract calls to achieve additional functions such as WETH to ETH, the final deadline for the transaction issued after the effective time, the timeout automatically fails to protect the safe execution of the transaction.

DODOV1 uses external prophecy machine price guidance for market making, and therefore supports single currency to provide liquidity, involving the following functions:
function depositBaseTo(address to, uint256 amount) external returns (uint256);
function depositQuoteTo(address to, uint256 amount) external returns (uint256);
These two functions enable the injection of one-sided liquidity into the pool, requiring the market maker to construct a transaction with two actions, the first to authorize the injected tokens to the pool, and the second to trigger depositBaseTo or depositQuoteTo
function withdrawBase(uint256 amount) external returns (uint256);
function withdrawQuote(uint256 amount) external returns (uint256);
These two functions enable the withdrawal of one-sided liquidity from the pool.
Note: PMM will issue a recharge bonus or charge a withdrawal fee when the system deviates significantly from equilibrium and the amount of recharges or withdrawals is large. In general, market makers do not need to pay attention to these two components. Of course, traders are more than welcome to top up to earn rewards when the system is out of balance, and then withdraw when the system is balanced to avoid being charged a commission.
Copy link
On this page