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

Test suite: Portfolio test files don't properly override the subject()

Alexangelj opened this issue · comments

Description

If the subjects.last variable is altered, the ghost state's subject variable also has to be updated. This happens in the setup, but the Portfolio overrides happen after the setUp function runs.

Making a function in the root setUp function in the Setup.sol file will fix this issue:

function _change_subject(address new_subject) internal virtual {
        subjects().change_subject(new_subject);
        _ghost.subject = address(_subjects.last);
    }