Skip to content

Conversation

@0xMcsweeja
Copy link

GH Issue

Factory wrapper for bridging debt tokens

TLDR

wraps a wildcat market debt token and exposes a non-rebasing share supply. Shares represent the underlying scaled balance of the wrapper inside the market; interest accrual is reflected through the share price rather than token balances.

entering vault:

  • deposit: debt token holder wants to deposit X normalized market tokens and receive the matching scaled shares
  • mint: debt token holder wants to mint X shares (scaled units) by transferring in Y normalized market tokens

exiting vault:

  • withdraw: share holder targets X normalized market tokens out; the vault burns the minimum shares (scaled units) needed so that normalized amount can be sent to the receiver
  • redeem: share holder burns X shares (scaled units) and receives the corresponding normalized market tokens that those shares map to at the current scale factor

random notes:

  • do we want any access control / ownership for any reason
  • do we want a way to sweep any tokens that might land in the vault unexpectedly for any reason?
  • pls double check the naming convention for the wrapper name and symbol based on feedback from L (that i may have misinterpreted)

@laurenceday
Copy link
Contributor

Largely looks fine to me with some caveats - what we're probably going to want here is a primary factory that any market can deploy a wrapper contract for once and once only (so tracking centrally via the factory itself whether a wrapper contract exists), so we can extend the UI with a 'wanna wrap? here. wrapper doesn't exist yet? deploy it yourself!'

To the extent that access control is needed, I'd leave it pretty open ended in the sense that anyone can hit the factory to create a new instance of a vault wrapper if one doesn't exist, since its' existence doesn't affect the market in any form.

For the second question, for the sake of sanity I'd also include a sweep function for arbitrary ERC20s, with the account permitted to do that being the owner of the market itself. Wouldn't necessarily call it 'owner' for the wrapper since the only thing it could do is sweep, but I guess that's six and two threes.

@laurenceday
Copy link
Contributor

Naturally my thoughts on 'LGTM' are to be overridden by @d1ll0n

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.

3 participants