Prevent exchanges, burns and transferAndSettles from succeeding with 0 amounts.
Fix an edge-case that was introduced with SIP-37 that reduces exchanges, burns and transferAndSettle invocations down to the user's balance - even if no settlement occurred.
Since SIP-37 exchanges of invalid amounts for the user have been succeeding as
0 exchanges, emitting events. These successful transactions may cause users to think their exchanges have gone through and they also create noise in event monitoring tools such as The Graph.
This proposal is to simply check for any unsettled exchanges and only then to amend the amount, otherwise to treat the amount incoming as before SIP-37 was introduced (that is, revert if the amount is more than the user has).
Exchanger.settlementOwingto return the number of entries in the queue for that synth.
Exchanger.settleto return the number of entries removed in the settlement as
Synth.transferFromAndSettleto all take this
numEntriesSettledinto consideration - if
numEntriesSettled == 0then the amount to use is what's been given the function - as per the pre-SIP-37 implementation. If
numEntriesSettled > 0then adjust the amount as per SIP-37.
settlementOwing to return
numEntries prevents any further cross-contract calls, thereby limiting gas.
Copyright and related rights waived via CC0.