From 753fdba5236936192b93d4d4cc3ec7b2ff5cfdba Mon Sep 17 00:00:00 2001 From: Vivek Jain Date: Tue, 28 May 2024 14:16:37 +0530 Subject: [PATCH 1/8] Add article for creating native token foundary --- .../token/create-native-token-foundary.md | 97 +++++++++++++++++++ 1 file changed, 97 insertions(+) create mode 100644 docs/build/isc/v1.0.0-rc.6/docs/how-tos/core-contracts/token/create-native-token-foundary.md diff --git a/docs/build/isc/v1.0.0-rc.6/docs/how-tos/core-contracts/token/create-native-token-foundary.md b/docs/build/isc/v1.0.0-rc.6/docs/how-tos/core-contracts/token/create-native-token-foundary.md new file mode 100644 index 00000000000..33245fce975 --- /dev/null +++ b/docs/build/isc/v1.0.0-rc.6/docs/how-tos/core-contracts/token/create-native-token-foundary.md @@ -0,0 +1,97 @@ +--- +description: How to Create a Native Token Foundary. +image: /img/logo/WASP_logo_dark.png +tags: + - foundry + - EVM + - how-to + - native tokens + - mint + - register +--- + +import ExampleCodeIntro from '../../../_partials/how-tos/token/_example_code_intro.md'; + +# Create a Native Token Foundary + +To streamline the process of creating and managing native tokens, the new `createNativeTokenFoundry` method has been introduced. This single method consolidates the functionalities of minting native tokens and registering them as ERC20 tokens, which were previously handled by two separate methods: `mintNativeTokens` and `registerERC20NativeToken`. By using `createNativeTokenFoundry`, you can efficiently mint new tokens and register them for use as ERC20 tokens in one seamless operation, simplifying the overall token management workflow. This method ensures that only the foundry owner can mint tokens, maintaining security and control over the token creation process. + +#### Previously, minting native tokens using `mintNativeTokens` method required specifying the foundry serial number, the amount to mint, and the allowance. + +```solidity +ISC.accounts.mintNativeTokens(_foundrySN, _amount, allowance); +``` +#### Additionally, to fully utilize your native tokens, you needed to register them as ERC20 tokens using the `registerERC20NativeToken` function from the ISC magic contract. + +```solidity +ISC.sandbox.registerERC20NativeToken(_foundrySN, _name, _symbol, _decimals, allowance); +``` +#### Now, the new `createNativeTokenFoundry` method combines these functionalities. This single method streamlines the process of minting native tokens and registering them as ERC20 tokens. + +```solidity +ISC.accounts.createNativeTokenFoundry(tokenName, tokenSymbol, tokenDecimals, tokenScheme, allowance); +``` + + + +## Example Code + + + +### 2. Mint and Register Native Token + +Minting native tokens and registering them as ERC20 tokens using `createNativeTokenFoundry` method + +```solidity +ISC.accounts.createNativeTokenFoundry(tokenName, tokenSymbol, tokenDecimals, tokenScheme, allowance); +``` + +## Full Example Code + +```solidity + +function createNativeTokenFoundry( + string memory _tokenName, + string memory _tokenSymbol, + uint8 _tokenDecimals, + NativeTokenScheme memory tokenScheme, + uint64 _storageDeposit + ) + public payable + { + require(msg.value == _storageDeposit * (10**12), "Please send exact funds to pay for storage deposit"); + + ISCAssets memory allowance; + allowance.baseTokens = _storageDeposit; + + ISC.accounts.createNativeTokenFoundry( + _tokenName, + _tokenSymbol, + _tokenDecimals, + tokenScheme, + allowance + ); + } + +``` + +### Types + +#### NativeTokenScheme + +```solidity +struct NativeTokenScheme { + uint256 mintedTokens; + uint256 meltedTokens; + uint256 maximumSupply; +} +``` +#### ISCAssets + +```solidity +struct ISCAssets { + uint64 baseTokens; + struct NativeToken[] nativeTokens; + NFTID[] nfts; +} +``` \ No newline at end of file From 306d509f1eb56a147f178ac46b339a0b7147e4c0 Mon Sep 17 00:00:00 2001 From: Vivek Jain Date: Tue, 28 May 2024 14:16:55 +0530 Subject: [PATCH 2/8] Add article to sidebar --- docs/build/isc/v1.0.0-rc.6/sidebars.js | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/docs/build/isc/v1.0.0-rc.6/sidebars.js b/docs/build/isc/v1.0.0-rc.6/sidebars.js index 79e46174358..4f74988f6be 100644 --- a/docs/build/isc/v1.0.0-rc.6/sidebars.js +++ b/docs/build/isc/v1.0.0-rc.6/sidebars.js @@ -156,13 +156,8 @@ module.exports = { }, { type: 'doc', - label: 'Mint a Native Token', - id: 'how-tos/core-contracts/token/mint-token', - }, - { - type: 'doc', - label: 'Register Token as ERC20', - id: 'how-tos/core-contracts/token/register-token', + label: 'Create a Native Token Foundary ', + id: 'how-tos/core-contracts/token/create-native-token-foundary', }, { type: 'doc', From 4c752677afbc7db3eca0726c2b882ab9ddd1f990 Mon Sep 17 00:00:00 2001 From: Vivek Jain Date: Thu, 30 May 2024 13:19:23 +0530 Subject: [PATCH 3/8] Fix articles and add deprecated warning --- .../token/create-native-token-foundary.md | 53 +++++-------------- .../core-contracts/token/mint-token.md | 4 ++ .../core-contracts/token/register-token.md | 4 ++ docs/build/isc/v1.0.0-rc.6/sidebars.js | 10 ++++ 4 files changed, 31 insertions(+), 40 deletions(-) diff --git a/docs/build/isc/v1.0.0-rc.6/docs/how-tos/core-contracts/token/create-native-token-foundary.md b/docs/build/isc/v1.0.0-rc.6/docs/how-tos/core-contracts/token/create-native-token-foundary.md index 33245fce975..564e6ad0eb0 100644 --- a/docs/build/isc/v1.0.0-rc.6/docs/how-tos/core-contracts/token/create-native-token-foundary.md +++ b/docs/build/isc/v1.0.0-rc.6/docs/how-tos/core-contracts/token/create-native-token-foundary.md @@ -14,24 +14,10 @@ import ExampleCodeIntro from '../../../_partials/how-tos/token/_example_code_int # Create a Native Token Foundary -To streamline the process of creating and managing native tokens, the new `createNativeTokenFoundry` method has been introduced. This single method consolidates the functionalities of minting native tokens and registering them as ERC20 tokens, which were previously handled by two separate methods: `mintNativeTokens` and `registerERC20NativeToken`. By using `createNativeTokenFoundry`, you can efficiently mint new tokens and register them for use as ERC20 tokens in one seamless operation, simplifying the overall token management workflow. This method ensures that only the foundry owner can mint tokens, maintaining security and control over the token creation process. - -#### Previously, minting native tokens using `mintNativeTokens` method required specifying the foundry serial number, the amount to mint, and the allowance. - -```solidity -ISC.accounts.mintNativeTokens(_foundrySN, _amount, allowance); -``` -#### Additionally, to fully utilize your native tokens, you needed to register them as ERC20 tokens using the `registerERC20NativeToken` function from the ISC magic contract. - -```solidity -ISC.sandbox.registerERC20NativeToken(_foundrySN, _name, _symbol, _decimals, allowance); -``` -#### Now, the new `createNativeTokenFoundry` method combines these functionalities. This single method streamlines the process of minting native tokens and registering them as ERC20 tokens. - -```solidity -ISC.accounts.createNativeTokenFoundry(tokenName, tokenSymbol, tokenDecimals, tokenScheme, allowance); -``` - +You can use the new `createNativeTokenFoundry` method to streamline creating and managing native tokens. This single method consolidates the functionalities of minting native tokens and registering them as ERC20 tokens. Two separate methods previously handled this process: +`mintNativeTokens` and `registerERC20NativeToken`. +By using `createNativeTokenFoundry`, you can efficiently mint new tokens and register them for use as ERC20 tokens in one seamless operation, simplifying the overall token management workflow. +This method ensures that only the foundry owner can mint tokens, maintaining security and control over the token creation process. ## Example Code @@ -54,12 +40,20 @@ function createNativeTokenFoundry( string memory _tokenName, string memory _tokenSymbol, uint8 _tokenDecimals, - NativeTokenScheme memory tokenScheme, + uint256 _mintedTokens, + uint256 _meltedTokens, + uint256 _maximumSupply, uint64 _storageDeposit ) public payable { require(msg.value == _storageDeposit * (10**12), "Please send exact funds to pay for storage deposit"); + + NativeTokenScheme memory tokenScheme = NativeTokenScheme({ + mintedTokens: _mintedTokens, + meltedTokens: _meltedTokens, + maximumSupply: _maximumSupply + }); ISCAssets memory allowance; allowance.baseTokens = _storageDeposit; @@ -73,25 +67,4 @@ function createNativeTokenFoundry( ); } -``` - -### Types - -#### NativeTokenScheme - -```solidity -struct NativeTokenScheme { - uint256 mintedTokens; - uint256 meltedTokens; - uint256 maximumSupply; -} -``` -#### ISCAssets - -```solidity -struct ISCAssets { - uint64 baseTokens; - struct NativeToken[] nativeTokens; - NFTID[] nfts; -} ``` \ No newline at end of file diff --git a/docs/build/isc/v1.0.0-rc.6/docs/how-tos/core-contracts/token/mint-token.md b/docs/build/isc/v1.0.0-rc.6/docs/how-tos/core-contracts/token/mint-token.md index 9e8e8d9b3c4..59372753931 100644 --- a/docs/build/isc/v1.0.0-rc.6/docs/how-tos/core-contracts/token/mint-token.md +++ b/docs/build/isc/v1.0.0-rc.6/docs/how-tos/core-contracts/token/mint-token.md @@ -12,6 +12,10 @@ import ExampleCodeIntro from '../../../_partials/how-tos/token/_example_code_int # Mint Native Tokens +:::caution +this method is now deprecated, use new [`createNativeTokenFoundry`](./create-native-token-foundary.md) method instead. +::: + To mint tokens from a [foundry](/tips/tips/TIP-0018/#foundry-output), you first need to be aware that only the foundry owner can mint token, so you should execute the `ISC.accounts.mintNativeTokens` function in the same contract that [created the foundry](./create-foundry.md). diff --git a/docs/build/isc/v1.0.0-rc.6/docs/how-tos/core-contracts/token/register-token.md b/docs/build/isc/v1.0.0-rc.6/docs/how-tos/core-contracts/token/register-token.md index 6a910327068..854a7d76424 100644 --- a/docs/build/isc/v1.0.0-rc.6/docs/how-tos/core-contracts/token/register-token.md +++ b/docs/build/isc/v1.0.0-rc.6/docs/how-tos/core-contracts/token/register-token.md @@ -10,6 +10,10 @@ import ExampleCodeIntro from '../../../_partials/how-tos/token/_example_code_int # Register Tokens +:::caution +this method is now deprecated, use new [`createNativeTokenFoundry`](./create-native-token-foundary.md) method instead. +::: + To properly use your native tokens, you should register them as ERC20 using the `registerERC20NativeToken` function from the ISC magic contract. ## Example Code diff --git a/docs/build/isc/v1.0.0-rc.6/sidebars.js b/docs/build/isc/v1.0.0-rc.6/sidebars.js index 4f74988f6be..352ee080ee8 100644 --- a/docs/build/isc/v1.0.0-rc.6/sidebars.js +++ b/docs/build/isc/v1.0.0-rc.6/sidebars.js @@ -154,6 +154,16 @@ module.exports = { label: 'Create a Foundry', id: 'how-tos/core-contracts/token/create-foundry', }, + { + type: 'doc', + label: 'Mint a Native Token', + id: 'how-tos/core-contracts/token/mint-token', + }, + { + type: 'doc', + label: 'Register Token as ERC20', + id: 'how-tos/core-contracts/token/register-token', + }, { type: 'doc', label: 'Create a Native Token Foundary ', From 04046adaf9b7d7bd62e5c68db0b4f4c1df5e25d1 Mon Sep 17 00:00:00 2001 From: Dr-Electron Date: Fri, 31 May 2024 14:28:20 +0200 Subject: [PATCH 4/8] Update content --- .../token/create-native-token-foundary.md | 101 +++++++++++------- docs/build/isc/v1.0.0-rc.6/sidebars.js | 12 +-- 2 files changed, 68 insertions(+), 45 deletions(-) diff --git a/docs/build/isc/v1.0.0-rc.6/docs/how-tos/core-contracts/token/create-native-token-foundary.md b/docs/build/isc/v1.0.0-rc.6/docs/how-tos/core-contracts/token/create-native-token-foundary.md index 564e6ad0eb0..b5ca422c9a1 100644 --- a/docs/build/isc/v1.0.0-rc.6/docs/how-tos/core-contracts/token/create-native-token-foundary.md +++ b/docs/build/isc/v1.0.0-rc.6/docs/how-tos/core-contracts/token/create-native-token-foundary.md @@ -12,59 +12,82 @@ tags: import ExampleCodeIntro from '../../../_partials/how-tos/token/_example_code_intro.md'; -# Create a Native Token Foundary +# Create a Native Token -You can use the new `createNativeTokenFoundry` method to streamline creating and managing native tokens. This single method consolidates the functionalities of minting native tokens and registering them as ERC20 tokens. Two separate methods previously handled this process: -`mintNativeTokens` and `registerERC20NativeToken`. -By using `createNativeTokenFoundry`, you can efficiently mint new tokens and register them for use as ERC20 tokens in one seamless operation, simplifying the overall token management workflow. -This method ensures that only the foundry owner can mint tokens, maintaining security and control over the token creation process. +This guide will show you how you can efficiently mint new tokens and register them for use as ERC20 tokens with the `createNativeTokenFoundry` function in one seamless operation. It will create a foundry on L1 and registers it as a ERC20 on L2. This method ensures that only the foundry owner can mint tokens, maintaining security and control over the token creation process. +## About Foundries + +The Stardust update allows you to create your own native tokens. Native tokens are minted by a [Foundry](/tips/tips/TIP-0018/#foundry-output). +The Foundry allows you to specify your native token's maximum supply **once** and change the circulating supply. ## Example Code -### 2. Mint and Register Native Token +### 2. Define the Token Scheme + +Define the `NativeTokenScheme` by specifying its mintedTokens, meltedTokens and maximumSupply. For simplicity, in this how-to we mint the whole maximum supply at creation. + +```solidity +NativeTokenScheme memory nativeTokenScheme = NativeTokenScheme({ + mintedTokens: _maximumSupply, + meltedTokens: 0, + maximumSupply: _maximumSupply +}); +``` + +### 3. Mint and Register Native Token Minting native tokens and registering them as ERC20 tokens using `createNativeTokenFoundry` method ```solidity -ISC.accounts.createNativeTokenFoundry(tokenName, tokenSymbol, tokenDecimals, tokenScheme, allowance); +uint32 foundrySN = ISC.accounts.createNativeTokenFoundry( + _tokenName, + _tokenSymbol, + _tokenDecimals, + nativeTokenScheme, + allowance +); ``` ## Full Example Code ```solidity +pragma solidity ^0.8.0; -function createNativeTokenFoundry( - string memory _tokenName, - string memory _tokenSymbol, - uint8 _tokenDecimals, - uint256 _mintedTokens, - uint256 _meltedTokens, - uint256 _maximumSupply, - uint64 _storageDeposit - ) - public payable - { - require(msg.value == _storageDeposit * (10**12), "Please send exact funds to pay for storage deposit"); - - NativeTokenScheme memory tokenScheme = NativeTokenScheme({ - mintedTokens: _mintedTokens, - meltedTokens: _meltedTokens, - maximumSupply: _maximumSupply - }); - - ISCAssets memory allowance; - allowance.baseTokens = _storageDeposit; - - ISC.accounts.createNativeTokenFoundry( - _tokenName, - _tokenSymbol, - _tokenDecimals, - tokenScheme, - allowance - ); - } - -``` \ No newline at end of file +import "@iota/iscmagic/ISC.sol"; + +contract MyToken { + event MintedToken(uint32 foundrySN); + + constructor( + string memory _tokenName, + string memory _tokenSymbol, + uint8 _tokenDecimals, + uint256 _maximumSupply, + uint64 _storageDeposit + ) + public payable + { + require(msg.value == _storageDeposit * (10**12), "Please send exact funds to pay for storage deposit"); + ISCAssets memory allowance; + allowance.baseTokens = _storageDeposit; + + NativeTokenScheme memory nativeTokenScheme = NativeTokenScheme({ + mintedTokens: _maximumSupply, + meltedTokens: 0, + maximumSupply: _maximumSupply + }); + + uint32 foundrySN = ISC.accounts.createNativeTokenFoundry( + _tokenName, + _tokenSymbol, + _tokenDecimals, + nativeTokenScheme, + allowance + ); + emit MintedToken(foundrySN); + } +} +``` diff --git a/docs/build/isc/v1.0.0-rc.6/sidebars.js b/docs/build/isc/v1.0.0-rc.6/sidebars.js index 352ee080ee8..991bf3ed0af 100644 --- a/docs/build/isc/v1.0.0-rc.6/sidebars.js +++ b/docs/build/isc/v1.0.0-rc.6/sidebars.js @@ -149,6 +149,11 @@ module.exports = { type: 'doc', id: 'how-tos/core-contracts/token/introduction', }, + { + type: 'doc', + label: 'Create a Native Token', + id: 'how-tos/core-contracts/token/create-native-token-foundary', + }, { type: 'doc', label: 'Create a Foundry', @@ -156,7 +161,7 @@ module.exports = { }, { type: 'doc', - label: 'Mint a Native Token', + label: 'Mint a Native Token using a Foundry', id: 'how-tos/core-contracts/token/mint-token', }, { @@ -164,11 +169,6 @@ module.exports = { label: 'Register Token as ERC20', id: 'how-tos/core-contracts/token/register-token', }, - { - type: 'doc', - label: 'Create a Native Token Foundary ', - id: 'how-tos/core-contracts/token/create-native-token-foundary', - }, { type: 'doc', label: 'Custom ERC20 Functions', From 7d2832467ff00b0ecebb42af8ddcc81f3cbdaf6d Mon Sep 17 00:00:00 2001 From: Dr-Electron Date: Fri, 31 May 2024 14:37:48 +0200 Subject: [PATCH 5/8] Add admonition as partial --- .../how-tos/token/_obsolete_token_creation.md | 5 +++++ .../how-tos/core-contracts/token/create-foundry.md | 4 ++++ .../docs/how-tos/core-contracts/token/mint-token.md | 8 ++++---- .../how-tos/core-contracts/token/register-token.md | 5 ++--- docs/build/isc/v1.0.0-rc.6/sidebars.js | 10 +++++----- 5 files changed, 20 insertions(+), 12 deletions(-) create mode 100644 docs/build/isc/v1.0.0-rc.6/docs/_partials/how-tos/token/_obsolete_token_creation.md diff --git a/docs/build/isc/v1.0.0-rc.6/docs/_partials/how-tos/token/_obsolete_token_creation.md b/docs/build/isc/v1.0.0-rc.6/docs/_partials/how-tos/token/_obsolete_token_creation.md new file mode 100644 index 00000000000..e61ae1c6ddc --- /dev/null +++ b/docs/build/isc/v1.0.0-rc.6/docs/_partials/how-tos/token/_obsolete_token_creation.md @@ -0,0 +1,5 @@ +:::caution + +This method is now obsolete, use the new [`createNativeTokenFoundry`](./create-native-token-foundary.md) method instead. + +::: \ No newline at end of file diff --git a/docs/build/isc/v1.0.0-rc.6/docs/how-tos/core-contracts/token/create-foundry.md b/docs/build/isc/v1.0.0-rc.6/docs/how-tos/core-contracts/token/create-foundry.md index f9636742db8..17ba120d40c 100644 --- a/docs/build/isc/v1.0.0-rc.6/docs/how-tos/core-contracts/token/create-foundry.md +++ b/docs/build/isc/v1.0.0-rc.6/docs/how-tos/core-contracts/token/create-foundry.md @@ -7,8 +7,12 @@ tags: - how-to --- import ExampleCodeIntro from '../../../_partials/how-tos/token/_example_code_intro.md'; +import ObsoleteTokenCreation from '../../../_partials/how-tos/token/_obsolete_token_creation.md'; # Create a Foundry + + + ## About Foundries The Stardust update allows you to create your own native tokens. Native tokens are minted by a [Foundry](/tips/tips/TIP-0018/#foundry-output). diff --git a/docs/build/isc/v1.0.0-rc.6/docs/how-tos/core-contracts/token/mint-token.md b/docs/build/isc/v1.0.0-rc.6/docs/how-tos/core-contracts/token/mint-token.md index 59372753931..3962a77ade9 100644 --- a/docs/build/isc/v1.0.0-rc.6/docs/how-tos/core-contracts/token/mint-token.md +++ b/docs/build/isc/v1.0.0-rc.6/docs/how-tos/core-contracts/token/mint-token.md @@ -9,12 +9,12 @@ tags: - mint --- import ExampleCodeIntro from '../../../_partials/how-tos/token/_example_code_intro.md'; +import ObsoleteTokenCreation from '../../../_partials/how-tos/token/_obsolete_token_creation.md'; -# Mint Native Tokens +# Mint a Native Token using a Foundry + + -:::caution -this method is now deprecated, use new [`createNativeTokenFoundry`](./create-native-token-foundary.md) method instead. -::: To mint tokens from a [foundry](/tips/tips/TIP-0018/#foundry-output), you first need to be aware that only the foundry owner can mint token, so you should execute the `ISC.accounts.mintNativeTokens` function in the same contract that [created the foundry](./create-foundry.md). diff --git a/docs/build/isc/v1.0.0-rc.6/docs/how-tos/core-contracts/token/register-token.md b/docs/build/isc/v1.0.0-rc.6/docs/how-tos/core-contracts/token/register-token.md index 854a7d76424..990ae5e69b3 100644 --- a/docs/build/isc/v1.0.0-rc.6/docs/how-tos/core-contracts/token/register-token.md +++ b/docs/build/isc/v1.0.0-rc.6/docs/how-tos/core-contracts/token/register-token.md @@ -7,12 +7,11 @@ tags: - how-to --- import ExampleCodeIntro from '../../../_partials/how-tos/token/_example_code_intro.md'; +import ObsoleteTokenCreation from '../../../_partials/how-tos/token/_obsolete_token_creation.md'; # Register Tokens -:::caution -this method is now deprecated, use new [`createNativeTokenFoundry`](./create-native-token-foundary.md) method instead. -::: + To properly use your native tokens, you should register them as ERC20 using the `registerERC20NativeToken` function from the ISC magic contract. diff --git a/docs/build/isc/v1.0.0-rc.6/sidebars.js b/docs/build/isc/v1.0.0-rc.6/sidebars.js index 991bf3ed0af..b7c8a784f98 100644 --- a/docs/build/isc/v1.0.0-rc.6/sidebars.js +++ b/docs/build/isc/v1.0.0-rc.6/sidebars.js @@ -154,6 +154,11 @@ module.exports = { label: 'Create a Native Token', id: 'how-tos/core-contracts/token/create-native-token-foundary', }, + { + type: 'doc', + label: 'Custom ERC20 Functions', + id: 'how-tos/core-contracts/token/erc20-native-token', + }, { type: 'doc', label: 'Create a Foundry', @@ -169,11 +174,6 @@ module.exports = { label: 'Register Token as ERC20', id: 'how-tos/core-contracts/token/register-token', }, - { - type: 'doc', - label: 'Custom ERC20 Functions', - id: 'how-tos/core-contracts/token/erc20-native-token', - }, ], }, { From 47391c21ce845dfb6574670a1987b0871d1cfce5 Mon Sep 17 00:00:00 2001 From: Dr-Electron Date: Fri, 31 May 2024 15:06:03 +0200 Subject: [PATCH 6/8] Apply suggestions from code review Co-authored-by: Lucas Tortora <85233773+lucas-tortora@users.noreply.github.com> --- .../core-contracts/token/create-native-token-foundary.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/build/isc/v1.0.0-rc.6/docs/how-tos/core-contracts/token/create-native-token-foundary.md b/docs/build/isc/v1.0.0-rc.6/docs/how-tos/core-contracts/token/create-native-token-foundary.md index b5ca422c9a1..d64c926edad 100644 --- a/docs/build/isc/v1.0.0-rc.6/docs/how-tos/core-contracts/token/create-native-token-foundary.md +++ b/docs/build/isc/v1.0.0-rc.6/docs/how-tos/core-contracts/token/create-native-token-foundary.md @@ -14,12 +14,12 @@ import ExampleCodeIntro from '../../../_partials/how-tos/token/_example_code_int # Create a Native Token -This guide will show you how you can efficiently mint new tokens and register them for use as ERC20 tokens with the `createNativeTokenFoundry` function in one seamless operation. It will create a foundry on L1 and registers it as a ERC20 on L2. This method ensures that only the foundry owner can mint tokens, maintaining security and control over the token creation process. +This guide will show you how you can efficiently mint new tokens and register them for use as ERC20 tokens with the `createNativeTokenFoundry` function in one seamless operation. It will create a foundry on L1 and register it as an ERC20 on L2. This method ensures that only the foundry owner can mint tokens, maintaining security and control over the token creation process. ## About Foundries The Stardust update allows you to create your own native tokens. Native tokens are minted by a [Foundry](/tips/tips/TIP-0018/#foundry-output). -The Foundry allows you to specify your native token's maximum supply **once** and change the circulating supply. +The Foundry lets you specify your native token's maximum supply **once** and change the circulating supply. ## Example Code @@ -27,7 +27,7 @@ The Foundry allows you to specify your native token's maximum supply **once** an ### 2. Define the Token Scheme -Define the `NativeTokenScheme` by specifying its mintedTokens, meltedTokens and maximumSupply. For simplicity, in this how-to we mint the whole maximum supply at creation. +Define the `NativeTokenScheme` by specifying its `mintedTokens`, `meltedTokens`, and `maximumSupply`. For simplicity, in this guide we mint the whole maximum supply at creation. ```solidity NativeTokenScheme memory nativeTokenScheme = NativeTokenScheme({ From 4678ba542edfae667bcd8ee158b92cd538a0cb44 Mon Sep 17 00:00:00 2001 From: Dr-Electron Date: Fri, 31 May 2024 15:10:16 +0200 Subject: [PATCH 7/8] Fix constructor --- .../core-contracts/token/create-native-token-foundary.md | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/docs/build/isc/v1.0.0-rc.6/docs/how-tos/core-contracts/token/create-native-token-foundary.md b/docs/build/isc/v1.0.0-rc.6/docs/how-tos/core-contracts/token/create-native-token-foundary.md index d64c926edad..f816c2f68ae 100644 --- a/docs/build/isc/v1.0.0-rc.6/docs/how-tos/core-contracts/token/create-native-token-foundary.md +++ b/docs/build/isc/v1.0.0-rc.6/docs/how-tos/core-contracts/token/create-native-token-foundary.md @@ -67,9 +67,7 @@ contract MyToken { uint8 _tokenDecimals, uint256 _maximumSupply, uint64 _storageDeposit - ) - public payable - { + ) payable { require(msg.value == _storageDeposit * (10**12), "Please send exact funds to pay for storage deposit"); ISCAssets memory allowance; allowance.baseTokens = _storageDeposit; From 8abf82d09b7bc4f6775e6e0482162618d70b70ad Mon Sep 17 00:00:00 2001 From: Dr-Electron Date: Fri, 31 May 2024 15:23:54 +0200 Subject: [PATCH 8/8] Fix abmonition and rename file --- .../docs/_partials/how-tos/token/_obsolete_token_creation.md | 2 +- .../{create-native-token-foundary.md => create-native-token.md} | 0 docs/build/isc/v1.0.0-rc.6/sidebars.js | 2 +- 3 files changed, 2 insertions(+), 2 deletions(-) rename docs/build/isc/v1.0.0-rc.6/docs/how-tos/core-contracts/token/{create-native-token-foundary.md => create-native-token.md} (100%) diff --git a/docs/build/isc/v1.0.0-rc.6/docs/_partials/how-tos/token/_obsolete_token_creation.md b/docs/build/isc/v1.0.0-rc.6/docs/_partials/how-tos/token/_obsolete_token_creation.md index e61ae1c6ddc..1a70e93ffaa 100644 --- a/docs/build/isc/v1.0.0-rc.6/docs/_partials/how-tos/token/_obsolete_token_creation.md +++ b/docs/build/isc/v1.0.0-rc.6/docs/_partials/how-tos/token/_obsolete_token_creation.md @@ -1,5 +1,5 @@ :::caution -This method is now obsolete, use the new [`createNativeTokenFoundry`](./create-native-token-foundary.md) method instead. +This method is now obsolete, use the new [`createNativeTokenFoundry`](../../../how-tos/core-contracts/token/create-native-token.md) method instead. ::: \ No newline at end of file diff --git a/docs/build/isc/v1.0.0-rc.6/docs/how-tos/core-contracts/token/create-native-token-foundary.md b/docs/build/isc/v1.0.0-rc.6/docs/how-tos/core-contracts/token/create-native-token.md similarity index 100% rename from docs/build/isc/v1.0.0-rc.6/docs/how-tos/core-contracts/token/create-native-token-foundary.md rename to docs/build/isc/v1.0.0-rc.6/docs/how-tos/core-contracts/token/create-native-token.md diff --git a/docs/build/isc/v1.0.0-rc.6/sidebars.js b/docs/build/isc/v1.0.0-rc.6/sidebars.js index b7c8a784f98..3f638c5f7a1 100644 --- a/docs/build/isc/v1.0.0-rc.6/sidebars.js +++ b/docs/build/isc/v1.0.0-rc.6/sidebars.js @@ -152,7 +152,7 @@ module.exports = { { type: 'doc', label: 'Create a Native Token', - id: 'how-tos/core-contracts/token/create-native-token-foundary', + id: 'how-tos/core-contracts/token/create-native-token', }, { type: 'doc',