removeLiquidity() in the amm calculates marginToRemove without updating the margin with the funding payment
Description
removeLiquidity() removes the margin from the position pro-rata to the removed shares, without considering the previous funding payment.
The impact should be limited to the case when a significant amount of shares is removed and the fundingPayment is applied after the margin removal, which may lead to bad debt and revert.
Recommendation
Add the fundingPayment to the margin and only then calculate marginToRemove.
Status
Addressed in the AMMRouter