Skip to content

Commit 1014a37

Browse files
author
Dan Laine
committed
update wording
1 parent 6b63715 commit 1014a37

File tree

2 files changed

+50
-54
lines changed

2 files changed

+50
-54
lines changed

SUMMARY.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
* [Create a Variable-Cap Asset](build/tutorials/smart-digital-assets/creating-a-variable-cap-asset.md)
5050
* [Create an NFT \(Part 1\)](build/tutorials/smart-digital-assets/creating-a-nft-part-1.md)
5151
* [Mint NFTs with the Avalanche Wallet](build/tutorials/smart-digital-assets/wallet-nft-studio.md)
52-
* [How to use WAVAX on Avalanche](how-to-use-wavax-on-avalanche.md)
52+
* [Use Wrapped AVAX (WAVAX) on Avalanche](build/tutorials/smart-digital-assets/how-to-use-wavax-on-avalanche.md)
5353
* [AvalancheGo APIs](build/avalanchego-apis/README.md)
5454
* [Issuing API Calls](build/avalanchego-apis/issuing-api-calls.md)
5555
* [Platform Chain \(P-Chain\) API](build/avalanchego-apis/platform-chain-p-chain-api.md)
Lines changed: 49 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,30 @@
1-
# How to use WAVAX on Avalanche
1+
# How to use Wrapped AVAX (WAVAX) on Avalanche
22

33
## What is WAVAX?
44

5-
AVAX is the native token on the [Avalanche platform](../../../learn/platform-overview/README.md). However, many of the smart contracts on the Contract Chain (C-Chain), which is an instance of the Ethereum Virtual Machine, are designed to work with Ethereum's ERC-20 tokens. Since the two are not directly compatible, to be able to use AVAX in the contracts that expect ERC-20 tokens, AVAX needs to be *wrapped* into WAVAX \(Wrapped AVAX\), which is ERC-20 compatible.
5+
AVAX is the native token on the [Avalanche platform](../../../learn/platform-overview/README.md). Many smart contracts on the Contract Chain (C-Chain), which is an instance of the Ethereum Virtual Machine, are designed to work with Ethereum's ERC-20 tokens. In order to use AVAX in such contracts, you must use wrapped AVAX \(WAVAX\), which is ERC-20 compatible.
66

77
## Overview
88

9-
The process of converting AVAX to WAVAX consists of depositing AVAX to a smart contract that locks the received tokens, and issues ERC-20 WAVAX to you. When you wish to get your AVAX back, you return the WAVAX to the smart contract, it burns the WAVAX and unlocked AVAX are withdrawn to you.
9+
To convert AVAX to WAVAX you will deposit AVAX into a smart contract which will lock the AVAX and issue WAVAX to you. To convert WAVAX to AVAX, you will return the WAVAX to the smart contract, which will burn the WAVAX and return your AVAX.
1010

11-
There are several steps involved:
12-
* connecting Metamask to Avalanche Platform
13-
* funding your account
14-
* loading WAVAX contract into Remix
15-
* connecting to deployed contract
16-
* issuing deposit/withdraw commands to the contract
17-
* adding WAVAX to Metamask
11+
In this tutorial, you will:
12+
* Connect Metamask to Avalanche
13+
* Fund your Metamask account
14+
* Load the WAVAX contract into Remix
15+
* Connect to the pre-deployed WAVAX contract
16+
* Convert AVAX to WAVAX and back
17+
* Add WAVAX as a custom token to Metamask
1818

19-
Ok, let's go.
19+
## Connect Metamask
2020

