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

Tokenized vaults example #1182

Open
wants to merge 14 commits into
base: main
Choose a base branch
from
Open

Tokenized vaults example #1182

wants to merge 14 commits into from

Conversation

iFrostizz
Copy link
Contributor

@iFrostizz iFrostizz commented Jul 23, 2024

https://eips.ethereum.org/EIPS/eip-4626

tldr; A vault that can be used as a token that is indexed on an asset that is the underlying token.
The exchange rate is always tracked and holds some properties that could be left tested more thoroughly as part of a future work:
Let define the exchange rate (R) as assets (A) / shares (S)

  • Deposit of assets:
    • S' >= S
    • A' >= A
    • R' >= R
  • Withdrawal of assets:
    • S' <= S
    • A' <= A
    • R' <= R
  • Corectness of rounding:
    • The pool is always advantaged (rounds towards the pool) and user is disadvantaged. This ensures that the pool cannot be emptied by a repeated deposit / withdraw

The token needs to be built prior to running tests because otherwise it will complain that the wasm binary cannot be found. Two hacks here (we probably want to create some kind of packaging system with dependency resolution):

  • The token binary path is figured by taking the vault binary path
  • The token is compiled by manually changing the env variable names inside of the build script and putting it back to build the vault afterwards

@iFrostizz iFrostizz self-assigned this Jul 29, 2024
@iFrostizz iFrostizz marked this pull request as ready for review July 30, 2024 11:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: In Review 👀
Development

Successfully merging this pull request may close these issues.

1 participant