-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
88 additions
and
145 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity 0.8.24; | ||
|
||
import {Test} from "forge-std/Test.sol"; | ||
import {ERC20Mock} from "openzeppelin-contracts/contracts/mocks/token/ERC20Mock.sol"; | ||
|
||
import {ERC7786Base} from "../src/ERC7786Base.sol"; | ||
import {Call} from "../src/RIP7755Structs.sol"; | ||
|
||
import {MockBeaconOracle} from "./mocks/MockBeaconOracle.sol"; | ||
|
||
contract BaseTest is Test, ERC7786Base { | ||
ERC20Mock mockErc20; | ||
MockBeaconOracle mockBeaconOracle; | ||
|
||
address approveAddr; | ||
|
||
Call[] calls; | ||
address ALICE = makeAddr("alice"); | ||
address FILLER = makeAddr("filler"); | ||
string rootPath; | ||
string validProof; | ||
string invalidL1State; | ||
string invalidBlockHeaders; | ||
string invalidL2StateRootProof; | ||
string invalidL2Storage; | ||
|
||
uint256 constant _REWARD_AMOUNT = 1 ether; | ||
bytes32 constant _VERIFIER_STORAGE_LOCATION = 0x43f1016e17bdb0194ec37b77cf476d255de00011d02616ab831d2e2ce63d9ee2; | ||
|
||
function _setUp() internal { | ||
mockErc20 = new ERC20Mock(); | ||
|
||
deployCodeTo("MockBeaconOracle.sol", abi.encode(), 0x000F3df6D732807Ef1319fB7B8bB8522d0Beac02); | ||
mockBeaconOracle = MockBeaconOracle(0x000F3df6D732807Ef1319fB7B8bB8522d0Beac02); | ||
|
||
rootPath = vm.projectRoot(); | ||
} | ||
|
||
modifier fundAlice(uint256 amount) { | ||
mockErc20.mint(ALICE, amount); | ||
vm.deal(ALICE, amount); | ||
vm.prank(ALICE); | ||
mockErc20.approve(approveAddr, amount); | ||
_; | ||
} | ||
|
||
function _deriveStorageKey(bytes32 messageId) internal pure returns (bytes memory) { | ||
return abi.encode(keccak256(abi.encodePacked(messageId, _VERIFIER_STORAGE_LOCATION))); | ||
} | ||
} |
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
Oops, something went wrong.