Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/Bonfida/name-tokenizer
Tokenize a domain name into an NFT
https://github.com/Bonfida/name-tokenizer
metaplex rust solana solana-program typescript
Last synced: 11 days ago
JSON representation
Tokenize a domain name into an NFT
- Host: GitHub
- URL: https://github.com/Bonfida/name-tokenizer
- Owner: Bonfida
- Created: 2022-03-02T12:21:16.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2024-02-26T04:23:24.000Z (9 months ago)
- Last Synced: 2024-04-18T03:46:05.664Z (7 months ago)
- Topics: metaplex, rust, solana, solana-program, typescript
- Language: Rust
- Homepage: https://naming.bonfida.org
- Size: 483 KB
- Stars: 28
- Watchers: 2
- Forks: 10
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- awesome - Bonfida/name-tokenizer - Tokenize a domain name into an NFT (Rust)
README
Name tokenizer
Tokenize domain name into Metaplex NFTs
Table of contents
1. [Program ID](#program-id)
2. [Introduction](#introduction)
3. [Security](#security)
4. [Reproducible build](#build)
5. [Collection](#collection)
6. [Mint](#mint)
7. [NFT](#nft)
8. [Tests](#tests)
- Rust
- JSProgram ID
Mainnet program ID `nftD3vbNkNqfj2Sd3HZwbpw4BxxKWr4AjGb9X38JeZk`
Introduction
This program allows people to tokenize their domain name in NFTs that follow the [Metaplex standard](https://github.com/metaplex-foundation/metaplex-program-library/tree/master/token-metadata) with a creation/redemption mechanism.
Reproducible build
A reproducible build script (`build.sh`) can be used to build the program using docker
Security
For security disclosures or to report a bug, please visit [ImmuneFi](https://immunefi.com/bounty/bonfida/) for more information on our bug bounty program.
Collection
NFTs are all part of a verified collection `E5ZnBpH9DYcxRkumKdS4ayJ3Ftb6o3E8wSbXw4N92GWg`.
Mint
NFT mints are PDAs derived from the domain name key they represent. The derivation is made as follow:
```rust
pub const MINT_PREFIX: &[u8; 14] = b"tokenized_name";// ...
let (mint, mint_nonce) = Pubkey::find_program_address(
&[MINT_PREFIX, &accounts.name_account.key.to_bytes()],
program_id,
);
```NFT
When a domain name is tokenized its ownership is transfered to a PDA that will be holding the domain while it's tokenized. In exchange, the program mints an NFT for the user. When redeeming the domain is transfered back to the NFT holder and the NFT burned.
During the tokenization process an `NftRecord` is created with the following state:
```rust
pub struct NftRecord {
/// Tag
pub tag: Tag,/// Nonce
pub nonce: u8,/// Name account of the record
pub name_account: Pubkey,/// Record owner
pub owner: Pubkey,/// NFT mint
pub nft_mint: Pubkey,
}
```If funds are sent by mistake to the `NftRecord` instead of the NFT holder while the domain is tokenized the owner has the possibility to withdraw them. The "correct owner" is determined as follow:
- If the `NftRecord` is active i.e domain is tokenized: The correct owner is the NFT holder
- If `NftRecord` is inactive i.e the NFT has been redeemed: The correct owner is the last person who redeemed (`owner` field in the `NftRecord`)Tests
### Rust
Functional Rust tests can be run with
```
cargo test-bpf --features devnet
```### JS
End to end tests can be run with
```
yarn jest
```