Skip to content

Commit

Permalink
Recompile, add address validation in addition to existence
Browse files Browse the repository at this point in the history
  • Loading branch information
gamalielhere committed Oct 9, 2018
1 parent 86b44be commit d2fbd27
Show file tree
Hide file tree
Showing 4 changed files with 163 additions and 161 deletions.
13 changes: 7 additions & 6 deletions checkContract.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,14 @@ const constraints = {
allowEmpty: false
}
},
address: {
presence: {
allowEmpty: false
},
length: {
is: 42
address: function(value) {
if (web3.utils.isAddress(value)) {
return null;
}
return {
presence: { message: 'Token Address missing' },
length: { is: 42 }
};
},
comment: {
presence: true
Expand Down
17 changes: 9 additions & 8 deletions checkToken.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,14 @@ const constraints = {
allowEmpty: false
}
},
address: {
presence: {
allowEmpty: false
},
length: {
is: 42
address: function(value) {
if (web3.utils.isAddress(value)) {
return null;
}
return {
presence: { message: 'Token Address missing' },
length: { is: 42 }
};
},
ens_address: {
presence: true
Expand Down Expand Up @@ -121,14 +122,14 @@ function checkToken() {
if (validate(obj, constraints) !== undefined) {
const errs = validate(obj, constraints);
Object.keys(errs).forEach(key => {
console.log(
console.error(
`${errs[key][0]} for ${file} in ${tokensDirectory}/${folder}`
);
});
process.exit(1);
}
} else {
console.log('Incorrect file name or file extension');
console.error('Incorrect file name or file extension');
process.exit(1);
}
});
Expand Down
Loading

0 comments on commit d2fbd27

Please sign in to comment.