Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Register token #1469

Merged
merged 35 commits into from
Feb 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
6748f63
Add 'Create Foundry' how-to
Dr-Electron Feb 11, 2024
b165346
Remove ethersjs
Dr-Electron Feb 16, 2024
1d1cfdb
Update how-to
Dr-Electron Feb 16, 2024
e035aac
Mint native token
Dr-Electron Feb 16, 2024
b2cbb80
Add register token how-to
Dr-Electron Feb 16, 2024
8ffaf54
Update docs/build/isc/v1.0.0-rc.6/docs/how-tos/create-foundry.md
Dr-Electron Feb 19, 2024
a723c7e
Update docs/build/isc/v1.0.0-rc.6/docs/how-tos/create-foundry.md
Dr-Electron Feb 19, 2024
820a117
Update docs/build/isc/v1.0.0-rc.6/docs/how-tos/create-foundry.md
Dr-Electron Feb 19, 2024
fb882fb
Update docs/build/isc/v1.0.0-rc.6/docs/how-tos/create-foundry.md
Dr-Electron Feb 19, 2024
9f84a83
Update docs/build/isc/v1.0.0-rc.6/docs/how-tos/create-foundry.md
Dr-Electron Feb 19, 2024
7edf206
Update docs/build/isc/v1.0.0-rc.6/docs/how-tos/create-foundry.md
Dr-Electron Feb 19, 2024
bf1ebbd
Update docs/build/isc/v1.0.0-rc.6/docs/how-tos/native-token/register-…
Dr-Electron Feb 19, 2024
e47053a
Update docs/build/isc/v1.0.0-rc.6/docs/how-tos/native-token/register-…
Dr-Electron Feb 19, 2024
8dad6ab
Update docs/build/isc/v1.0.0-rc.6/docs/how-tos/native-token/register-…
Dr-Electron Feb 19, 2024
2b304cb
Update docs/build/isc/v1.0.0-rc.6/docs/how-tos/native-token/register-…
Dr-Electron Feb 19, 2024
9c74765
Update docs/build/isc/v1.0.0-rc.6/docs/how-tos/native-token/mint-toke…
Dr-Electron Feb 19, 2024
d59e169
Update docs/build/isc/v1.0.0-rc.6/docs/how-tos/native-token/mint-toke…
Dr-Electron Feb 19, 2024
9665412
Update docs/build/isc/v1.0.0-rc.6/docs/how-tos/native-token/mint-toke…
Dr-Electron Feb 19, 2024
5b57b70
Update contract and add admonitions
Dr-Electron Feb 20, 2024
a12e03d
Merge branch 'createFoundry' into mint-token
Dr-Electron Feb 20, 2024
84cfb64
Rename section
Dr-Electron Feb 20, 2024
a9ea8af
Update units
Dr-Electron Feb 20, 2024
52834c7
Merge branch 'createFoundry' into mint-token
Dr-Electron Feb 20, 2024
ec64dfe
Update contract and docs
Dr-Electron Feb 20, 2024
989373d
Fix sidebar
Dr-Electron Feb 20, 2024
d51c25d
Merge branch 'mint-token' into register-token
Dr-Electron Feb 20, 2024
00de9f9
Update allowance and add possibility to get erc20 address
Dr-Electron Feb 20, 2024
d202a3e
Added format suggestions
lucas-tortora Feb 20, 2024
f2a4018
Merge branch 'createFoundry' into mint-token
Dr-Electron Feb 20, 2024
12cd0ee
Export admonitions
Dr-Electron Feb 20, 2024
c01ab17
Merge branch 'mint-token' into register-token
Dr-Electron Feb 20, 2024
37badb6
Remove spaces
Dr-Electron Feb 20, 2024
4fa6b18
Update docs/build/isc/v1.0.0-rc.6/docs/how-tos/token/register-token.md
Dr-Electron Feb 20, 2024
c78d6b9
Merge branch 'ISC/restructure' into register-token
Dr-Electron Feb 20, 2024
4dc03ca
import markdown
lucas-tortora Feb 20, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
1. Check if the amount paid to the contract is the same as the required [storage deposit](/learn/protocols/stardust/core-concepts/storage-deposit)
and set the allowance.

