@@ -93,7 +93,7 @@ contract Jurisdiction is Ownable, Pausable, AttributeRegistryInterface, BasicJur
9393 ) external onlyOwner whenNotPaused {
9494 // prevent existing attributes with the same id from being overwritten
9595 require (
96- isAttributeType (ID) == false ,
96+ ! isAttributeType (ID),
9797 "an attribute type with the provided ID already exists "
9898 );
9999
@@ -152,7 +152,7 @@ contract Jurisdiction is Ownable, Pausable, AttributeRegistryInterface, BasicJur
152152 ) external onlyOwner whenNotPaused {
153153 // prevent existing attributes with the same id from being overwritten
154154 require (
155- isAttributeType (ID) == false ,
155+ ! isAttributeType (ID),
156156 "an attribute type with the provided ID already exists "
157157 );
158158
@@ -335,7 +335,7 @@ contract Jurisdiction is Ownable, Pausable, AttributeRegistryInterface, BasicJur
335335
336336 // prevent existing validators from being overwritten
337337 require (
338- isValidator (validator) == false ,
338+ ! isValidator (validator),
339339 "a validator with the provided address already exists "
340340 );
341341
@@ -442,7 +442,7 @@ contract Jurisdiction is Ownable, Pausable, AttributeRegistryInterface, BasicJur
442442
443443 // check that the validator is not already approved
444444 require (
445- _attributeTypes[attributeTypeID].approvedValidators[validator] == false ,
445+ ! _attributeTypes[attributeTypeID].approvedValidators[validator],
446446 "validator is already approved on the provided attribute "
447447 );
448448
@@ -563,7 +563,7 @@ contract Jurisdiction is Ownable, Pausable, AttributeRegistryInterface, BasicJur
563563 );
564564
565565 require (
566- _issuedAttributes[account][attributeTypeID].validator == address ( 0 ) ,
566+ ! _issuedAttributes[account][attributeTypeID].exists ,
567567 "duplicate attributes are not supported, remove existing attribute first "
568568 );
569569
@@ -721,6 +721,11 @@ contract Jurisdiction is Ownable, Pausable, AttributeRegistryInterface, BasicJur
721721 // downside is that everyone will have to keep track of the extra parameter.
722722 // Another solution is to just modifiy the required stake or fee amount.
723723
724+ require (
725+ ! _issuedAttributes[msg .sender ][attributeTypeID].exists,
726+ "duplicate attributes are not supported, remove existing attribute first "
727+ );
728+
724729 // retrieve required minimum stake and jurisdiction fees on attribute type
725730 uint256 minimumStake = _attributeTypes[attributeTypeID].minimumStake;
726731 uint256 jurisdictionFee = _attributeTypes[attributeTypeID].jurisdictionFee;
@@ -745,7 +750,7 @@ contract Jurisdiction is Ownable, Pausable, AttributeRegistryInterface, BasicJur
745750 );
746751
747752 require (
748- _invalidAttributeApprovalHashes[hash] == false ,
753+ ! _invalidAttributeApprovalHashes[hash],
749754 "signed attribute approvals from validators may not be reused "
750755 );
751756
@@ -760,13 +765,6 @@ contract Jurisdiction is Ownable, Pausable, AttributeRegistryInterface, BasicJur
760765 "signature does not match an approved validator for given attribute type "
761766 );
762767
763- require (
764- _issuedAttributes[msg .sender ][attributeTypeID].validator == address (0 ),
765- "duplicate attributes are not supported, remove existing attribute first "
766- );
767- // alternately, check attributes[validator][msg.sender][_attribute].exists
768- // and update value / increment stake if the validator is the same?
769-
770768 // store attribute value and amount of ether staked in correct scope
771769 _issuedAttributes[msg .sender ][attributeTypeID] = IssuedAttribute ({
772770 exists: true ,
@@ -812,18 +810,18 @@ contract Jurisdiction is Ownable, Pausable, AttributeRegistryInterface, BasicJur
812810 function removeAttribute (uint256 attributeTypeID ) external {
813811 // attributes may only be removed by the user if they are not restricted
814812 require (
815- _attributeTypes[attributeTypeID].restricted == false ,
813+ ! _attributeTypes[attributeTypeID].restricted,
816814 "only jurisdiction or issuing validator may remove a restricted attribute "
817815 );
818816
819- // determine the assigned validator on the user attribute
820- address validator = _issuedAttributes[msg .sender ][attributeTypeID].validator;
821-
822817 require (
823818 _issuedAttributes[msg .sender ][attributeTypeID].exists,
824819 "only existing attributes may be removed "
825820 );
826821
822+ // determine the assigned validator on the user attribute
823+ address validator = _issuedAttributes[msg .sender ][attributeTypeID].validator;
824+
827825 // determine if the attribute has a staked value
828826 uint256 stake = _issuedAttributes[msg .sender ][attributeTypeID].stake;
829827
@@ -878,10 +876,15 @@ contract Jurisdiction is Ownable, Pausable, AttributeRegistryInterface, BasicJur
878876
879877 // attributes may only be added by a third party if onlyPersonal is false
880878 require (
881- _attributeTypes[attributeTypeID].onlyPersonal == false ,
879+ ! _attributeTypes[attributeTypeID].onlyPersonal,
882880 "only operatable attributes may be added on behalf of another address "
883881 );
884882
883+ require (
884+ ! _issuedAttributes[account][attributeTypeID].exists,
885+ "duplicate attributes are not supported, remove existing attribute first "
886+ );
887+
885888 // retrieve required minimum stake and jurisdiction fees on attribute type
886889 uint256 minimumStake = _attributeTypes[attributeTypeID].minimumStake;
887890 uint256 jurisdictionFee = _attributeTypes[attributeTypeID].jurisdictionFee;
@@ -906,7 +909,7 @@ contract Jurisdiction is Ownable, Pausable, AttributeRegistryInterface, BasicJur
906909 );
907910
908911 require (
909- _invalidAttributeApprovalHashes[hash] == false ,
912+ ! _invalidAttributeApprovalHashes[hash],
910913 "signed attribute approvals from validators may not be reused "
911914 );
912915
@@ -921,13 +924,6 @@ contract Jurisdiction is Ownable, Pausable, AttributeRegistryInterface, BasicJur
921924 "signature does not match an approved validator for provided attribute "
922925 );
923926
924- require (
925- _issuedAttributes[account][attributeTypeID].validator == address (0 ),
926- "duplicate attributes are not supported, remove existing attribute first "
927- );
928- // alternately, check attributes[validator][_who][_attribute].exists
929- // and update value / increment stake if the validator is the same?
930-
931927 // store attribute value and amount of ether staked in correct scope
932928 _issuedAttributes[account][attributeTypeID] = IssuedAttribute ({
933929 exists: true ,
@@ -974,7 +970,7 @@ contract Jurisdiction is Ownable, Pausable, AttributeRegistryInterface, BasicJur
974970 function removeAttributeFor (address account , uint256 attributeTypeID ) external {
975971 // attributes may only be removed by the user if they are not restricted
976972 require (
977- _attributeTypes[attributeTypeID].restricted == false ,
973+ ! _attributeTypes[attributeTypeID].restricted,
978974 "only jurisdiction or issuing validator may remove a restricted attribute "
979975 );
980976
@@ -1326,9 +1322,9 @@ contract Jurisdiction is Ownable, Pausable, AttributeRegistryInterface, BasicJur
13261322 // NOTE: consider returning an error code along with the boolean.
13271323 return (
13281324 fundsRequired >= minimumStake.add (jurisdictionFee).add (validatorFee) &&
1329- _invalidAttributeApprovalHashes[hash] == false &&
1325+ ! _invalidAttributeApprovalHashes[hash] &&
13301326 canValidate (validator, attributeTypeID) &&
1331- _issuedAttributes[msg .sender ][attributeTypeID].exists == false
1327+ ! _issuedAttributes[msg .sender ][attributeTypeID].exists
13321328 );
13331329 }
13341330
@@ -1363,9 +1359,9 @@ contract Jurisdiction is Ownable, Pausable, AttributeRegistryInterface, BasicJur
13631359 // NOTE: consider returning an error code along with the boolean.
13641360 return (
13651361 fundsRequired >= minimumStake.add (jurisdictionFee).add (validatorFee) &&
1366- _invalidAttributeApprovalHashes[hash] == false &&
1362+ ! _invalidAttributeApprovalHashes[hash] &&
13671363 canValidate (validator, attributeTypeID) &&
1368- _issuedAttributes[account][attributeTypeID].exists == false
1364+ ! _issuedAttributes[account][attributeTypeID].exists
13691365 );
13701366 }
13711367
0 commit comments