Add functions with mutex to ReentrantERC20Token and update IExchange with missing function

This commit is contained in:
Amir Bandeali 2019-04-24 21:25:31 -07:00
parent 24906138c7
commit d373f5488a
2 changed files with 23 additions and 0 deletions

View File

@ -39,6 +39,16 @@ contract ISignatureValidator {
)
external;
/// @dev Approves/unnapproves an OrderValidator contract to verify signatures on signer's behalf
/// using the `OrderValidator` signature type.
/// @param validatorAddress Address of Validator contract.
/// @param approval Approval or disapproval of Validator contract.
function setOrderValidatorApproval(
address validatorAddress,
bool approval
)
external;
/// @dev Verifies that a signature for a hash is valid.
/// @param hash Message hash that is signed.
/// @param signerAddress Address of signer.

View File

@ -50,7 +50,9 @@ contract ReentrantERC20Token is
CANCEL_ORDER,
BATCH_CANCEL_ORDERS,
CANCEL_ORDERS_UP_TO,
PRE_SIGN,
SET_SIGNATURE_VALIDATOR_APPROVAL,
SET_ORDER_VALIDATOR_APPROVAL,
NONE
}
@ -161,12 +163,23 @@ contract ReentrantERC20Token is
exchange.cancelOrdersUpTo.selector,
1
);
} else if (currentFunctionId == uint8(ExchangeFunction.PRE_SIGN)) {
callData = abi.encodeWithSelector(
exchange.preSign.selector,
uint256(getRandomAddress())
);
} else if (currentFunctionId == uint8(ExchangeFunction.SET_SIGNATURE_VALIDATOR_APPROVAL)) {
callData = abi.encodeWithSelector(
exchange.setSignatureValidatorApproval.selector,
getRandomAddress(),
false
);
} else if (currentFunctionId == uint8(ExchangeFunction.SET_ORDER_VALIDATOR_APPROVAL)) {
callData = abi.encodeWithSelector(
exchange.setOrderValidatorApproval.selector,
getRandomAddress(),
false
);
} else {
return true;
}