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

Broker pattern or token pattern? #29

Closed
RusseII opened this issue Feb 9, 2022 · 5 comments
Closed

Broker pattern or token pattern? #29

RusseII opened this issue Feb 9, 2022 · 5 comments
Assignees

Comments

@RusseII
Copy link
Contributor

RusseII commented Feb 9, 2022

Broker pattern vs token pattern

We have the option of having the broker contract act as an intermediary that handles the main functionality of our protocol (broker pattern) or we can implement this functionality on each of the different tokens themselves (token pattern)

Do we have one broker contract that holds all the collateral, handles convertability, handles repayment, handles bond redemption for each of the bonds? Or should we implement that logic on the bond itself and limit the functionality of the broker to just deploying the bond tokens?

  • AAVE uses the broker pattern while Compound uses the token pattern

  • We will be deploying a new bond contract for every single auction. For gas savings - we may want to keep the bond functionality minimal (Broker pattern). This may not be an issue if we follow the clone pattern for new bonds. This will be explored further in Research clone factory to deploy erc20 bond contracts #15

@RusseII RusseII self-assigned this Feb 9, 2022
@RusseII RusseII added the draft label Feb 10, 2022
@RusseII RusseII changed the title Broker pattern or token pattern? Broker pattern or token pattern? (draft) Feb 10, 2022
@RusseII
Copy link
Contributor Author

RusseII commented Feb 10, 2022

@RusseII RusseII removed the draft label Feb 10, 2022
@RusseII RusseII changed the title Broker pattern or token pattern? (draft) Broker pattern or token pattern? Feb 10, 2022
@Pet3ris
Copy link

Pet3ris commented Feb 11, 2022

I think either can work just fine but broker pattern may is where things are going.

See https://docs.balancer.fi/products/the-vault for some of the benefits. It will allow you to have different custom types of bond contracts in the future. You will be able to support claims across multiple bonds, etc. in the future. It will also simplify your dapp - easier to pull stats like total collateral from your broker contract.

@RusseII
Copy link
Contributor Author

RusseII commented Feb 15, 2022

I'm currently leaning towards following the token pattern

Previously, the main argument for following broker pattern over token pattern was due to a 10x increase in gas if the logic was on the BondTokens. If we are using clone factories I believe this is not a concern.

I'm a fan of the token pattern mostly because I think that it is easier to understand for new users of the protocol.

@Pet3ris is this the type of decision where you think we should continue to ponder, or just commit to one and move on?

Some differences I'm having trouble quantifying between the two patterns:

  • Difference on how we'd be querying the data
  • Upgradability pros and cons of each method
  • Security implications of each pattern - does one of them leave more risk for a hack or larger amount of funds lost?
  • Interoperability with future protocol upgrades

@RusseII
Copy link
Contributor Author

RusseII commented Feb 15, 2022

After talking more with Peteris - Let's go with the token pattern proposed in #46. Both patterns are valid and we can refactor in the future if we need too.

Token pattern chosen mostly because it's more intuitive to users.

@RusseII
Copy link
Contributor Author

RusseII commented Feb 24, 2022

closed by #46

@RusseII RusseII closed this as completed Feb 24, 2022
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

No branches or pull requests

2 participants