Skip to content

Commit

Permalink
Merge pull request #71 from Hats-Protocol/feat/tophat-details
Browse files Browse the repository at this point in the history
Add `details` to tophat
  • Loading branch information
nintynick authored Dec 7, 2022
2 parents 17347b1 + 99b9ada commit 966cc08
Show file tree
Hide file tree
Showing 5 changed files with 118 additions and 68 deletions.
3 changes: 2 additions & 1 deletion script/Hats.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,9 @@ contract DeployHatsAndMintTopHat is Script {
Hats hats = new Hats(name, imageURI);

string memory image = "";
string memory details = "";

uint256 tophat = hats.mintTopHat(deployer, image);
uint256 tophat = hats.mintTopHat(deployer, details, image);

console2.log("hats: ", address(hats));
console2.log("tophat: ", tophat);
Expand Down
11 changes: 6 additions & 5 deletions src/Hats.sol
Original file line number Diff line number Diff line change
Expand Up @@ -89,17 +89,18 @@ contract Hats is IHats, ERC1155, HatsIdUtilities {
/// @param _imageURI The image uri for this top hat and the fallback for its
/// downstream hats [optional]
/// @return topHatId The id of the newly created topHat
function mintTopHat(address _target, string memory _imageURI)
public
returns (uint256 topHatId)
{
function mintTopHat(
address _target,
string memory _details,
string memory _imageURI
) public returns (uint256 topHatId) {
// create hat

topHatId = uint256(++lastTopHatId) << 224;

_createHat(
topHatId,
"", // details
_details, // details
1, // maxSupply = 1
address(0), // there is no eligibility
address(0), // it has no toggle
Expand Down
8 changes: 5 additions & 3 deletions src/Interfaces/IHats.sol
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,11 @@ import "./HatsErrors.sol";
import "./HatsEvents.sol";

interface IHats is IHatsIdUtilities, HatsErrors, HatsEvents {
function mintTopHat(address _target, string memory _imageURI)
external
returns (uint256 topHatId);
function mintTopHat(
address _target,
string memory _details,
string memory _imageURI
) external returns (uint256 topHatId);

// function createTopHatAndHat(
// string memory _details,
Expand Down
Loading

0 comments on commit 966cc08

Please sign in to comment.