Did you know that @CryptoAlgebra developed a unique reserve logic, which allows them to redistribute tokens which are transferred directly to the pair / rebase tokens, as a fee to the liquidity providers in the current active range?
Here’s how it works:
a) Alice transfers 100e18 tokens directly to the pair without any further interaction. Usually, these tokens are lost in a UniV3-Style-AMM
b) In Algebra, upon the mint/burn/swap interactions, the _updateReserves function is invoked at the beginning:
Here’s how it works:
a) Alice transfers 100e18 tokens directly to the pair without any further interaction. Usually, these tokens are lost in a UniV3-Style-AMM
b) In Algebra, upon the mint/burn/swap interactions, the _updateReserves function is invoked at the beginning:
As you can see, this function simply checks if the balances are larger than the reserves and in such a scenario, the delta is simply accounted as a fee for the current active liquidity range.
This novel feature ensures that no tokens are lost whenever they are accidentally directly transferred to the pair.