Skip to content

Commit

Permalink
Require that DecentAutonomousAdmin (current and future versions) impl…
Browse files Browse the repository at this point in the history
…ement a `version` function
  • Loading branch information
adamgall committed Nov 1, 2024
1 parent 11b0c90 commit 1836224
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 1 deletion.
4 changes: 4 additions & 0 deletions contracts/autonomous-admin/DecentAutonomousAdminV1.sol
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ contract DecentAutonomousAdminV1 is
// //////////////////////////////////////////////////////////////
// Public Functions
// //////////////////////////////////////////////////////////////
function version() external pure override returns (uint32) {
return 1;
}

function triggerStartNextTerm(TriggerStartArgs calldata args) public {
IHatsElectionsEligibility hatsElectionModule = IHatsElectionsEligibility(
args.hatsProtocol.getHatEligibilityModule(args.hatId)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
// SPDX-License-Identifier: MIT
pragma solidity 0.8.28;

interface IDecentAutonomousAdmin {
function version() external view returns (uint32);
}
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
// SPDX-License-Identifier: MIT
pragma solidity 0.8.28;

import {IDecentAutonomousAdmin} from "./IDecentAutonomousAdmin.sol";
import {IHats} from "../hats/IHats.sol";

interface IDecentAutonomousAdminV1 {
interface IDecentAutonomousAdminV1 is IDecentAutonomousAdmin {
error NotCurrentWearer();

struct TriggerStartArgs {
address currentWearer;
IHats hatsProtocol;
Expand Down
6 changes: 6 additions & 0 deletions test/autonomous-admin/DecentAutonomousAdminV1.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,12 @@ describe('DecentAutonomousAdminHatV1', function () {
await hatsElectionModule.elect(nextTermEnd, [await secondWearer.getAddress()]);
});

describe('version', function () {
it('should return the correct version', async () => {
expect(await decentAutonomousAdminInstance.version()).to.equal(1);
});
});

describe('triggerStartNextTerm', function () {
describe('before the first term is over', function () {
it('should have correct wearers', async () => {
Expand Down

0 comments on commit 1836224

Please sign in to comment.