yearn-vaults-v3 icon indicating copy to clipboard operation
yearn-vaults-v3 copied to clipboard

Should we express the `maxDebt` in percentage instead of token amount?

Open pandadefi opened this issue 2 years ago • 6 comments

Unlike v2 we are expressing the number of tokens a strategy can borrow in a number of tokens. This is not a great approach since the amount of debt a vault will old will greatly change. A strategy could be allowed to borrow 100% of the funds in the vault after a vault total assets significantly decreased. Or some funds could be left not managed if the total asset in the vault significantly increased.

We should reintroduce a ratio mechanism in percentage. See: https://github.com/yearn/yearn-vaults/blob/main/contracts/Vault.vy#L85

pandadefi avatar Jul 05 '22 07:07 pandadefi

@jmonteer

pandadefi avatar Jul 05 '22 11:07 pandadefi

I would like us to think about a mechanism with a min and max ratio and a ratio increase trigger that won't retrigger funds transfer when only a small amount of debt should be added/removed.

pandadefi avatar Jul 05 '22 12:07 pandadefi

how about a ratio implementation with a hardcoded band (e.g. 5% of current debt, or maybe you can set it but for simplicity can start off hardcoded) where if it's within the band, there is no change in debt. maybe we can have it early revert if no change is necessary. i'm guessing the goal here is to reduce gas costs?

anticlimactic avatar Jul 05 '22 13:07 anticlimactic

I am split between the two approaches.

On the one hand, using token amount is in line with the way the security team and vault management do the debt allocation. They currently say: "I want to allocate a maximum amount of 5m DAI to this strategy, what is the equivalent debt ratio?" and they set the new debt ratio. Then in following harvests they keep that amount (and change debtRatio accordingly).

It also helps with APR management. A strategy can take extra 5m but doesn't understand debt ratios (%). Therefore, vault managers just calculate the amount in tokens then do the reverse calc to get the debt ratio.

On the other hand, I agree % debt ratios are better for those vaults that change a lot in TVL to be kept rebalanced. However, I think this can be achieved by a layer on top (debt allocator). Let's say that maxDebts are refreshed regularly, then the Debt Allocator will do the calcs to get maxDebt and push that number.

My opinion is currently leaning towards using number of tokens. Any functionality provided by debt ratios as % can still be implemented by the Debt Allocator.

I confirmed this understanding with the Vault management team just in case.

jmonteer avatar Jul 05 '22 16:07 jmonteer

We can have this working with a mix of ratio and amount. The amount is the max amount of funds for a strategy. The ratio makes the allocation until the amount is reached.

pandadefi avatar Jul 06 '22 08:07 pandadefi

We decided to go with fixed amounts of tokens. We will revisit this in the future.

jmonteer avatar Jul 09 '22 10:07 jmonteer