From 79ac1f4e28e2aadda7cd9974ff3f1fd61e5f5201 Mon Sep 17 00:00:00 2001 From: David Colon <38386583+Da-Colon@users.noreply.github.com> Date: Tue, 22 Oct 2024 01:16:41 -0400 Subject: [PATCH] add ERC165 support --- contracts/DecentAutonomousAdmin.sol | 33 +++++++++---------- .../interfaces/IDecentAutonomousAdmin.sol | 21 ++++++++++++ 2 files changed, 37 insertions(+), 17 deletions(-) create mode 100644 contracts/interfaces/IDecentAutonomousAdmin.sol diff --git a/contracts/DecentAutonomousAdmin.sol b/contracts/DecentAutonomousAdmin.sol index 221f8f12..7d0fc5df 100644 --- a/contracts/DecentAutonomousAdmin.sol +++ b/contracts/DecentAutonomousAdmin.sol @@ -3,24 +3,15 @@ pragma solidity 0.8.28; import {IHats} from "./interfaces/hats/full/IHats.sol"; import {IHatsElectionEligibility} from "./interfaces/hats/full/IHatsElectionEligibility.sol"; -import {ISablierV2Lockup} from "./interfaces/sablier/full/ISablierV2Lockup.sol"; import {FactoryFriendly} from "@gnosis.pm/zodiac/contracts/factory/FactoryFriendly.sol"; - -contract DecentAutonomousAdmin is FactoryFriendly { - string public constant NAME = "DecentAutonomousAdmin"; - string public constant version_ = "0.1.0"; - - struct SablierStreamInfo { - uint256 streamId; - ISablierV2Lockup sablierV2Lockup; - } - struct TriggerStartArgs { - address currentWearer; - IHats userHatProtocol; - uint256 userHatId; - address nominatedWearer; - } - +import {ERC165} from "@openzeppelin/contracts/utils/introspection/ERC165.sol"; +import {IDecentAutonomousAdmin} from "./interfaces/IDecentAutonomousAdmin.sol"; + +contract DecentAutonomousAdmin is + IDecentAutonomousAdmin, + ERC165, + FactoryFriendly +{ // ////////////////////////////////////////////////////////////// // initializer // ////////////////////////////////////////////////////////////// @@ -56,6 +47,14 @@ contract DecentAutonomousAdmin is FactoryFriendly { args.userHatProtocol.mintHat(args.userHatId, args.nominatedWearer); } + function supportsInterface( + bytes4 interfaceId + ) public view override returns (bool) { + return + interfaceId == type(IDecentAutonomousAdmin).interfaceId || + super.supportsInterface(interfaceId); + } + // ////////////////////////////////////////////////////////////// // Internal Functions // ////////////////////////////////////////////////////////////// diff --git a/contracts/interfaces/IDecentAutonomousAdmin.sol b/contracts/interfaces/IDecentAutonomousAdmin.sol new file mode 100644 index 00000000..ae4a7e34 --- /dev/null +++ b/contracts/interfaces/IDecentAutonomousAdmin.sol @@ -0,0 +1,21 @@ +// SPDX-License-Identifier: MIT +pragma solidity 0.8.28; + +import {IHats} from "./hats/full/IHats.sol"; +import {ISablierV2Lockup} from "./sablier/full/ISablierV2Lockup.sol"; + +interface IDecentAutonomousAdmin { + struct SablierStreamInfo { + uint256 streamId; + ISablierV2Lockup sablierV2Lockup; + } + + struct TriggerStartArgs { + address currentWearer; + IHats userHatProtocol; + uint256 userHatId; + address nominatedWearer; + } + + function triggerStartNextTerm(TriggerStartArgs calldata args) external; +}