...
Liquidity Pools is another dimension in this set of scenarios for Decentralized Exchanges. Basically it can be used in pair with or without bridges, so let's take a more clean example without them. But let's not stick to an Exchange Pair and work with multi-currency liquidity:
Image Removed
Image Added
Expand |
---|
|
No Format |
---|
| @startuml
Trader"Liquidity Provider" -> Iroha: Register Exchange Liquidity [20XOR, 20ETH, 1BTC]
Seller -> Iroha: Place Exchange Order(1BTC, 20ETH)
Iroha -> "BTC bridge": Mint 1BTC to Seller
alt Success:
Iroha -> Iroha: Transfer 1BTC from Seller to "Liquidity TraderProvider"
alt Success:
Iroha -> Iroha: Transfer 20ETH from "Liquidity TraderProvider" to Seller
end
end
@enduml |
|
...
No Format |
---|
|
Feature: Decentralized Exchange
Scenario: Buyer exchanges 20xor for 100usd
Given Iroha Peer is up
And Iroha DEX module enabled
And Peer has Domain with name exchange
And Peer has Account with name buyer and domain exchange
And Peer has Account with name seller and domain exchange
And Peer has Asset Definition with name xor and domain exchange
And Peer has Asset Definition with name usd and domain exchange
And buyer Account in domain exchange has 100 amount of Asset with definition usd in domain exchange
And seller Account in domain exchange has 20 amount of Asset with definition xor in domain exchange
When buyer Account places Exchange Order 20xor for 100usd
And seller Account places Exchange Order 100usd for 20 xor
Then Iroha transfer 20 amount of Asset with definition xor in domain exchange from seller account in domain exchange to buyer account in domain exchange
And Iroha transfer 100 amount of Asset with definition usd in domain exchange from account buyer in domain exchange to seller account in domain exchange
Scenario: Buyer exchanges 1btc for 20eth across bridges
Given Iroha Peer is up
And Iroha Bridge module enabled
And Iroha DEX module enabled
And Peer has Domain with name exchange
And Peer has Account with name buyer and domain exchange
And Peer has Account with name seller and domain exchange
And Peer has Asset Definition with name btc and domain exchange
And Peer has Asset Definition with name eth and domain exchange
And Peer has Bridge with name btc and owner btc_owner
And Peer has Bridge with name eth and owner eth_owner
And eth Brdige has buyer Account in domain exchange registered
And btc Brdige has seller Account in domain exchange registered
When buyer Account places Exchange Order 20xor for 100usd
And seller Account places Exchange Order 100usd for 20 xor
Then Iroha mint 1 amount of Asset with definition btc in domain exchange to seller Account in domain exchange using btc Bridge
And Iroha mint 20 amount of Asset with definition eth in domain exchange to buyer Account in domain exchange using eth Bridge
And Iroha transfer 1 amount of Asset with definition btc in domain exchange from seller account in domain exchange to buyer account in domain exchange
And Iroha transfer 20 amount of Asset with definition eth in domain exchange from buyer account in domain exchange to seller account in domain exchange
Scenario: Buyer exchanges 20xor for 100usd
Given Iroha Peer is up
And Iroha DEX module enabled
And Peer has Domain with name exchange
And Peer has Account with name traderliquidity_provider and domain exchange
And Peer has Account with name seller and domain exchange
And Peer has Asset Definition with name xor and domain exchange
And Peer has Asset Definition with name btc and domain exchange
And Peer has Asset Definition with name eth and domain exchange
And traderliquidity_provider Account in domain exchange has 1 amount of Asset with definition btc in domain exchange
And traderliquidity_provider Account in domain exchange has 20 amount of Asset with definition eth in domain exchange
And traderliquidity_provider Account in domain exchange has 20 amount of Asset with definition xor in domain exchange
And seller Account in domain exchange has 20 amount of Asset with definition eth in domain exchange
When traderliquidity_provider Account registers Exchange Liquidity 20xor and 20eth and 1btc
And seller Account places Exchange Order 20eth for 1btc
Then Iroha transfer 1 amount of Asset with definition btc in domain exchange from seller account in domain exchange to traderliquidity_provider account in domain exchange
And Iroha transfer 20 amount of Asset with definition eth in domain exchange from traderliquidity_provider account in domain exchange to seller account in domain exchange |
...