function validateElementaryType()

in src/validators/solidityTypeValidation/index.ts [16:34]


function validateElementaryType(value: string, type: string): string | undefined {
  if (type.match(Constants.validationRegexps.types.solidityInteger)) {
    return validateNumber(value, type);
  }

  switch (type) {
    case Constants.solidityTypes.string:
      return;
    case Constants.solidityTypes.bool:
      return value === 'true' || value === 'false' ? undefined : Constants.validationMessages.valueShouldBeBool;
    case Constants.solidityTypes.address:
      return value.match(Constants.validationRegexps.types.solidityAddress) ?
      undefined :
      Constants.validationMessages.valueShouldBeSolidityAddress;
    default:
      // TODO: validate other types
      return;
  }
}