ADI Network Testnet Quickstart
Getting starting developing with ADI Network Testnet
You can use all standard EVM tooling for ADI Network Testnet. You can find instructions for bridging testnet ADI and ETH to the ADI Network Testnet in the Network Details page.
To get started with Foundry or Hardhat, follow the steps below:
Deploying to ADI Network Testnet
Below are setup examples for Foundry and Hardhat 3 (with Viem or Ethers). Select your preferred setup tab:
Foundry Setup
1. The Counter contract code
contract Counter {
uint256 public number;
function setNumber(uint256 newNumber) public {
number = newNumber;
}
function increment() public {
number++;
}
}
2. Create a new Foundry project
forge init Counter
cd Counter
3. Build the project
forge build
4. Set your private key for deploying
export TESTNET_PRIVATE_KEY="0x..."
5. Create counter.sol
file and put the contract code inside.
counter.sol
file and put the contract code inside.6. Create counter.s.sol
and put the script inside, the script will deploy the counter contract
counter.s.sol
and put the script inside, the script will deploy the counter contract// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.13;
import {Script} from "forge-std/Script.sol";
import {Counter} from "../src/Counter.sol";
contract CounterScript is Script {
Counter public counter;
function setUp() public {}
function run() public {
vm.startBroadcast();
counter = new Counter();
vm.stopBroadcast();
}
}
7. Deploy the contract
forge script script/Counter.s.sol \
--rpc-url https://zksync-os-testnet-alpha.zksync.dev \
--broadcast --private-key $TESTNET_PRIVATE_KEY
8. Set the number value
cast send 0xCA1386680bfd9D89c7cc6Fc3ba11938ba6E44fef \
"setNumber(uint256)" 5 \
--rpc-url https://rpc.testnet.adifoundation.ai \
--private-key $TESTNET_PRIVATE_KEY
9. Get the latest number value
cast call 0xCA1386680bfd9D89c7cc6Fc3ba11938ba6E44fef \
"number()" \
--rpc-url https://rpc.testnet.adifoundation.ai
Last updated