Skip to content

Commit

Permalink
Merge branch 'main' into manySmallContractImprovements
Browse files Browse the repository at this point in the history
  • Loading branch information
josojo authored Jan 12, 2024
2 parents a827efd + be9a5c0 commit 453b610
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 10 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,6 @@ artifacts/*
cache_hardhat/
.openzeppelin/
deployment/deploy_output.json
report
lcov.info

7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,3 +113,10 @@ run tests:
```
forge test
```

run coverage tools:
```
forge coverage --ir-minimum --report lcov
genhtml -o report lcov.info
open index.html in browser
```
8 changes: 0 additions & 8 deletions contracts/ForkonomicToken.sol
Original file line number Diff line number Diff line change
Expand Up @@ -74,14 +74,6 @@ contract ForkonomicToken is
);
}

/// @dev Allows anyone to prepare the splitting of tokens
/// by burning them
/// @param amount The amount of tokens to burn
function prepareSplittingTokens(uint256 amount) public onlyAfterForking {
_burn(msg.sender, amount);
childTokenAllowances[msg.sender][false] += amount;
childTokenAllowances[msg.sender][true] += amount;
}

/// @inheritdoc IForkonomicToken
function splitTokensIntoChildTokens(uint256 amount) external {
Expand Down
2 changes: 1 addition & 1 deletion foundry.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ src = "contracts"
out = "out"
libs = ["node_modules", "lib"]
optimizer = true
optimizer_runs = 200
optimizer_runs = 500
evm_version = "london"
solc_version = "0.8.20"

Expand Down
2 changes: 1 addition & 1 deletion hardhat.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ module.exports = {
settings: {
optimizer: {
enabled: true,
runs: 200,
runs: 500,
},
},
},
Expand Down
22 changes: 22 additions & 0 deletions test/ForkableBridge.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -844,5 +844,27 @@ contract ForkableBridgeWrapperTest is Test {
ForkableBridgeWrapper(child1).setAndCheckClaimed(index);
vm.expectRevert(selector);
ForkableBridgeWrapper(child2).setAndCheckClaimed(index);

// check that the _verify function within PolygonZkEVMBridge calls really
// the _setAndCheckClaimed function of the ForkableBridge contract
// and not the _setAndCheckClaimed function of the PolygonZkEVMBridge contract
bytes32[32] memory smtProof;
for (uint256 i = 0; i < 32; i++) {
smtProof[i] = forkableBridge.branch(i);
}
vm.expectRevert(selector);
// forkableBridgeWrapper.claimAsset will call the PolygonZkEVMBridge.claimAsset function
ForkableBridgeWrapper(child1).claimAsset(
smtProof,
uint32(index),
bytes32(0),
bytes32(0),
uint32(0),
address(0x1),
uint32(1),
address(0),
uint256(1),
bytes("0x")
);
}
}

0 comments on commit 453b610

Please sign in to comment.