This repository was archived by the owner on May 9, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 155
Expand file tree
/
Copy pathTestContracts.sol
More file actions
100 lines (80 loc) · 2.49 KB
/
Copy pathTestContracts.sol
File metadata and controls
100 lines (80 loc) · 2.49 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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
// SPDX-License-Identifier: LGPL-3.0-only
pragma solidity 0.8.11;
import "./handlers/HandlerHelpers.sol";
contract NoArgument {
event NoArgumentCalled();
function noArgument() external {
emit NoArgumentCalled();
}
}
contract OneArgument {
event OneArgumentCalled(uint256 indexed argumentOne);
function oneArgument(uint256 argumentOne) external {
emit OneArgumentCalled(argumentOne);
}
}
contract TwoArguments {
event TwoArgumentsCalled(address[] argumentOne, bytes4 argumentTwo);
function twoArguments(address[] calldata argumentOne, bytes4 argumentTwo) external {
emit TwoArgumentsCalled(argumentOne, argumentTwo);
}
}
contract ThreeArguments {
event ThreeArgumentsCalled(string argumentOne, int8 argumentTwo, bool argumentThree);
function threeArguments(string calldata argumentOne, int8 argumentTwo, bool argumentThree) external {
emit ThreeArgumentsCalled(argumentOne, argumentTwo, argumentThree);
}
}
contract WithDepositer {
event WithDepositerCalled(address argumentOne, uint256 argumentTwo);
function withDepositer(address argumentOne, uint256 argumentTwo) external {
emit WithDepositerCalled(argumentOne, argumentTwo);
}
}
contract ReturnData {
function returnData(string memory argument) external pure returns(bytes32 response) {
assembly {
response := mload(add(argument, 32))
}
}
}
contract HandlerRevert is HandlerHelpers {
uint private _totalAmount;
constructor(
address bridgeAddress
) public HandlerHelpers(bridgeAddress) {
}
function executeProposal(bytes32, bytes calldata) external view {
if (_totalAmount == 0) {
revert('Something bad happened');
}
return;
}
function virtualIncreaseBalance(uint amount) external {
_totalAmount = amount;
}
}
contract TestForwarder {
function execute(bytes memory data, address to, address sender) external {
bytes memory callData = abi.encodePacked(data, sender);
(bool success, ) = to.call(callData);
require(success, "Relay call failed");
}
}
contract TestTarget {
uint public calls = 0;
uint public gasLeft;
bytes public data;
bool public burnAllGas;
fallback() external payable {
gasLeft = gasleft();
calls++;
data = msg.data;
if (burnAllGas) {
assert(false);
}
}
function setBurnAllGas() public {
burnAllGas = true;
}
}