Skip to content

Instantly share code, notes, and snippets.

@elenadimitrova
Last active July 13, 2017 08:48
Show Gist options
  • Save elenadimitrova/5da89dbdbf83e6e03f443d3aff651255 to your computer and use it in GitHub Desktop.
Save elenadimitrova/5da89dbdbf83e6e03f443d3aff651255 to your computer and use it in GitHub Desktop.
contract DataVerifiable {
/// @notice throws if ether was sent accidentally
modifier refundEtherSentByAccident() {
if(msg.value > 0) throw;
_
}
/// @notice throw if an address is invalid
/// @param _target the address to check
modifier throwIfAddressIsInvalid(address _target) {
if(_target == 0x0) throw;
_
}
/// @notice throw if the id is invalid
/// @param _id the ID to validate
modifier throwIfIsEmptyString(string _id) {
if(bytes(_id).length == 0) throw;
_
}
/// @notice throw if the uint is equal to zero
/// @param _id the ID to validate
modifier throwIfEqualToZero(uint _id) {
if(_id == 0) throw;
_
}
/// @notice throw if the id is invalid
/// @param _id the ID to validate
modifier throwIfIsEmptyBytes32(bytes32 _id) {
if(_id == "") throw;
_
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment