Skip to content

Commit

Permalink
Fix linting errors and integrate into CI
Browse files Browse the repository at this point in the history
  • Loading branch information
0age committed Oct 28, 2018
1 parent 7872ba5 commit 0498dd7
Show file tree
Hide file tree
Showing 5 changed files with 73 additions and 73 deletions.
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
42 changes: 20 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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`
Expand Down Expand Up @@ -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
---
Expand Down
1 change: 1 addition & 0 deletions contracts/AttributeRegistryInterface.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
pragma solidity ^0.4.25;


/**
* @title Attribute Registry interface. EIP-165 ID: 0x5f46473f
*/
Expand Down
44 changes: 22 additions & 22 deletions contracts/examples/validator/TPLBasicValidatorInterface.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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.
Expand Down
58 changes: 29 additions & 29 deletions contracts/examples/validator/TPLExtendedValidatorInterface.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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.
Expand All @@ -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;
}

0 comments on commit 0498dd7

Please sign in to comment.