You are on page 1of 42

On fungible / non-fungible

tokens
Defines the solidity version to use.
The ^ means any version higher
than 0.6.0 but has to start with
0.6.x. Not 0.7.x.

The contract named myToken is


defined here.

Constructor is executed only once


– during contract creation. Here, it
assigns the total supply to the
contract creator.
Define number of decimal places, name, symbol, and
total supply for the token (line 5, 6, 7, and 9)

Create a structure for address <-> balance (line 8)

Define owner of this contract as the person who


created this contract. (line 10)

Create transaction log

balances
address uint256 (balance)

0x5B38Da6a701c568545d 1000000
CfcB03FcB875f56beddC4
Fungible Token (ERC20)
• On Ethereum, the standard for fungible token is ERC20. The vast
majority of tokens are currently based on the ERC20 standard.

• Different units are interchangeable and have no unique


properties.

• An ERC20-compliant token contract must provide at least the


following functions and events:
 totalSupply, balanceOf, transfer, transferFrom, approve, allowance,
Transfer, Approval
Fungible Token (ERC20)
• There are two data structures for an ERC20 implementation.
 Track balances using mapping(address => uint256) balances;

“Me and my money”

 Track allowances using mapping(address => mapping (address =>


uint256)) public allowed;

“Me and those who can spend my money”


Fungible Token (ERC20)
• ERC20 tokens ≠ Ether!

Ether is transferred in an Ethereum transaction with a recipient


address.
ERC20 token is transferred by invoking the smart contract;
balances are tracked within the contract itself. Only the state of
the contract is changed.

To transfer or perform any actions on an ERC20 token, you need


ether to pay for gas.
car_registry

uint256 car
0 "Pontiac","Firebird",1967,"cn_010_kr",0xCA35b7d915458EF540
aDe6068dFe2F44E8fa733c
1 "Ford","Thunderbird",1955,"cn_015_tb",0xCA35b7d915458EF5
40aDe6068dFe2F44E8fa733c
2 "Chevrolet","Impala",1958,"cn_018_imp",0xCA35b7d915458EF
540aDe6068dFe2F44E8fa733c
3 "Aston
Martin","DB5",1964,"cn_007_GoldFinger",0xCA35b7d915458E
F540aDe6068dFe2F44E8fa733c
collections

address uint256[]
0xCA35b7d915458EF540aDe6068dFe2F44E8fa733c 0,1,2,3
… Null
… …
… …
owners

uint256 (car ID) Address


0 0xCA35b7d915458EF540aDe6068dFe2F44E8fa733c
1 0xCA35b7d915458EF540aDe6068dFe2F44E8fa733c
2 0xCA35b7d915458EF540aDe6068dFe2F44E8fa733c
3 0xCA35b7d915458EF540aDe6068dFe2F44E8fa733c
ownedPosition

uint256 (car ID) uint256 (position)


0 0
1 3
2 1
3 2
The addCarToRegistry function adds a new car and its owner to the registry. It
uses the addCar and assignCar functions.
These functions allow users to ask the contract for information about the cars and their
ownership. It does not change the “state”, thus, enquiring these functions does not
consume gas.

getChassis gets the chassis number of car with ID specified in index.


whoOwnsThisCar returns the owner of car with ID specified in index.
howManyCarsDoTheyOwn checks the total collections an address has (them).
The transfer function will transfer car with ID specified in index to a destination address.
It returns a Boolean value (bool) of “True” if succeed, and “False” if unsuccessful.

Line 67-69:
It first requires the person who calls this function to be the owner of the car. Then, it
changes the ownership of the car with ID index (owners[index]) to the new owner
(destination). It adds the car with ID index to the new owner’s collections.
Line 71-75:

Handles the collection of the original owner. It removes the car from the original
owner’s collection and reduce the number of collections by one.
The NFTs are unique based on their car ID. In this example, it is ID = 0, 1, 2, 3 that
separately represents each unique car.
Using openzeppelin ERC721
• Copy and paste the code to Remix.

• Modify Line 14 with your desired NFT name and symbol.

• Compile and Deploy the contract.

• Once Deployed, use the mintNFT function – key in any address


