Skip to content

Commit

Permalink
rebased on ISC/restructure
Browse files Browse the repository at this point in the history
saving working state
@todo add dummy value to images
@todo review ERC721 texts and update images
  • Loading branch information
lucas-tortora committed Feb 9, 2024
1 parent 3a7267c commit 671ad23
Show file tree
Hide file tree
Showing 38 changed files with 82 additions and 520 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
:::tip Deploy a Smart Contract with Hardhat

Deploy a Solidity Smart Contract using Hardhat following our [how-to Deploy a Smart Contract guide](/isc/how-tos/EVM/deploy-a-smart-contract#hardhat).

:::
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
:::tip Deploy a Smart Contract with Remix

Deploy a Solidity Smart Contract using Remix following our [how-to Deploy a Smart Contract guide](/isc/how-tos/EVM/deploy-a-smart-contract#remix).

:::
4 changes: 0 additions & 4 deletions docs/build/isc/v1.0.0-rc.6/docs/explanations/invocation.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,11 +87,7 @@ etc.) has an associated gas cost.

For users to specify how much they're willing to pay for a request, they need to specify a `GasBudget` in the request.
This gas budget is the "maximum operations that this request can execute" and will be charged as a fee based on the
<<<<<<<< HEAD:docs/build/isc/v1.0.0-rc.6/docs/explanations/invocation.md
chain's current [fee policy](../reference/core-contracts/governance.md#fee-policy).
========
chain's current [fee policy](/isc/reference/core-contracts/governance#fee-policy).
>>>>>>>> 136ca6e9c8 (re-merge EVM and WASM):docs/learn/smart-contracts/invocation.md

The funds to cover the gas used will be charged directly from the user's on-chain account.

Expand Down
8 changes: 0 additions & 8 deletions docs/build/isc/v1.0.0-rc.6/docs/explanations/sandbox.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,22 +30,14 @@ their internal state as a list of key/value pairs.

Besides reading and writing to the contract state, the Sandbox interface allows smart contracts to access:

<<<<<<<< HEAD:docs/build/isc/v1.0.0-rc.6/docs/explanations/sandbox.md
- The [ID](how-accounts-work.md) of the contract.
========
- The [ID](/isc/explanations/how-accounts-work) of the contract.
>>>>>>>> 136ca6e9c8 (re-merge EVM and WASM):docs/learn/smart-contracts/sandbox.md
- The details of the current request or view call.
- The current request allowance and a way to claim the allowance.
- The balances owned by the contract.
- The ID of whoever had deployed the contract.
- The timestamp of the current block.
- Cryptographic utilities like hashing, signature verification, and so on.
<<<<<<<< HEAD:docs/build/isc/v1.0.0-rc.6/docs/explanations/sandbox.md
- The [events](../schema/how-tos/events.mdx) dispatch.
========
- The [events](/isc/how-tos/wasm/events) dispatch.
>>>>>>>> 136ca6e9c8 (re-merge EVM and WASM):docs/learn/smart-contracts/sandbox.md
- Entropy that emulates randomness in an unpredictable yet deterministic way.
- Logging. Used for debugging in a test environment.

Expand Down
4 changes: 0 additions & 4 deletions docs/build/isc/v1.0.0-rc.6/docs/explanations/validators.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,4 @@ It is common for validator nodes to be part of a private subnet and have only a
outside world, protecting the committee from external attacks.

The management of validator and access nodes is done through
<<<<<<<< HEAD:docs/build/isc/v1.0.0-rc.6/docs/explanations/validators.md
the [`governance` core contract](../reference/core-contracts/governance.md).
========
the [`governance` core contract](/isc/reference/core-contracts/governance/).
>>>>>>>> 136ca6e9c8 (re-merge EVM and WASM):docs/learn/smart-contracts/validators.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import NetworkWarning from '../_admonitions/_network_warning.md'

The current release of IOTA Smart Contracts has support for [EVM/Solidity](#evmsolidity-based-smart-contracts) smart
contracts, as well as experimental [Wasm](#wasm-vm-for-isc) smart contracts, providing limited compatibility with
existing smart contracts and tooling from other EVM based chains like Ethereum. This allows us to offer the existing
existing smart contracts and tooling from other EVM based chains like Ethereum. This allows us to offer the existing
ecosystem around EVM/Solidity a familiar alternative.

## EVM/Solidity Based Smart Contracts
Expand Down Expand Up @@ -47,14 +47,14 @@ Experiment but avoid using it for production applications; opt for [EVM](quick-s

:::

IOTA Smart Contracts (ISC) provide a sandboxed environment through an API, facilitating secure and deterministic
interactions with ISC functions. This API supports any Virtual Machine (VM) aiming to build a system for smart contract
code execution on ISC.
IOTA Smart Contracts (ISC) provide a sandboxed environment through an API, facilitating secure and deterministic
interactions with ISC functions. This API supports any Virtual Machine (VM) aiming to build a system for smart contract
code execution on ISC.

![Wasp node ISC Host](/img/wasm_vm/IscHost.png)

You can use a [WebAssembly (Wasm)](https://webassembly.org/) VM as a compilation target, facilitated by the open-source
[Wasmtime runtime](https://wasmtime.dev/). This setup encourages dynamic smart contract operations compiled to Wasm code,
[Wasmtime runtime](https://wasmtime.dev/). This setup encourages dynamic smart contract operations compiled to Wasm code,
promoting security and adaptability with different programming languages.

![Wasm VM](/img/wasm_vm/WasmVM.png)
Expand All @@ -75,7 +75,7 @@ The ISC sandbox environment offers:

### Supported Languages

The WasmLib started with [Rust](https://www.rust-lang.org/) support, expanding to include [Go](https://golang.org/)
The WasmLib started with [Rust](https://www.rust-lang.org/) support, expanding to include [Go](https://golang.org/)
and [TypeScript](https://www.typescriptlang.org/) with the help of respective Wasm code generators:

| Language | Wasm code generator |
Expand All @@ -84,5 +84,5 @@ and [TypeScript](https://www.typescriptlang.org/) with the help of respective Wa
| Rust | [wasm-pack](https://rustwasm.github.io/wasm-pack/) |
| TypeScript | [AssemblyScript](https://www.assemblyscript.org/) |

These generators maintain a common subset of their host language, aiming for a unified coding style to simplify the
These generators maintain a common subset of their host language, aiming for a unified coding style to simplify the
initiation into smart contract creation, welcoming developers with a C-style language background to quickly adapt.
6 changes: 6 additions & 0 deletions docs/build/isc/v1.0.0-rc.6/docs/getting-started/tools.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ tags:
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
import {AddToMetaMaskButton, EVMNetworks} from '@theme/AddToMetaMaskButton';
import DeployWithRemix from '../_admonitions/_deploy_with_remix.md';
import DeployWithHardhat from '../_admonitions/_deploy_with_hardhat.md';
import { ChainId } from '@theme/ChainId';

# Compatible Tools
Expand Down Expand Up @@ -95,6 +97,8 @@ the `Environment` dropdown.

![Select Injected Provider from the Environment dropdown](/img/evm/remix-injected-provider-metamask.png)

<DeployWithRemix/>

Metamask will ask to connect to Remix, and once connected, it will set the `Environment` to `Injected Web3` with
the "Custom (<ChainId url='https://json-rpc.evm.shimmer.network'/>) network" or "Custom (<ChainId url='https://json-rpc.evm.testnet.shimmer.network'/>) network".

Expand Down Expand Up @@ -140,6 +144,8 @@ networks: {
</TabItem>
</Tabs>

<DeployWithHardhat/>

:::caution

Currently, there is no validation service available for EVM/Solidity smart contracts on IOTA Smart Contracts, which is
Expand Down
77 changes: 36 additions & 41 deletions docs/build/isc/v1.0.0-rc.6/docs/how-tos/EVM/ERC20.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,41 +12,39 @@ tags:
- how to
---

# ERC20 Example
import DeployWithRemix from '../../_admonitions/_deploy_with_remix.md';
import DeployWithHardhat from '../../_admonitions/_deploy_with_hardhat.md';

## Prerequisites
# Create ERC20 Custom Tokens

- [Remix IDE](https://remix.ethereum.org/).
- [A Metamask Wallet](https://metamask.io/).
- [Connect your MetaMask with the public Testnet](../../getting-started/tools.mdx#metamask).
## Required Prior Knowledge

### Required Prior Knowledge

This guide assumes you are familiar with [tokens](https://en.wikipedia.org/wiki/Cryptocurrency#Crypto_token)
This guide assumes you are familiar with the concept
of [tokens](https://en.wikipedia.org/wiki/Cryptocurrency#Crypto_token)
in [blockchain](https://en.wikipedia.org/wiki/Blockchain),
[Ethereum Request for Comments (ERCs)](https://eips.ethereum.org/erc)(also known as Ethereum Improvement Proposals (EIP))
, [NFTs](learn/protocols/stardust/core-concepts/multi-asset-ledger#non-fungible-tokens-nfts), [Smart Contracts](/learn/smart-contracts/introduction) and have
already tinkered with [Solidity](https://docs.soliditylang.org/en/v0.8.16/).
[Ethereum Request for Comments (ERCs)](https://eips.ethereum.org/erc)(also known as Ethereum Improvement Proposals (
EIP))
, [NFTs](learn/protocols/stardust/core-concepts/multi-asset-ledger#non-fungible-tokens-nfts), [Smart Contracts](/learn/smart-contracts/introduction)
and have already tinkered with [Solidity](https://docs.soliditylang.org/en/v0.8.16/).
ERC20 is a standard for fungible tokens and is defined in
the [EIP-20 Token Standard](https://eips.ethereum.org/EIPS/eip-20) by Ethereum.

This guide will use the [Remix IDE](https://remix.ethereum.org/), but you can use this contract with any IDE you are
familiar with.

## About ERC20

With the ERC20 standard, you can create your own tokens and transfer them to the EVM on IOTA Smart Contracts without
fees.

You can use the [Remix IDE](https://remix.ethereum.org/) to deploy any regular Solidity Smart Contract.

Set the environment to `Injected Web3` and connect Remix with your MetaMask wallet.
If you haven’t already, please follow the instructions
on [how to connect your MetaMask with the public Testnet.](../../getting-started/tools.mdx#metamask).

## 1. Create a Smart Contract
## 1. Create the Smart Contract

Create a new Solidity file, for example, `ERC20.sol` in the contracts folder of
your [Remix IDE](https://remix.ethereum.org/) and add this code snippet:

```solidity
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.7;
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
Expand All @@ -58,46 +56,43 @@ contract ExampleERC20Token is ERC20 {
}
```

This imports all functions from the OpenZeppelin smart contract and creates a new ERC20 token with your name and Symbol.
OpenZeppelin provides many audited smart contracts and is a good point to start and learn.

You can change the token name `ExampleERC20Token` and the token symbol `EET`.
This imports all functions from the [OpenZeppelin ERC20](https://docs.openzeppelin.com/contracts/4.x/erc20) smart
contract and creates a new ERC20 token with your name and Symbol.

## 2. Compile Your Smart Contract
:::tip OpenZeppelin

Go to the second tab and compile your smart contract with the **Compile ERC20.sol** button.
OpenZeppelin provides many audited smart contracts and is a good point to start and learn.

![Compile ERC20.sol](/img/evm/examples/compile.png)
:::

## 3. Deploy Your Smart Contract
:::note Customize Your Token

1. Go to the next tab and select `Injected Web3` as your environment. Ensure that your MetaMask is installed and set up
correctly.
You can change the token name `ExampleERC20Token` and the token symbol `EET` for anything you want.

2. Choose your ´ExampleERC20Token´ smart contract in the contract dropdown.
:::

3. Press the "Deploy" button. Your MetaMask wallet will pop up, and you will need to accept the deployment.
<DeployWithRemix/>

![Deploy ERC20.sol](/img/evm/examples/deploy.png)
## 2. Add Your Custom Tokens to MetaMask

4. Your MetaMask browser extension will open automatically - press **confirm**.
Once you have deployed your contract, you can add your new custom token to your Metamask account.

![Confirm in MetaMask](/img/evm/examples/deploy-metamask.png)
1. Open Metamask, and click on the transaction that created the contract. From there, you can simply click
on `View on block explorer` to visit the transaction details. Alternatively, you can copy the transaction ID and
visit the [ShimmerEVM Explorer](https://explorer.evm.testnet.shimmer.network/)
or [ShimmerEVM Testnet Explorer](https://explorer.evm.testnet.shimmer.network/) and use the search bar to find transaction.

## 4. Add Your Token to MetaMask
!['View on block explorer](/img/evm/how-tos/ERC20/metamask-get-transaction-or-go-to-block-explorer.png)

1. Get the `contract address` from the transaction after the successful deployment. You can click on the latest
transaction in your MetaMask Activity tab. If you have configured your MetaMask correctly,
the [ShimmerEVM Explorer](https://explorer.evm.shimmer.network) will open the transaction.
2. Copy the contract address and import your token into MetaMask.
2. Copy the contract address from the transaction details, and import your custom ERC20 tokens into MetaMask.

![Copy contract address](/img/evm/examples/explorer-contract-address.png)
![Copy contract address](/img/evm/how-tos/ERC20/metamask-import-tokens.png)

## 5. Have some Fun
## 3. Have some Fun

Now you should see your token in MetaMask. You can send them to your friends without any fees or gas costs.

![Copy contract address](/img/evm/examples/erc20-balance.png)
![Copy contract address](/img/evm/how-tos/ERC20/metamask-erc20-balance.png)

You also can ask in the [Discord Chat Server](https://discord.iota.org) to send them around and discover what the
community is building on IOTA Smart Contracts.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ description: 'Learn how to deploy smart contracts to Shimmer EVM and Shimmer EVM
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
import {AddToMetaMaskButton, EVMNetworks} from '@theme/AddToMetaMaskButton';
import { ChainId } from '@theme/ChainId';

# Deploy a Smart Contract

Expand Down
104 changes: 0 additions & 104 deletions docs/build/isc/v1.0.0-rc.6/docs/how-tos/EVM/get-funds.md

This file was deleted.

4 changes: 0 additions & 4 deletions docs/build/isc/v1.0.0-rc.6/docs/how-tos/magic.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +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,
<<<<<<<< HEAD:docs/build/isc/v1.0.0-rc.6/docs/how-tos/magic.md
calls [ISC Sandbox's](../explanations/sandbox.md) `GetEntropy`.
========
calls [ISC Sandbox's](/learn/smart-contracts/sandbox) `GetEntropy`.
>>>>>>>> 136ca6e9c8 (re-merge EVM and WASM):docs/build/isc/v1.0.0-rc.6/docs/how-tos/use-the-magic-contract/magic.md

```solidity
pragma solidity >=0.8.5;
Expand Down
4 changes: 0 additions & 4 deletions docs/build/isc/v1.0.0-rc.6/docs/how-tos/send-tokens-to-l1.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,7 @@ tags:
- JSON
- RPC
---
<<<<<<<< HEAD:docs/build/isc/v1.0.0-rc.6/docs/how-tos/send-tokens-to-l1.mdx
import AboutAccounts from '../_admonitions/_about-accounts.md';
========
import AboutAccounts from '../../_admonitions/_about-accounts.md';
>>>>>>>> 136ca6e9c8 (re-merge EVM and WASM):docs/build/isc/v1.0.0-rc.6/docs/how-tos/use-the-magic-contract/send-tokens-to-l1.mdx

# Send Assets and Tokens to L1

Expand Down
Loading

0 comments on commit 671ad23

Please sign in to comment.