Listening to Contract Events
The DODO platform contracts trigger certain events as they operate. Among the more common events are pool creation, token swapping, and more.
Pool Creation Event #
The types of liquidity pools currently supported by the DODO platform include DODO V1 Standard Pools, DODO V2 Single-Token Pools, DODO V2 Market Maker Pools and DODO V2 Pegged Pools. All four types of pools are created by the corresponding factory contract execution and trigger creation events, as follows:
DODO V1 Standard Pool#
The corresponding factory contract name is DODO Zoo, and the events that third party platforms need to listen to are:
event DODOBirth(address newBorn, address baseToken, address quoteToken);
where newBorn
is the DODO V1 Standard Pool contract address.
DODO V2 Single-Token Pool#
The corresponding factory contract name is DODO Vending Machine Factory, and the events that third party platforms need to listen to are:
event NewDVM(
address baseToken,
address quoteToken,
address creator,
address dvm
);
where dvm
is the DODO V2 Single-Token Pool contract address and creator
is the pool creation account.
DODO V2 Market Maker Pool#
The corresponding factory contract name is DODO Private Pool Factory, and the events that third party platforms need to listen to are:
event NewDPP(
address baseToken,
address quoteToken,
address creator,
address dpp
);
where dpp
is the DODO V2 Market Maker Pool contract address and creator
is the pool creation account.
DODO V2 Pegged Pool#
The corresponding factory contract name is DODO Stable Pool Factory, and the events that third party platforms need to listen to are:
event NewDSP(
address baseToken,
address quoteToken,
address creator,
address DSP
);
where dsp
is the DODO V2 Pegged Pool contract address, and creator
is the pool creation account.
Note: The above mentioned DODO Zoo, DODO Vending Machine Factory, DODO Private Pool Factory, DODO Stable Pool Factory contracts can be obtained by querying the corresponding network under the contract address. All these contracts are open source and can be obtained directly in the blockchain browser.
Pool Transaction Event#
The different types of pools can be aggregated by DODO's own routing and external aggregators, and can also be called directly for transactions. Each transaction triggers an Event, which can be used by third-party platforms to count the volume of the pools. The events to listen for are different for DODO V1 Standard Pools and DODO V2 Pools (including Single-Token, Market Maker, and Pegged Pools).
DODO V1 Standard Pools#
The third party platform needs to obtain the corresponding pool address and listen for the following events:
event SellBaseToken(
address indexed seller,
uint256 payBase,
uint256 receiveQuote
);
event BuyBaseToken(
address indexed buyer,
uint256 receiveBase,
uint256 payQuote
);
There are two types of events, executed depending on which token in the pool is being bought.
SellBaseToken
represents the sale of a BaseToken
to the pool and the purchase of a QuoteToken
.
payBase
represents the number of BaseTokens
paid and receiveQuote
is the number of QuoteToken
s received. BuyBaseToken
represents the sale of QuoteToken
s to the pool and the purchase of BaseToken
s.
payQuote
represents the number of QuoteToken
s paid and receiveBase
is the number of BaseToken
s exchanged.
DODO V2 Pools#
The third party platform needs to obtain the address of the corresponding pool and listen for the following events:
event DODOSwap(
address fromToken,
address toToken,
uint256 fromAmount,
uint256 toAmount,
address trader,
address receiver
);
The pool transaction Event for DODO V2 is unified as DODOSwap
. fromToken
is the address of the token sold, toToken
is the address of the token bought, fromAmount
represents the number of tokens sold, toAmount
is the number of tokens bought, trader
is the transaction executor, and receiver
is the target token receiving account.