Skip to content

Commit

Permalink
Restructure how tos (#1500)
Browse files Browse the repository at this point in the history
* Restructure how-tos

* Update core contract introduction

* Add decimals

* Update docs/build/isc/v1.0.0-rc.6/docs/how-tos/core-contracts/basics/send-assets-to-l1.mdx
  • Loading branch information
Dr-Electron authored Feb 28, 2024
1 parent f492b01 commit 5de50e6
Show file tree
Hide file tree
Showing 20 changed files with 74 additions and 148 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,9 @@ Tokens in an Ethereum account can only be moved by sending an Ethereum transacti
The [`accounts` core contract](../reference/core-contracts/accounts.md) is responsible for managing the L2 ledger.
By calling this contract, it is possible to:

- [View current account balances](../how-tos/get-balance.md)
- [View current account balances](../how-tos/core-contracts/basics/get-balance.md)
- [Deposit funds to the chain](../how-tos/send-funds-from-L1-to-L2.mdx)
- [Withdraw funds from the chain](../how-tos/send-assets-to-l1.mdx)
- [Withdraw funds from the chain](../how-tos/core-contracts/basics/send-assets-to-l1.mdx)

## Example

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ by default `eth_getBalance` will return the L2 base token balance of the given E

### The Magic Contract

A [dedicated Ethereum contract](../how-tos/magic.md) exists to manage ISC tokens and generally avail ISC
A [dedicated Ethereum contract](../how-tos/core-contracts/introduction.md) exists to manage ISC tokens and generally avail ISC
functionalities, introducing commands like `isc.send(...)` for token transfers.

### Gas Fees
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Once you have your L1 assets on L2, you might want to check their balance. This

## Example Code

1. Get the [AgentID](../explanations/how-accounts-work.md) from the sender by calling `ISC.sandbox.getSenderAccount()`.
1. Get the [AgentID](../../../explanations/how-accounts-work.md) from the sender by calling `ISC.sandbox.getSenderAccount()`.

```solidity
ISCAgentID memory agentID = ISC.sandbox.getSenderAccount();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,18 @@ tags:
- Solidity
---

import AboutAccounts from '../_admonitions/_about-accounts.md';
import AboutAccounts from '../../../_admonitions/_about-accounts.md';

# Send Assets and Tokens to L1

<AboutAccounts/>

:::info

ShimmerEVM has 18 decimal places, while Shimmer has 6. This means that any decimals beyond the 6th will be ignored by Shimmer, even though you can see them on ShimmerEVM. Please keep this in mind while sending your tokens to L1.

:::

This guide will show you how to use the ISC sandbox interface to send assets from L2 to L1. This includes base tokens, native tokens, and NFTs. Before you can send these assets, you need to know how you get them on L2 and how you allow a contract to use them.

Note that assets on L1 require a storage deposit; therefore, the number of base tokens sent to L1 should cover at least the storage deposit required to hold the assets on L1.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
description: The ISC Magic Contract allows EVM contracts to access ISC functionality.
description: The ISC Core Contracts allows VMs to access ISC functionality.
image: /img/logo/WASP_logo_dark.png
tags:
- configure
Expand All @@ -13,25 +13,25 @@ tags:
- RPC
---

# The ISC Magic Contract
# The Core Contracts

[EVM and ISC are inherently very different platforms](../getting-started/compatibility.md).
Some EVM-specific actions (e.g., manipulating Ethereum tokens) are disabled, and EVM contracts can access ISC-specific
functionality through the \_[ISC Magic Contract](../reference/magic-contract.md)\_\_.
The [core contracs](../../explanations/core-contracts.md) are contracts deployed on every chain and are vital to interact with L1 and the chain itself. They can be called in Solidity through the [ISC Magic Contract](../../reference/magic-contract.md).

## The ISC Magic Contract

The Magic contract is an EVM contract deployed by default on every ISC chain, in the EVM genesis block, at
address `0x1074000000000000000000000000000000000000`.
The implementation of the Magic contract is baked-in in
the [`evm`](../reference/core-contracts/evm.md) [core contract](../reference/core-contracts/overview.md);
the [`evm`](../../reference/core-contracts/evm.md) [core contract](../../reference/core-contracts/overview.md);
i.e. it is not a pure-Solidity contract.

The Magic contract has several methods, which are categorized into specialized
interfaces: `ISCSandbox`, `ISCAccounts`, `ISCUtil` and so on.
You can access these interfaces from any Solidity contract by importing
the [ISC library](https://www.npmjs.com/package/@iota/iscmagic):

```sh
yarn add @iota/iscmagic
```bash npm2yarn
npm install @iota/iscmagic
```

You can import it into your contracts like this:
Expand All @@ -48,7 +48,7 @@ tokens and native tokens on L2.
In the example below, `ISC.sandbox.getEntropy()` calls the
[`getEntropy`](https://github.com/iotaledger/wasp/blob/develop/packages/vm/core/evm/iscmagic/ISCSandbox.sol#L20)
method of the `ISCSandbox` interface, which, in turn,
calls [ISC Sandbox's](../explanations/sandbox.md) `GetEntropy`.
calls [ISC Sandbox's](../../explanations/sandbox.md) `GetEntropy`.

```solidity
pragma solidity >=0.8.5;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ tags:
- EVM
- how-to
---
import ExampleCodeIntro from '../../_partials/how-tos/token/_example_code_intro.md';
import ExampleCodeIntro from '../../../_partials/how-tos/token/_example_code_intro.md';

# Create a Foundry
## About Foundries
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ tags:
- native tokens
- mint
---
import ExampleCodeIntro from '../../_partials/how-tos/token/_example_code_intro.md';
import ExampleCodeIntro from '../../../_partials/how-tos/token/_example_code_intro.md';

# Mint Native Tokens

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ tags:
- EVM
- how-to
---
import ExampleCodeIntro from '../../_partials/how-tos/token/_example_code_intro.md';
import ExampleCodeIntro from '../../../_partials/how-tos/token/_example_code_intro.md';

# Register Tokens

Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
---
description: Solidity smart contract example.
description: Basic smart contract example.
image: /img/logo/WASP_logo_dark.png
tags:
- smart contracts
- EVM
- Solidity
- how to
- basic contract
---
import DeployAdmonition from '../_admonitions/_deploy_a_smart_contract.md';

# Solidity Smart Contract Example
# Basic Smart Contract Example

[Solidity](https://docs.soliditylang.org/en/v0.8.16/) smart contracts on IOTA Smart Contracts are compatible with
Solidity smart contracts on any other network. Most smart contracts will work directly without any modification. To get
Expand Down
83 changes: 0 additions & 83 deletions docs/build/isc/v1.0.0-rc.6/docs/how-tos/create-foundry.md

This file was deleted.

4 changes: 2 additions & 2 deletions docs/build/isc/v1.0.0-rc.6/docs/how-tos/introduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ beginner or an experienced developer, the how-to guides offer clear and concise
functionality into your projects easier.

To make the most of the how-to guides in this section, identify the specific topic or functionality you want to explore.
Whether you want to [get funds on L2](send-funds-from-L1-to-L2.mdx), [add ISC specific functionality](magic.md),
or [send funds to L1](send-assets-to-l1.mdx), you can find dedicated guides that walk you through the process.
Whether you want to [get funds on L2](send-funds-from-L1-to-L2.mdx), [add ISC specific functionality](introduction.md),
or [send funds to L1](./core-contracts/basics/send-assets-to-l1.mdx), you can find dedicated guides that walk you through the process.

With the how-to guides in the IOTA SDK, you can overcome implementation hurdles and gain a deeper understanding
of the IOTA ecosystem. These guides empower you with the knowledge and practical examples to seamlessly integrate IOTA
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ is popular amongst other developers.

:::tip Solo

If you want to test ISC-specific functionalities, like the [magic contract](magic.md), you should use
If you want to test ISC-specific functionalities, like the [magic contract](./core-contracts/introduction.md), you should use
the [Solo Framework](../solo/getting-started.md).

:::
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ tags:
The `evm` contract is one of the [core contracts](overview.md) on each IOTA Smart Contracts chain.

The `evm` core contract provides the necessary infrastructure to accept Ethereum transactions and execute EVM code.
It also includes the implementation of the [ISC Magic contract](../../how-tos/magic.md).
It also includes the implementation of the [ISC Magic contract](../../how-tos/core-contracts/introduction.md).

:::note

Expand Down
85 changes: 45 additions & 40 deletions docs/build/isc/v1.0.0-rc.6/sidebars.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,6 @@ module.exports = {
},
],
},

{
type: 'category',
label: 'How To',
Expand Down Expand Up @@ -137,79 +136,85 @@ module.exports = {
},
{
type: 'category',
label: 'Use the Magic Contract',
label: 'Interact with the Core Contracts',
items: [
{
type: 'doc',
label: 'Use the Magic Contract',
id: 'how-tos/magic',
},
{
type: 'doc',
label: 'Send Assets to L1',
id: 'how-tos/send-assets-to-l1',
},
{
type: 'doc',
label: 'Get Randomness on L2',
id: 'how-tos/get-randomness-on-l2',
label: 'Introduction',
id: 'how-tos/core-contracts/introduction',
},
{
type: 'category',
label: 'Token',
label: 'Basics',
items: [
{
label: 'Introduction',
type: 'doc',
id: 'how-tos/token/introduction',
label: 'Get Native Assets Balance',
id: 'how-tos/core-contracts/basics/get-balance',
},
{
type: 'doc',
label: 'Create a Foundry',
id: 'how-tos/token/create-foundry',
type: 'category',
label: 'Allowance',
items: [
{
type: 'doc',
label: 'Allow',
id: 'how-tos/core-contracts/basics/allowance/allow',
},
{
type: 'doc',
label: 'Get Allowance',
id: 'how-tos/core-contracts/basics/allowance/get-allowance',
},
{
type: 'doc',
label: 'Take Allowance',
id: 'how-tos/core-contracts/basics/allowance/take-allowance',
},
],
},
{
type: 'doc',
label: 'Mint a Native Token',
id: 'how-tos/token/mint-token',
label: 'Send Assets to L1',
id: 'how-tos/core-contracts/basics/send-assets-to-l1',
},
],
},
{
type: 'category',
label: 'Token',
items: [
{
label: 'Introduction',
type: 'doc',
label: 'Register Token as ERC20',
id: 'how-tos/token/register-token',
id: 'how-tos/core-contracts/token/introduction',
},
{
type: 'doc',
label: 'Custom ERC20 Functions',
id: 'how-tos/token/erc20-native-token',
label: 'Create a Foundry',
id: 'how-tos/core-contracts/token/create-foundry',
},
],
},
{
type: 'category',
label: 'Allowance',
items: [
{
type: 'doc',
label: 'Allow',
id: 'how-tos/allowance/allow',
label: 'Mint a Native Token',
id: 'how-tos/core-contracts/token/mint-token',
},
{
type: 'doc',
label: 'Get Allowance',
id: 'how-tos/allowance/get-allowance',
label: 'Register Token as ERC20',
id: 'how-tos/core-contracts/token/register-token',
},
{
type: 'doc',
label: 'Take Allowance',
id: 'how-tos/allowance/take-allowance',
label: 'Custom ERC20 Functions',
id: 'how-tos/core-contracts/token/erc20-native-token',
},
],
},
{
type: 'doc',
label: 'Get Native Assets Balance',
id: 'how-tos/get-balance',
label: 'Get Randomness on L2',
id: 'how-tos/core-contracts/get-randomness-on-l2',
},
],
},
Expand Down

0 comments on commit 5de50e6

Please sign in to comment.