diff --git a/docs/build/isc/v1.0.0-rc.6/docs/how-tos/create-foundry.md b/docs/build/isc/v1.0.0-rc.6/docs/how-tos/create-foundry.md new file mode 100644 index 00000000000..c460a1f98ab --- /dev/null +++ b/docs/build/isc/v1.0.0-rc.6/docs/how-tos/create-foundry.md @@ -0,0 +1,71 @@ +--- +description: How to create a L1 foundry +image: /img/logo/WASP_logo_dark.png +tags: + - foundry + - EVM + - how-to +--- + + +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + +## About Foundry + +The stardust update allows you to create your own native tokens. Native tokens are minted by a so-called Foundry. The Foundry allows you to specify a max supply once and change the circulating supply. This how-to will explain how to create a foundry from L2 that you can control from L2. + +## Example Code + + + + +```solidity +// SPDX-License-Identifier: MIT + +pragma solidity ^0.8.0; + +import "@iota/iscmagic/ISC.sol"; + +contract CreateFoundry { + event CreatedFoundry(uint foundrySN); + + function createFoundry(uint _mintedTokens, uint _meltedTokens, uint _maximumSupply) public payable { + NativeTokenScheme memory nativeTokenScheme = NativeTokenScheme({ + mintedTokens: _mintedTokens, + meltedTokens: _meltedTokens, + maximumSupply: _maximumSupply + }); + ISCAssets memory allowance = ISCAssets({ + baseTokens: 500_000, + nativeTokens: new NativeToken[](0), + nfts: new NFTID[](0) + }); + uint foundrySN = ISC.accounts.foundryCreateNew(nativeTokenScheme, allowance); + emit CreatedFoundry(foundrySN); + } +} +``` + + + + +```typescript +async function main() { + const contract = new ethers.Contract(ISC_MAGIC_ADDRESS, getTheAbi(), wallet) + const nativeTokenScheme = { + mintedTokens: 0, + meltedTokens: 0, + maximumSupply: 100 + }; + const allowance = { + baseTokens: 500_000, + nativeTokens: [], + nfts: [] + }; + const tx = await contract.foundryCreateNew(nativeTokenScheme, allowance); +} +``` + + + \ No newline at end of file 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 7d80a886d58..537bb0080b0 100644 --- a/docs/build/isc/v1.0.0-rc.6/sidebars.js +++ b/docs/build/isc/v1.0.0-rc.6/sidebars.js @@ -156,6 +156,11 @@ module.exports = { label: 'Send Tokens to L1', id: 'how-tos/send-tokens-to-l1', }, + { + type: 'doc', + label: 'Create Foundry', + id: 'how-tos/create-foundry', + } ], }, ],