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

Fix: settlement remains unsettled for fee on transfer tokens

Alexangelj opened this issue · comments

Description

BLESS INVARIANT TESTING.

I found a failing invariant test very deep (40 call depth, >256 runs):

image

Looking at the call, it's clear it should be getting the expected value:
image

However user balance is increasing by a smaller amount.

I didn't notice but "FOT" is fee on transfer token...

Fix

  • Make sure the settlement checks the PAYMENTS were fully paid, instead of just checking the balance of tokens is positive.
  • Clearly label the tokens with better names. Another note is that the pool's in the invariant test suite will randomize tokens, so an "Asset" token could be in the "Quote" storage slot, leading to confusion.