This project automates the creation and management of Metaplex Core Collections and assets It accomplishes this through three key functionalities:
- Minting: The project utilizes dedicated programs to mint both collections and individual assets within the Metaplex Core standard.
- Vaulting: Minted NFTs are then secured within a vault using the "mint-vault" program. This program likely offers features like access control or timed release for the vaulted assets.
- Swapping: Finally, the project integrates a "swap" program that allows users to exchange their vaulted Collections for SOL (Solana's native token).
In essence, this project provides a streamlined workflow for creating Metaplex Core Collections and assets, safeguarding them in a vault, and enabling users to convert them into SOL seamlessly.
The charges for the mint-swap include:
- Locking Fee: Secure your assets in our vault for a one-time fee of 1 SOL.
- Swap Fee: Easily exchange assets within the vault for a flat fee of 2 SOL.
When developing, change your Solana dev environment to match the following
solana-install init 1.18.8
# solana-cli 1.18.8 (src:e2d34d37; feat:3469865029, client:SolanaLabs)
avm use 0.29.0
# anchor-cli 0.29.0
Build Project
- Install required yarn dependencies
yarn install
- Build the project to generate types, IDL, and a deployable SBF program
anchor build
- The tests are split into two
- the mint-vault tests, which mint the asset and lock the asset in the program vault
- the swap tests for swapping the assets to SOL (Solana's native token)
Solana limits requests to its network (RPC calls) to prevent overload. Because of these limits, the tests must be run individually, one at a time, to avoid exceeding the rate and causing errors.
Make sure to update the uploadAssetFiles
method in utils.ts path with your file path for the image
Call the available instructions one by one update the variables appropriately with the required values for the public keys. These might be collection
asset
or previous owner
Available instructions are
- MintVault program
init
- only call this if you deploy a new program. Starts the program by setting up its communication rules (protocol state) and accounts for managing digital resources (asset manager accounts).create_collection
- creates a collection for the assets that will be mintedmint_asset
- mints an asset from a previously created collectionlock_in_vault
- locks an asset in the program vault. Protocol takes a flat fee of 1 SOL for locking the assetpurchase
- Unlock and acquire an asset from a program vault for a one-time fee of 2 SOL.
- Swap program
- swap. The user initiates a swap by transferring their CPI tokens into the mint-vault program. This program then calls the purchase IX function to exchange a locked asset within the vault for SOL.