```solidity
require(msg.value == _storageDeposit*(10**12), "Please send exact funds to pay for storage deposit");
ISCAssets memory allowance;
allowance.baseTokens = _storageDeposit;
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import Ownership from '../../../_admonitions/_ownership.md';
import Payable from '../../../_admonitions/_payable.md';
import CheckStorageDeposit from './_check_storage_deposit.md'

<Ownership/>

<CheckStorageDeposit/>

<Payable/>
16 changes: 2 additions & 14 deletions docs/build/isc/v1.0.0-rc.6/docs/how-tos/token/create-foundry.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@ tags:
- EVM
- how-to
---

import Ownership from '../../_admonitions/_ownership.md';
import Payable from '../../_admonitions/_payable.md';
import ExampleCodeIntro from '../../_partials/how-tos/token/_example_code_intro.md';

# Create a Foundry
## About Foundries
Expand All @@ -19,17 +17,7 @@ This guide will show you how to create an L1 foundry using a L2 smart contract.

## Example Code

<Ownership/>

1. Check if the amount paid to the contract is the same as the required [storage deposit](/learn/protocols/stardust/core-concepts/storage-deposit) and set the allowance.

```solidity
require(msg.value == _storageDeposit*(10**12), "Please send exact funds to pay for storage deposit");
ISCAssets memory allowance;
allowance.baseTokens = _storageDeposit;
```

<Payable/>
<ExampleCodeIntro/>

2. Define the `NativeTokenScheme`:

Expand Down
17 changes: 2 additions & 15 deletions docs/build/isc/v1.0.0-rc.6/docs/how-tos/token/mint-token.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@ tags:
- native tokens
- mint
---

import Ownership from '../../_admonitions/_ownership.md';
import Payable from '../../_admonitions/_payable.md';
import ExampleCodeIntro from '../../_partials/how-tos/token/_example_code_intro.md';

# Mint Native Tokens

Expand All @@ -19,18 +17,7 @@ so you should execute the `ISC.accounts.mintNativeTokens` function in the same c

## Example Code

<Ownership/>

1. Check if the amount paid to the contract is the same as the required [storage deposit](/learn/protocols/stardust/core-concepts/storage-deposit)
and set the allowance.

```solidity
require(msg.value == _storageDeposit*(10**12), "Please send exact funds to pay for storage deposit");
ISCAssets memory allowance;
allowance.baseTokens = _storageDeposit;
```

<Payable/>
<ExampleCodeIntro/>

2. Mint the native token specifying the foundry serial number, the amount to mint and the allowance.

Expand Down
48 changes: 48 additions & 0 deletions docs/build/isc/v1.0.0-rc.6/docs/how-tos/token/register-token.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
---
description: How to register a native token as ERC20
image: /img/logo/WASP_logo_dark.png
tags:
- ERC20
- EVM
- how-to
---
import ExampleCodeIntro from '../../_partials/how-tos/token/_example_code_intro.md';

# Register Tokens

To properly use your native tokens, you should register them as ERC20 using the `registerERC20NativeToken` function from the ISC magic contract.

## Example Code

<ExampleCodeIntro/>


2. Register the native tokens specifying:
* the foundry serial number
* a name
* a symbol
* it's decimals
* the allowance.
```solidity
ISC.sandbox.registerERC20NativeToken(_foundrySN, _name, _symbol, _decimals, allowance);
```

3. Get the ERC20 contract address with `erc20NativeTokensAddress`:
```solidity
address erc20address = ISC.sandbox.erc20NativeTokensAddress(_foundrySN);
```

### Full Example Code

```solidity
event ERC20Address(address erc20address);

function registerERC20NativeToken(uint32 _foundrySN, string calldata _name, string calldata _symbol, uint8 _decimals, 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.sandbox.registerERC20NativeToken(_foundrySN, _name, _symbol, _decimals, allowance);
address erc20address = ISC.sandbox.erc20NativeTokensAddress(_foundrySN);
emit ERC20Address(erc20address);
}
```
5 changes: 5 additions & 0 deletions docs/build/isc/v1.0.0-rc.6/sidebars.js
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,11 @@ module.exports = {
label: 'Mint a Native Token',
id: 'how-tos/token/mint-token',
},
{
type: 'doc',
label: 'Register Token as ERC20',
id: 'how-tos/token/register-token',
},
],
},
],
Expand Down