-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: init fork tests from Fork.t.sol instead from cli
- Loading branch information
Showing
6 changed files
with
90 additions
and
69 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity ^0.8.17; | ||
|
||
import "forge-std/Test.sol"; | ||
import "forge-std/console.sol"; | ||
import {IAddressesProvider, AuthRequestBuilder, ClaimRequestBuilder, SignatureBuilder, RequestBuilder} from "src/SismoConnectLib.sol"; | ||
|
||
interface IAvailableRootsRegistry { | ||
event RegisteredRoot(uint256 root); | ||
|
||
function registerRoot(uint256 root) external; | ||
|
||
function owner() external view returns (address); | ||
} | ||
|
||
contract ForkTest is Test { | ||
IAddressesProvider sismoAddressesProvider; | ||
IAvailableRootsRegistry availableRootsRegistry; | ||
|
||
AuthRequestBuilder authRequestBuilder; | ||
ClaimRequestBuilder claimRequestBuilder; | ||
SignatureBuilder signatureBuilder; | ||
RequestBuilder requestBuilder; | ||
|
||
function setUp() public virtual { | ||
vm.createSelectFork({urlOrAlias: "mainnet"}); | ||
|
||
sismoAddressesProvider = IAddressesProvider(0x3Cd5334eB64ebBd4003b72022CC25465f1BFcEe6); | ||
availableRootsRegistry = IAvailableRootsRegistry( | ||
sismoAddressesProvider.get(string("sismoConnectAvailableRootsRegistry")) | ||
); | ||
|
||
authRequestBuilder = AuthRequestBuilder( | ||
sismoAddressesProvider.get(string("authRequestBuilder-v1.1")) | ||
); | ||
claimRequestBuilder = ClaimRequestBuilder( | ||
sismoAddressesProvider.get(string("claimRequestBuilder-v1.1")) | ||
); | ||
signatureBuilder = SignatureBuilder( | ||
sismoAddressesProvider.get(string("signatureBuilder-v1.1")) | ||
); | ||
requestBuilder = RequestBuilder(sismoAddressesProvider.get(string("requestBuilder-v1.1"))); | ||
} | ||
|
||
function _registerTreeRoot(uint256 root) internal { | ||
address rootsRegistryOwner = availableRootsRegistry.owner(); | ||
// prank to the rootsRegistryOwner | ||
vm.startPrank(rootsRegistryOwner); | ||
availableRootsRegistry.registerRoot(root); | ||
vm.stopPrank(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters