From 0498dd75d77ec13620e1734ea6b99fef945b2e8a Mon Sep 17 00:00:00 2001 From: 0age <0age@protonmail.com> Date: Sat, 27 Oct 2018 20:53:36 -0400 Subject: [PATCH] Fix linting errors and integrate into CI --- .travis.yml | 1 + README.md | 42 +++++++------- contracts/AttributeRegistryInterface.sol | 1 + .../validator/TPLBasicValidatorInterface.sol | 44 +++++++------- .../TPLExtendedValidatorInterface.sol | 58 +++++++++---------- 5 files changed, 73 insertions(+), 73 deletions(-) diff --git a/.travis.yml b/.travis.yml index b928872..e54c202 100644 --- a/.travis.yml +++ b/.travis.yml @@ -17,6 +17,7 @@ install: - yarn global add coveralls - yarn install script: + - yarn linter - yarn build - yarn deploy basic && yarn deploy extended && yarn deploy token - yarn coverage && cat coverage/lcov.info | coveralls diff --git a/README.md b/README.md index 63e6e2c..504a320 100644 --- a/README.md +++ b/README.md @@ -52,20 +52,20 @@ $ ganache-cli --gasLimit 8000000 Then, to run tests: ```sh +$ yarn linter $ yarn test $ yarn coverage -$ yarn linter ``` -A jurisdiction may then be deployed locally using `yarn deploy basic` or `yarn deploy extended`. +A jurisdiction may then be deployed locally using `yarn build` followed by `yarn deploy basic` or `yarn deploy extended`. A mock permissioned token that relies on the deployed jurisdiction can then be deployed using `yarn deploy token` (see [config.js](https://github.com/TPL-protocol/tpl-contracts/blob/master/config.js) for a few token configuration options). ## API *NOTE: This documentation is still a work in progress. See the relevant contract source code for additional information.* * [AttributeRegistryInterface](#attributeregistryinterface) - * [getAttributeTypeID](#function-getattributetypeid) * [hasAttribute](#function-hasattribute) * [getAttributeValue](#function-getattributevalue) * [countAttributeTypes](#function-countattributetypes) + * [getAttributeTypeID](#function-getattributetypeid) * [BasicJurisdictionInterface](#basicjurisdictioninterface) * [getAttributeTypeID](#function-getattributetypeid) * [getAttributeValidator](#function-getattributevalidator) @@ -149,25 +149,6 @@ A jurisdiction may then be deployed locally using `yarn deploy basic` or `yarn d ### AttributeRegistryInterface --- -#### *function* getAttributeTypeID - -AttributeRegistryInterface.getAttributeTypeID(index) `view` `0e62fde6` - -**Get the ID of the attribute type at index `index`.** - - -Inputs - -| **type** | **name** | **description** | -|-|-|-| -| *uint256* | index | uint256 The index of the attribute type in question. | - -Outputs - -| **type** | **name** | **description** | -|-|-|-| -| *uint256* | | undefined | - #### *function* hasAttribute AttributeRegistryInterface.hasAttribute(account, attributeTypeID) `view` `4b5f297a` @@ -223,7 +204,24 @@ Outputs |-|-|-| | *uint256* | | undefined | +#### *function* getAttributeTypeID + +AttributeRegistryInterface.getAttributeTypeID(index) `view` `0e62fde6` + +**Get the ID of the attribute type at index `index`.** + + +Inputs + +| **type** | **name** | **description** | +|-|-|-| +| *uint256* | index | uint256 The index of the attribute type in question. | +Outputs + +| **type** | **name** | **description** | +|-|-|-| +| *uint256* | | undefined | ### BasicJurisdictionInterface --- diff --git a/contracts/AttributeRegistryInterface.sol b/contracts/AttributeRegistryInterface.sol index 423ed7e..affde24 100644 --- a/contracts/AttributeRegistryInterface.sol +++ b/contracts/AttributeRegistryInterface.sol @@ -1,5 +1,6 @@ pragma solidity ^0.4.25; + /** * @title Attribute Registry interface. EIP-165 ID: 0x5f46473f */ diff --git a/contracts/examples/validator/TPLBasicValidatorInterface.sol b/contracts/examples/validator/TPLBasicValidatorInterface.sol index 4f653a9..9a04b90 100644 --- a/contracts/examples/validator/TPLBasicValidatorInterface.sol +++ b/contracts/examples/validator/TPLBasicValidatorInterface.sol @@ -5,6 +5,28 @@ pragma solidity ^0.4.25; * @title TPL Basic Validator interface. EIP-165 ID: 0xd13d3f23 */ interface TPLBasicValidatorInterface { + /** + * @notice Issue an attribute of the type with ID `attributeTypeID` to account + * `account` on the jurisdiction. + * @param account address The account to issue the attribute to. + * @param attributeTypeID uint256 The ID of the attribute type in question. + * @dev Note that the function is payable - this is so that the function in + * question can support both basic and extended jurisdictions. Attaching a + * value when utilizing a basic jurisdiction will revert the transaction. + */ + function issueAttribute( + address account, + uint256 attributeTypeID + ) external payable; + + /** + * @notice Revoke an attribute of the type with ID `attributeTypeID` from + * account `account` on the jurisdiction. + * @param account address The account to revoke the attribute from. + * @param attributeTypeID uint256 The ID of the attribute type in question. + */ + function revokeAttribute(address account, uint256 attributeTypeID) external; + /** * @notice Check if contract is assigned as a validator on the jurisdiction. * @return True if validator is assigned, false otherwise. @@ -45,28 +67,6 @@ interface TPLBasicValidatorInterface { uint256 attributeTypeID ) external view returns (bool, bytes1); - /** - * @notice Issue an attribute of the type with ID `attributeTypeID` to account - * `account` on the jurisdiction. - * @param account address The account to issue the attribute to. - * @param attributeTypeID uint256 The ID of the attribute type in question. - * @dev Note that the function is payable - this is so that the function in - * question can support both basic and extended jurisdictions. Attaching a - * value when utilizing a basic jurisdiction will revert the transaction. - */ - function issueAttribute( - address account, - uint256 attributeTypeID - ) external payable; - - /** - * @notice Revoke an attribute of the type with ID `attributeTypeID` from - * account `account` on the jurisdiction. - * @param account address The account to revoke the attribute from. - * @param attributeTypeID uint256 The ID of the attribute type in question. - */ - function revokeAttribute(address account, uint256 attributeTypeID) external; - /** * @notice Get account of utilized jurisdiction and associated attribute * registry managed by the jurisdiction. diff --git a/contracts/examples/validator/TPLExtendedValidatorInterface.sol b/contracts/examples/validator/TPLExtendedValidatorInterface.sol index fdcf3cf..09d6428 100644 --- a/contracts/examples/validator/TPLExtendedValidatorInterface.sol +++ b/contracts/examples/validator/TPLExtendedValidatorInterface.sol @@ -6,6 +6,35 @@ pragma solidity ^0.4.25; * EIP-165 ID: 0x596c0405 */ interface TPLExtendedValidatorInterface { + /** + * @notice Set a signing key on the jurisdiction with an associated public + * key at address `newSigningKey`. + * @param newSigningKey address The signing key to set. + */ + function setSigningKey(address newSigningKey) external; + + /** + * @notice Invalidate a signed attribute approval before it has been set by + * supplying the hash of the approval `hash` and the signature `signature`. + * @param hash bytes32 The hash of the attribute approval. + * @param signature bytes The hash's signature, resolving to the signing key. + */ + function invalidateAttributeApproval(bytes32 hash, bytes signature) external; + + /** + * @notice Withdraw funds paid into the validator of amount `value` to the + * account at `to`. + * @param to address The address to withdraw to. + * @param value uint256 The amount to withdraw. + */ + function withdraw(bytes32 to, uint256 value) external; + + /** + * @notice Get the validator's signing key on the jurisdiction. + * @return The account referencing the public component of the signing key. + */ + function getSigningKey() external view returns (address); + /** * @notice Check if the validator is approved to issue an attribute of the * type with ID `attributeTypeID` to account `account` on the jurisdiction @@ -21,19 +50,6 @@ interface TPLExtendedValidatorInterface { uint256 value ) external view returns (bool, bytes1); - /** - * @notice Get the validator's signing key on the jurisdiction. - * @return The account referencing the public component of the signing key. - */ - function getSigningKey() external view returns (address); - - /** - * @notice Set a signing key on the jurisdiction with an associated public - * key at address `newSigningKey`. - * @param newSigningKey address The signing key to set. - */ - function setSigningKey(address newSigningKey) external; - /** * @notice Get the hash of a given attribute approval from the jurisdiction. * @param account address The account specified by the attribute approval. @@ -52,20 +68,4 @@ interface TPLExtendedValidatorInterface { uint256 fundsRequired, uint256 validatorFee ) external view returns (bytes32 hash); - - /** - * @notice Invalidate a signed attribute approval before it has been set by - * supplying the hash of the approval `hash` and the signature `signature`. - * @param hash bytes32 The hash of the attribute approval. - * @param signature bytes The hash's signature, resolving to the signing key. - */ - function invalidateAttributeApproval(bytes32 hash, bytes signature) external; - - /** - * @notice Withdraw funds paid into the validator of amount `value` to the - * account at `to`. - * @param to address The address to withdraw to. - * @param value uint256 The amount to withdraw. - */ - function withdraw(bytes32 to, uint256 value) external; } \ No newline at end of file