XueDAO is excited to present the CONNECT Hackathon, featuring a comprehensive Solidity workshop designed to provide participants with hands-on experience in blockchain technology and smart contract development. As part of this workshop, we will guide you through the creation and deployment of an ERC-20 token, aptly named XueToken.
Participants in the workshop will have the opportunity to design, develop, and test XueToken, an ERC-20 compliant token. The project is structured into three main parts, each focusing on a critical aspect of token functionality. To ensure a comprehensive understanding, participants must complete the following steps and pass the associated unit tests.
Develop the core functionality to enable token transfers between addresses.
Unit Test Command:
forge test --mt test_CheckTransferPoints -vvv
Enable address owners to approve third parties to spend tokens on their behalf.
Unit Test Command:
forge test --mt test_CheckApprovePoints -vvv
Allow third parties to transfer tokens on behalf of the address owners, within the approved limits.
Unit Test Command:
forge test --mt test_CheckTransferFromPoints -vvv
The smart contract for XueToken is located in the following directory:
./src/XueToken.sol
Unit tests are available in:
./test/XueToken.t.sol
This is a list of the most frequently needed commands.
Build the contracts:
$ forge build
Delete the build artifacts and cache directories:
$ forge clean
Compile the contracts:
$ forge build
Get a test coverage report:
$ forge coverage
Deploy to Anvil:
$ forge script script/Deploy.s.sol --broadcast --fork-url http://localhost:8545
For this script to work, you need to have a MNEMONIC
environment variable set to a valid
BIP39 mnemonic.
For instructions on how to deploy to a testnet or mainnet, check out the Solidity Scripting tutorial.
Format the contracts:
$ forge fmt
Get a gas report:
$ forge test --gas-report
Lint the contracts:
$ pnpm run lint
Run the tests:
$ forge test
Generate test coverage and output result to the terminal:
$ pnpm run test:coverage
Generate test coverage with lcov report (you'll have to open the ./coverage/index.html
file in your browser, to do so
simply copy paste the path):
$ pnpm run test:coverage:report
- abigger87/femplate
- cleanunicorn/ethereum-smartcontract-template
- foundry-rs/forge-template
- FrankieIsLost/forge-template
This project is licensed under MIT.