From 4d1f606c9e3c1f7e4aa5c678056205cacc81140e Mon Sep 17 00:00:00 2001 From: icLighthouse <92904844+iclighthouse@users.noreply.github.com> Date: Thu, 3 Mar 2022 12:05:47 +0800 Subject: [PATCH 1/5] Create cbd-0003 CBP3 for Comments --- CBPs/cbd-0003 | 169 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 169 insertions(+) create mode 100644 CBPs/cbd-0003 diff --git a/CBPs/cbd-0003 b/CBPs/cbd-0003 new file mode 100644 index 0000000..4699f8c --- /dev/null +++ b/CBPs/cbd-0003 @@ -0,0 +1,169 @@ +--- +cbp: 3 +title: Compatibility token standard namespace convention +description: To solve the naming conflict problem between different token standards. +author: ICLighthouse(@iclighthouse) +discussions-to: https://forum.dfinity.org/t/discussion-on-the-compatibility-of-different-token-standards/11246 +status: Draft +type: Standard +created: 2022-03-03 +--- + +## Abstract +There are multiple different implementations of the Dfinity token (Fungible Token and Non-Fungible Token) standards and no consensus can be formed. This will be detrimental to the development of dApps on IC network. + +IC Canister's methods are not allowed polymorphism, and method naming conflicts will create a barrier to token compatibility. + +CBP3 is a compatibility token standard namespace convention that provides compatibility and interoperability for different standards implementations. This is a convention (not mandatory) and is minimally intrusive for different implementations. + +## Motivation + +It enables compatibility between different token standards through namespace conventions and specifications. + +To achieve. + +- Forward Compatible +- Horizontally Compatible +- Scalable +- Minimally Intrusive + +The main interface implements a standard scheme using the method names of ERC20. The optional compatibility interface implements self/other standard schemes with the method names plus the namespace (prefix `xxx_`). + +### Specific public methods + +Returns the list of supported token standards (standard name i. e. namespace), in lowercase letters, separated by "`; `". The format is similar to "`main_standard; compatible_standard1; compatible_standard2`". E.g. "`dip20; drc20`", "`dft`". + +``` candid +standard: () -> (text) query; +``` + +### Main interface + +Use the method names of ERC20 to define the main interface, which allows you to implement the main standard of your choice. + +``` candid +For example: + +name: () -> (text) query; +symbol: () -> (text) query; +decimals: () -> (nat8) query; +totalSupply: () -> (nat) query; +balanceOf: (...) -> (...) query; +transfer: (...) -> (...); +transferFrom: (...) -> (...); +approve: (...) -> (...); +allowance: (...) -> (...); +... +``` + +### Optional compatibility interface + +Use the method names prefixed with standard name "xxx_" to define the compatibility interfaces. + +``` candid +For example 1: + +dip20_name: () -> (text) query; +dip20_symbol: () -> (text) query; +dip20_decimals: () -> (nat8) query; +dip20_totalSupply: () -> (nat) query; +dip20_balanceOf: (...) -> (...) query; +dip20_transfer: (...) -> (...); +dip20_transferFrom: (...) -> (...); +dip20_approve: (...) -> (...); +dip20_allowance: (...) -> (...); +... +``` +``` candid +For example 2: + +dft_name: () -> (text) query; +dft_symbol: () -> (text) query; +dft_decimals: () -> (nat8) query; +dft_totalSupply: () -> (nat) query; +dft_balanceOf: (...) -> (...) query; +dft_transfer: (...) -> (...); +dft_transferFrom: (...) -> (...); +dft_approve: (...) -> (...); +dft_allowance: (...) -> (...); +... +``` + +## Single-standard compatibility example + +``` candid +standard: () -> (text) query; // “drc20” + +// drc20 +name: () -> (text) query; +symbol: () -> (text) query; +decimals: () -> (nat8) query; +totalSupply: () -> (nat) query; +balanceOf: (...) -> (...) query; +transfer: (...) -> (...); +transferFrom: (...) -> (...); +approve: (...) -> (...); +allowance: (...) -> (...); +... + +// drc20 (Compatibility aliases) +drc20_name: () -> (text) query; +drc20_symbol: () -> (text) query; +drc20_decimals: () -> (nat8) query; +drc20_totalSupply: () -> (nat) query; +drc20_balanceOf: (...) -> (...) query; +drc20_transfer: (...) -> (...); +drc20_transferFrom: (...) -> (...); +drc20_approve: (...) -> (...); +drc20_allowance: (...) -> (...); +... +``` + +## Multi-standard compatibility example + +``` candid +standard: () -> (text) query; // “dft; drc20” + +// dft +name: () -> (text) query; +symbol: () -> (text) query; +decimals: () -> (nat8) query; +totalSupply: () -> (nat) query; +balanceOf: (...) -> (...) query; +transfer: (...) -> (...); +transferFrom: (...) -> (...); +approve: (...) -> (...); +allowance: (...) -> (...); +... + +// drc20 +dip20_name: () -> (text) query; +dip20_symbol: () -> (text) query; +dip20_decimals: () -> (nat8) query; +dip20_totalSupply: () -> (nat) query; +dip20_balanceOf: (...) -> (...) query; +dip20_transfer: (...) -> (...); +dip20_transferFrom: (...) -> (...); +dip20_approve: (...) -> (...); +dip20_allowance: (...) -> (...); +... +``` + +## Standard List +(Welcome to add new token standards!) + +### Fungible Token + +- dip20: https://github.com/Psychedelic/DIP20 +- dft: https://github.com/Deland-Labs/dfinity-fungible-token-standard +- drc20: https://github.com/iclighthouse/DRC_standards/tree/main/DRC20 +- ext: https://github.com/Toniq-Labs/extendable-token +- motokotoken: https://github.com/enzoh/motoko-token +- is20: https://github.com/infinity-swap/IS20 + +### Non-Fungible Token + +- departureLabsnft: https://github.com/DepartureLabsIC/non-fungible-token +- ext: https://github.com/Toniq-Labs/extendable-token +- dip721: https://github.com/SuddenlyHazel/DIP721 +- c3nft: https://github.com/C3-Protocol/NFT-standards From 07a6b00e12d0586c282723130b4a4a44bef444ff Mon Sep 17 00:00:00 2001 From: icLighthouse <92904844+iclighthouse@users.noreply.github.com> Date: Thu, 3 Mar 2022 12:06:25 +0800 Subject: [PATCH 2/5] Rename cbd-0003 to cbd-0003.md --- CBPs/{cbd-0003 => cbd-0003.md} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename CBPs/{cbd-0003 => cbd-0003.md} (100%) diff --git a/CBPs/cbd-0003 b/CBPs/cbd-0003.md similarity index 100% rename from CBPs/cbd-0003 rename to CBPs/cbd-0003.md From 99eca8d51ef06d5e3710ff88f0d1f33dc11ced3c Mon Sep 17 00:00:00 2001 From: icLighthouse <92904844+iclighthouse@users.noreply.github.com> Date: Thu, 3 Mar 2022 12:08:28 +0800 Subject: [PATCH 3/5] Update cbd-0003.md --- CBPs/cbd-0003.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/CBPs/cbd-0003.md b/CBPs/cbd-0003.md index 4699f8c..6a890cb 100644 --- a/CBPs/cbd-0003.md +++ b/CBPs/cbd-0003.md @@ -2,7 +2,7 @@ cbp: 3 title: Compatibility token standard namespace convention description: To solve the naming conflict problem between different token standards. -author: ICLighthouse(@iclighthouse) +author: ICLighthouse([@iclighthouse](https://github.com/iclighthouse)) discussions-to: https://forum.dfinity.org/t/discussion-on-the-compatibility-of-different-token-standards/11246 status: Draft type: Standard @@ -29,6 +29,8 @@ To achieve. The main interface implements a standard scheme using the method names of ERC20. The optional compatibility interface implements self/other standard schemes with the method names plus the namespace (prefix `xxx_`). +## Specification + ### Specific public methods Returns the list of supported token standards (standard name i. e. namespace), in lowercase letters, separated by "`; `". The format is similar to "`main_standard; compatible_standard1; compatible_standard2`". E.g. "`dip20; drc20`", "`dft`". From bafd35da6efe54cb672d1986ad39c800fe498930 Mon Sep 17 00:00:00 2001 From: icLighthouse <92904844+iclighthouse@users.noreply.github.com> Date: Thu, 3 Mar 2022 12:09:34 +0800 Subject: [PATCH 4/5] Update cbd-0003.md --- CBPs/cbd-0003.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/CBPs/cbd-0003.md b/CBPs/cbd-0003.md index 6a890cb..80809cc 100644 --- a/CBPs/cbd-0003.md +++ b/CBPs/cbd-0003.md @@ -2,7 +2,7 @@ cbp: 3 title: Compatibility token standard namespace convention description: To solve the naming conflict problem between different token standards. -author: ICLighthouse([@iclighthouse](https://github.com/iclighthouse)) +author: ICLighthouse(@[iclighthouse](https://github.com/iclighthouse)) discussions-to: https://forum.dfinity.org/t/discussion-on-the-compatibility-of-different-token-standards/11246 status: Draft type: Standard @@ -27,10 +27,10 @@ To achieve. - Scalable - Minimally Intrusive -The main interface implements a standard scheme using the method names of ERC20. The optional compatibility interface implements self/other standard schemes with the method names plus the namespace (prefix `xxx_`). - ## Specification +The main interface implements a standard scheme using the method names of ERC20. The optional compatibility interface implements self/other standard schemes with the method names plus the namespace (prefix `xxx_`). + ### Specific public methods Returns the list of supported token standards (standard name i. e. namespace), in lowercase letters, separated by "`; `". The format is similar to "`main_standard; compatible_standard1; compatible_standard2`". E.g. "`dip20; drc20`", "`dft`". From 95b0cbb401d7ec5fd3f6cb1b73bd105757038d2b Mon Sep 17 00:00:00 2001 From: icLighthouse <92904844+iclighthouse@users.noreply.github.com> Date: Thu, 3 Mar 2022 12:10:00 +0800 Subject: [PATCH 5/5] Update cbd-0003.md --- CBPs/cbd-0003.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CBPs/cbd-0003.md b/CBPs/cbd-0003.md index 80809cc..9ea3365 100644 --- a/CBPs/cbd-0003.md +++ b/CBPs/cbd-0003.md @@ -2,7 +2,7 @@ cbp: 3 title: Compatibility token standard namespace convention description: To solve the naming conflict problem between different token standards. -author: ICLighthouse(@[iclighthouse](https://github.com/iclighthouse)) +author: ICLighthouse(@iclighthouse, https://github.com/iclighthouse) discussions-to: https://forum.dfinity.org/t/discussion-on-the-compatibility-of-different-token-standards/11246 status: Draft type: Standard