0
0
Blockchain / Solidityprogramming~30 mins

CI/CD for smart contracts in Blockchain / Solidity - Mini Project: Build & Apply

Choose your learning style9 modes available
CI/CD for Smart Contracts
📖 Scenario: You are working on a blockchain project that uses smart contracts. To make sure your smart contracts are always tested and deployed safely, you want to set up a simple Continuous Integration and Continuous Deployment (CI/CD) pipeline.This pipeline will automatically test your smart contract code and deploy it to a test network when changes are made.
🎯 Goal: Build a basic CI/CD pipeline script that:Defines the smart contract source filesSets a test network configurationRuns tests on the smart contractsDeploys the smart contracts to the test network
📋 What You'll Learn
Create a list of smart contract files
Add a variable for the test network name
Write a command to run smart contract tests
Write a command to deploy smart contracts to the test network
Print deployment success message
💡 Why This Matters
🌍 Real World
Blockchain developers use CI/CD pipelines to automate testing and deployment of smart contracts, ensuring code quality and faster updates.
💼 Career
Understanding CI/CD for smart contracts is valuable for blockchain developer roles and DevOps positions supporting blockchain projects.
Progress0 / 4 steps
1
Define smart contract files
Create a list called contract_files with these exact smart contract filenames: "Token.sol", "Crowdsale.sol", and "Wallet.sol".
Blockchain / Solidity
Need a hint?

Use square brackets [] to create a list and include the filenames as strings inside.

2
Set test network configuration
Add a variable called test_network and set it to the string "sepolia" to specify the Ethereum test network.
Blockchain / Solidity
Need a hint?

Assign the string "sepolia" to the variable test_network.

3
Run smart contract tests
Write a line that runs the command npx hardhat test using Python's os.system function to execute tests on the smart contracts.
Blockchain / Solidity
Need a hint?

Use os.system to run shell commands from Python.

4
Deploy contracts and print success
Write a line that runs the command npx hardhat run scripts/deploy.js --network sepolia using os.system to deploy the contracts to the test network. Then write a print statement that outputs exactly "Deployment to sepolia successful!".
Blockchain / Solidity
Need a hint?

Use os.system to run the deploy command with the --network sepolia option. Then print the success message exactly.