that you wish to give the NFT to, and the following URI:
https://ipfs.io/ipfs/QmUFbUjAifv9GwJo7ufTB5sccnrNqELhDMaf
oEmZdPPng7. Click on “transact”.
How to List NFT for Free on
OpenSea
• https://www.youtube.com/watch?v=dzr1BKrmm4o&ab_channel
=EvanDoesTech
NFT
Crypto-Collectibles
The NFT Craze?
• Non-fungible tokens or NFTs — products that operate as digital
assets — have grown to encompass a $250 million market,
according to a 2020 report from tech-tracking company L'Atelier
BNP Paribas and nonfungible.com.

• NFT creators and resellers have


made millions. In March, artist
Beeple smashed digital art
records and became one of the
most valuable living artists
when he sold a crypto art
piece for nearly $70 million.
NFT Platforms
• In February, Christie's — an auction house that was founded
in 1766 — made its first foray into digital tokens with the $69
million Beeple sale. Since then, famed auction house
Sotheby's has also announced plans to sell NFTs.
• Other platforms like Super Rare, Foundation, and Nifty
Gateway allow buyers to pick from carefully curated work.
These platforms provide artists with around 10% royalties on
any future sales of their work.
• Platforms like Zora operate as invite-only, while Rarible and
Mintable allow any user to upload and sell images and text
as NFTs on the site.
• OpenSea claims to be the largest NFT marketplace and is
home to anything from art to virtual reality, sports and
trading cards. The site has over 200 categories and 4 million
items.
NFT Platforms
• NBA Top Shot, a site where people can buy video
highlights as NFTs, has sold over $260 million in NFTs in
the past month, according to CryptoSlam. In February, a
LeBron James dunk set the record for the most expensive
Top Shot sales at $208,000 worth of the cryptocurrency
Flow.
• Other NFT collectibles based on arcade games like Street
Fighter have also gained popularity — generating over
$1.5 million only weeks after the site was launched and
over $600,000 in the past month, according to
CryptoSlam data.
NFT Platforms
Real Estate:
• One of the first NFT digital houses in the world sold for
over $500,000 on SuperRare's marketplace.
• NFT sites that capitalize on virtual reality and real estate
also include Decentraland, which is built on Ethereum and
owned and created by users.
• Other NFTs: Tweeters, digital hologram, and a person
named Petter Rudwall.
Others
• Twitter’s CEO Jack Dorsey sold an NFT of his first tweet for the
equivalent of USD 2.5 million.

• One-of-a-kind digital rendition of the Nyan Cat meme from 2011


– sold for 300 eth (~US$590k).

https://giphy.com/gifs/nyan-cat-sIIhZliB2McAo
https://appinventiv.com/blog/guide-to-nft-and-its-uses/
Non-Fungible Token ERC721
• The ERC20 token standard tracks the balance of an account but
not the provenance of the token.

• Non-fungible tokens track ownership of something unique; in-


game item, collectible, house, artwork, loans, etc.

• Tokens hold a mapping of its unique identifier with the owner’s


address and also implements a transferFrom interface to
exchange NFTs in a programmable way.

• Comparing ERC20 and ERC721 – the emphasis on ownership:

mapping(address => uint256) balances; ERC20

mapping(uint256 => address) private Owner; ERC721


Non-Fungible Token ERC1155
• Defines a multi-token standard that introduces the idea of
“classes” to assets.

• This allows developers to capture more complex representations


beyond a simple one-to-one relationship between an asset and
a token.

• A classic example is the different classes of items in a game.


ERC-1155 can represent different types of items (e.g. swords,
guns, shields, armor).

• ERC-1155 is a superset of ERC-721, the advantage is efficiency in


the representation and batch transfers.
ERC Standards

https://arxiv.org/pdf/2105.07447.pdf?ref=https://githubhelp.com
Non-Fungible Token ERC6551
• Token bound accounts – NFTs can own assets and interact with
applications.

 A character in a role-playing game that accumulates assets and


abilities over time based on actions they have taken
 An automobile composed of many fungible and non-fungible
components
 An investment portfolio composed of multiple fungible assets
 A punch pass membership card granting access to an establishment
and recording a history of past interactions

• How can you further leverage the characteristics of blockchain?


Non-Fungible Token ERC998
• Composable Non-Fungible Token

• A top-down composable contract stores and keeps track of child


tokens for each of its tokens.

• A bottom-up composable contract stores and keeps track of a


parent token for each of its tokens.

• With composable tokens it is possible to compose lists or trees


