Deploying and Testing Your Token

Step 3: Interacting with the Contract

Setting Up MetaMask

  1. Install MetaMask: Install the MetaMask browser extension from metamask.io.

  2. Configure MetaMask for Arbitrum:

    • Click on the network dropdown in MetaMask and select "Custom RPC".

    • Enter the following details:

      • Network Name: Arbitrum Sepolia Testnet

      • New RPC URL: https://sepolia-rollup.arbitrum.io/rpc

      • Chain ID: 421613 (for Sepolia)

      • Symbol: ETH

      • Block Explorer URL: https://explorer.arbitrum.io

    • Save the network configuration.

Acquiring Testnet ETH

  1. Visit a Sepolia Faucet: Use one of the following links to get Sepolia ETH for testing:

  2. Enter your MetaMask wallet address: Click "Claim" to receive Sepolia ETH.

Interacting with the Contract using Ethers.js

Create a script.js file with the following content:

Run the script:

This script connects to your deployed ERC-20 contract, retrieves token information, checks balances, and performs a token transfer.

Conclusion

You have successfully created and deployed an ERC-20 token contract using Rust and Arbitrum Stylus. You also learned how to interact with your contract using Ethers.js. This example demonstrates the power and flexibility of combining Rust with blockchain development on the Arbitrum network. Happy coding!

Last updated