From 7fe25b062c3b0e98d6315d9ed51509a94172617f Mon Sep 17 00:00:00 2001 From: BenRey Date: Mon, 16 Dec 2024 18:25:13 +0100 Subject: [PATCH] Update README to reflect MRC20 and MRC721 token standards --- README.md | 4 ++-- smart-contracts/README.md | 10 ++++----- .../contracts/MRC1155/MRC1155-internal.ts | 2 +- .../contracts/MRC721/MRC721-internals.ts | 16 +++++++------- .../assembly/contracts/MRC721/MRC721.ts | 22 +++++++++---------- .../enumerable/MRC721Enumerable-internals.ts | 6 ++--- .../MRC721/enumerable/MRC721Enumerable.ts | 6 ++--- 7 files changed, 33 insertions(+), 33 deletions(-) diff --git a/README.md b/README.md index 021c538b..349c0079 100644 --- a/README.md +++ b/README.md @@ -11,13 +11,13 @@ If you're interested in learning more about Massa and its capabilities, check ou ## Fungible Token -The [Fungible Token standard implementation](smart-contracts/assembly/contracts/FT) defines a common set of rules for creating and managing Massa-based tokens that are fungible (i.e. interchangeable). +The [Fungible Token standard implementation](smart-contracts/assembly/contracts/MRC20) defines a common set of rules for creating and managing Massa-based tokens that are fungible (i.e. interchangeable). This is MassaLabs implementation of [the ERC20](https://ethereum.org/en/developers/docs/standards/tokens/erc-20/). ## Non-Fungible Token -The [Non-Fungible Token standard implementation](smart-contracts/assembly/contracts/NFT) defines a common set of rules for creating and managing Massa-based tokens that are non-fungible (i.e. unique). +The [Non-Fungible Token standard implementation](smart-contracts/assembly/contracts/MRC721) defines a common set of rules for creating and managing Massa-based tokens that are non-fungible (i.e. unique). This is MassaLabs implementation of [the ERC721](https://ethereum.org/en/developers/docs/standards/tokens/erc-721/). diff --git a/smart-contracts/README.md b/smart-contracts/README.md index 865a89c0..2ad23bf5 100644 --- a/smart-contracts/README.md +++ b/smart-contracts/README.md @@ -1,7 +1,7 @@ # Massa Smart-contract Standards -- [fungible token](assembly/contracts/FT): implementation of the ERC20 token. -- [non-fungible token](assembly/contracts/NFT) +- [fungible token](assembly/contracts/MRC20): implementation of the ERC20 token. +- [non-fungible token](assembly/contracts/MRC721) ## Documentation @@ -22,8 +22,8 @@ npm i @massalabs/sc-standards ```typescript import { Args } from '@massalabs/as-types'; import { callerHasWriteAccess } from '@massalabs/massa-as-sdk'; -import * as FT from '@massalabs/sc-standards/assembly/contracts/FT/index'; -export * from '@massalabs/sc-standards/assembly/contracts/FT/token'; +import * as MRC20 from '@massalabs/sc-standards/assembly/contracts/MRC20/index'; +export * from '@massalabs/sc-standards/assembly/contracts/MRC20/token'; /** * This function is meant to be called only one time: when the contract is deployed. @@ -37,7 +37,7 @@ export function constructor(_: StaticArray): StaticArray { return []; } - FT.constructor( + MRC20.constructor( new Args().add('MY_TOKEN').add('MTK').add(4).add(100000).serialize(), ); diff --git a/smart-contracts/assembly/contracts/MRC1155/MRC1155-internal.ts b/smart-contracts/assembly/contracts/MRC1155/MRC1155-internal.ts index 1e4b8a80..b11f2761 100644 --- a/smart-contracts/assembly/contracts/MRC1155/MRC1155-internal.ts +++ b/smart-contracts/assembly/contracts/MRC1155/MRC1155-internal.ts @@ -107,7 +107,7 @@ export function _uri(_: u256): string { } /** - * Set the URI for the NFT contract + * Set the URI for the MRC721 contract * @param newUri - the new URI */ export function _setURI(newUri: string): void { diff --git a/smart-contracts/assembly/contracts/MRC721/MRC721-internals.ts b/smart-contracts/assembly/contracts/MRC721/MRC721-internals.ts index 576a8f6a..fbd864e6 100644 --- a/smart-contracts/assembly/contracts/MRC721/MRC721-internals.ts +++ b/smart-contracts/assembly/contracts/MRC721/MRC721-internals.ts @@ -1,19 +1,19 @@ /** - * This file contains the internals functions of an NFT contract as defined by the ERC721 standard. + * This file contains the internals functions of a MRC721 contract as defined by the ERC721 standard. * https://eips.ethereum.org/EIPS/eip-721 * * DO NOT DEPLOY THIS CONTRACT. * * This file is NOT meant to be deployed on its own. - * The functions exposed by this file are meant to be imported and used inside an NFT implementation contract. - * This file can be seen as a library of helper functions that can be used to implement an NFT contract. + * The functions exposed by this file are meant to be imported and used inside an MRC721 implementation contract. + * This file can be seen as a library of helper functions that can be used to implement an MRC721 contract. * - * The goal of having one separate file for the internals of the NFT contract is + * The goal of having one separate file for the internals of the MC721 contract is * 1. To abstract the complexity of storage access. * 2. To guarantee that the storage is accessed in a consistent and gas efficient way. - * 3. To allow developers to focus on the business logic of their NFT contracts. + * 3. To allow developers to focus on the business logic of their MRC721 contracts. * - * Please check the NFT-example.ts file for an example of how to use this file. + * Please check the ./MRC721.ts file for an example of how to use this file. * */ @@ -38,12 +38,12 @@ export const ALLOWANCE_KEY_PREFIX: StaticArray = [0x05]; export const OPERATOR_ALLOWANCE_KEY_PREFIX: StaticArray = [0x06]; /** - * Constructs a new NFT contract. + * Constructs a new MRC721 contract. * @param binaryArgs - the binary arguments name and symbol * * @remarks This function shouldn't be directly exported by the implementation contract. * It is meant to be called by the constructor of the implementation contract. - * Please check the NFT-example.ts file for an example of how to use this function. + * Please check the MRC721.ts file for an example of how to use this function. */ export function _constructor(name: string, symbol: string): void { Storage.set(NAME_KEY, stringToBytes(name)); diff --git a/smart-contracts/assembly/contracts/MRC721/MRC721.ts b/smart-contracts/assembly/contracts/MRC721/MRC721.ts index aec0a490..bcaec033 100644 --- a/smart-contracts/assembly/contracts/MRC721/MRC721.ts +++ b/smart-contracts/assembly/contracts/MRC721/MRC721.ts @@ -1,14 +1,14 @@ /** * - * This is an example of an NFT contract that uses the NFT-internals + * This is an example of a MRC721 contract that uses the MRC721-internals * helper functions to implement the ERC721 standard. * * This files does basically two things: - * 1. It wraps the NFT-internals functions, manages the deserialize/serialize of the arguments and return values, + * 1. It wraps the MRC721-internals functions, manages the deserialize/serialize of the arguments and return values, * and exposes them to the outside world. * 2. It implements some custom features that are not part of the ERC721 standard, like mint, burn or ownership. * - * The NFT-internals functions are not supposed to be re-exported by this file. + * The MRC721-internals functions are not supposed to be re-exported by this file. */ import { @@ -60,7 +60,7 @@ export function symbol(): StaticArray { * @param binaryArgs - serialized string representing the address whose balance we want to check * @returns a serialized u256 representing the balance of the address * @remarks As we can see, instead of checking the storage directly, - * we call the _balanceOf function from the NFT-internals. + * we call the _balanceOf function from the MRC721-internals. */ export function balanceOf(binaryArgs: StaticArray): StaticArray { const args = new Args(binaryArgs); @@ -117,7 +117,7 @@ export function isApprovedForAll(binaryArgs: StaticArray): StaticArray { * * @param binaryArgs - serialized strings representing the address of the recipient and the tokenId to approve * @remarks This function is only callable by the owner of the tokenId or an approved operator. - * Indeed, this will be checked by the _approve function of the NFT-internals. + * Indeed, this will be checked by the _approve function of the MRC721-internals. * */ export function approve(binaryArgs: StaticArray): void { @@ -169,8 +169,8 @@ export function transferFrom(binaryArgs: StaticArray): void { * @remarks This function is only callable by the owner of the contract. * * This function is not part of the ERC721 standard. - * It serves as an example of how to use the NFT-internals functions to implement custom features. - * Here we make use of the _update function from the NFT-internals to mint a new token. + * It serves as an example of how to use the MRC721-internals functions to implement custom features. + * Here we make use of the _update function from the MRC721-internals to mint a new token. * Indeed, by calling _update with a non-existing tokenId, we are creating a new token. * * We also make sure that the mint feature is only callable by the owner of the contract @@ -192,8 +192,8 @@ export function mint(binaryArgs: StaticArray): void { * @param binaryArgs - serialized u256 representing the tokenId to burn * * @remarks This function is not part of the ERC721 standard. - * It serves as an example of how to use the NFT-internals functions to implement custom features. - * Here we make use of the _update function from the NFT-internals to burn a token. + * It serves as an example of how to use the MRC721-internals functions to implement custom features. + * Here we make use of the _update function from the MRC721-internals to burn a token. * Indeed, by calling _update with the zero address as a recipient, we are burning the token. * * We also made sure that the burn feature is only callable by the owner of the token or an approved operator. @@ -211,7 +211,7 @@ export function burn(binaryArgs: StaticArray): void { /** * Here we re-export the ownerAddress function from the ownership file. * This will allow the outside world to check the owner of the contract. - * However we do not re-export any function from the NFT-internals file. - * This is because the NFT-internals functions are not supposed to be called directly by the outside world. + * However we do not re-export any function from the MRC721-internals file. + * This is because the MRC721-internals functions are not supposed to be called directly by the outside world. */ export { ownerAddress } from '../utils/ownership'; diff --git a/smart-contracts/assembly/contracts/MRC721/enumerable/MRC721Enumerable-internals.ts b/smart-contracts/assembly/contracts/MRC721/enumerable/MRC721Enumerable-internals.ts index 2dc738f0..1a0eff5b 100644 --- a/smart-contracts/assembly/contracts/MRC721/enumerable/MRC721Enumerable-internals.ts +++ b/smart-contracts/assembly/contracts/MRC721/enumerable/MRC721Enumerable-internals.ts @@ -1,5 +1,5 @@ /** - * This file provides internal functions to support token enumeration functionality for the NFT contract on Massa. + * This file provides internal functions to support token enumeration functionality for the MRC721 contract on Massa. * It utilizes key prefix querying to retrieve all token IDs and tokens owned by specific addresses * in the datastore without maintaining explicit indices. */ @@ -18,12 +18,12 @@ export const TOTAL_SUPPLY_KEY: StaticArray = stringToBytes('totalSupply'); export const OWNED_TOKENS_KEY: StaticArray = stringToBytes('ownedTokens'); /** - * Constructs a new NFT contract. + * Constructs a new MRC721 contract. * @param binaryArgs - the binary arguments name and symbol * * @remarks This function shouldn't be directly exported by the implementation contract. * It is meant to be called by the constructor of the implementation contract. - * Please check the NFTEnumerable-example.ts file for an example of how to use this function. + * Please check the MRC721Enumerable.ts file for an example of how to use this function. */ export function _constructor(name: string, symbol: string): void { _constructorBase(name, symbol); diff --git a/smart-contracts/assembly/contracts/MRC721/enumerable/MRC721Enumerable.ts b/smart-contracts/assembly/contracts/MRC721/enumerable/MRC721Enumerable.ts index 527e33a1..f1532bbf 100644 --- a/smart-contracts/assembly/contracts/MRC721/enumerable/MRC721Enumerable.ts +++ b/smart-contracts/assembly/contracts/MRC721/enumerable/MRC721Enumerable.ts @@ -1,5 +1,5 @@ /** - * This is an example of an NFT contract that uses the `NFTEnumerable-internals` + * This is an example of an MRC721 contract that uses the `MRC721Enumerable-internals` * helper functions to implement enumeration functionality similar to the ERC-721 Enumerable extension. * * @remarks @@ -46,12 +46,12 @@ * enabling efficient data retrieval. * * **This file does two things:** - * 1. It wraps the `NFTEnumerable-internals` functions, manages the deserialization/serialization of the arguments + * 1. It wraps the `MRC721Enumerable-internals` functions, manages the deserialization/serialization of the arguments * and return values, and exposes them to the outside world. * 2. It implements some custom features that are not part of the ERC-721 standard, * such as `mint`, `burn`, or ownership management. * - * **Important:** The `NFTEnumerable-internals` functions are not supposed to be re-exported by this file. + * **Important:** The `MRC721Enumerable-internals` functions are not supposed to be re-exported by this file. */ import { Args, u256ToBytes } from '@massalabs/as-types';