Skip to content

Boosted pool#5

Open
decaf-addict wants to merge 13 commits intometastable2from
boosted
Open

Boosted pool#5
decaf-addict wants to merge 13 commits intometastable2from
boosted

Conversation

@decaf-addict
Copy link
Owner

@decaf-addict decaf-addict commented Jan 21, 2022

StablePool:

  1. Holds stablecoins DAI/USDC/USDT
  2. When deposited/withdrawn, BPT is minted/burned to/from you
    • Deposit: want --> BPT
    • Withdraw: BPT --> want

BoostedPool:

  1. Holds linear pool tokens (LPT) bb-a-DAI/bb-a-USDC/bb-a-USDT
  2. When deposited/withdrawn, BPT is swapped from the pool to you/you to pool
    • Deposit: want --> LPT --> BPT
    • Withdraw: BPT --> LPT--> want

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)


// 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) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we need this method to be public? if so, is it okay for anyone to call it?

Copy link
Owner Author

@decaf-addict decaf-addict Jan 29, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

if (_profit > 0) {
_sellBptForExactToken(_profit);
function _collectTradingFees(uint _profit) internal {
if (vault.strategies(address(this)).debtRatio == 0 || emergencyExit || balanceOfBpt() == 0) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that's a good point...I need to think of a cleaner way for this

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@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++;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what happens if _swap1Token == _swap2Token

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

weird things will probably happen lol. This is just meant to be used internally with pre-defined arguments, which wouldn't have _swap1Token == _swap2Token

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the external part is just if we ever need to rescue it from sms

@decaf-addict
Copy link
Owner Author

image
latest passing as well

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants