primitivefinance/portfolio

Improve clarity of reserve types and trading function invariant

Alexangelj opened this issue · 0 comments

Reserves can be in the following format:

  • Reserves in decimal
  • Reserves scaled from decimal to wad
  • Reserves in wad per liquidity

Trading function invariant could accept the following reserves:

  • Reserves in wad per liquidity, rounded up
  • Reserves in wad per liquidity, rounded down
  • Whatever combination of reserves of the above types

This makes it increasingly more confusing and difficult to replicate the exact values in non-solidity environments, and also in solidity tests.