of ERC-721 and ERC-20 tokens connected by ownership. Any
such structure will have a single owner address at the root of
the structure, that is the owner of the entire composition. The
entire composition can be transferred with one transaction by
changing the root owner.
Semi-Fungible Token ERC3525
• Token contains an ERC-721 equivalent ID property to identify
itself as a universally unique entity so that the tokens can be
transferred between addresses and approved to be operated in
ERC-721 compatible way.

• Token also contains a value property, representing the


quantitative nature of the token. The meaning of the ‘value’
property is quite like that of the ‘balance’ property of an ERC-20
token.

• Allows the creation of financial instruments such as bonds,


insurance policies, or vesting plans using ERC-721 and control
the value in them.
The logic of an ICO launch:

FT vs NFT

The logic of an NFT launch:


Copyright Issues Owning an NFT may not mean that
you bought the copyright of the work
• The NFT is just a metadata
file containing information
on a digital version of the
tokenised work.

• Anything that can be


digitised can be turned
into an NFT. The original
work is only needed in the
first step to create the
NFT.

• In principle, NFTs have


little to do with copyright.

https://www.wipo.int/wipo_magazi
ne/en/2021/04/article_0007.html
Copyright Issues
• April 2021, when an NFT of a Basquiat drawing was offered for
sale, the sellers had announced that the winning bidder would
have the option of destroying the physical work once the digital
version had been acquired.

• The hasty withdrawal of that sale after an intervention from the


Basquiat estate underscored the plethora of intellectual
property and other legal issues that makers of NFTs have so far
neglected.

• It is also difficult to see how the minting of an NFT without


authorization could be considered copyright infringement.
Asset Tokenisation
• The process of adding new assets to a blockchain is called
tokenisation, and the blockchain representation of the asset
is referred to as a token.

 Assets are more accessible and transactions are more efficient.


 Tokenised assets can be used in many decentralised applications
and stored within smart contracts.
 When issued according to a common standard, these tokens are
interoperable and can be used in almost all DeFi applications.
Why NFT?
• The complete data of NFT is stored securely in blockchain which
means the tokens can never be removed, destroyed, or replicated
no matter what.

• The uniqueness of NFTs is delivered by smart contracts, an


executable set of programmable code integrated into an underlying
blockchain and that the larger non-expert population can see,

• The main source of value for NFTs is their scarcity. Although NFT
developers can make an infinite number of tokens, they’re kept
limited purposefully to maintain their value.

• NFTs are entirely indivisible which means they can’t be divided like
bitcoins into smaller denominations.

• With the capabilities of blockchain, NFTs can be easily tracked back


to their real owner and eradicates the need for third-party
verification forever.
Why NFT?
Ownership • Tracks ownership of unique items (collectibles,
luxury goods, real estates) on the blockchain
Rights • Allows peer-to-peer trading of the items

Customisation • An NFT can be programmed with any desired


information – images, history, background info
Approach • Allows info that flows together with the token

• Peer-to-peer trading that results in transfer of


ownership is verifiable.
Secure Trade • Transfer of ownership is interoperable across
various services and market places.
How do we value an NFT?
• Public recognition of the asset’s value or the value, rarity, and
intrinsic value of the asset.
Recognised officially by a Recognised officially by a
trusted party or an trusted party or an
individual with IP individual without IP
protection protection
Recognised by a Digital artwork by famous Luxury goods, NBA Top
wide range of artists; NFT = IP Shot, Dogecoin
users possession? transaction signed by
Elon Musk, Tweet1
Recognised by a Digital artwork by less- Meme, digital tokens
small group of known artists, game or created by less-known
users props cards individuals

1. https://www.theverge.com/2021/3/22/22344937/jack-dorsey-nft-sold-first-tweet-ethereum-cryptocurrency-twitter
How do we value an NFT?
• Interoperability: the ability to use the tokens in different
applications increases the value of the tokens due to ease of
trade.

• Blockchain security: the underlying settlement technology (i.e.,


blockchain) for NFT transactions must be secure; same goes for
the smart contract.

• Robust community of users: the NFTs must be meaningful and


has value close to the heart of the user.

• Confidence in the team/creator: Transparent in operation,


genuine NFT creation

• Others – rarity, tangibility, utility.


Another Type of NFT
What else can (or
should) we tokenise?
Identity? Humanitarian aid?
What are the
considerations
when creating
an NFT?
Uniqueness? Privacy? Soul-bound?

You might also like