Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added tests from OZ repo #22

Merged
merged 3 commits into from
Apr 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
73 changes: 73 additions & 0 deletions contracts/CallReceiverMock.sol
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;
}
}
2 changes: 1 addition & 1 deletion contracts/PushGovernor.sol
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ contract PushGovernor is Initializable, GovernorUpgradeable, GovernorSettingsUpg
}

function quorum(uint256 blockNumber) public pure override returns (uint256) {
return 40000000e18;
return 4e18;
}

// The following functions are overrides required by Solidity.
Expand Down
Loading