Implementation on the Cardano blockchain
We will transform a part of the functionality of Solidity and Ethernet virtual machines, such as the one belonging to the above for deposits, withdrawals and exchange liquidity, to be executed multiple times in sequence within a given block. Cardano uses a Bitcoin-like asset model called "extended unspent transaction output" (eUTXO), which makes transforming the above model much more complex than one might expect. In smart contract implementations, the eUTXO model is more "passive" than the explicit call function of “get balance”, and has little access to global state.
eUTXO is built on a simpler Bitcoin-like UTXO model. In the UTXO model, funds are tracked as a chain of custody by pointing to a specific (unspent) output of a previous transaction, and then using it as an input for a new transaction. A very simple script can be attached and evaluated to determine whether the output is allowed.
The eUTXO model used by Cardano extends it in the following ways:
  • UTXO is equipped with arbitrary data
  • The script that locks the funds has access to the input data, called "redeemer", as well as the entire transaction
We first propose a natural method for converting the above system into an eUTXO model and discuss the trade-offs made in the process.
In this implementation, we will lock in a script that allows the creation of a specific "asset pair liquidity pool" of unique tokens, similar to the LP-Token in solidity. As mentioned"passive" above, the worldwide tokens are used in conjunction with the minting rules to ensure the uniqueness of the asset pairs, rather than diluting the available liquidity and suffer from undesirable slippage.
  • These unique tokens are always locked in eUTXO along with the liquidity in the pool, enforced using a validator script.
  • Minting rules allow LP-Token to be minted, but liquidity needs to be deposited The same minting rules allow the destruction of LP-Token, as long as the appropriate liquidity is redeemed.
However, there can be a bad experience with this model: In the case of a given eUTXO only being spent once without adopting multiple UTXO parallelism - an inherent advantage of eUTXO. As part of a single transaction, it seems that only one exchange may occur per block. On Cardano blockchain, however, there will be a block approximately every 20 seconds. So this will be anathema to a decentralized exchange, thus adopting a method of parallelism presents a better solution that we expected to be put forward in our Technical Paper v2.
Last modified 4mo ago
Copy link