@@ -16,8 +16,6 @@ contract Orchestrator is Ownable {
16
16
bytes data;
17
17
}
18
18
19
- event TransactionFailed (address indexed destination , uint256 index , bytes data );
20
-
21
19
// Stable ordering is not guaranteed.
22
20
Transaction[] public transactions;
23
21
@@ -47,9 +45,8 @@ contract Orchestrator is Ownable {
47
45
for (uint256 i = 0 ; i < transactions.length ; i++ ) {
48
46
Transaction storage t = transactions[i];
49
47
if (t.enabled) {
50
- bool result = externalCall ( t.destination, t.data);
48
+ ( bool result , ) = t.destination. call ( t.data);
51
49
if (! result) {
52
- emit TransactionFailed (t.destination, i, t.data);
53
50
revert ("Transaction Failed " );
54
51
}
55
52
}
@@ -94,38 +91,4 @@ contract Orchestrator is Ownable {
94
91
function transactionsSize () external view returns (uint256 ) {
95
92
return transactions.length ;
96
93
}
97
-
98
- /**
99
- * @dev wrapper to call the encoded transactions on downstream consumers.
100
- * @param destination Address of destination contract.
101
- * @param data The encoded data payload.
102
- * @return True on success
103
- */
104
- function externalCall (address destination , bytes memory data ) internal returns (bool ) {
105
- bool result;
106
- assembly {
107
- // solhint-disable-line no-inline-assembly
108
- // "Allocate" memory for output
109
- // (0x40 is where "free memory" pointer is stored by convention)
110
- let outputAddress := mload (0x40 )
111
-
112
- // First 32 bytes are the padded length of data, so exclude that
113
- let dataAddress := add (data, 32 )
114
-
115
- result := call (
116
- // 34710 is the value that solidity is currently emitting
117
- // It includes callGas (700) + callVeryLow (3, to pay for SUB)
118
- // + callValueTransferGas (9000) + callNewAccountGas
119
- // (25000, in case the destination address does not exist and needs creating)
120
- sub (gas (), 34710 ),
121
- destination,
122
- 0 , // transfer value in wei
123
- dataAddress,
124
- mload (data), // Size of the input, in bytes. Stored in position 0 of the array.
125
- outputAddress,
126
- 0 // Output is ignored, therefore the output size is zero
127
- )
128
- }
129
- return result;
130
- }
131
94
}
0 commit comments