Skip to content

Commit

Permalink
Merge pull request #73 from Hats-Protocol/develop
Browse files Browse the repository at this point in the history
Prepare to deploy 0.5-beta
  • Loading branch information
nintynick authored Dec 7, 2022
2 parents 4e24350 + d518a80 commit 49e3ab7
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 39 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
push:
branches:
- main
- beta
- develop
pull_request:

jobs:
Expand Down
24 changes: 6 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,15 @@
[![Stargazers][stars-shield]][stars-url]
[![Issues][issues-shield]][issues-url]
[![Twitter][twitter-shield]][twitter-url]
<!-- [![CCO License][license-shield]][license-url] -->

<!-- LOGO -->
<br />
<div align="center">
<a href="https://github.com/Hats-Protocol/hats-protocol">
<img src="https://user-images.githubusercontent.com/10171948/192988691-07b7f842-232d-4ac6-9b14-21b626775834.png" alt="Logo" width="320" height="184">
<img src="https://ipfs.io/ipfs/QmbQy4vsu4aAHuQwpHoHUsEURtiYKEbhv7ouumBXiierp9" alt="Hats Hat" width="300" height="300">
</a>

<h3 align="center">Hats Protocol</h3>
<h2 align="center">Hats Protocol</h3>

<p align="center">
How DAOs get things done
Expand All @@ -48,7 +47,7 @@
<li>
<a href="#about-the-project">About The Project</a>
<ul>
<li><a href="#latest-deployments">Latest Deployments</a></li>
<li><a href="#latest-deployments">Deployments</a></li>
</ul>
</li>
<li><a href="#getting-started">Getting Started</a></li>
Expand All @@ -67,17 +66,9 @@ Hats Protocol is a protocol for DAO-native roles and credentials that support de

Hats are represented on-chain by ERC1155 tokens. An address with a balance of a given Hat token "wears" that hat, granting them the responsibilities and authorities that have been assigned to the Hat by the DAO.

### Latest Deployments
### Deployments

#### Beta 3

