Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/cygaar/ERC721Stylus
Implementation of ERC721 in Rust for Stylus
https://github.com/cygaar/ERC721Stylus
Last synced: 14 days ago
JSON representation
Implementation of ERC721 in Rust for Stylus
- Host: GitHub
- URL: https://github.com/cygaar/ERC721Stylus
- Owner: cygaar
- Created: 2023-10-03T03:16:19.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2023-10-06T17:08:00.000Z (about 1 year ago)
- Last Synced: 2024-05-21T17:11:30.251Z (6 months ago)
- Language: Rust
- Size: 638 KB
- Stars: 14
- Watchers: 1
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: licenses/Apache-2.0
Awesome Lists containing this project
- awesome-stylus - https://github.com/cygaar/ERC721Stylus/ (Rust)
README
# ERC721 Stylus
Implementation of ERC721 in Rust for Arbitrum's [Stylus](https://docs.arbitrum.io/stylus/stylus-gentle-introduction).
Most of the code is based off of the example [here](https://github.com/OffchainLabs/stylus-workshop-nft/blob/main/src/erc712.rs), however there are several differences:
- Fixed balances bug in the transfer function
- Fixed receiver check for safeMint and safeTransfer
- Optimized mint function to be more gas efficient
- Optimized safeMint function to be more gas efficient
- mint(address) has been changed to mint(address, tokenId). Same goes for safeMint.
- totalSupply was removed from the base implementation
- supportsInterface returns true for IERC721Metadata
- tokenUri() has been renamed to tokenUR() to match the ERC721 spec
- Changed internal burn() function to only require a tokenId
- Refactored code to match the latest Stylus SDK## Running the code
To get the contract abi, you can run:
```bash
cargo stylus export-abi
```To deploy the code you can run (this will use the default Stylus RPC):
```bash
cargo stylus deploy --private-key=
```You can interact with Stylus contracts as you would any other contract using the exported ABI.
More info on Stylus can be found [here](https://docs.arbitrum.io/stylus/stylus-quickstart).