Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: The Balancer #202

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open

WIP: The Balancer #202

wants to merge 7 commits into from

Conversation

aalavandhan
Copy link
Member

@aalavandhan aalavandhan commented Mar 22, 2024

  1. Balancer: New module to orchestrate all external interactions with perp/vault systems and holds all the fee logic. (The current fee policy evolves into the balancer). Balancer allows for operations on both perp and vault both individually as well as simultaneously (mint2, redeem2 and rebalance).

  2. All Perp operations now run through the balancer. We also move away from the lazy state update model (previously we used to call updateState before every action). The absolute supply caps have been removed. The naming convention for all read interface functions have been updated (previously they were prepended with "get", to indicate a lazy state update before reading).

  3. All vault operations now run through the balancer. We allow the balancer to deposit Z tranches from the current deposit bond to mint vault notes (used by mint2). The updated swap logic limits the vault liquidity from getting too high or too low based on the maximum capital required to rollover the entire spot supply. The rollover vault also handles an edge case that arises from redeeming a bond fully before maturity.

  4. The latest version of the tranche contracts expose a bond.collateralBalance() method on the button-wood bonds. This method accounts for the total collateral which is deposited into the bond through the deposit function and discounts any collateral which is transferred directly into the bond (erroneously or maliciously). We update all instances where we calculate the bond's collateral balance to use collateralBalance method instead of token.balanceOf(bond)

@aalavandhan aalavandhan changed the base branch from main to code-cleanup March 22, 2024 02:42
@ampleforth ampleforth deleted a comment from openzeppelin-code bot Mar 22, 2024
@aalavandhan aalavandhan force-pushed the balancer-v4 branch 2 times, most recently from c0155b6 to 46dd2d7 Compare March 26, 2024 13:39
Base automatically changed from code-cleanup to dev March 27, 2024 18:04
@aalavandhan aalavandhan force-pushed the balancer-v4 branch 2 times, most recently from bbf41e6 to 950ab24 Compare April 9, 2024 00:28
@aalavandhan aalavandhan force-pushed the dev branch 2 times, most recently from 6ab7730 to 52a3533 Compare April 16, 2024 16:14
Base automatically changed from dev to main April 16, 2024 17:46
@aalavandhan aalavandhan force-pushed the balancer-v4 branch 5 times, most recently from b446cb6 to d996baf Compare April 18, 2024 01:34
@aalavandhan aalavandhan changed the base branch from main to dev April 18, 2024 14:13
@aalavandhan aalavandhan marked this pull request as draft May 24, 2024 20:35
@aalavandhan aalavandhan added the WIP work in progress label May 24, 2024
@aalavandhan aalavandhan force-pushed the dev branch 2 times, most recently from ae80de5 to 17622f2 Compare May 30, 2024 20:48
@aalavandhan aalavandhan force-pushed the balancer-v4 branch 2 times, most recently from 33b294a to d0dbc18 Compare June 11, 2024 13:42
@ampleforth ampleforth deleted a comment from openzeppelin-code bot Jun 11, 2024
Copy link

openzeppelin-code bot commented Jun 11, 2024

The Balancer

Generated at commit: 5896abb694b92c1a32715fa0e03d462c80ac7281

🚨 Report Summary

Severity Level Results
Contracts Critical
High
Medium
Low
Note
Total
0
0
0
3
25
28
Dependencies Critical
High
Medium
Low
Note
Total
0
0
0
0
0
0

For more details view the full report in OpenZeppelin Code Inspector

@aalavandhan aalavandhan removed the WIP work in progress label Jun 14, 2024
@aalavandhan aalavandhan marked this pull request as ready for review June 14, 2024 14:51
Base automatically changed from dev to main June 21, 2024 03:14
@aalavandhan aalavandhan changed the title The Balancer WIP: The Balancer Nov 6, 2024
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.

1 participant