Skip to content

Commit

Permalink
Update InvariantBridge.t.sol
Browse files Browse the repository at this point in the history
  • Loading branch information
wcgcyx committed Feb 21, 2024
1 parent 32e49ed commit fcfc463
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions test/invariant/InvariantBridge.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -225,4 +225,25 @@ contract InvariantBridge is Test {
assertEq(bridgeBalance, userBalanceSum);
}
}

/// forge-config: default.invariant.runs = 256
/// forge-config: default.invariant.depth = 15
/// forge-config: default.invariant.fail-on-revert = true
function invariant_IndividualERC20Balanced() external {
for (uint256 i = 0; i < NO_OF_TOKENS; i++) {
address rootToken = rootTokens[i];
for (uint256 j = 0; j < NO_OF_USERS; j++) {
address user = users[j];

vm.selectFork(rootId);
uint256 balanceL1 = ChildERC20(rootToken).balanceOf(user);
address childToken = rootBridge.rootTokenToChildToken(rootToken);

vm.selectFork(childId);
uint256 balanceL2 = ChildERC20(childToken).balanceOf(user);

assertEq(balanceL1 + balanceL2, MAX_AMOUNT);
}
}
}
}

0 comments on commit fcfc463

Please sign in to comment.