-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #121 from decentdao/add-decenthats-modification-mo…
…dule Add DecentHatsModificationModule
- Loading branch information
Showing
3 changed files
with
482 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity 0.8.28; | ||
|
||
import {IERC6551Registry} from "./interfaces/IERC6551Registry.sol"; | ||
import {IHats} from "./interfaces/hats/full/IHats.sol"; | ||
import {IHatsModuleFactory} from "./interfaces/hats/full/IHatsModuleFactory.sol"; | ||
import {DecentHatsUtils} from "./DecentHatsUtils.sol"; | ||
|
||
contract DecentHatsModificationModule is DecentHatsUtils { | ||
struct CreateTermedOrUntermedRoleHatParams { | ||
IHats hatsProtocol; | ||
IERC6551Registry registry; | ||
address topHatAccount; | ||
address hatsAccountImplementation; | ||
uint256 adminHatId; | ||
uint256 topHatId; | ||
HatParams hat; | ||
address hatsElectionsEligibilityImplementation; | ||
IHatsModuleFactory hatsModuleFactory; | ||
} | ||
|
||
/** | ||
* @notice Creates a new termed or untermed role hat and any streams on it. | ||
* | ||
* @notice This contract should be enabled a module on the Safe for which the role is to be created, and disabled after. | ||
* | ||
* @dev Stream funds on untermed Roles are targeted at the hat's smart account. In order to withdraw funds from the stream, the | ||
* hat's smart account must be the one call to `withdraw-` on the Sablier contract, setting the recipient arg to its wearer. | ||
* | ||
* @dev Stream funds on termed Roles are targeted directly at the nominated wearer. | ||
* The wearer should directly call `withdraw-` on the Sablier contract. | ||
* | ||
* @dev Role hat creation, minting, smart account creation and stream creation are handled here in order | ||
* to avoid a race condition where not more than one active proposal to create a new role can exist at a time. | ||
* See: https://github.com/decentdao/decent-interface/issues/2402 | ||
*/ | ||
function createRoleHat( | ||
CreateTermedOrUntermedRoleHatParams calldata params | ||
) external { | ||
_processHat( | ||
params.hatsProtocol, | ||
params.registry, | ||
params.hatsAccountImplementation, | ||
params.topHatId, | ||
params.topHatAccount, | ||
params.hatsModuleFactory, | ||
params.hatsElectionsEligibilityImplementation, | ||
params.adminHatId, | ||
params.hat | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import { HardhatRuntimeEnvironment } from 'hardhat/types'; | ||
import { DeployFunction } from 'hardhat-deploy/types'; | ||
import { deployNonUpgradeable } from '../helpers/deployNonUpgradeable'; | ||
|
||
const func: DeployFunction = async (hre: HardhatRuntimeEnvironment) => { | ||
await deployNonUpgradeable(hre, 'DecentHatsModificationModule'); | ||
}; | ||
|
||
export default func; |
Oops, something went wrong.