Deploy a basic token airdrop to veCRV holders at a specified height
A bare-bones implementation of the Ethereum ERC-20 standard, written in Vyper.
For Solidity, check out token-mix.
Install Brownie, if you haven't already.
Download the mix.
brownie bake vyper-token
This mix provides a simple template upon which you can build your own token, as well as unit tests providing 100% coverage for core ERC20 functionality.
To interact with a deployed contract in a local environment, start by opening the console:
brownie consoleNext, deploy a test token:
>>>token=Token.deploy("Test Token", "TST", 18, 1e21, {'from': accounts[0]})
Transactionsent: 0x4a61edfaaa8ba55573603abd35403cf41291eca443c983f85de06e0b119da377Gasprice: 0.0gweiGaslimit: 12000000Token.constructorconfirmed-Block: 1Gasused: 521513 (4.35%)
Tokendeployedat: 0xd495633B90a237de510B4375c442C0469D3C161CYou now have a token contract deployed, with a balance of 1e21 assigned to accounts[0]:
>>>token<TokenContract'0xd495633B90a237de510B4375c442C0469D3C161C'>>>>token.balanceOf(accounts[0])
1000000000000000000000>>>token.transfer(accounts[1], 1e18, {'from': accounts[0]})
Transactionsent: 0xb94b219148501a269020158320d543946a4e7b9fac294b17164252a13dce9534Gasprice: 0.0gweiGaslimit: 12000000Token.transferconfirmed-Block: 2Gasused: 51668 (0.43%)
<Transaction'0xb94b219148501a269020158320d543946a4e7b9fac294b17164252a13dce9534'>To run the tests:
brownie testThe unit tests included in this mix are very generic and should work with any ERC20 compliant smart contract. To use them in your own project, all you must do is modify the deployment logic in the tests/conftest.py::token fixture.
To get started with Brownie:
- Check out the other Brownie mixes that can be used as a starting point for your own contracts. They also provide example code to help you get started.
- "Getting Started with Brownie" is a good tutorial to help you familiarize yourself with Brownie.
- For more in-depth information, read the Brownie documentation.
Any questions? Join our Gitter channel to chat and share with others in the community.
This project is licensed under the MIT license.