I am developing a pallet, that has a prize pot and has to distribute it with different accounts that has won. Kind of similar to the Lottery pallet.
My issue is with the Existential Deposit is when transferring the pot.
For example the pot has 10 UNITS, and has to distribute 9 UNITS to A and 1 to B. And the Existential Deposit is 2 UNITS.
To do the transfer from the pallet Account I have to options:
-Using the option KeepAlive which fails if the transfer will make the balance go below the Existential Deposit:
T::Currency::transfer( &T::account_id(), &winner, amount_won, KeepAlive, )?;
In that scenario, if is trying to send the funds to player A first (9 UNITS) it will already fail.
-Or use AllowDeath which send the funds anyway the balance goes below the Existential Deposit.
T::Currency::transfer( &T::account_id(), &winner, amount_won, AllowDeath, )?;
In that scenario, if is trying to send the fund to player A first (9 UNITS) it will success but the account will be reaped and the second will fail.
What is the best strategy here?
Have some business logic to send first to the account with less funds? In the example above will be sending with the flag AllowDeath first to the player B (1 UNIT) and then to the player A (9 UNITS)?
Or It makes sense to fund the pallet in the genesis with the minimum Existential Deposit? or have an extrinsic to fund it?