Update test contracts
This commit is contained in:
44
contracts/multisig/contracts/test/ContractCallReceiver.sol
Normal file
44
contracts/multisig/contracts/test/ContractCallReceiver.sol
Normal file
@@ -0,0 +1,44 @@
|
||||
/*
|
||||
|
||||
Copyright 2019 ZeroEx Intl.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
|
||||
*/
|
||||
|
||||
pragma solidity ^0.5.9;
|
||||
|
||||
import "@0x/contracts-utils/contracts/src/LibBytes.sol";
|
||||
|
||||
|
||||
contract ContractCallReceiver {
|
||||
|
||||
using LibBytes for bytes;
|
||||
|
||||
event ContractCall(
|
||||
bytes4 functionSelector,
|
||||
bytes data,
|
||||
uint256 value
|
||||
);
|
||||
|
||||
function ()
|
||||
external
|
||||
payable
|
||||
{
|
||||
emit ContractCall(
|
||||
msg.data.readBytes4(0),
|
||||
msg.data,
|
||||
msg.value
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -16,7 +16,8 @@
|
||||
|
||||
*/
|
||||
|
||||
pragma solidity 0.4.24;
|
||||
pragma solidity ^0.5.9;
|
||||
pragma experimental ABIEncoderV2;
|
||||
|
||||
import "../src/AssetProxyOwner.sol";
|
||||
|
||||
@@ -26,33 +27,52 @@ contract TestAssetProxyOwner is
|
||||
AssetProxyOwner
|
||||
{
|
||||
constructor (
|
||||
bytes4[] memory _functionSelectors,
|
||||
address[] memory _destinations,
|
||||
uint128[] memory _functionCallTimeLockSeconds,
|
||||
address[] memory _owners,
|
||||
address[] memory _assetProxyContracts,
|
||||
uint256 _required,
|
||||
uint256 _secondsTimeLocked
|
||||
uint256 _defaultSecondsTimeLocked
|
||||
)
|
||||
public
|
||||
AssetProxyOwner(_owners, _assetProxyContracts, _required, _secondsTimeLocked)
|
||||
AssetProxyOwner(
|
||||
_functionSelectors,
|
||||
_destinations,
|
||||
_functionCallTimeLockSeconds,
|
||||
_owners,
|
||||
_required,
|
||||
_defaultSecondsTimeLocked
|
||||
)
|
||||
{}
|
||||
|
||||
function testValidRemoveAuthorizedAddressAtIndexTx(uint256 id)
|
||||
public
|
||||
view
|
||||
validRemoveAuthorizedAddressAtIndexTx(id)
|
||||
returns (bool)
|
||||
function registerFunctionCallBypassWalet(
|
||||
bool hasCustomTimeLock,
|
||||
bytes4 functionSelector,
|
||||
address destination,
|
||||
uint128 newSecondsTimeLocked
|
||||
)
|
||||
external
|
||||
{
|
||||
// Do nothing. We expect reverts through the modifier
|
||||
return true;
|
||||
_registerFunctionCall(
|
||||
hasCustomTimeLock,
|
||||
functionSelector,
|
||||
destination,
|
||||
newSecondsTimeLocked
|
||||
);
|
||||
}
|
||||
|
||||
/// @dev Compares first 4 bytes of byte array to `removeAuthorizedAddressAtIndex` function selector.
|
||||
/// @param data Transaction data.
|
||||
/// @return Successful if data is a call to `removeAuthorizedAddressAtIndex`.
|
||||
function isFunctionRemoveAuthorizedAddressAtIndex(bytes memory data)
|
||||
public
|
||||
pure
|
||||
returns (bool)
|
||||
|
||||
function assertValidFunctionCall(
|
||||
uint256 transactionConfirmationTime,
|
||||
bytes calldata data,
|
||||
address destination
|
||||
)
|
||||
external
|
||||
view
|
||||
{
|
||||
return data.readBytes4(0) == REMOVE_AUTHORIZED_ADDRESS_AT_INDEX_SELECTOR;
|
||||
_assertValidFunctionCall(
|
||||
transactionConfirmationTime,
|
||||
data,
|
||||
destination
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user