-
Notifications
You must be signed in to change notification settings - Fork 3
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
1 parent
a86384f
commit 0c56527
Showing
1 changed file
with
41 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
// SPDX-License-Identifier: CAL | ||
pragma solidity =0.8.19; | ||
|
||
import "forge-std/Test.sol"; | ||
import {Flow, FlowTransferV1} from "../../src/concrete/basic/Flow.sol"; | ||
import { | ||
SignedContextV1, | ||
EvaluableConfigV3, | ||
EvaluableV2 | ||
} from "rain.interpreter.interface/interface/IInterpreterCallerV2.sol"; | ||
import {IInterpreterV2, IInterpreterStoreV2} from "rain.interpreter.interface/interface/IInterpreterV2.sol"; | ||
|
||
contract FlowTest is Test { | ||
function testValidateMultipleSignedContexts( | ||
bytes memory data, | ||
IInterpreterV2 interpreter, | ||
IInterpreterStoreV2 store, | ||
address expression, | ||
uint256[] memory callerContext, | ||
SignedContextV1[] memory signedContexts, | ||
uint256 fuzzedKeyAlice | ||
) public { | ||
address alice = vm.addr((fuzzedKeyAlice % (SECP256K1_ORDER - 1)) + 1); | ||
|
||
// Create a new Flow contract instance | ||
Flow flow = new Flow(); | ||
|
||
// Decode the data to initialize the contract | ||
EvaluableConfigV3[] memory flowConfig = abi.decode(data, (EvaluableConfigV3[])); | ||
|
||
// Initialization | ||
vm.prank(alice); | ||
flow.initialize(data); | ||
|
||
// Create an evaluable object | ||
EvaluableV2 memory evaluable = EvaluableV2({interpreter: interpreter, store: store, expression: expression}); | ||
|
||
// Call the flow function with fuzzed data | ||
FlowTransferV1 memory flowTransfer = flow.flow(evaluable, callerContext, signedContexts); | ||
} | ||
} |