21-
## Connecting Metamask
21+
[Metamask](https://metamask.io/) is a popular web browser extension that makes it easy to interact with Ethereum and compatible blockchains, such as Avalanche's C-Chain. Setting up Metamask and creating an account on it is beyond the scope of this tutorial, but there are a number of resources on the internet to walk you through that.
2222

23-
[Metamask](https://metamask.io/) is a popular web browser extension that makes it easy to interact with Ethereum and compatible blockchains, such as Avalanche's C-Chain. Setting up Metamask, and an account on it is beyond the scope of this tutorial, but there are a number of readily available resources on the internet for that.
24-
25-
After you log in to your Metamask account, we need to connect it to the Avalanche platform. Click the Network drop-down -> Select Custom RPC:
23+
After you log in to your Metamask account, connect it to the Avalanche network. Click the Network drop-down -> Select **Custom RPC**:
2624

2725
![metamask network dropdown](../../../.gitbook/assets/metamask-network-dropdown.png)
2826

29-
Enter the information for the network of your choice as described below.
27+
Enter the information for the network of your choice:
3028

3129
### Avalanche Mainnet Settings:
3230

@@ -36,67 +34,65 @@ Enter the information for the network of your choice as described below.
3634
* **Symbol**: `AVAX`
3735
* **Explorer**: [https://cchain.explorer.avax.network/](https://cchain.explorer.avax.network/)
3836

39-
### FUJI Testnet Settings:
37+
### Fuji Testnet Settings:
4038

41-
* **Network Name**: Avalanche FUJI C-Chain
39+
* **Network Name**: Avalanche Fuji C-Chain
4240
* **New RPC URL**: [https://api.avax-test.network/ext/bc/C/rpc](https://api.avax-test.network/ext/bc/C/rpc)
4341
* **ChainID**: `0xa869`
4442
* **Symbol**: `AVAX`
4543
* **Explorer**: [https://cchain.explorer.avax-test.network](https://cchain.explorer.avax-test.network/)
4644

47-
After the changes are saved, select one of the Avalanche networks. You should see your AVAX balance, which will probably be 0.
45+
After saving the changes, select the Avalanche network you just specified. You should see your AVAX balance, which will probably be 0.
4846

49-
## Funding your C-Chain account
47+
## Fund your C-Chain account
5048

51-
We need to get some funds into the account.
49+
You need to get some AVAX into your account.
5250

53-
### **Using Avalanche Wallet**
51+
### **Using the Avalanche Wallet**
5452

55-
If you already have some AVAX, you can transfer them to the Metamask account. But first you need to find out your X-Chain address, as you can only transfer AVAX between accounts on the X-Chain. To do that, open your Ethereum account in the [Avalanche Wallet](https://wallet.avax.network/). Wallet accepts Ethereum private keys, so you need to export it from Metamask. Open the overflow menu \(three dots\), and select **Account details**.
53+
If you already have some AVAX, you can transfer them to your Metamask account. But first you need to find out your X-Chain address, as you can only transfer AVAX between accounts on the X-Chain. To do that, open your Ethereum account in the [Avalanche Wallet](https://wallet.avax.network/). Wallet accepts Ethereum private keys, so you need to export it from Metamask. Open the overflow menu \(three dots\), and select **Account details**.
5654

5755
![Account details](../../../.ghassets/wavax2avax-01-metamask.png)
5856

59-
There you select **Export private key**, and after entering your Metamask password, copy the private key to the clipboard. Use that private key to log into the Avalanche Wallet. After navigating to [https://wallet.avax.network/](https://wallet.avax.network/) select **Access Wallet** and then **Private Key**. Paste your Ethereum private key and click **Access Wallet**. Don't worry, your private key will not be saved or transmitted over the network.
57+
Select **Export private key** and enter your Metamask password. Copy the private key to your clipboard. Go to the [Avalanche Wallet](https://wallet.avax.network/), select **Access Wallet** and then **Private Key**. Paste your Ethereum private key and click **Access Wallet**. Don't worry, your private key will not be saved or transmitted over the network.
6058

6159
After you log in, you will see your funds, addresses and other information. Copy your X-Chain address (it starts with `X-avax1` on mainnet, and `X-fuji1` on current test net) and use it to send tokens from your funded wallet. Return to your Wallet logged in with Metamask account. There you can [Cross Chain Transfer](../platform/transfer-avax-between-x-chain-and-c-chain.md) your AVAX from X-Chain to C-Chain. They should be visible in your Metamask shortly after the transfer.
6260

63-
### **Using Test Network Faucet**
61+
### **Using the Test Network Faucet**
6462

65-
For funding on the test network, you can use the Test Network Faucet. Navigate to [https://faucet.avax-test.network/](https://faucet.avax-test.network/) and paste your Ethereum address, as it is shown below the account name in Metamask: `0x` prefix, followed by 40 hexadecimal numbers. Ex: 0xDd1749831fbF70d88AB7bB07ef7CD9c53D054a57. When you click on the account name, it will automatically copy it to the clipboard.
63+
If you're connected to the test network, you can use its faucet to fund your Metamask account. Navigate to [the faucet](https://faucet.avax-test.network/) and paste your Ethereum address, which is shown below the account name in Metamask (e.g.`0xDd1749831fbF70d88AB7bB07ef7CD9c53D054a57`). When you click on the account name, it will copy the account to the clipboard.
6664

6765
![Faucet funding](../../../.ghassets/wavax2avax-02-faucet.png)
6866

6967
Paste that address into the faucet, prove that you're not a robot, and then request test AVAX. They should appear in your Metamask shortly.
7068

71-
Ok, we're funded and ready for WAVAX smart contract.
72-
73-
## Loading WAVAX contract into Remix
69+
## Load WAVAX contract into Remix
7470

75-
Remix is a popular online tool for writing, deploying and interacting with smart contracts. It works in the browser, no need for installation or any local files. Point your browser to [https://remix.ethereum.org/](https://remix.ethereum.org/). You will land on the Home screen, with options for importing contracts.
71+
Remix is a popular browser-based tool for writing, deploying and interacting with smart contracts. Naviate to [Remix's website](https://remix.ethereum.org/). Scroll down until you see options for importing contracts.
7672

7773
![Import from GitHub](../../../.ghassets/wavax2avax-03-remix-import.png)
7874

79-
Select **GitHub**, and in the input field paste `https://github.com/ava-labs/wrapped-assets/raw/main/WAVAX.sol` and select **OK**. That will load the contract into Remix.
75+
Select **GitHub**, and in the input field paste `https://raw.githubusercontent.com/ava-labs/wrapped-assets/main/WAVAX.sol` and select **OK**. That will load the contract into Remix.
8076

8177
![File Explorer](../../../.ghassets/wavax2avax-04-contract.png)
8278

83-
After switching to the File Explorer on the left side, select `WAVAX.sol`, which is the contract we just loaded.
79+
Switching to the File Explorer tab on the left and select `WAVAX.sol`, which is the contract we just loaded.
8480

8581
On the left side menu, switch to Compile tab:
8682

8783
![Compile](../../../.ghassets/wavax2avax-05-compile.png)
8884

89-
Check that compiler version is compatible with the contract, as shown. Press **Compile WAVAX.sol**, and check that WAVAX has appeared under Contract. If everything is ok, we're now ready to connect to the deployed contract on the Avalanche platform.
85+
Check that compiler version is compatible with the contract, as shown. Press **Compile WAVAX.sol**, and check that WAVAX contract has appeared in the `CONTRACT` field below. Now you're ready to connect to the WAVAX contract, which has already been deployed on the Avalanche network.
9086

91-
## Connecting to deployed WAVAX contract
87+
## Connect to the WAVAX contract
9288

93-
Switch to **Deploy & Run Tranasactions** tab in the menu:
89+
Switch to the **Deploy & Run Tranasactions** tab on the left side.
9490

9591
![Connect](../../../.ghassets/wavax2avax-06-deploy.png)
9692

97-
Make sure you're logged in your Metamask. In the **Environment** dropdown menu, select `Injected Web3`. That will pop up Metamask, asking you to select the account \(choose the one connected with Avalanche\) and allow it to connect. This will pre-fill the **Account** field. Make sure `WAVAX` is selected under **Contract**. We can now connect to the contract that is already published on Avalanche. In the **At Address** edit field, copy:
98-
* For main net: `0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7`
99-
* For Fuji test net: `0xd00ae08403B9bbb9124bB305C09058E32C39A48c`
93+
Make sure you're logged in to your Metamask. In the **Environment** dropdown menu, select `Injected Web3`. Metamask will pop up and ask you to select the account. Choose the one connected to Avalanche and allow it to connect. This will pre-fill the **Account** field. Make sure the **Contract** field is set to the `WAVAX` contract. Now we can connect to the contract, which has already published on Avalanche. In the **At Address** edit field, copy:
94+
* For Mainnet: `0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7`
95+
* For Fuji Testnet: `0xd00ae08403B9bbb9124bB305C09058E32C39A48c`
10096

10197
After pasting the address, press the **At Address** button.
10298

@@ -106,29 +102,21 @@ Remix should find the deployed contract:
106102

107103
We are now ready to interact with the contract. Open the contract interface by pressing the highlighted arrow.
108104

109-
## Issuing commands to the contract
105+
## Issue Commands to the WAVAX Contract
110106

111107
Let's wrap some AVAX!
112108

113-
Since ETH is denominated in 10^18 smaller units \(wei\), and AVAX is denominated in 10^9, switch the value selector from `wei` to `gwei` \(giga-wei, or 10^9 wei, making the units compatible\).
109+
Since ETH is denominated in 10^18 smaller units \(wei\), and AVAX is denominated in 10^9, switch the value selector from `wei` to `gwei` \(gigawei\). 1 gwei = 10^9 wei = 1 nAVAX.
114110

115111
![Interaction](../../../.ghassets/wavax2avax-08-interact.png)
116112

117-
### Wrapping AVAX to WAVAX
118-
119-
So, to wrap 10AVAX, enter `10000000000` gwei in the **value** field. To initiate the wrapping, click **Deposit**. You will be presented with a Confirm transaction dialog by Remix. When you press **Confirm** Metamask will pop up, also asking for confirmation. Press **Confirm** in Metamask too. You should notice your AVAX amount lowered by 10, plus the fee amount. Skip to the next section to see your WAVAX in Metamask.
120-
121-
### Unwrapping WAVAX to AVAX
122-
123-
To unwrap WAVAX, expand the arrow next to **Withdraw** button:
124-
125-
![Withdraw](../../../.ghassets/wavax2avax-09-withdraw.png)
113+
### Wrap AVAX to Create WAVAX
126114

127-
Unfortunately, withdraw field is denominated in wei, so our 10AVAX ends up as `10000000000000000000` for the withdraw amount. Pressing **Transact** will trigger the same confirmation first in Remix, then in Metamask. Your AVAX should be back in the account, minus the fee amount.
115+
To wrap 10 AVAX, enter `10000000000` \(10^10\) gwei in the **Value** field. To initiate the wrapping, click **Deposit**. You will be presented with a prompt by Remix to confirm the transaction. When you press **Confirm** Metamask will pop up, also asking for confirmation. Press **Confirm** in Metamask, too. You should notice your AVAX balance lowered by 10, plus the fee amount. Skip to the next section to see your WAVAX in Metamask.
128116

129-
## Adding WAVAX to Metamask
117+
## Add WAVAX to Metamask
130118

131-
To see your WAVAX balance, we need to add WAVAX as a custom token. Select **Add token** button in Metamask, and switch to **Custom Token** tab:
119+
To see your WAVAX balance, you must add WAVAX as a custom token to Metamask. In Metamask, select the three dots next to your account name and select `Expand View`. This opens a new browser tab. Scroll down and select **Add token**. Switch to the **Custom Token** tab.
132120

133121
![Custom Token](../../../.ghassets/wavax2avax-10-add-token.png)
134122

@@ -138,7 +126,15 @@ In the **Token Contract Address** paste the same contract address we used before
138126

139127
Click **Next** and **Add Tokens**. Your WAVAX should now be visible in under your account in Metmask.
140128

129+
### Unwrap WAVAX to AVAX
130+
131+
To unwrap WAVAX, expand the arrow next to **Withdraw** button:
132+
133+
![Withdraw](../../../.ghassets/wavax2avax-09-withdraw.png)
134+
135+
Unfortunately, the withdraw field is denominated in wei, so 10 AVAX is represented as `10000000000000000000` \(10^19\) for the withdraw amount. Pressing **Transact** will trigger the same confirmation first in Remix, then in Metamask. Your AVAX should be back in the account, minus the fee amount.
136+
141137
## Conclusion
142138

143-
You should now be able to interact with smart contracts on Avalanche's C-Chain with WAVAX, ERC-20 version of AVAX. In the future, this should be significantly simpler, with built-in support from the Wallet and exchanges, but in the meantime, you will still be able to access upcoming DEXes, bridges and other Solidity-based contracts on the Avalanche Platform.
139+
You can now interact with smart contracts on Avalanche's C-Chain with WAVAX, the ERC-20 version of AVAX. In the future, converting between AVAX and WAVAX will be significantly simpler, with built-in support from the Wallet and exchanges, but in the meantime, you can still access DEXes, bridges and other Solidity-based contracts on the Avalanche Platform.
144140

0 commit comments

Comments
 (0)