Deploying Native NFT Collections on Fuel

Neven6 42 views 30 slides Jul 18, 2024
Slide 1
Slide 1 of 30
Slide 1
1
Slide 2
2
Slide 3
3
Slide 4
4
Slide 5
5
Slide 6
6
Slide 7
7
Slide 8
8
Slide 9
9
Slide 10
10
Slide 11
11
Slide 12
12
Slide 13
13
Slide 14
14
Slide 15
15
Slide 16
16
Slide 17
17
Slide 18
18
Slide 19
19
Slide 20
20
Slide 21
21
Slide 22
22
Slide 23
23
Slide 24
24
Slide 25
25
Slide 26
26
Slide 27
27
Slide 28
28
Slide 29
29
Slide 30
30

About This Presentation

Slides used for the Encode x Fuel Educate Series


Slide Content

Fuel 101
Deploying Native NFT collections on Fuel

About Me
DevRel@ Fuel Labs
Prev:
-Lead ML Engineer @LucidityFinance
-Head of Devrel @ Pesto Tech
-Dev Rel advocate @ Polygon
-Senior Software Dev @Goldman Sachs
-1x Founder @RadarFi

How is Fuel different?

-Uses Fuel Virtual Machine (FuelVM)
-Leverages a unspent transaction output (UTXO) model - which enables
parallel transaction execution.
-Designed for minimizing blockchain state
-Designed for interoperability with Ethereum wallets, assets and smart contract
paradigms

UTXO Model

Basics First
●Fuel - The architecture (which we call a rollup operating system)
●Sepolia Testnet - The Fuel L2 test network on Ethereum.
●Sway - Rust-like smart contract programming language.
●Forc (Fuel orchestrator). All in one toolchain. Equivalent of cargo or npm.
●Fuels - SDKs to develop on and connect to Fuel blockchains
●Fuelup - Toolchain manager for fuel (similar to nvm or rustup)

How are Fuel Dapps different?
EVM Fuel
Solidity Sway
EVM FuelVM
Indexer: The Graph Indexer: Envio / Subsquid

Development and deployment: Hardhat,
Foundry
Fuel Orchestrator: forc
SDKs: Web3.js, ethers.js SDK: Fuels TS and RS

Solidity Sway
The language most of us
started with on EVM

-Javascript-like syntax
-Has inheritance
-Designed to target the
EVM
-Single context


Rust based (DSL = domain specific
language) designed for blockchain
development

-Rust-like syntax
-Has traits paradigm
-Designed to target any
blockchain (but currently only the
FuelVM is supported)
-Multi-context

Context: Program Types
Solidity Sway

Contracts Contracts
Libraries Scripts
Predicates
Libraries

Solidity

Sway

Syntax and Storage
Solidity


-Influenced by C++, Python and JS
-Opt-out storage access
-Storage manipulation relies on built in
language concepts
-No built-in support for namespacing
or storage slot placement

Sway


-Based on Rust
-Opt in storage access permissions
-Storage manipulation is based on
standard library and user defined
types
-First-class storage namespacing
-Built in syntax to place storage slots
where you want them

Standard Library
Solidity


-No standard library
-Has Open-Zeppelin and other popular
modules

Sway


-Has a standard library
-Has a core library
-Prelude gives you essentials out of
the box
-Import without worrying about
versions

Fungible Tokens

Solidity


-No native assets other than ETH
-Only has application level tokens
-Utilise ERC-20 contract from Open
Zeppelin
-Requires: approve and transfer behavior

Sway


-Can leverage the FuelVM native asset
system under the hood
-Can also build application level tokens
-Utilise Sway SRC-20 standard
-All smart contracts in Fuel can mint /
burn native assets by default
-Calls in Fuel can transfer any native
asset
-Fuel has scripts which enable approve +
transfers in the same transaction

Solidity

Sway: SRC-3: Minting Native Assets
fn mint(recipient: Identity, sub_id: SubId, amount: u64)

What are sway standards?
●The Sway Standards repository is your go-to for importing and using
standards in the Sway Language. Here, you'll find standards at various stages
of development.

●Find the relevant standard and implement the standard ABI into your contract.

Sway standards: Native Assets


●SRC-20 Defines the implementation of a standard API for Native Assets using the
Sway Language.
●SRC-3 Mint and Burn to enable mint and burn functionality for fungible assets.
●SRC-7 Arbitrary Asset Metadata Standard used to store metadata for Native Assets.
●SRC-9 Metadata Keys Standard used to store standardized metadata keys for
Native Assets in combination with the SRC-7 standard.
●SRC-6 Vault Standard defines the implementation of a standard API for asset vaults.
●SRC-13 Soulbound Address provides a predicate interface to lock Native Assets as
soulbound.

Using a standard


Add this to the project's Forc.toml file under [dependencies] with the most recent release:




Import your desired standard in your Sway Smart Contract

Let’s get to building!

Installation and Setup

Pre requisites:
-Node.js
-Fuel toolchain

Installation instructions ??????
https://tinyurl.com/FuelSetup

Building an NFT collection

On the Fuel Network, all NFTs are Native Assets. They are commonly associated
with artwork / collectibles however there are many greater utilities beyond that
which have yet to be written for the Fuel Network.

Basics First
What standards to use?
●SRC-20: Native Asset
●SRC-3: Mint and Burn
●SRC-7: Metadata standards

Native Asset Library: To implement the basic functionality behind the standards.

NFT Collections codebase




https://tinyurl.com/NFTonFuel

https://tinyurl.com/NFTsonFuel

Important resources
Tags