-
Notifications
You must be signed in to change notification settings - Fork 158
Expand file tree
/
Copy pathNoReceiveForwarder.sol
More file actions
38 lines (32 loc) · 1.1 KB
/
NoReceiveForwarder.sol
File metadata and controls
38 lines (32 loc) · 1.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/// @notice A call forward that doesnt implement the receive or fallback functions, so cant receive value
contract NoReceiveForwarder {
function forward(address to, bytes calldata data) public payable {
(bool success,) = address(to).call{value: msg.value}(data);
require(success, "call forward failed");
}
}
/// @notice A call forward that does implement the receive or fallback functions, so cant receive value
contract ReceivingForwarder {
function forward(address to, bytes calldata data) public payable {
(bool success,) = address(to).call{value: msg.value}(data);
require(success, "call forward failed");
}
receive() external payable {}
}
/// @notice Errors upon construction
contract ConstructorError {
constructor() {
require(false, "test error in constructor");
}
}
/// @notice Errors upon construction
contract ConstructorFine {
constructor() {
require(true, "test error in constructor");
}
function number() public pure returns (uint256) {
return 0;
}
}