https://github.com/m4cs/vyper-erc721a
ERC721A Implementation Written in Vyperlang - WIP
https://github.com/m4cs/vyper-erc721a
erc721 erc721a nfts vyper vyper-contracts
Last synced: 3 months ago
JSON representation
ERC721A Implementation Written in Vyperlang - WIP
- Host: GitHub
- URL: https://github.com/m4cs/vyper-erc721a
- Owner: M4cs
- Created: 2022-08-06T05:19:39.000Z (almost 3 years ago)
- Default Branch: master
- Last Pushed: 2022-08-06T05:19:54.000Z (almost 3 years ago)
- Last Synced: 2025-02-17T21:13:21.298Z (4 months ago)
- Topics: erc721, erc721a, nfts, vyper, vyper-contracts
- Language: Vyper
- Homepage:
- Size: 3.91 KB
- Stars: 6
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# ERC721A - Vyper Implementation
I was bored and couldn't find an ERC721A specific implementation written in Vyper. I decided to translate it from Solidity over into Vyper. This should implement everything apart from the extraData from ERC721A... maybe even better? I hear Vyper is pretty efficient on gas, haven't done any testing yet.
Feel free to contribute. This is just a starting point, I basically just picked up Vyper to write this so I'm sure it's awful to any Vyper OGs.
The language is cool though, definitely enjoyed writing a contract basically using Python.
## What's Available Out of the Box?
This Vyper implementation offers a (mostly) 1:1 rewrite of ERC721A. I decided to not include `_safeTransferFrom` because it's not really necessary and just spends more gas. The contract itself includes an internal `_burn` and `_mint` function, and the functionality you'd expect from `transferFrom`. There is no `_beforeTokenTransfers` or `_afterTokenTransfers` because those are also pretty useless and if you want to do that, just edit the functionality in the Vyper contract.
Vyper doesn't support virtual or overridable functions so instead you will just have to edit whatever functions you'd normally override.
There is also a basic implementation of `toString()` included which allows you to convert uint256 tokenIds to strings.
Any contribution is most welcome. Hope this helps somebody! Plan to update with more contracts as I learn Vyper.
## To Compile:
Install Vyper:
```
pip3 install vyper
```Compile Bytecode and export ABI:
```
# To get Bytecode:
vyper ./contracts/ERC721A.vy# To get ABI:
vyper -f abi ./contracts/ERC721A.vy
```