Conversation
|
|
||
| // There is no way to calculate the total asset without doing a tx call. | ||
| /// There is no way to calculate the total asset without sending a txn. | ||
| function estimateTotalAssets() public returns (uint256 _wants) { |
There was a problem hiding this comment.
do we need this method to be public? if so, is it okay for anyone to call it?
There was a problem hiding this comment.
it doesn't have to be public, calling this updates the cache so it's actually better if other people can call it and save us gas
contracts/Strategy.sol
Outdated
| if (_profit > 0) { | ||
| _sellBptForExactToken(_profit); | ||
| function _collectTradingFees(uint _profit) internal { | ||
| if (vault.strategies(address(this)).debtRatio == 0 || emergencyExit || balanceOfBpt() == 0) { |
There was a problem hiding this comment.
I think we still will want to collect fees even if the debtRatio is 0, right? is this scenario is possible: we set debt ratio to 0, then we do a harvest to get all the profit and return the assets to the vault? In this case, we won't be collecting trading fees, right?
There was a problem hiding this comment.
that's a good point...I need to think of a cleaner way for this
There was a problem hiding this comment.
@newmickymousse fixed in the latest push with an addition to tests for this situation
| assets[sh.assetsIndex] = _swap1Token; | ||
| if (!sh.isSame) sh.assetsIndex++; | ||
| assets[sh.assetsIndex] = address(poolData.lpt); | ||
| sh.assetsIndex++; |
There was a problem hiding this comment.
what happens if _swap1Token == _swap2Token
There was a problem hiding this comment.
weird things will probably happen lol. This is just meant to be used internally with pre-defined arguments, which wouldn't have _swap1Token == _swap2Token
There was a problem hiding this comment.
the external part is just if we ever need to rescue it from sms

StablePool:
BoostedPool:
For more info on Boosted Pools https://docs.balancer.fi/products/balancer-pools/boosted-pools
Diff with metastable pool bc it uses similar interfaces for
estimateTotalAssets()(it mocks a real swap and reverts in order to estimate value)