layer2-finance-contracts icon indicating copy to clipboard operation
layer2-finance-contracts copied to clipboard

Add barnbridge strategy

Open thashimoto1998 opened this issue 3 years ago • 5 comments

thashimoto1998 avatar Apr 07 '21 02:04 thashimoto1998

@thashimoto1998 FYI I'm fixing the Compound implementation to be compatible with a view only IStrategy.getBalance() requirement.

Dominator008 avatar Apr 09 '21 05:04 Dominator008

I encountered below compatible error when compile barnbridge strategy.

contracts/strategies/StrategyBarnBridgeJcUSDC.sol:80:31: TypeError: Function declared as view, but this expression (potentially) modifies the state and thus requires non-payable (the default) or payable.
        uint256 jcUsdcPrice = IISmartYield(smartYield).price();
                              ^------------------------------^

Error HH600: Compilation failed

thashimoto1998 avatar Apr 09 '21 05:04 thashimoto1998

I see, there is need to also modify interface.

thashimoto1998 avatar Apr 09 '21 05:04 thashimoto1998

I see, there is need to also modify interface.

Yeah my bad, it looks like there is no way to enforce getBalance() to be view-only for anything Compound related. In that case I'll rename IStrategy.getBalance() to syncBalance() and remove the view-only modifier.

Dominator008 avatar Apr 09 '21 06:04 Dominator008

@thashimoto1998 FYI, I changed getAssetAmount() and getPrice() back to view in the V2 contract interfaces. I think we can cache ISmartYield(smartYield).price() periodically and use the cached price in the view functions.

Dominator008 avatar Aug 24 '21 05:08 Dominator008