Skip to content

Commit

Permalink
revisions
Browse files Browse the repository at this point in the history
  • Loading branch information
owenwahlgren committed Oct 1, 2024
1 parent 02028b6 commit fc0836a
Show file tree
Hide file tree
Showing 8 changed files with 39 additions and 35 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ icon: Book
**Interchain Token Transfers (ICTT)** allow assets, such as ERC-20 or native tokens, to move seamlessly between different Avalanche L1 blockchains. The system consists of a **TokenHome** contract, which lives on the source blockchain, and **TokenRemote** contracts, which reside on other Avalanche L1s that want to receive the asset.

---
![](/course-images/ictt/ictt.png)

---
### Overview of How It Works

- **Home and Remote Contracts**:
Expand All @@ -34,9 +36,11 @@ Assets can be transferred in multiple configurations:

This flexibility allows developers to choose how assets are represented and used across multiple Avalanche L1s.

Configurations of the `TokenHome` and `TokenRemote` contracts can be found [here](https://github.com/ava-labs/avalanche-interchain-token-transfer/tree/main/contracts/src)

- **Permissionless Registration**:

ICTT is designed to be permissionless. Anyone can register a compatible **TokenRemote** instance to a **TokenHome** contract, expanding the network of chains that can receive transferred tokens.
ICTT is designed to be permissionless. Anyone can register a compatible `TokenRemote` instance to a `TokenHome` contract, expanding the network of chains that can receive transferred tokens.

- **Customizable Logic**:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,20 @@ In this section, you will learn how to transfer an ERC-20 token from Avalanche
<Step>
### Create a new blockchain and Deploy on Local Network

Use the `avalanche` CLI to create a new blockchain where you will deploy the ERC-20 as the native token.
Use the **Avalanche CLI** to create a new blockchain where you will deploy the ERC-20 as the native token.


```bash
avalanche blockchain create myblockchain
```
```bash
avalanche blockchain deploy myblockchain
```
</Step>
<Step>
### Deploy an ERC-20 Contract on C-Chain

Use the `avalanche` CLI to create a new blockchain where you will deploy the ERC-20 as the native token.
Use the **Avalanche CLI** to create a new blockchain where you will deploy the ERC-20 as the native token.

You will deploy an ERC-20 token on the Avalanche C-Chain, which will later be transferred and used as the native token on the new L1.

Expand All @@ -35,7 +37,7 @@ forge create --rpc-url local-c --private-key $PK lib/avalanche-interchain-token-
</Step>
<Step>
### Deploy Interchain Token Transfer Contracts
Set up the home and remote transferer contracts for transferring tokens between the C-Chain and the L".
Set up the home and remote transferer contracts for transferring tokens between the C-Chain and the newly created L1.

- `ERC20TokenHome` Contract on C-Chain
```bash
Expand Down Expand Up @@ -96,10 +98,11 @@ cast send --rpc-url local-c --private-key $PK $ERC20_HOME_C_CHAIN "approve(addre
```

- **Add Collateral and Send Tokens**
Add collateral to the transferer contract and send the tokens to the L1.
Add collateral to the transferer contract.
```bash
cast send --rpc-url local-c --private-key $PK $ERC20_HOME_TRANSFERER_C_CHAIN "addCollateral(bytes32, address, uint256)" $L1_BLOCKCHAIN_ID_HEX $NATIVE_TOKEN_REMOTE_L1 100000000000000000000
```
Send tokens to the L1
```bash
cast send --rpc-url local-c --private-key $PK $ERC20_HOME_TRANSFERER_C_CHAIN "send((bytes32, address, address, address, uint256, uint256, uint256, address), uint256)" "(${L1_BLOCKCHAIN_ID_HEX}, ${NATIVE_TOKEN_REMOTE_L1}, ${FUNDED_ADDRESS}, ${ERC20_HOME_C_CHAIN}, 0, 0, 250000, 0x0000000000000000000000000000000000000000)" 1000000000000000000000
```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ Use the `avalanche` CLI to create a new blockchain where you will deploy the ERC

```bash
avalanche blockchain create myblockchain
```
```bash
avalanche blockchain deploy myblockchain
```

Expand Down Expand Up @@ -49,7 +51,7 @@ Now, deploy the Interchain Token Transfer contracts on both the `C-Chain` and th
forge create --rpc-url local-c --private-key $PK lib/avalanche-interchain-token-transfer/contracts/src/TokenHome/NativeTokenHome.sol:NativeTokenHome --constructor-args $TELEPORTER_REGISTRY_C_CHAIN $FUNDED_ADDRESS $WRAPPED_NATIVE_C_CHAIN
```

- `NativeTokenRemote` Contract on C-Chain
- `NativeTokenRemote` Contract on `myblockchain`

```bash
forge create --rpc-url myblockchain --private-key $PK lib/avalanche-interchain-token-transfer/contracts/src/TokenRemote/NativeTokenRemote.sol:NativeTokenRemote --constructor-args "(${TELEPORTER_REGISTRY_L1}, ${FUNDED_ADDRESS}, ${C_CHAIN_BLOCKCHAIN_ID_HEX}, ${NATIVE_HOME_TRANSFERER_C_CHAIN})" "NATV" 700000000000000000000 0 false 0
Expand All @@ -67,7 +69,7 @@ export NATIVE_TOKEN_REMOTE_L1=<"Deployed to" address>
<Step>
### Grant Native Minting Rights to NativeTokenRemote

To ensure that the `NativeTokenRemote` contract can mint native tokens on the L1 when ERC-20 tokens are transferred from the `C-Chain`, the contract must be granted **minting rights**. This is done by adding the `NativeTokenRemote contract` address to the `Native Minter Precompile`.
To ensure that the `NativeTokenRemote` contract can mint native tokens on the L1 when ERC-20 tokens are transferred from the `C-Chain`, the contract must be granted **minting rights**. This is done by adding the `NativeTokenRemote` contract address to the `Native Minter Precompile`.

1. You will need to interact with the `Native Minter Precompile`, which resides at a fixed address on all Avalanche L1s:
**Native Minter Precompile Address**: `0x0200000000000000000000000000000000000001`
Expand Down Expand Up @@ -111,10 +113,11 @@ cast send --rpc-url local-c --private-key $PK $ERC20_HOME_C_CHAIN "approve(addre
```

- **Add Collateral and Send Tokens**
Add collateral to the transferer contract and send the tokens to the L1.
Add collateral to the transferer contract.
```bash
cast send --rpc-url local-c --private-key $PK $ERC20_HOME_TRANSFERER_C_CHAIN "addCollateral(bytes32, address, uint256)" $L1_BLOCKCHAIN_ID_HEX $NATIVE_TOKEN_REMOTE_L1 100000000000000000000
```
Send tokens to the L1.
```bash
cast send --rpc-url local-c --private-key $PK $ERC20_HOME_TRANSFERER_C_CHAIN "send((bytes32, address, address, address, uint256, uint256, uint256, address), uint256)" "(${L1_BLOCKCHAIN_ID_HEX}, ${NATIVE_TOKEN_REMOTE_L1}, ${FUNDED_ADDRESS}, ${ERC20_HOME_C_CHAIN}, 0, 0, 250000, 0x0000000000000000000000000000000000000000)" 1000000000000000000000
```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,14 @@ icon: Terminal

You've made it to the end of the section. Let's check your progress.

<Accordions>
<Accordion title="Question 1">
---

<Quiz quizId="205"/>
</Accordion>
<Accordion title="Question 2">
---
<Quiz quizId="206"/>
</Accordion>
<Accordion title="Question 3">
---
<Quiz quizId="207"/>
</Accordion>
<Accordion title="Question 4">
---
<Quiz quizId="208"/>
</Accordion>
<Accordion title="Question 5">
---
<Quiz quizId="209"/>
</Accordion>
</Accordions>
2 changes: 1 addition & 1 deletion content/course/l1-tokenomics/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ This course is for people with some blockchain knowledge. Check out this [guide]
This course is intended for people with knowledge about Cross-Chain communication protocols, and a solid understanding of the basic concepts of Avalanche. You should be familiar with these concepts:

1. Avalanche Architecture: Be familiar with Avalanche blockchains.
2. Cross-Chain Messages: Know how to communicate 2 Avalanche blockchains with Teleporter.
2. Cross-Chain Messages: Know how to communicate between two Avalanche blockchains with Teleporter.

If some of this is not clear, we strongly recommend taking the Avalanche Fundamentals, Multi-Chain Architecture, and Interchain Messaging courses first.

Expand Down
28 changes: 14 additions & 14 deletions content/courses.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ const officialCourses: Course[] = [
icon: <ArrowLeftRight />,
featured: true,
duration: "2.5 hours",
tools: ["Telepoter", "Foundry"],
tools: ["ICM", "Foundry"],
languages: ["Solidity"],
instructors: ["Martin Eckardt", "Andrea Vargas", "Ash", "Owen Wahlgren", "Sarp"]
},
Expand Down Expand Up @@ -99,7 +99,18 @@ const officialCourses: Course[] = [
languages: ["Go"],
instructors: ["Martin Eckardt", "Ash"] // + Usman
},
{
{
name:"L1 Tokenomics",
description:"Learn how to design and deploy tokenomics for your Avalanche L1",
slug:"l1-tokenomics",
icon: <Coins />,
duration: "2 hours",
featured: true,
tools: ["Avalanche-CLI", "ICM"],
languages: ["Solidity"],
instructors: ["Sarp"]
},
{
name:"AvaCloud APIs",
description:"Learn how to leverage AvaCloud APIs to build web apps on Avalanche",
slug:"avacloudapis",
Expand All @@ -109,18 +120,7 @@ const officialCourses: Course[] = [
tools: ["AvaCloudSDK", "AvaCloud API"],
languages: ["Typescript"],
instructors: ["Owen Wahlgren"]
},
{
name:"L1 Tokenomics",
description:"Learn how to leverage AvaCloud APIs to build web apps on Avalanche",
slug:"l1-tokenomics",
icon: <Coins />,
duration: "2 hour",
featured: true,
tools: ["Avalanche-CLI", "Teleporter", "Solidity"],
languages: ["Solidity"],
instructors: ["Sarp"]
}
}
];

const ecosystemCourses: Course[] = [
Expand Down
Binary file added public/course-banner/l1-tokenomics.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/course-images/ictt/ictt.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit fc0836a

Please sign in to comment.