Skip to content

Integration of oracles/price data and feeds for collateralized lending via NFTs on Layer2. This original repo has the Yearn V3 Base Strat Impl

License

Notifications You must be signed in to change notification settings

NFTEarth/tokenized-strategy-NFTFi

 
 

Repository files navigation

NFTEarth and NFTFi

Overview

This repository aims to serve as the base level of building NFTFi tooling and integrations/applications for supporting all DeFi protocols - from small to large - to on-board into Layer2 ecosystems and into NFTFinance (NFTFi) use-cases. The market is new and there is currently not a single protocol serving these unmet needs. NFTEarth aims to be the first, or one of the leaders in NFTFi practical applications by using the Yearn V3 tokenized strategies as the foundational starting point - this will allow for using DeFi tokens to obtain loans and earn extra yield - composability enabled through NFT collateralization. Below is forked from Yearn's tokenized strategy repo. Checkout ERC-4626 details from Ethereum to learn about the implications and possibilities here.

image - view the NFTEarth Whitepaper for more thorough background and use cases specific to NFTEarth and the NFT functionality.

Yearn Tokenized Strategy

This repository contains the base code for the Yearn V3 tokenized strategy implementation. The V3 strategy implementation utilizes an immutable proxy pattern to allow anyome to easily create their own single strategy vaults that will all use the same logic held within the TokenizedStrategy for their redundant and high risk code. The implementation holds all ERC-20, ERC-4626, profit locking and reporting functionility to make any strategy that uses it a fully permisionless vault without holding any of this logic itself.

NOTE: The implementation address that calls are delegated to is pre-set to a constant and can never be changed post deployment. The implementation contract itself is ownerless and can never be updated in any way.

A Strategy contract can become a fully ERC-4626 compliant vault by inheriting the BaseTokenizedStrategy contract that uses the fallback function to delegateCall a previously deployed version of TokenizedStrategy. A strategist then only needs to override three simple functions in their specific strategy.

TokenizedStrategy - The implementation contract that holds all logic for every strategy.

BaseTokenizedStrategy - Abstract contract to inherit that communicates with the TokenizedStrategy.

Full tech spech can be found here

Installation and Setup

  1. First you will need to install Foundry. NOTE: If you are on a windows machine it is recommended to use WSL

  2. Fork this repository (easier) or create a new repository using it as template. Create from template

  3. Clone your newly created repository recursively to include modules.

git clone --recursive https://github.com/myuser/tokenized-strategy

cd tokenized-strategy

NOTE: if you create from template you may need to run the following command to fetch the git submodules (.gitmodules for exact releases) git submodule init && git submodule update

  1. Build the project.
make build

To print the size of each contract

make size
  1. Run tests
make test

Testing

Run all tests run on a local chain

make test

Run all tests with traces (very useful)

make trace

Run all tests with gas outputs

make gas

Run specific test contract with traces (e.g. test/StrategyOperation.t.sol)

make trace-contract contract=StrategyOperationsTest

Run specific test with traces (e.g. test/StrategyOperation.t.sol::testStrategy)

make trace-test test=testStrategy

See here for some tips on testing Testing Tips

Storage Layout

To print out the storage layout of any contract (e.g 'test/MockStrategy.sol')

make inspect contract=MockStrategy

Resources

About

Integration of oracles/price data and feeds for collateralized lending via NFTs on Layer2. This original repo has the Yearn V3 Base Strat Impl

Topics

Resources

License

Stars

Watchers

Forks

Languages

  • Solidity 99.7%
  • Makefile 0.3%