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

[Feature] Initialise a Bond from another Bond #65

Open
CjHare opened this issue Nov 12, 2021 · 3 comments
Open

[Feature] Initialise a Bond from another Bond #65

CjHare opened this issue Nov 12, 2021 · 3 comments
Labels
enhancement New feature or request
Milestone

Comments

@CjHare
Copy link
Contributor

CjHare commented Nov 12, 2021

Feature Description

Individual bonds can be upgraded by depositing the derivate (receipt) bond token into another bond that accepts it.

Upgrading a bond is done by creating another bond contract and migrating the previous version across.

Support this by adding another init function, that accept an existing bond contract

From the deprecated Bond contract:
Extract the debt tokens (ERC20).
Extract the collateral (ERC20)

Additional Information

The new version may benefit from creating a separation between the bond and debt tokens (the bond no longer extend ERC20), but there would be more external call & gas cost. A quick analysis to compare each of the ops may be warrented.

@CjHare CjHare added the enhancement New feature or request label Nov 12, 2021
@CjHare CjHare added this to the bond v2 milestone Nov 12, 2021
@CjHare
Copy link
Contributor Author

CjHare commented Nov 12, 2021

@shahankhatch Does the issue description align with your ideas on the upgradability for bond contracts?

@shahankhatch
Copy link
Contributor

A couple of approaches to consider:

  1. the above init from another bond implies new bond2(bond1instance), initializing the new bond with the bond1instance's erc20 registry. Note that collateral is maintained in the erc20 token's contract (so bond1instance needs to update the address or transfer).
  2. Allow the execution logic of the bond to be upgraded in the case of a blanket bond upgrade (maybe as simple as a proxy-based upgrade). This could potentially be similar to (1), where the constructor sets the proxy for the updated execution logic.
  3. A separate tool for claiming an upgraded bond token by submitting their existing bond token. This implies bond2 is instantiated, the user then submits their bond1tokens and obtain bond2tokens (perhaps at a different ratio), and the claim tool itself updates erc20 addresses and amounts.

It may be the case a bond will go through all of these approaches thoughout its lifetime. wdyt?

@CjHare
Copy link
Contributor Author

CjHare commented Nov 15, 2021

The description definitely leans towards 1.

Option 2 is likely to require altering the Bond contract we have today (create the separation of logic), which means implementing a feature we don't need today in a contract we do. Also here's the currently unknown variable of whether cloning will be used and how that affects the mix 🤔 ...actually creating the bond via cloning may provide the mechanism you're describing the Option 2.

Option 3 does have a scalability risk (potentially costly), as the gas increase has a linear relationship to the number of holders (initially only a few holders, but if we're aiming for a generic toolset for others it could be a concern for others).

The Option 3 description muddles together an upgrade with dilution ...was that intentional?
(As the intent of this ticket was a straight upgrade without dilution).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants