Skip to content

Commit

Permalink
Add createRoleHat
Browse files Browse the repository at this point in the history
  • Loading branch information
DarksightKellar committed Oct 24, 2024
1 parent e782284 commit 1563a93
Show file tree
Hide file tree
Showing 4 changed files with 375 additions and 32 deletions.
27 changes: 25 additions & 2 deletions contracts/DecentHats_0_1_0.sol
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ contract DecentHats_0_1_0 {
0x5d0e6ce4fd951366cc55da93f6e79d8b81483109d79676a04bcc2bed6a4b5072;
}

function updateKeyValuePairs(
function declareSafeHatTree(
address _keyValuePairs,
uint256 topHatId
) internal {
Expand Down Expand Up @@ -195,6 +195,29 @@ contract DecentHats_0_1_0 {
}
}

function createRoleHat(
IHats hatsProtocol,
uint256 adminHatId,
Hat calldata hat,
uint256 topHatId,
address topHatAccount,
IERC6551Registry registry,
address hatsAccountImplementation,
bytes32 salt
) public returns (uint256 hatId, address accountAddress) {
(hatId, accountAddress) = createHatAndAccountAndMintAndStreams(
hatsProtocol,
adminHatId,
hat,
topHatAccount,
registry,
hatsAccountImplementation,
salt
);

hatsProtocol.transferHat(topHatId, address(this), msg.sender);
}

function createAndDeclareTree(CreateTreeParams calldata params) public {
bytes32 salt = getSalt();

Expand All @@ -207,7 +230,7 @@ contract DecentHats_0_1_0 {
salt
);

updateKeyValuePairs(params.keyValuePairs, topHatId);
declareSafeHatTree(params.keyValuePairs, topHatId);

(uint256 adminHatId, ) = createHatAndAccountAndMintAndStreams(
params.hatsProtocol,
Expand Down
192 changes: 177 additions & 15 deletions deployments/sepolia/DecentHats_0_1_0.json

Large diffs are not rendered by default.

Loading

0 comments on commit 1563a93

Please sign in to comment.