Deploy Smart Contracts with Foundry
We’ll create a simple SplitWise app, a contract where friends can track and settle debts.
Prerequisites
Install Foundry:
curl -L <https://foundry.paradigm.xyz> | bash foundryupNode.js & npm (for optional frontend)
Hela Node/Web3 Gateway running locally or using testnet RPC URL
Wallet (Metamask) configured to connect to Hela RPC
Check the version:
forge --versionInitialize Foundry Project:
Let’s create a new project:
forge init hello-hela
cd hello-helaInside this folder, you now have:
src/→ your contractstest/→ your tests
Write the Smart Contract:
We’ll create a simple SplitWise app, a contract where friends can track and settle debts.
Create :(src/SplitWise.sol)
Write a Simple Test (test/SplitWise.t.sol)
test/SplitWise.t.sol)Tests are super important to confirm things work before spending gas.
Run the tests:
Deploy to HeLa
Open foundry.toml and add your Hela testnet endpoint:
Deploy with:
Interact with Your Contract
Add an expense:
Check balance:
You’ll see a number:
Positive → your friend owes you
Negative → you owe them
Support :
If you encounter any issues during setup or require assistance, please join the HeLa Developer Community for direct support and guidance.
Last updated