Skip to content

AlignmentVault is a composable primitive that allows any contract or EOA to permanently allocate ETH to deepening the liquidity of a target ("aligned") NFT collection.

Notifications You must be signed in to change notification settings

Zodomo/AlignmentVault

Repository files navigation

Languages Issues Pull Request Contributors Stars Forks

.-----------------------------------------------------------------------------.
|            _ _                                  ___      __         _ _     |
|      /\   | (_)                                | \ \    / /        | | |    |
|     /  \  | |_  __ _ _ __  _ __ ___   ___ _ __ | |\ \  / /_ _ _   _| | |_   |
|    / /\ \ | | |/ _` | '_ \| '_ ` _ \ / _ \ '_ \| __\ \/ / _` | | | | | __|  |
|   / ____ \| | | (_| | | | | | | | | |  __/ | | | |_ \  / (_| | |_| | | |_   |
|  /_/    \_\_|_|\__, |_| |_|_| |_| |_|\___|_| |_|\__| \/ \__,_|\__,_|_|\__|  |
|                 __/ |                                                       |
|                |___/                                                        |
'-----------------------------------------------------------------------------'

Table of Contents

  1. About The Project
  2. Contract Details
  3. Contract Initialization
  4. Ownership Management
  5. View Functions
  6. Inventory Position Management
  7. Liquidity Position Management
  8. Aligned Token Management
  9. Miscellaneous Token Management
  10. Usage

About The Project

The AlignmentVault primitive is a smart contract that allows locking ETH, WETH, NFTs, NFTX vTokens, and NFTX liquidity to deepen the floor liquidity of a target NFT collection using NFTX V3 (Uniswap V3). The liquidity is locked forever, but the yield generated can be claimed indefinitely. Because of the nature of Uniswap V3, this vault primitive essentially allows you to market make a NFT collection with permanently locked liquidity.

This contract harnesses the economic velocity of derivative collections and directs it towards boosting a primary collection. It forces alignment of derivative teams in a way that is beneficial and allows them to retain the economic utility from the aligned capital. This is regenerative finance ("ReFi") for NFT communities.

There is a testnet deployment of an AlignmentVaultFactory available at 0xD1ac539e856F8C86c7bf2217eC4b70D0D1c0D82C on Sepolia.

(back to top)

Contract Details

SPDX-License-Identifier: AGPL-3.0
Solidity Version: 0.8.23
Author: Zodomo
Contact Information:

(back to top)

Contract Initialization

  • initialize: Initializes all contract variables and NFTX integration. Requires the owner, aligned NFT collection, and optionally the NFTX vault ID.

(back to top)

Ownership Management

  • renounceOwnership: Overridden to disable it, as renouncing would break the vault.
  • setDelegate: Sets the delegate address for the vault. The delegate can represent the vault when claiming yield, should NFTX support the Delegate Registry for this.

(back to top)

View Functions

  • getUniswapPoolValues: Returns the Uniswap pool address, the current price, and the current tick of the pool.
  • getInventoryPositionIds: Returns an array of inventory position IDs.
  • getLiquidityPositionIds: Returns an array of liquidity position IDs.
  • getSpecificInventoryPositionFees: Returns the fees accrued for a specific inventory position.
  • getTotalInventoryPositionFees: Returns the total fees accrued across all inventory positions.
  • getSpecificLiquidityPositionFees: Returns the fees accrued for a specific liquidity position.
  • getTotalLiquidityPositionFees: Returns the total fees accrued across all liquidity positions.

(back to top)

Inventory Position Management

  • inventoryPositionCreateVToken: Creates an inventory position with vTokens.
  • inventoryPositionCreateNfts: Creates an inventory position with NFTs.
  • inventoryPositionIncrease: Increases an existing inventory position with vTokens.
  • inventoryPositionWithdrawal: Withdraws vTokens and/or NFTs from an inventory position.
  • inventoryPositionCombine: Combines child inventory positions under a parent position.
  • inventoryPositionCollectFees: Collects fees from specified inventory positions.
  • inventoryPositionCollectAllFees: Collects fees from all inventory positions.

(back to top)

Liquidity Position Management

  • liquidityPositionCreate: Creates a new liquidity position.
  • liquidityPositionIncrease: Increases an existing liquidity position.
  • liquidityPositionWithdrawal: Withdraws from a liquidity position.
  • liquidityPositionCollectFees: Collects fees from specified liquidity positions.
  • liquidityPositionCollectAllFees: Collects fees from all liquidity positions.

(back to top)

Aligned Token Management

  • buyNftsFromPool: Buys NFTs from the NFTX pool.
  • mintVToken: Mints vTokens by depositing NFTs.
  • buyVToken: Buys vTokens with ETH.
  • buyVTokenExact: Buys an exact amount of vTokens with ETH.
  • sellVToken: Sells vTokens for ETH.
  • sellVTokenExact: Sells an exact amount of vTokens for ETH.

(back to top)

Miscellaneous Token Management

  • rescueERC20: Rescues ERC20 tokens from the vault (except aligned tokens).
  • rescueERC721: Rescues ERC721 tokens from the vault (except aligned tokens).
  • rescueERC1155: Rescues ERC1155 tokens from the vault (except aligned tokens).
  • rescueERC1155Batch: Rescues a batch of ERC1155 tokens from the vault (except aligned tokens).
  • wrapEth: Wraps ETH to WETH.
  • unwrapEth: Unwraps WETH to ETH.

(back to top)

Usage

  1. Deploy the vault using the AlignmentVaultFactory contract, specifying the aligned NFT collection and optionally the NFTX vault ID.
  2. Send ETH to the vault. This ETH will be locked forever but will generate yield.
  3. Use the various management functions to create and manage inventory and liquidity positions.
  4. Collect fees from these positions as needed.
  5. Use the token management functions to interact with the aligned NFT collection and its vTokens.

Please note that any ETH, NFTs, or tokens sent to the vault will be locked forever. Only the generated yield can be withdrawn.

(back to top)

Contributing

Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.

You can contribute by writing tests, fixing bugs, optimizing the code, adding cool ass ASCII art, updating the README, or anything else productive.

Built in collaboration with MiyaMaker: https://miyamaker.com

Special thanks for helping me through the end:

  • @sudotx
  • @RyanSea

(back to top)

About

AlignmentVault is a composable primitive that allows any contract or EOA to permanently allocate ETH to deepening the liquidity of a target ("aligned") NFT collection.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •