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

lockup, registry: Remove special cased locked balances #6

Open
armaniferrante opened this issue Apr 1, 2021 · 0 comments
Open

lockup, registry: Remove special cased locked balances #6

armaniferrante opened this issue Apr 1, 2021 · 0 comments

Comments

@armaniferrante
Copy link
Contributor

armaniferrante commented Apr 1, 2021

Registry:

Instead of having two versions of balances, locked and unlocked, for a given member account, one can consolidate these two with the following scheme:

When depositing into the stake program, the program can create a redeemable "deposit token" that represents a claim on the assets in the stake account (separate from the pool token, which is just used as an accounting measurement for rewards). For locked tokens, the locked token program would send funds to the stake program, and the stake program would mint these "deposit tokens" to the lockup program. To withdraw, one would provide these "deposit tokens" to the stake program, which would burn them and return the corresponding number of assets.

Lockup

Any app can then facilitate the use of locked tokens by implementing an additional deposit_locked method that takes in a Vesting account and mints these "deposit tokens" to an account with an owner being program derived address with the vesting account as one of the seeds. Withdrawals would not need to be special cased. Any transaction signed by an owner of a "deposit token" would be able to withdrawal.

Pros

  • Cuts the number of required accounts for a Member account in half
  • Easier to reason about the locked property being maintained. A program has to just prove two things: 1) all tokens coming into and out of the program are through the deposit_* and withdraw instructions and 2) deposit_locked only mints "deposit tokens" to token accounts owned by vesting accounts.
@armaniferrante armaniferrante changed the title registry: Remove special cased locked balances lockup, registry: Remove special cased locked balances Apr 5, 2021
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

1 participant