If you call modifyEquity with the intent to clear the equity position and the accumulator goes up right before the user calls the function, user won't be able to zero the position because equityCreated > initialEquity.
Possible solution could be to check if equityCreated > initialEquity and call collectIntrest if true. Another possible solution would be to just call CollectInterest everytime user call modifyEquity
This maybe a deal breaker,
If you call
modifyEquity
with the intent to clear the equity position and the accumulator goes up right before the user calls the function, user won't be able to zero the position becauseequityCreated > initialEquity
.Possible solution could be to check if
equityCreated > initialEquity
and callcollectIntrest
if true. Another possible solution would be to just callCollectInterest
everytime user callmodifyEquity