Skip to content

Contracts and artifacts for the Alchemix V2 system.

Notifications You must be signed in to change notification settings

AlejoLovallo/alchemix-nft

 
 

Repository files navigation

Alchemix: Non-Fungible Tokens as Collateral

Context

Currently, The Alchemix Platform allows users to leverage a range of ERC-20 tokens without risk of liquidation depositing those tokens in vaults.

Proposal

Add the possibility to the users request a loan using their NFTs to be used as collateral through an integration with a loan platform for NFT. Users can leverage their idle NFTs to obtain loans and earn extra yield.

Solution

For our solution, we analyzed two NFTs loan platform: Drops and JPEGd. Those platform work a quite different. For instance, Drops has lending pools where the user gets eth, dai or usdc. On the other hand, JPEGd offeres in exchange pUSD and a third party is required to exchange those tokens to ones that Alchemix supports. In that case, we propose Curve.fi to swap them.

The idea is to create different types of vaults on Alchemix to allow users to deposit their tokens there. For instance, JPEGd CryptoPunk NFTs.

JPEGd integration

  • Using the JPEGd NFT borrowing and lending platform, the Protocol will create a new vault asking the user to transfer its NFT. Nowadays, this platform has four different types of NFT collections. Such as CryptoPunks, BAYC, MAYC, Doodles and EtherRocks.
  • Firstly, the users deposits a NFT in the corresponding vault
  • Secondly, behind the scene those tokens will be deposited into JPEGd in exchange of pUSD which will be minted.
  • Thirdly, The pUSD tokens will be swapped in Curve Finance in exchange of DAI or any stablecoin that Alchemix supports.
  • Finally, The DAI will follow the usual lending and borrowing details of Alchemix.

Basic diagram

Deposit Flow

For instance, the following diagram shows a deposits flow where the user gets DAI tokens

Withdraw Flow

Drops

We also added https://drops.co/lending/ This integration works quite similar to the previous one. The main difference is the Users gets directly USDC from the Drops platform and swap is not required. You can see the [contract] (https://github.com/AlejoLovallo/alchemix-nft/blob/master/contracts/challenge/AlchemicDropsNft.sol) And the [tests] (https://github.com/AlejoLovallo/alchemix-nft/blob/master/test/Challenge.spec.ts) Important Use the .env with the following values when running yarn test otherwise it won't work as we are using a fork from ethereum mainnet

ALCHEMY_API_KEY=<YOUR KEY>
FORK=true
FORK_BLOCK=15390000

Implementation

ToDo

  • JPEGd integration design
  • JPEGd NFT lock functionality
  • Alchemix NFT Vault using NFT as collateral
  • JPEGd Unlock NFT functionality
  • Drops NFT Lock functionality
  • Drops NFT Unlock functionality
  • Tests
  • Improvement proposal: deploy all contracts using hardhat deploy plugin

References

About

Contracts and artifacts for the Alchemix V2 system.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 78.8%
  • Solidity 21.2%