
Introduction
1. Introduction
DEX Raiden v1 is an on-chain system of smart contracts on the Ethereum and Binance Smart Chain blockchain, implementing an automated liquidity protocol based on a “constant product formula”.
Each DEX Raiden v1 pair stores pooled reserves of two assets, and provides liquidity for those two assets, maintaining the invariant that the product of the reserves cannot decrease. Traders pay a 30-basis-point fee on trades, which goes to liquidity providers. The contracts are non-upgradeable.
DEX Raiden v1.1 is a new implementation based on the same formula, with several new highly desirable features.
Most significantly, it enables the creation of arbitrary ERC20/ERC20 pairs and BEP20/BEP20, rather than supporting only pairs between ERC20/ETH and BEP20/BSC. It also provides a hardened price oracle that accumulates the relative price of the two assets at the beginning of each block. This allows other contracts on Ethereum and Binance Smart Chain to estimate the time-weighted average price for the two assets over arbitrary intervals. Finally, it enables “flash swaps” where users can receive assets freely and use them elsewhere on the chain, only paying for (or returning) those assets at the end of the transaction. While the contract is not generally upgradeable, there is a private key that has the ability to update a variable on the factory contract to turn on an on-chain 5-basis-point fee on trades. This fee will initially be turned off, but could be turned on in the future, after which liquidity providers would earn 25 basis points on every trade, rather than 30 basis points. As discussed in section 3, DEX Raiden v1.1 also fixes some minor issues with DEX Raiden v1, as well as rearchitecting the implementation, reducing DEX Raiden's attack surface and making the system more easily upgradeable by minimizing the logic in the “core” contract that holds liquidity providers’ funds. This paper describes the mechanics of that core contract, as well as the factory contract used to instantiate those contracts. Actually using DEX Raiden v1 will require calling the pair contract through a “router” contract that computes the trade or deposit amount and transfers funds to the pair contract.

Last updated