Design for ARC20 #35
Closed
ghostant-1017
started this conversation in
ARCs
Replies: 1 comment 4 replies
-
Thank you for starting this discussion again. Linking from the previous discussion: #13 Pieces that are missing:
|
Beta Was this translation helpful? Give feedback.
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
arc: 35
title: Design for ARC20
authors: syyanyuhui@gmail.com
discussion: #35
topic: Application
status: Draft
created: 19/6/2023
Abstract
This ARC introduces a design for Fungible Tokens just like ERC20 which is upgradeable and extensible.
Data Structures
Credential
is arecord
type that includes information about thetoken_id
,owner
,total_supply
andsupplied
indicates the amount already issued.Token
is arecord
type that includes information about theowner
,token_id
,amount
.Order
is a struct to store the exchange information.Pair
is a struct containstoken_id
andaddress
. As leo doesn't support two-dimensional arrary yet, we can work around it. This is thekey
type ofmapping balance
.mapping(token_id, address) => u64
stores the public balance on chain.mapping exist: u64 => bool
indicates whether certaintoken_id
is registered or not. Maybe we can store the(address, total_supply)
as the value.Core Transitions
Credential
which contains a uniquetoken_id
and determine thetotal_supply
at the same time.Credential
.Credential
as one of inputs to mint the token which has the sametoken_id
withCredential
.Token
as one of inputs to transfer tokens to others.Token
into two parts.Extensional Transtions
Token
to exchange anothertoken_id
andamount
.Upgradeable Transitions for V2
When we want to add more features to ARC20, we can upgrade it to the v2 version using the following method.
Credential
fromarc20.aleo
and create a newCredentialV2
fromarc20_v2.aleo
contains the sametoken_id
.Token
fromarc20.aleo
and createTokenV2
with the sametoken_id
andamount
.Specification
Test Cases
Each case outlined in the specification of each feature should be tested.
Dependencies
Leo's current features already support it.
Backwards Compatibility
Everyone could choose to stay at
v1
or upgrade tov2
orv3
v4
... as they like!Security & Compliance
There should be no regulatory concerns.
Beta Was this translation helpful? Give feedback.
All reactions