primitivefinance / portfolio

Portfolio is an automated market making protocol for implementing custom strategies at the lowest cost possible.

Home Page:https://www.primitive.xyz/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

When a pool reaches its reserve's boundaries per liquidity it prevents swaps from happening

Alexangelj opened this issue · comments

Every pool's reserves are bound between: 0 < x < 1 and 0 < y < strike price. The reserves can reach this point when a swap happens which has a fee that contributes to the reserves causing it to exceed one of its bounds. Once this happens, the checkInvariant function will revert, preventing further swaps from happening.

Closed by #409 . The trading function now considers the boundary case and return's the respective terminal result, which is defined in the original trading function.