-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
updated hardhat version and test-suite to support new interface/balancer
- Loading branch information
1 parent
012f38e
commit bbf41e6
Showing
28 changed files
with
4,729 additions
and
9,365 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 |
---|---|---|
|
@@ -12,7 +12,7 @@ jobs: | |
|
||
strategy: | ||
matrix: | ||
node-version: [16.x] | ||
node-version: [20.x] | ||
os: [ubuntu-latest] | ||
|
||
steps: | ||
|
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 |
---|---|---|
@@ -1 +1 @@ | ||
16 | ||
20 |
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,52 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity ^0.8.20; | ||
|
||
contract DMock { | ||
struct MockCall { | ||
bytes data; | ||
bytes returnValue; | ||
} | ||
|
||
// Maps a method signature to its mock call definition | ||
mapping(bytes32 => MockCall) public mockCalls; | ||
|
||
// Fallback function to handle all calls | ||
// solhint-disable-next-line | ||
fallback(bytes calldata) external returns (bytes memory) { | ||
// Check if mock has been defined based on {sig,param} pair | ||
MockCall storage mockCall_ = mockCalls[keccak256(msg.data)]; | ||
|
||
// else check if generic mock has been defined based on sig | ||
if (mockCall_.data.length <= 0) { | ||
mockCall_ = mockCalls[keccak256(abi.encodePacked(bytes4(msg.data)))]; | ||
} | ||
|
||
// solhint-disable-next-line custom-errors | ||
require(mockCall_.data.length > 0, "DMock: method not mocked"); | ||
|
||
// Return the mocked return value | ||
return mockCall_.returnValue; | ||
} | ||
|
||
// Function to set up a mock call, given method sig and parameters | ||
function mockCall(bytes memory data, bytes memory returnValue) public { | ||
mockCalls[keccak256(data)] = MockCall(data, returnValue); | ||
} | ||
|
||
// Function to set up a mock call, given just method sig | ||
function mockMethod(bytes4 sig, bytes memory returnValue) public { | ||
bytes memory data = abi.encodePacked(sig); | ||
mockCalls[keccak256(data)] = MockCall(data, returnValue); | ||
} | ||
|
||
// Function to clear mocked call | ||
function clearMockCall(bytes memory data) public { | ||
delete mockCalls[keccak256(data)]; | ||
} | ||
|
||
// Function to clear mocked method call | ||
function clearMockMethodSig(bytes4 sig) public { | ||
bytes memory data = abi.encodePacked(sig); | ||
delete mockCalls[keccak256(data)]; | ||
} | ||
} |
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 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.