diff --git a/contracts/tokens/SecurityToken.sol b/contracts/tokens/SecurityToken.sol index 1d2b165f5..d7f0ab80e 100644 --- a/contracts/tokens/SecurityToken.sol +++ b/contracts/tokens/SecurityToken.sol @@ -540,34 +540,34 @@ contract SecurityToken is StandardToken, DetailedERC20, ReentrancyGuard, Registr uint256 _value, bytes _data, bool _isTransfer - ) internal checkGranularity(_value) returns (bool) { + ) + internal + checkGranularity(_value) + returns (bool) + { if (!transfersFrozen) { - if (modules[TRANSFER_KEY].length == 0) { + if (modules[TRANSFER_KEY].length == 0) return true; - } - bool isInvalid = false; - bool isValid = false; - bool isForceValid = false; - bool unarchived = false; + + bool isValid; + bool isInvalid; address module; - for (uint8 i = 0; i < modules[TRANSFER_KEY].length; i++) { + + for (uint256 i = 0; i < modules[TRANSFER_KEY].length; i++) { module = modules[TRANSFER_KEY][i]; if (!modulesToData[module].isArchived) { - unarchived = true; ITransferManager.Result valid = ITransferManager(module).verifyTransfer(_from, _to, _value, _data, _isTransfer); if (valid == ITransferManager.Result.INVALID) { isInvalid = true; - } - if (valid == ITransferManager.Result.VALID) { + } else if (valid == ITransferManager.Result.VALID) { isValid = true; - } - if (valid == ITransferManager.Result.FORCE_VALID) { - isForceValid = true; + } else if (valid == ITransferManager.Result.FORCE_VALID) { + return true; } } } - // If no unarchived modules, return true by default - return unarchived ? (isForceValid ? true : (isInvalid ? false : isValid)) : true; + if (isValid && !isInvalid) + return true; } return false; }