From a92080579bd5a19143adf5645abee4ca73a3e426 Mon Sep 17 00:00:00 2001
From: BenRey
Date: Tue, 19 Nov 2024 09:20:00 +0100
Subject: [PATCH] fix inheritance example in FT token contract
---
.../basic-concepts/inheritance.mdx | 41 ++++++++++---------
1 file changed, 22 insertions(+), 19 deletions(-)
diff --git a/docs/build/smart-contract/basic-concepts/inheritance.mdx b/docs/build/smart-contract/basic-concepts/inheritance.mdx
index b52dbcb16..731c3cccd 100644
--- a/docs/build/smart-contract/basic-concepts/inheritance.mdx
+++ b/docs/build/smart-contract/basic-concepts/inheritance.mdx
@@ -11,29 +11,32 @@ This example showcases a token contract that follows the Massa Fungible Token (F
By using inheritance, you can easily create a new token with customized properties while reusing the FT standard functions.
```ts
-import { Args } from '@massalabs/as-types';
-import { u256 } from 'as-bignum/assembly';
-export * as FT from '@massalabs/sc-standards/assembly/contracts/FT/token';
-
-export function constructor(_: StaticArray): StaticArray {
- const token_name = "My Token";
- const token_symbol = "MTK";
- const decimals: u8 = 18;
- const totalSupply = u256.fromU64(123456);
-
- FT.constructor(
- new Args()
- .add(token_name)
- .add(token_symbol)
- .add(decimals)
- .add(totalSupply)
- .serialize(),
- );
+import { Args } from "@massalabs/as-types";
+import { u256 } from "as-bignum/assembly";
+import { constructor as ftConstructor } from "@massalabs/sc-standards/assembly/contracts/FT/token";
+export * from "@massalabs/sc-standards/assembly/contracts/FT/token";
+
+export function constructor(_: StaticArray): void {
+ const tokenName = "My Token";
+ const tokenSymbol = "MTK";
+ const decimals: u8 = 18;
+ const totalSupply = u256.fromU64(123456);
+
+ ftConstructor(
+ new Args()
+ .add(tokenName)
+ .add(tokenSymbol)
+ .add(decimals)
+ .add(totalSupply)
+ .serialize()
+ );
}
```
## Why use inheritance with the FT standard?
+
Using the FT standard as a base allows you to inherit its well-defined functionalities without needing to reimplement core token mechanics. This approach ensures that your token will be compatible with existing Massa applications and services that follow the FT standard, facilitating interoperability and reliability.
## Customization with Inheritance
-Extending the FT standard allows you to add new functions or modify existing ones, tailoring the token contract to your specific needs. For example, you could implement custom transfer logic, introduce new events, or include access control mechanisms for minting and burning tokens.
\ No newline at end of file
+
+Extending the FT standard allows you to add new functions or modify existing ones, tailoring the token contract to your specific needs. For example, you could implement custom transfer logic, introduce new events, or include access control mechanisms for minting and burning tokens.