Given that:
ETH
is a token user wants to sendOMG
is a fee token
ETH | OMG |
---|---|
5 | 5 |
10 | 10 |
15 | - |
20 | - |
Pick fee tokens first for the stealth inputs (because fee token is often used)
Send Amount (ETH) | Fee Amount (OMG) | Inputs | Stealth Inputs |
---|---|---|---|
5 | 3 | 5 ETH, 10 OMG | 5 OMG, 20 ETH |
35 | 8 | 20 ETH, 15 ETH, 10 OMG | 5 OMG |
35 | 15 | 20 ETH, 15 ETH, 10 OMG, 5 OMG | - |
12 | 15 | 20 ETH, 10 OMG, 5 OMG | 15 ETH |
30 | 10 | 20 ETH, 15 ETH, 10 OMG | 5 OMG |
15 | 10 | 15 ETH, 10 OMG | 5 OMG, 20 ETH |
Example 1. Makes sense.
Example 2. Makes sense
Example 3. Makes sense
Example 4. Makes sense
Example 5. This would have no benefit because you will return an output of 5 OMG, which is equivalent to the input you put in. What you could do here is put an extra ETH input.
Example 6. Again, this would have no benefit as you would return the same stealth inputs as outputs. What you could do is add two inputs of the same currency.
I have clarified the logic in what I wrote:
U < 3; input amounts match corresponding currency payables exactly -> Stealth merge if 2 or more UTXOs of the same currency available.
U < 4; input amounts exceed corresponding currency payables -> Stealth merge if 1 or more UTXOs available on a currency where we expect "change"