- Gnosis Chain (chain id #100) &mdash; `0x245e5B56C18B18aC2d72F94C5F7bE1D52497A8aD`

#### Beta 4

- Goerli Testnet (chain id #4) &mdash; `0x2923469a33bd2fa2ab33c877db81d35a9d8d60c6`
- Gnosis Chain (chain id #100) &mdash; `0x72c89eb08444bc16396dd9432b3e82d956c412ec`
- Polygon (chain id #137) &mdash; `0xe81597289a249ae725c2d80e7848dbfa9708c22d`
For information on Hats Protocol versions and deployments, see [Releases](https://github.com/Hats-Protocol/hats-protocol/releases).

<!-- GETTING STARTED -->
## Getting Started
Expand Down Expand Up @@ -399,15 +390,12 @@ Since batch Hats transfers can be made from and to multiple wearers, batch trans
The wearer of a Hat can "take off" their Hat via `Hats.renounceHat`. This burns the token and revokes any associated authorities and responsibilities from the now-former wearer, but does not put the wearer in bad standing.

<p align="right">(<a href="#documentation-top">back to contents</a>)</p>
<p align="right">(<a href="#readme-top">back to top</a>)</p>

<!-- LICENSE
## License

Distributed under the CC0 License. See `LICENSE.txt` for more information.
Distributed under the AGPLv3 License. See `LICENSE.txt` for more information.

<p align="right">(<a href="#readme-top">back to top</a>)</p>
-->

<!-- CONTACT -->
## Contact
Expand Down
20 changes: 10 additions & 10 deletions src/Hats.sol
Original file line number Diff line number Diff line change
Expand Up @@ -733,13 +733,13 @@ contract Hats is IHats, ERC1155, HatsIdUtilities {
}
}

/// @notice Checks the active status of a hat
/// @dev Use `_isActive` for internal calls that can take a Hat as a param
/// @param _hatId The id of the hat
/// @return bool The active status of the hat
function isActive(uint256 _hatId) public view returns (bool) {
return _isActive(_hats[_hatId], _hatId);
}
// /// @notice Checks the active status of a hat
// /// @dev Use `_isActive` for internal calls that can take a Hat as a param
// /// @param _hatId The id of the hat
// /// @return bool The active status of the hat
// function isActive(uint256 _hatId) public view returns (bool) {
// return _isActive(_hats[_hatId], _hatId);
// }

function _getHatStatus(Hat memory _hat) internal view returns (bool) {
return (_hat.config >> 95 != 0);
Expand All @@ -757,9 +757,9 @@ contract Hats is IHats, ERC1155, HatsIdUtilities {
return (_hat.config & uint96(1 << 94) != 0);
}

function isMutable(uint256 _hatId) public view returns (bool) {
return _isMutable(_hats[_hatId]);
}
// function isMutable(uint256 _hatId) public view returns (bool) {
// return _isMutable(_hats[_hatId]);
// }

/// @notice Checks whether a wearer of a Hat is in good standing
/// @dev Public function for use when pa ssing a Hat object is not possible or preferable
Expand Down
2 changes: 1 addition & 1 deletion src/Interfaces/IHats.sol
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ interface IHats is IHatsIdUtilities, HatsErrors, HatsEvents {
view
returns (bool);

function isActive(uint256 _hatId) external view returns (bool);
// function isActive(uint256 _hatId) external view returns (bool);

function isInGoodStanding(address _wearer, uint256 _hatId)
external
Expand Down
27 changes: 18 additions & 9 deletions test/Hats.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -1103,7 +1103,8 @@ contract RenounceHatsTest is TestSetup2 {
contract ToggleSetHatsTest is TestSetup2 {
function testDeactivateHat() public {
// confirm second hat is active
assertTrue(hats.isActive(secondHatId));
(, , , , , , , , active_) = hats.viewHat(secondHatId);
assertTrue(active_);
assertTrue(hats.isWearerOfHat(secondWearer, secondHatId));

// expectEmit HatStatusChanged to false
Expand All @@ -1113,7 +1114,8 @@ contract ToggleSetHatsTest is TestSetup2 {
// 7-2. change Hat Status true->false via setHatStatus
vm.prank(address(_toggle));
hats.setHatStatus(secondHatId, false);
assertFalse(hats.isActive(secondHatId));
(, , , , , , , mutable_, ) = hats.viewHat(secondHatId);
assertFalse(mutable_);
assertFalse(hats.isWearerOfHat(secondWearer, secondHatId));
}

Expand All @@ -1140,7 +1142,8 @@ contract ToggleSetHatsTest is TestSetup2 {
// changeHatStatus false->true via setHatStatus
vm.prank(address(_toggle));
hats.setHatStatus(secondHatId, true);
assertTrue(hats.isActive(secondHatId));
(, , , , , , , , active_) = hats.viewHat(secondHatId);
assertTrue(active_);
assertTrue(hats.isWearerOfHat(secondWearer, secondHatId));
}

Expand Down Expand Up @@ -1185,7 +1188,8 @@ contract ToggleGetHatsTest is TestSetup2 {

// call mocked function within checkHatStatus to deactivate
hats.checkHatStatus(secondHatId);
assertFalse(hats.isActive(secondHatId));
(, , , , , , , mutable_, ) = hats.viewHat(secondHatId);
assertFalse(mutable_);
assertFalse(hats.isWearerOfHat(secondWearer, secondHatId));
}

Expand All @@ -1207,7 +1211,8 @@ contract ToggleGetHatsTest is TestSetup2 {

// call mocked function within checkHatStatus to reactivate
hats.checkHatStatus(secondHatId);
assertTrue(hats.isActive(secondHatId));
(, , , , , , , , active_) = hats.viewHat(secondHatId);
assertTrue(active_);
assertTrue(hats.isWearerOfHat(secondWearer, secondHatId));
}
}
Expand All @@ -1230,15 +1235,17 @@ contract MutabilityTests is TestSetup {
}

function testAdminCanMakeMutableHatImmutable() public {
assertTrue(hats.isMutable(secondHatId));
(, , , , , , , mutable_, ) = hats.viewHat(secondHatId);
assertTrue(mutable_);

vm.expectEmit(false, false, false, true);
emit HatMutabilityChanged(secondHatId);

vm.prank(topHatWearer);
hats.makeHatImmutable(secondHatId);

assertFalse(hats.isMutable(secondHatId));
(, , , , , , , mutable_, ) = hats.viewHat(secondHatId);
assertFalse(mutable_);
}

function testCannotChangeImmutableHatMutability() public {
Expand All @@ -1254,7 +1261,8 @@ contract MutabilityTests is TestSetup {
secondHatImageURI
);

assertFalse(hats.isMutable(thirdHatId));
(, , , , , , , mutable_, ) = hats.viewHat(thirdHatId);
assertFalse(mutable_);

vm.expectRevert(abi.encodeWithSelector(HatsErrors.Immutable.selector));

Expand Down Expand Up @@ -1286,7 +1294,8 @@ contract MutabilityTests is TestSetup {
secondHatImageURI
);

assertFalse(hats.isMutable(thirdHatId));
(, , , , , , , mutable_, ) = hats.viewHat(thirdHatId);
assertFalse(mutable_);

vm.expectRevert(abi.encodeWithSelector(HatsErrors.Immutable.selector));
hats.changeHatDetails(thirdHatId, "should not work");
Expand Down
3 changes: 3 additions & 0 deletions test/HatsTestSetup.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ abstract contract TestVariables is HatsEvents, HatsErrors {
bool retmutable;
bool retactive;

bool active_;
bool mutable_;

event TransferSingle(
address indexed operator,
address indexed from,
Expand Down

0 comments on commit 49e3ab7

Please sign in to comment.