This is an instructions for users who want to interact with dodo smart contract directly.
Each trading pair is an independent DODO smart contract, and all DODO contracts are registered in DODO ZOO.
Users interact with each DODO smart contract directly. All external functions are divided into three sub-contracts according to the role of their users: Admin, Trader and LiquidityProvider.
To simplify users' operations, we developed DODO ETH Proxy, a helper contract that helps user handle with WETH-ETH converting.

sellBaseToken(uint256 amount, uint256 minReceiveQuote) returns (uint256 receiveQuote)
| sellBaseToken | Desc |
|---|---|
| @dev | Sell base token and receive quote token |
| @param amount | The amount of base token to sell |
| @param minReceiveQuote | The minimum amount of quote token required. Transaction will be reverted if the trader receive quote token less than this value. |
| @returns receiveQuote | The amount of quote token received |
buyBaseToken(uint256 amount, uint256 maxPayQuote) returns (uint256 payQuote)
| buyBaseToken | Desc |
|---|---|
| @dev | Buy base token and pay quote token |
| @param amount | The amount of base token to buy |
| @param maxPayQuote | The maximum amount of quote token needs to pay. Transaction will be reverted if the trader pay quote token greater than this value. |
| @returns payQuote | The amount of quote token paid |
depositBase(uint256 amount)
| depositBase | Desc |
|---|---|
| @dev | Deposit base token to liquidity pool |
| @param amount | The amount of base token to deposit |
depositQuote(uint256 amount)
| depositQuote | Desc |
|---|---|
| @dev | Deposit quote token to liquidity pool |
| @param amount | The amount of quote token to deposit |
withdrawBase(uint256 amount) returns (uint256 receiveAmount)
| withdrawBase | Desc |
|---|---|
| @dev | Withdraw base token from liquidity pool |
| @param amount | The amount of base token to withdraw |
| @returns receiveAmount | The amount of base token sender received |
| @notice | DODO charges penalty fee from liquidity providers who withdraw assets and share the fee with all remaining liquidity providers. Normally the penalty would be 0 or nearly 0. |
withdrawQuote(uint256 amount) returns (uint256 receiveAmount)
| withdrawQuote | Desc |
|---|---|
| @dev | Withdraw quote token from liquidity pool |
| @param amount | The amount of quote token to withdraw |
| @returns receiveAmount | The amount of quote token sender received |
| @notice | DODO charges penalty fee from liquidity providers who withdraw assets and share the fee with all remaining liquidity providers. Normally the penalty would be 0 or nearly 0. |
withdrawAllBase() returns (uint256 receiveAmount)
| withdrawAllBase | Desc |
|---|---|
| @dev | Withdraw message sender’s all base token deposited in the pool. |
withdrawAllQuote() returns (uint256 receiveAmount)
| withdrawAllQuote | Desc |
|---|---|
| @dev | Withdraw message sender’s all quote token deposited in the pool. |
_GAS_PRICE_LIMIT_
| _GASPRICELIMIT_ | Desc |
|---|---|
| @dev | A public variable. All transactions involving trading should be sent with gas price no greater than this value. Otherwise, DODO will revert the transactions. |
getLpBaseBalance(address lp) returns (uint256 lpBalance)
| getLpBaseBalance | Desc |
|---|---|
| @dev | Get liquidity provider’s base token balance in the pool |
getLpQuoteBalance(address lp) returns (uint256 lpBalance)
| getLpQuoteBalance | Desc |
|---|---|
| @dev | Get liquidity provider’s quote token balance in the pool |
getWithdrawQuotePenalty(uint256 amount) returns (uint256 penalty)
| getWithdrawQuotePenalty | Desc |
|---|---|
| @dev | Get the penalty fee will be charged if some liquidity provider withdraw a certain amount of quote token from pool. |
getWithdrawBasePenalty(uint256 amount) returns (uint256 penalty)
| getWithdrawBasePenalty | Desc |
|---|---|
| @dev | Get the penalty fee will be charged if some liquidity provider withdraw a certain amount of base token from pool. |
querySellBaseToken(uint256 amount) returns (uint256 receiveQuote)
| querySellBaseToken | Desc |
|---|---|
| @dev | A “view” version of sellBaseToken. This function can be really useful to query price because it doesn’t cost gas. |
queryBuyBaseToken(uint256 amount) returns (uint256 payQuote)
| queryBuyBaseToken | Desc |
|---|---|
| @dev | A “view” version of buyBaseToken. This function can be really useful to query price because it doesn’t cost gas. |
As DODO only works fine with ERC20 tokens, if you want to use Ether directly on DODO, we provide a proxy smart contract to help you access DODO. Basicly, the proxy contract convert Ether to Wrapped ETH, a kind of ERC20 token, and use it on DODO. The operation is totally transparent to user.
sellEthTo(address quoteTokenAddress,uint256 ethAmount,uint256 minReceiveTokenAmount) returns (uint256 receiveTokenAmount)
| sellEthTo | Desc |
|---|---|
| @dev | Sell ETH on WETH-quoteTokenAddress market |
buyEthWith(address quoteTokenAddress,uint256 ethAmount,uint256 maxPayTokenAmount) returns (uint256 payTokenAmount)
| buyEthTo | Desc |
|---|---|
| @dev | Buy ETH on WETH-quoteTokenAddress market |
depositEth(uint256 ethAmount, address quoteTokenAddress)
| depositEth | Desc |
|---|---|
| @dev | Deposit ETH to WETH-quoteTokenAddress market |
withdrawBaseTo(address to, uint256 amount) returns (uint256)
depositBaseTo(address to, uint256 amount)
withdrawQuoteTo(address to, uint256 amount) returns (uint256)
depositQuoteTo(address to, uint256 amount)
withdrawAllBaseTo(address to) returns (uint256)
withdrawAllQuoteTo(address to) returns (uint256)