Skip to content

Draft: [V109-specific] Zero-unit pools in querier (and modifications to full-withdraw logic and RagnarokTx Amount)

Multipartite requested to merge Multi/querier-zero-unit-pools into develop

[Draft: My current inclination is to, dependent on merging of !3408
'Consistent TxOutItem MaxGas and GasRate, and txout deduction of MaxGas cost or outbound fee but not both',
rebase this MR's commit !2866 (f6b4acf4)
'Always withhold gas asset fee in manager_txout'
to deduct a gas asset's MaxGas in the txout manager when the Layer 1 pool's BalanceRune or BalanceAsset are zero,
and deducting a fee in the txout manager if not.
(Rather than deducting the gas cost in the withdraw handler and leaving Asset intended for gas in no-RUNE pool,
or the situation where a pool has depths and synths (thus could still pay a RUNE outbound fee) though no pool units (no non-synth liquidity providers.)]

[V109-specific]

Closes #1509
'Complete withdrawal from a gas asset pool results in pool BalanceAsset insolvency'
and together with !2865 (merged)
'Do not swallow add liquidity to a non-empty zero-units pool'
closes #1506
'Add liquidity and /pools endpoint do not reflect zero-LP_units pools'.

This was originally intended to a a simple querier change to show more information in the /pools endpoint,
but doing so allowed smoke tests to expose issues in the (gas asset pool) full-withdraw logic,
further demonstrated with an added regression test.

Unit test updates also brought to attention that a RagnarokTx with a non-zero Amount now increments that asset's pool with its fictitious Amount,
resolved by setting the Amount to zero before the RagnarokTx is used.

Edited by Multipartite

Merge request reports