Skip to content

Commit 7a82029

Browse files
committed
Deprecate makeArbitraryTransactions
1 parent 1511692 commit 7a82029

File tree

11 files changed

+61
-171
lines changed

11 files changed

+61
-171
lines changed

contracts/colony/ColonyArbitraryTransaction.sol

Lines changed: 2 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -34,34 +34,10 @@ contract ColonyArbitraryTransaction is ColonyStorage {
3434
bytes4 constant BURN_SIG = bytes4(keccak256("burn(uint256)"));
3535
bytes4 constant BURN_GUY_SIG = bytes4(keccak256("burn(address,uint256)"));
3636

37-
function makeArbitraryTransactions(
38-
address[] memory _targets,
39-
bytes[] memory _actions,
40-
bool _strict
41-
) public stoppable auth returns (bool) {
42-
require(_targets.length == _actions.length, "colony-targets-and-actions-length-mismatch");
43-
for (uint256 i; i < _targets.length; i += 1) {
44-
bool success = true;
45-
// slither-disable-next-line unused-return
46-
try this.makeSingleArbitraryTransaction(_targets[i], _actions[i]) returns (bool ret) {
47-
if (_strict) {
48-
success = ret;
49-
}
50-
} catch Error(string memory _err) {
51-
// We failed in a require, which is only okay if we're not in strict mode
52-
if (_strict) {
53-
revert(_err);
54-
}
55-
}
56-
require(success, "colony-arbitrary-transaction-failed");
57-
}
58-
return true;
59-
}
60-
61-
function makeSingleArbitraryTransaction(
37+
function makeArbitraryTransaction(
6238
address _to,
6339
bytes memory _action
64-
) external stoppable self returns (bool) {
40+
) public stoppable auth returns (bool) {
6541
// Prevent transactions to network contracts
6642
require(_to != address(this), "colony-cannot-target-self");
6743
require(_to != colonyNetworkAddress, "colony-cannot-target-network");

contracts/colony/ColonyAuthority.sol

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ contract ColonyAuthority is CommonAuthority {
9898
addRoleCapability(ROOT_ROLE, "upgradeExtension(bytes32,uint256)");
9999
addRoleCapability(ROOT_ROLE, "deprecateExtension(bytes32,bool)");
100100
addRoleCapability(ROOT_ROLE, "uninstallExtension(bytes32)");
101-
addRoleCapability(ROOT_ROLE, "makeArbitraryTransaction(address,bytes)"); // Deprecated
101+
addRoleCapability(ROOT_ROLE, "makeArbitraryTransaction(address,bytes)");
102102
addRoleCapability(ROOT_ROLE, "emitDomainReputationReward(uint256,address,int256)");
103103
addRoleCapability(ROOT_ROLE, "emitSkillReputationReward(uint256,address,int256)");
104104
addRoleCapability(ARBITRATION_ROLE, "transferStake(uint256,uint256,address,address,uint256,uint256,address)");
@@ -116,7 +116,7 @@ contract ColonyAuthority is CommonAuthority {
116116
addRoleCapability(FUNDING_ROLE, "moveFundsBetweenPots(uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256,address)");
117117

118118
// Added in colony v8 (ebony-lwss)
119-
addRoleCapability(ROOT_ROLE, "makeArbitraryTransactions(address[],bytes[],bool)");
119+
addRoleCapability(ROOT_ROLE, "makeArbitraryTransactions(address[],bytes[],bool)"); // Deprecated
120120
addRoleCapability(ROOT_ROLE, "setDefaultGlobalClaimDelay(uint256)");
121121
addRoleCapability(ARBITRATION_ROLE, "setExpenditureMetadata(uint256,uint256,uint256,string)");
122122

contracts/colony/IColony.sol

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -51,24 +51,11 @@ interface IColony is IDSAuth, ColonyDataTypes, IRecovery, IBasicMetaTransaction,
5151
/// @return tokenAddress Address of the token contract
5252
function getToken() external view returns (address tokenAddress);
5353

54-
/// @notice Execute arbitrary transactions on behalf of the Colony in series
55-
/// @param _targets Array of addressed to be targeted
56-
/// @param _actions Array of Bytes arrays encoding the function calls and arguments
57-
/// @param _strict Boolean indicating whether if one transaction fails, the whole call to this function should fail.
58-
/// @return success Boolean indicating whether the transactions succeeded
59-
function makeArbitraryTransactions(
60-
address[] memory _targets,
61-
bytes[] memory _actions,
62-
bool _strict
63-
) external returns (bool success);
64-
65-
/// @notice Executes a single arbitrary transaction
66-
/// @dev Only callable by the colony itself. If you wish to use this functionality, you should
67-
/// use the makeAbitraryTransactions function
54+
/// @notice Executes an arbitrary transaction
6855
/// @param _target Contract to receive the function call
6956
/// @param _action Bytes array encoding the function call and arguments
7057
/// @return success Boolean indicating whether the transactions succeeded
71-
function makeSingleArbitraryTransaction(
58+
function makeArbitraryTransaction(
7259
address _target,
7360
bytes memory _action
7461
) external returns (bool success);

docs/interfaces/icolony.md

Lines changed: 4 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1049,18 +1049,17 @@ Lock the colony's token. Can only be called by a network-managed extension.
10491049
|---|---|---|
10501050
|timesLocked|uint256|The amount of times the token was locked
10511051

1052-
### `makeArbitraryTransactions(address[] memory _targets, bytes[] memory _actions, bool _strict):bool success`
1052+
### `makeArbitraryTransaction(address _target, bytes memory _action):bool success`
10531053

1054-
Execute arbitrary transactions on behalf of the Colony in series
1054+
Executes an arbitrary transaction
10551055

10561056

10571057
**Parameters**
10581058

10591059
|Name|Type|Description|
10601060
|---|---|---|
1061-
|_targets|address[]|Array of addressed to be targeted
1062-
|_actions|bytes[]|Array of Bytes arrays encoding the function calls and arguments
1063-
|_strict|bool|Boolean indicating whether if one transaction fails, the whole call to this function should fail.
1061+
|_target|address|Contract to receive the function call
1062+
|_action|bytes|Bytes array encoding the function call and arguments
10641063

10651064
**Return Parameters**
10661065

@@ -1087,25 +1086,6 @@ Add a new expenditure in the colony. Secured function to authorised members.
10871086
|---|---|---|
10881087
|expenditureId|uint256|Identifier of the newly created expenditure
10891088

1090-
### `makeSingleArbitraryTransaction(address _target, bytes memory _action):bool success`
1091-
1092-
Executes a single arbitrary transaction
1093-
1094-
*Note: Only callable by the colony itself. If you wish to use this functionality, you should use the makeAbitraryTransactions function*
1095-
1096-
**Parameters**
1097-
1098-
|Name|Type|Description|
1099-
|---|---|---|
1100-
|_target|address|Contract to receive the function call
1101-
|_action|bytes|Bytes array encoding the function call and arguments
1102-
1103-
**Return Parameters**
1104-
1105-
|Name|Type|Description|
1106-
|---|---|---|
1107-
|success|bool|Boolean indicating whether the transactions succeeded
1108-
11091089
### `mintTokens(uint256 _wad)`
11101090

11111091
Mint `_wad` amount of colony tokens. Secured function to authorised members.

docs/interfaces/imetacolony.md

Lines changed: 4 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1087,18 +1087,17 @@ Lock the colony's token. Can only be called by a network-managed extension.
10871087
|---|---|---|
10881088
|timesLocked|uint256|The amount of times the token was locked
10891089

1090-
### `makeArbitraryTransactions(address[] memory _targets, bytes[] memory _actions, bool _strict):bool success`
1090+
### `makeArbitraryTransaction(address _target, bytes memory _action):bool success`
10911091

1092-
Execute arbitrary transactions on behalf of the Colony in series
1092+
Executes an arbitrary transaction
10931093

10941094

10951095
**Parameters**
10961096

10971097
|Name|Type|Description|
10981098
|---|---|---|
1099-
|_targets|address[]|Array of addressed to be targeted
1100-
|_actions|bytes[]|Array of Bytes arrays encoding the function calls and arguments
1101-
|_strict|bool|Boolean indicating whether if one transaction fails, the whole call to this function should fail.
1099+
|_target|address|Contract to receive the function call
1100+
|_action|bytes|Bytes array encoding the function call and arguments
11021101

11031102
**Return Parameters**
11041103

@@ -1125,25 +1124,6 @@ Add a new expenditure in the colony. Secured function to authorised members.
11251124
|---|---|---|
11261125
|expenditureId|uint256|Identifier of the newly created expenditure
11271126

1128-
### `makeSingleArbitraryTransaction(address _target, bytes memory _action):bool success`
1129-
1130-
Executes a single arbitrary transaction
1131-
1132-
*Note: Only callable by the colony itself. If you wish to use this functionality, you should use the makeAbitraryTransactions function*
1133-
1134-
**Parameters**
1135-
1136-
|Name|Type|Description|
1137-
|---|---|---|
1138-
|_target|address|Contract to receive the function call
1139-
|_action|bytes|Bytes array encoding the function call and arguments
1140-
1141-
**Return Parameters**
1142-
1143-
|Name|Type|Description|
1144-
|---|---|---|
1145-
|success|bool|Boolean indicating whether the transactions succeeded
1146-
11471127
### `mintTokens(uint256 _wad)`
11481128

11491129
Mint `_wad` amount of colony tokens. Secured function to authorised members.

packages/metatransaction-broadcaster/MetatransactionBroadcaster.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -206,8 +206,12 @@ class MetatransactionBroadcaster {
206206
async isColonyFamilyTransactionAllowed(target, txData, userAddress) {
207207
const colonyDef = await this.loader.load({ contractDir: "colony", contractName: "IColony" });
208208

209-
// Add the old makeArbitraryTransaction to the abi
210-
const iface = new ethers.utils.Interface(["function makeArbitraryTransaction(address,bytes)"]);
209+
// Add the old makeSingleArbitraryTransaction and makeArbitraryTransactions to the abi
210+
const iface = new ethers.utils.Interface([
211+
"function makeSingleArbitraryTransaction(address,bytes)",
212+
"function makeArbitraryTransactions(address[],bytes[],bool)",
213+
]);
214+
211215
const oldJsonAbi = JSON.parse(iface.format(ethers.utils.FormatTypes.json));
212216
oldJsonAbi[0].inputs = oldJsonAbi[0].inputs.map((x) => {
213217
return { ...x, internalType: x.type };

0 commit comments

Comments
 (0)