You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jan 9, 2026. It is now read-only.
**Important**: The `chainweb.config.json` configuration file is only used when running scripts with `ChainwebScript`.
162
162
When running tests with `ChainwebTest`, the configuration parameters are passed directly to the constructor and the configuration file is ignored.
163
163
164
+
## Setup function
165
+
166
+
To add custom setup logic to tests or scripts, you should use the optional `userSetUp` method instead of the default Foundry `setUp` method.
167
+
168
+
For example:
169
+
170
+
```bash
171
+
contract CounterTest is ChainwebTest(2, 0) {
172
+
functionuserSetUp() public override {
173
+
// Custom setup can be done here if needed
174
+
console.log("Setting up your test here");
175
+
}
176
+
}
177
+
```
178
+
164
179
## Tests
165
180
166
181
To write tests that run on Chainweb EVM and support the multi-chain network, you should extend the `ChainwebTest` contract that's defined in the `lib/foundry-chainweb/src/Chainweb.sol` file instead of using the default Foundry `Test` base contract.
@@ -437,3 +452,51 @@ Sensitive details saved to: /Users/pistolas/foundry-chainweb/examples/Counter/ca
437
452
In the sample output for deploying the contract on multiple chains, you'll notice that the Foundry chain identifiers are computed using the default value from the `foundry.toml` file (`31337`) as a base value and incremented for each Chainweb EVM chain.
438
453
As a result of the computation, Chainweb EVM chain 20 (index 0) maps to the Foundry chain identifier 31337, Chainweb EVM chain 21 (index 1) maps to the Foundry chain identifier 31338, and so on.
439
454
455
+
## Verifying contracts
456
+
457
+
You can verify contracts that run on Chainwebd EVM by running the standard `forge verify-contract` command.
458
+
The following example demonstrates verifying a contract like `Counter.sol` that has no constructor arguments:
You can run the following command to see all the options:
481
+
482
+
```bash
483
+
forge verify-contract --help
484
+
```
485
+
486
+
For contracts that run on multiple Chainweb EVM chains, you must run the `verify-contract`command on each chain.
487
+
However, the `verify-contract`command doesn't support verification if a contract with the same bytecode has been previously verified.
488
+
If you attempt to verify a contract with the same bytecode as a contract that has been previously verified, verification will fail with a message similar to the following:
489
+
490
+
```bash
491
+
[address] is already verified. Skipping verification.
492
+
```
493
+
494
+
To test contract verification on multiple chains, you must change the bytecode, redeploy, then run the verify-contract command on the redployed contract.
495
+
496
+
You can change the bytecode by adding a constant at the top of the contract like this:
497
+
498
+
```solidity
499
+
uint256 public constant DUMMY = 1;
500
+
```
501
+
502
+
Increase the value used for the constant in each contract you deploy to verify contracts that are deployed on multiple chains.
0 commit comments