-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #22 from push-protocol/FrameWork-for-governance-tests
Added tests from OZ repo
- Loading branch information
Showing
24 changed files
with
4,539 additions
and
1,569 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,73 @@ | ||
// SPDX-License-Identifier: MIT | ||
|
||
pragma solidity ^0.8.20; | ||
|
||
contract CallReceiverMock { | ||
event MockFunctionCalled(); | ||
event MockFunctionCalledWithArgs(uint256 a, uint256 b); | ||
|
||
uint256[] private _array; | ||
|
||
function mockFunction() public payable returns (string memory) { | ||
emit MockFunctionCalled(); | ||
|
||
return "0x1234"; | ||
} | ||
|
||
function mockFunctionEmptyReturn() public payable { | ||
emit MockFunctionCalled(); | ||
} | ||
|
||
function mockFunctionWithArgs(uint256 a, uint256 b) public payable returns (string memory) { | ||
emit MockFunctionCalledWithArgs(a, b); | ||
|
||
return "0x1234"; | ||
} | ||
|
||
function mockFunctionNonPayable() public returns (string memory) { | ||
emit MockFunctionCalled(); | ||
|
||
return "0x1234"; | ||
} | ||
|
||
function mockStaticFunction() public pure returns (string memory) { | ||
return "0x1234"; | ||
} | ||
|
||
function mockFunctionRevertsNoReason() public payable { | ||
revert(); | ||
} | ||
|
||
function mockFunctionRevertsReason() public payable { | ||
revert("CallReceiverMock: reverting"); | ||
} | ||
|
||
function mockFunctionThrows() public payable { | ||
assert(false); | ||
} | ||
|
||
function mockFunctionOutOfGas() public payable { | ||
for (uint256 i = 0; ; ++i) { | ||
_array.push(i); | ||
} | ||
} | ||
|
||
function mockFunctionWritesStorage(bytes32 slot, bytes32 value) public returns (string memory) { | ||
assembly { | ||
sstore(slot, value) | ||
} | ||
return "0x1234"; | ||
} | ||
} | ||
|
||
contract CallReceiverMockTrustingForwarder is CallReceiverMock { | ||
address private _trustedForwarder; | ||
|
||
constructor(address trustedForwarder_) { | ||
_trustedForwarder = trustedForwarder_; | ||
} | ||
|
||
function isTrustedForwarder(address forwarder) public view virtual returns (bool) { | ||
return forwarder == _trustedForwarder; | ||
} | ||
} |
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.