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-721 token, aptly named XueNFT.
Participants in the workshop will have the opportunity to design, develop, and test XueNFT, an ERC-721 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.
Enable address owners to approve third parties to manage specific tokens on their behalf.
Unit Test Command:
forge test --mt test_CheckApproveRelatedPoints -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
Ensure safe transfer of tokens, checking if the receiver is capable of handling ERC-721 tokens.
Unit Test Command:
forge test --mt test_CheckSafeTransferFromPoints -vvv
forge script script/Deploy.s.sol:Deploy \
--rpc-url $SEPOLIA_RPC \
--private-key $PRIVATE_KEY \
--verifier-url $VERIFIER_URL \
--broadcast \
--sig "run()" \
-vvv
The smart contract for XueNFT is located in the following directory:
./src/XueNFT.sol
Unit tests are available in:
./test/XueNFT.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.