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

Add TokenizedVaultDepositor #49

Closed
wants to merge 21 commits into from
Closed

Conversation

wphan
Copy link
Member

@wphan wphan commented Jun 14, 2024

PR continued in #55


This PR introduces a new TokenizedVaultDepositor that may be initialized by a Vault's manager. Each Vault may have at most 1 TokenizedVaultDepositor, which cannot be closed after creation.

Token mint/burn amounts are calculated using IF math, with the convention: if_shares -> tokens and if_amount -> vault_shares. Management fee and profit share calculations on TokenizedVaultDepositor are identical to VaultDepositor.

New instructions:

  • initialize_tokenized_vault_depositor
    • can be called once by manager to create a new TokenizedVaultDepositor
    • creates a new spl_token::Mint whose mint_authority and update_authority is the Vault
    • creates a metaplex::Metadata account
  • tokenize_shares
    • deducts shares from the sending VaultDepositor and adds to the TokenizedVaultDepositor
    • mints tokens to the ATA owned by VaultDepositor.authority
    • check: vault_depositor.shares + tokenized_vault_depositor.shares is unchanged
    • check: tokens minted = change in supply
  • redeem_tokens
    • transfer tokens to burn from user owned ATA to vault owned ATA and burns it
    • deducts shares from TokenizedVaultDepositor and adds to VaultDepositor
    • checks: vault_depositor.shares + tokenized_vault_depositor.shares is unchanged
    • check: tokens minted = change in supply

@wphan wphan requested review from 0xbigz and crispheaney June 14, 2024 16:07
@wphan wphan changed the base branch from master to wphan/fix/rebase_logic August 11, 2024 03:05
@wphan wphan force-pushed the wphan/tokenized_vault_depositors branch from 8b327df to 4be413e Compare August 11, 2024 03:52
@wphan wphan force-pushed the wphan/tokenized_vault_depositors branch from 69607ac to 5d4d388 Compare August 13, 2024 06:19
@wphan wphan changed the base branch from wphan/fix/rebase_logic to master August 15, 2024 19:10
@wphan wphan closed this Oct 8, 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.

2 participants