-
Notifications
You must be signed in to change notification settings - Fork 287
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f5eff18
commit f849902
Showing
3 changed files
with
69 additions
and
1 deletion.
There are no files selected for viewing
45 changes: 45 additions & 0 deletions
45
docs/build/isc/v1.0.0-rc.6/docs/how-tos/token/erc20-native-token.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
--- | ||
description: How to use the custom functionality of ERC20NativeToken | ||
image: /img/logo/WASP_logo_dark.png | ||
tags: | ||
- native token | ||
- erc20 | ||
- EVM | ||
- how-to | ||
--- | ||
|
||
# Custom ERC20 Functions | ||
|
||
Once you [registered your native token as ERC20](./erc20-native-token.md) you can use it like any other ERC20 token, with functions like | ||
`transfer`, `balanceOf`, etc. But, as the ERC20 token maps the native token on L2, there are some additional ISC features | ||
you can take advantage of. | ||
|
||
## Example Code | ||
|
||
### Get Your `ERC20NativeTokens` Instance | ||
|
||
You can use the `erc20NativeTokensAddress` function and the Foundry serial number to get the contract address: | ||
|
||
```solidity | ||
ERC20NativeTokens token = ERC20NativeTokens( | ||
ISC.sandbox.erc20NativeTokensAddress(_foundrySN) | ||
); | ||
``` | ||
|
||
* `nativeTokenID` will give you the native token ID of the ERC20 token: | ||
|
||
```solidity | ||
NativeTokenID memory id =token.nativeTokenID(); | ||
``` | ||
|
||
### Full Example Code | ||
|
||
```solidity | ||
function nativeTokenID(uint32 _foundrySN) public view returns (bytes memory) { | ||
ERC20NativeTokens token = ERC20NativeTokens( | ||
ISC.sandbox.erc20NativeTokensAddress(_foundrySN) | ||
); | ||
NativeTokenID memory id =token.nativeTokenID(); | ||
return id.data; | ||
} | ||
``` |
18 changes: 18 additions & 0 deletions
18
docs/build/isc/v1.0.0-rc.6/docs/how-tos/token/introduction.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
--- | ||
description: How to handle native tokens on L2 and use them as ERC20 | ||
image: /img/logo/WASP_logo_dark.png | ||
tags: | ||
- native token | ||
- EVM | ||
- how-to | ||
--- | ||
import DocCardList from '@theme/DocCardList'; | ||
|
||
# Native Token and ERC20NativeToken | ||
|
||
The IOTA L1 has functionality to create L1 tokens, also called native tokens. To use these native tokens on L2, you have | ||
a ERC20 contract called `ERC20NativeToken`. The following guides will show you how to [create a foundry](create-foundry.md) | ||
that can [mint your own L1 token from L2](mint-token.md), and [register](register-token.md) it as `ERC20NativeToken`, | ||
so it can be used like any other ERC20 token with some additional features. | ||
|
||
<DocCardList /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters