Deploy a Solidity contract to StableNet Testnet using Foundry’sforgeandcasttools.
What you’ll learn
By the end of this tutorial, you’ll be able to:- Configure a Foundry project for StableNet Testnet
- Deploy a WKRC payment contract using
forge script - Call contract functions with
cast sendand verify the result on Explorer
Prerequisites
-
Foundry installed — run
forge --versionto check. If not installed: - Testnet WKRC from the Faucet
Scaffold your project
Configure foundry.toml
Add the StableNet Testnet endpoint tofoundry.toml:
Write WKRCPayment.sol
Delete the placeholder and createsrc/WKRCPayment.sol:
Write the deploy script
Createscript/DeployWKRCPayment.s.sol:
Deploy to Testnet
StableNet enforces a minimum priority fee set by the GovValidator contract. Pass
--priority-gas-price 27600000000000 on every forge script and cast send call.Approve WKRC and send a payment
Before callingpay(), approve the deployed contract to spend WKRC from your wallet:
Verify on Explorer
Open explorer.stablenet.network and search for your contract address. You should see the deployment transaction, theapprove call on the WKRC contract, and the pay call with a Payment event in the logs.
Next steps
Deploy with Hardhat
Deploy the same contract using Hardhat and ethers.js.
Listen to Events
Subscribe to on-chain events with WebSocket.
RPC API Reference
Full list of supported JSON-RPC methods.
Fee Delegation
Let a separate account pay gas for your users.

