0.1.11 • Published 1 year ago

@yield-protocol/yieldspace-tv v0.1.11

Weekly downloads
-
License
Business Source L...
Repository
github
Last release
1 year ago

YieldSpace for Tokenized Vaults

DISCLAIMER: Please do not use in production without taking the appropriate steps to ensure maximum security. This code is provided as-is, with no guarantees of any kind.


yieldspace-tv is a new implementation of Yieldspace that allows for the use of shares in tokenized vaults as base reserves. This is based on concepts and formulas derived in "YieldSpace with Yield Bearing Vaults" by Allan Niemerg which was based on the original "The Yield Protocol: On-Chain Lending With Interest Rate Discovery" written by Dan Robinson and Allan Niemerg.

The pool is an UniV2 style, x/y fixed constant automated market maker used for providing liquidity and trading a pair of "fyToken" and related underlying "base" token as described in the papers noted above. In this new version, the base tokens can now be tokenized vault shares.

The use of tokenized vaults as base allows for a higher yield on the base reserves held by the pool. The main changes in the math come from introducing c and mu into the equation. c represents the current value of the tokenized vault shares. mu is the normalization factor which is the initial c0 at first mint.

This repo also serves as Yield's initial foray into the Foundry development tool ecosystem. Tests are written in Solidity and use Foundry cheatcodes.

This repo includes:

Additional notes:

  • If too many base tokens are sent to the mint functions (mint or mintWithBase), the extra base tokens will be sent back to the to address
  • If too many tokens are sent in to buyFYToken or buyBase, those tokens are not sent back. The user can retrieve them with retrieveFYToken or retrieveBase.
  • The remaining tokens in the buy functions will typically be small rounding differences and not worth the gas to send back. Also, changing the behavior of the buy functions to match the mint functions would be a breaking change. For that reason, we have chosen to leave the current behavior.

As this repo is still under development, these smart contracts have not yet been deployed.

Detailed documentation can be found in the Yield docs.

Install

Pre Requisites

Before running any command, be sure Foundry is installed.

Setup

git clone git@github.com:yieldprotocol/yieldspace-tv.git
cd yieldspace-tv
forge update

Test

Compile and test the smart contracts with Forge:

forge test

If using forking capability, be sure to add MAINNET_RPC to your .env.

Math

In developing this YieldSpace we have used two different libraries for fixed point arithmetic.

Security

In developing the code in this repository we have set the highest bar possible for security. yieldspace-tv has been audited by ABDK Consulting and the report can be found here.

We have also used fuzzing tests for the Pool and YieldMath contracts, allowing us to find edge cases and vulnerabilities that we would have missed otherwise.

Bug Bounty

Yield is offering bounties for bugs disclosed through Immunefi. The bounty reward is up to $500,000, depending on severity. Please include full details of the vulnerability and steps/code to reproduce. We ask that you permit us time to review and remediate any findings before public disclosure.

Contributing

This project doesn't include any governance or upgradability features. If you have a contribution to make, please reach us out on Discord and we will consider it for a future release or product.

Acknowledgements

We would like to thank Dan Robinson (Paradigm), Georgios Konstantopoulos (Paradigm), SamCZSun (Paradigm), Mikhail Vladimirov (ABDK), Gustavo Grieco (Trail of Bits), Martin Lundfall (dAppHub), Noah Zinsmeister (Uniswap), and Transmissions11 (Paradigm) for their feedback and advice. We wouldn't be here without them.

0.1.11

1 year ago

0.1.10

1 year ago

0.1.9-rc.3

1 year ago

0.1.9-rc.2

1 year ago

0.1.9-rc.1

2 years ago

0.1.9-rc.0

2 years ago

0.1.8

2 years ago

0.1.7

2 years ago

0.1.6-rc1

2 years ago

0.1.6

2 years ago

0.1.5

2 years ago

0.1.4

2 years ago

0.1.3-rc3

2 years ago

0.1.3-rc2

2 years ago

0.1.3-rc1

2 years ago

0.1.3

2 years ago

0.1.2

2 years ago

0.1.2-rc0

2 years ago

0.1.1-rc22

2 years ago

0.1.1-rc21

2 years ago

0.1.1-rc20

2 years ago

0.1.1-rc19

2 years ago

0.1.1-rc18

2 years ago

0.1.1-rc17

2 years ago

0.1.1-rc16

2 years ago

0.1.1-rc15

2 years ago

0.1.1-rc13

2 years ago

0.1.1-rc12

2 years ago

0.1.1-rc11

2 years ago

0.1.1-rc10

2 years ago

0.1.1-rc9

2 years ago

0.1.1-rc8

2 years ago

0.1.1-rc7

2 years ago

0.1.1-rc6

2 years ago

0.1.1-rc5

2 years ago

0.1.1-rc4

2 years ago

0.1.1-rc3

2 years ago

0.1.1-rc2

2 years ago

0.1.1-rc1

2 years ago

0.1.0

2 years ago

0.1.0-rc2

2 years ago

0.1.0-rc1

2 years ago

0.0.6-rc3

2 years ago

0.0.6-rc2

2 years ago

0.0.6-rc1

2 years ago

0.0.6

2 years ago

0.0.5

2 years ago

0.0.4

2 years ago

0.0.3

2 years ago

0.0.2

2 years ago

0.0.1

2 years ago