Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/OffchainLabs/stylus-erc20
https://github.com/OffchainLabs/stylus-erc20
Last synced: 14 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/OffchainLabs/stylus-erc20
- Owner: OffchainLabs
- Created: 2024-06-13T15:36:11.000Z (5 months ago)
- Default Branch: main
- Last Pushed: 2024-09-10T12:01:02.000Z (2 months ago)
- Last Synced: 2024-09-10T13:37:16.459Z (2 months ago)
- Language: Solidity
- Size: 3.24 MB
- Stars: 2
- Watchers: 3
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: licenses/Apache-2.0
Awesome Lists containing this project
- awesome-stylus - https://github.com/OffchainLabs/stylus-erc20 (Rust)
README
# Stylus ERC-20 example
Implementation example of an ERC-20 token contract written in Rust for Arbitrum Stylus.
Disclaimer: this code is unaudited and not fit for production use.
## Getting started
Follow the instructions in the [Stylus quickstart](https://docs.arbitrum.io/stylus/stylus-quickstart) to configure your development environment.
## Deploying and testing the contract
The `scripts` folder contains two scripts to deploy and test the contract:
1. [./scripts/deploy.sh](./scripts/deploy.sh) deploys the contract to the chain specified in the .env file, using cargo-stylus
2. [./scripts/test.sh](./scripts/test.sh) performs a series of calls to verify that the contract behaves as expectedRemember to set the environment variables in an `.env` file.
## Deploying behind a proxy
This project also includes a Solidity Proxy to deploy the ERC-20 contract behind it, so it can be upgraded in the future. To do this, use the script [./scripts/deployWithProxy.sh](./scripts/deployWithProxy.sh).
To update the logic contract, use the script [./scripts/updateLogic.sh](./scripts/updateLogic.sh).
Note that this Proxy is based on the TransparentUpgradeableProxy of Solidity, but the ERC-20 contract itself is not Initializable.
## How to run a local Stylus dev node
Instructions to setup a local Stylus dev node can be found [here](https://docs.arbitrum.io/stylus/how-tos/local-stylus-dev-node).
## How to get ETH for the Stylus testnet
The Stylus testnet is an L3 chain that settles to Arbitrum Sepolia. The usual way of obtaining ETH is to bridge it from Arbitrum Sepolia through the [Arbitrum Bridge](https://bridge.arbitrum.io/?destinationChain=stylus-testnet&sourceChain=arbitrum-sepolia). You can find a list of Arbitrum Sepolia faucets [here](https://docs.arbitrum.io/stylus/reference/testnet-information#faucets).
## Useful resources
- [Stylus quickstart](https://docs.arbitrum.io/stylus/stylus-quickstart)
- [Stylus by example](https://arbitrum-stylus-by-example.vercel.app/)
- [Awesome Stylus](https://github.com/OffchainLabs/awesome-stylus)
- [Stylus Telegram group](https://t.me/arbitrum_stylus)
- [Discord channel](https://discord.com/channels/585084330037084172/1146789176939909251)## Stylus reference links
- [Stylus documentation](https://docs.arbitrum.io/stylus/stylus-gentle-introduction)
- [Stylus SDK](https://github.com/OffchainLabs/stylus-sdk-rs)
- [Cargo Stylus](https://github.com/OffchainLabs/cargo-stylus)