Skip to content

XueDAOTW/24-sol-workshop-hw1

Repository files navigation

XueDAO - CONNECT Hackathon: XueToken Workshop

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.

Workshop Overview

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.

Tasks and Unit Tests

1. Implement Basic Token Transfer

Develop the core functionality to enable token transfers between addresses.

Unit Test Command:

forge test --mt test_CheckTransferPoints -vvv

2. Implement Token Approval

Enable address owners to approve third parties to spend tokens on their behalf.

Unit Test Command:

forge test --mt test_CheckApprovePoints -vvv

3. Implement TransferFrom Functionality

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

Smart Contract Location

The smart contract for XueToken is located in the following directory:

./src/XueToken.sol

Unit tests are available in:

./test/XueToken.t.sol

Usage

This is a list of the most frequently needed commands.

Build

Build the contracts:

$ forge build

Clean

Delete the build artifacts and cache directories:

$ forge clean

Compile

Compile the contracts:

$ forge build

Coverage

Get a test coverage report:

$ forge coverage

Deploy

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

Format the contracts:

$ forge fmt

Gas Usage

Get a gas report:

$ forge test --gas-report

Lint

Lint the contracts:

$ pnpm run lint

Test

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

Related Efforts

License

This project is licensed under MIT.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published