July 15, 2021: Curve v2 Take 2🔺🎬

A Deep Dive into changes in the TriCrypto Pool

They’re multiplying!  It’s the pool so nice they made it twice…

A dilemma. Two tricryptos. Thanks to market dumps you have just one coin left. Which pool should get your last coin?

Curve explained the rationale as follows:

Wait, a bug?  Time to panic?!?!?

The team explains that these are minor fixes. Over the course of several weeks v1 will be phased out and v2 will be phased in. Rewards are currently only accruing to v1, so there’s no immediate reason to migrate.

At some point in the next few weeks this will flip. Rewards to v1 will drop off, and rewards to v2 will ramp up. If you don’t move by this point, NGMI.

Why can’t funds be automatically moved? This would itself be a big security issue if pools could move your funds without your permission. Curve will be providing an interface to simplify the transition. The team suggests waiting for magic button before making the move:

Who should get started with TriCrypto v2? At the moment, it’s best utilized by arb traders. The new pool functions just like the old pool, where bots may have opportunity to efficiently capitalize on wild market movements. It appears arb traders have already taken up the call:

These trades get passed back to liquidity providers in the form of APY, so perhaps it’s not a surprise to see v2 generating slightly better APY despite not even getting rewards.

Back to the panic porn though… we all thought Curve devs are the biggest brains on the planet. Was it SAFU to swim in a pool with bugs?!?!?!

It’s all open source, so let’s walk through the diff. V1 on the left, V2 on the right.

Lines 1-118: nothing scary here

  • price_threshhold is renamed allowed_extra_profit

  • Different start value for A

Only bigger changes of note here are adjustments to some calculations. MAX_FEE doubles. MAX_A is affected by number of coins squared. A + gamma is weighted by the multiplier. Reads primarily as though the team is making adjustments to make the pool more efficient after testing in prod for a few weeks.

Of course, this would only come into play if there were any adjustments to A. These would need to be voted in by the DAO. Perhaps some of the larger veCRV holders could collude to try to take advantage of the two differing formulas, but the move would need to be highly public. The shot clock is running out on any such play.

Again, adjustments to A and cosmetic changes.

Here’s the biggest set of changes, related to how admin fees are calculated and claimed. The prior version was tagged “Would be nice to recalc D but we have no bytespace left.” This gets replaced by a different methodology. This would affect admin fee claiming, so it’s not of much interest to the casual ape.

A fair amount happening here in the function to calculate price, particularly when there is a ramp. A ramp depends on changing the A parameter, so until this happens, doesn’t look like any effect.

More ramp logic.

Refactoring

Here add_liquidity adds some logic to deal with what may happen as constants change. Since this is a user facing endpoint it’s arguably one of the few changes that could affect users. Again though, it only looks to come into play during the ramp.

Next notable change here, where there’s some more math for changes to the D parameter.

Changes to deal with changes to A gamma

Again, logic to deal with the ramp

More ramp changes

Finally, the logic where admins commit new parameters gets a bit cleaner due to the changes.

Overall, the bulk of the changes are indeed focused on dealing with ramps when parameters change, which hasn’t happened to date and may never happen, so we won’t be able to judge the difference between v1 and v2.

This concludes my audit — it looks as though everything is as described. If you noticed anything different please comment and I’ll update this article.

If these are the only adjustments to the first several weeks of TriCrypto’s battle testing, it’s a great sign. It’s a great sign for Curve v2 in general, and it looks like this success means more to come 👀


For more info, check our live market data at https://curvemarketcap.com/ or our subscribe to our daily newsletter at https://curve.substack.com/. Nothing in our newsletter can be construed as financial advice. Author is a $CRV maximalist, and holds a stake in TriCrypto v1.