123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778 |
- // SPDX-License-Identifier: MIT
- pragma solidity ^0.8.20;
- contract CallReceiverMock {
- event MockFunctionCalled();
- event MockFunctionCalledWithArgs(uint256 a, uint256 b);
- event MockFunctionCalledExtra(address caller, uint256 value);
- 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";
- }
- function mockFunctionExtra() public payable {
- emit MockFunctionCalledExtra(msg.sender, msg.value);
- }
- }
- contract CallReceiverMockTrustingForwarder is CallReceiverMock {
- address private _trustedForwarder;
- constructor(address trustedForwarder_) {
- _trustedForwarder = trustedForwarder_;
- }
- function isTrustedForwarder(address forwarder) public view virtual returns (bool) {
- return forwarder == _trustedForwarder;
- }
- }
|