The server hot wallet automatically manages inventory.
In practice, to run the server, the user just sends XEC and tokens to the "slush" wallet.
The server starts, automatically converts XEC in slush to stamps used for postage txs in the Seller wallet, and automatically converts token quantities to constant-sized UTXOs in the Seller wallet.
The server routinely scans these wallets and tops up Seller with properly sized inventory and XEC postage UTXOs from what is in the Slush wallet.
Slush wallet
- User sends tokens here to adjust inventory or top up inventory of either or both token pairs
- User sends XEC here to top up XEC for fees
Seller wallet
- The server manages this wallet to have UTXOs at a fixed size set by the config file. For example we may use UTXOs of 1M XECX and 1.0 FIRMA in a XECX<>FIRMA AMM.
- Every sale sends change to slush, as change will not be exact sized UTXOs, e.g. if someone buys 1.5M XECX for 6.43 FIRMA
- Funds that are in Slush count toward inventory in setting AMM price. But only the consistently-sized UTXOs in the seller wallet can be used in the postage-based atomic ALP swaps. So the wallet periodically creates txs using UTXOs in slush to top up the Seller wallet if the correct quantities are available.
From an admin perspective, it's just a matter of "topping up" the slush wallet. The server handles the rest.
A malicious attacker could change the AMM price by sending one of the AMM tokens to the slush or seller wallet. But this would only have the effect of making the token they are sending in cheaper and the other token more expensive. So, a very strange attack; they could crash the AMM price of Token A by giving an alp-dex server Token A. Of course, selling Token A through the dex would do the same thing, but they would also get some Token B for it.