So what happens when we deposit assets into an existing stableswap pool? We can deposit a single asset, or a mix of the assets contained within. Because the pool needs to remain balanced to maintain
F(A, B, C) = k, a deposit actually combines two actions behind the scenes. First, a "virtual swap" is made for us. Let us say we supply only one asset, x tokens of ACash. A virtual swap is made to make the proportion of your supplied assets equal to the ideal proportions of the pool. This means that some part of those x ACash tokens are swapped for BCash, and some for CCash. As a result the tokens you deposit go from [x, 0, 0] to [d, e, f] - d tokens of ACash, e tokens of BCash, and f tokens of CCash. The fee for the "virtual swap" associated with such a deposit is on average 50% of the usual swap fee, but will depend on the balance of assets in the pool at the time of deposit. Our swapped set of [d, e, f] tokens is now deposited into the pool, with no adverse effects on pool balance.
Note: If we were to supply a perfectly balanced proportion of [d, e, f] in the first place then no swap would be made and no fees would be charged on deposit.