Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New Feature Termed Roles #102

Merged
merged 124 commits into from
Oct 30, 2024
Merged
Show file tree
Hide file tree
Changes from 102 commits
Commits
Show all changes
124 commits
Select commit Hold shift + click to select a range
a56a3a9
add getHatEligibilityModule to IHats interface
Da-Colon Sep 17, 2024
21502f9
Add HatsElectionEligibility interface
Da-Colon Sep 17, 2024
e69292e
wip DecentAutonomousAdminHat contract
Da-Colon Sep 17, 2024
9e66612
create AA Hat
Da-Colon Sep 23, 2024
4432441
remove unused param
Da-Colon Sep 25, 2024
5830d1f
update interfaces with needed methods
Da-Colon Sep 25, 2024
5f88285
add tests for Wearer requirement
Da-Colon Sep 25, 2024
9245696
add deployment file
Da-Colon Sep 25, 2024
77e81db
drop hat off name
Da-Colon Sep 25, 2024
85b8217
add Autonomous Admin as wearer of admin hat
Da-Colon Sep 25, 2024
8666ac5
remove only
Da-Colon Sep 25, 2024
db60757
fix deploy name
Da-Colon Sep 25, 2024
6b2d609
pass eligibility address as param
Da-Colon Sep 26, 2024
b53a417
update with proxy pattern
Da-Colon Sep 27, 2024
4170355
update with new props to deploy proxy
Da-Colon Sep 27, 2024
5094eef
rename and update tests to support proxy pattern
Da-Colon Sep 27, 2024
ca71da0
remove only
Da-Colon Sep 27, 2024
94d0cf4
update DecentHats tests to support changes to contract
Da-Colon Sep 27, 2024
62917d5
update deploy with constructor arg
Da-Colon Sep 27, 2024
3c06793
use existing salt
Da-Colon Sep 27, 2024
bda7d79
remove only
Da-Colon Sep 27, 2024
6ff9499
don't add new variables
Da-Colon Sep 27, 2024
ce2087c
add interface for HatModuleFactory
Da-Colon Oct 1, 2024
04c2639
update to add electionModuleAddress to termed roles
Da-Colon Oct 1, 2024
f379a19
update test with new params
Da-Colon Oct 1, 2024
79fd8db
rename param
Da-Colon Oct 3, 2024
7fe6947
revert use of moduleProxyfactory to deploy DecentAutoAdmin
Da-Colon Oct 4, 2024
5cdba24
rename termEndTs -> termEndDateTs
Da-Colon Oct 4, 2024
69641f5
Update tests to support changes
Da-Colon Oct 4, 2024
bf0fa43
revert DecentHats_0_1_0 contract
Da-Colon Oct 7, 2024
b472237
remove versioning from constructor
Da-Colon Oct 7, 2024
6c83f8c
remove unneeded deploy file
Da-Colon Oct 7, 2024
be65d3b
add DecentHats_0_2_0 contract and deployment script
Da-Colon Oct 7, 2024
558b3b7
reorder structs for gas efficiency
Da-Colon Oct 7, 2024
26d843f
revert 0_1_0 test and add 0_2_0 tests
Da-Colon Oct 7, 2024
0d41023
update test
Da-Colon Oct 7, 2024
1bafbf8
fix deployment script
Da-Colon Oct 8, 2024
bf80360
use ModuleProxyFactory to deploy AutoAdmin
Da-Colon Oct 9, 2024
216e1e0
update tests to support changes
Da-Colon Oct 9, 2024
a3bc214
Downtype "sablier" in SablierStreamParams to an address, and rename i…
adamgall Oct 9, 2024
85543b3
Add PRBMath to package, for Sablier interfaces
adamgall Oct 9, 2024
42de8fc
Added minimum amount of "full" Sablier interfaces needed for DecentSa…
adamgall Oct 9, 2024
ffc7c0f
Fix MockSablierV2LockupLinear contract to actually implement full ISa…
adamgall Oct 9, 2024
60fb6d8
Use new "full" Sablier interfaces in DecenHats_0_2_0
adamgall Oct 9, 2024
fabf38d
Type the sablier address as the "full" ISablierV2Lockup type in Decen…
adamgall Oct 9, 2024
38f80ef
Remove changes from original ISablierV2LockupLinear interface, so no …
adamgall Oct 9, 2024
1470b4e
Named imports in DecentAutonomousAdmin
adamgall Oct 9, 2024
43fad8e
Copy in the FULL Hats interfaces
adamgall Oct 9, 2024
dca553b
Rename IHatModuleFactory to IHatsModuleFactory, place it in Hats dire…
adamgall Oct 9, 2024
49ef5d7
Move IHatsElectionsElegibility into "full" directory
adamgall Oct 9, 2024
1633f26
If you don't need to use a variable in a function just delete the nam…
adamgall Oct 9, 2024
004e4a3
Finish implementing full Hats interface in MockHatsAdmin
adamgall Oct 9, 2024
71ac995
Use "full" IHats interface in DecentAutonomousAdmin and DecentHats_0_2_0
adamgall Oct 9, 2024
f90ac5a
Revert changes to original IHats interface
adamgall Oct 9, 2024
0ce7bbd
Revert change to DecentHats_0_1_0 contract -- this actually does caus…
adamgall Oct 9, 2024
80981ee
Remove unused import from DecentHats_0_2_0
adamgall Oct 9, 2024
72137a1
Merge branch 'develop' into add-contract/DecentAutonomousAdminHat
adamgall Oct 9, 2024
ee3478c
Update Sablier contracts to their actual solidity pragma
adamgall Oct 9, 2024
518e053
Support solidity version 0.8.28 in hardhat config
adamgall Oct 9, 2024
6a45c94
Use solidity version 0.8.28 for new contracts
adamgall Oct 9, 2024
d0a6e04
renaming and move salt to constant
Da-Colon Oct 11, 2024
58c3468
update tests to read SALT from contract
Da-Colon Oct 11, 2024
15d6495
Merge branch 'develop' of github.com:decent-dao/fractal-contracts int…
Da-Colon Oct 11, 2024
bdd2678
reorder new deploy scripts
Da-Colon Oct 11, 2024
a05a74b
revert changes made to struct
Da-Colon Oct 12, 2024
cc595bd
set eligibility module and elect when new term role
Da-Colon Oct 17, 2024
80a1331
fix tests
Da-Colon Oct 17, 2024
075a281
remove flushing of payments when triggering new term
Da-Colon Oct 17, 2024
0c9963b
termed role payments are direct to nominated wearer
Da-Colon Oct 19, 2024
09cf6c9
clean up
Da-Colon Oct 20, 2024
e56fede
make factoryFriendly
Da-Colon Oct 20, 2024
ffcf907
revert changes
Da-Colon Oct 21, 2024
78e4151
revert changes
Da-Colon Oct 21, 2024
f424617
change for consistency
Da-Colon Oct 21, 2024
0b6c791
revert change
Da-Colon Oct 21, 2024
ae18198
add comments
Da-Colon Oct 21, 2024
418a93f
small cleanup
Da-Colon Oct 21, 2024
79ac1f4
add ERC165 support
Da-Colon Oct 22, 2024
8d0f1f2
Merge branch 'develop' into add-contract/DecentAutonomousAdminHat
adamgall Oct 22, 2024
1682d01
Lint and pretty
adamgall Oct 22, 2024
7d1f12d
Merge branch 'develop' into add-contract/DecentAutonomousAdminHat
adamgall Oct 22, 2024
faffebf
remove unused structand unsued comment area
Da-Colon Oct 23, 2024
6e63069
remove unneeded conditionals
Da-Colon Oct 23, 2024
c175538
add requires to check term param length and nominees length
Da-Colon Oct 23, 2024
23feccb
Merge branch 'develop' of github.com:decent-dao/fractal-contracts int…
Da-Colon Oct 26, 2024
6e9e322
update with public function to create new RoleHats
Da-Colon Oct 26, 2024
d0baf89
Add createTermRole external function
Da-Colon Oct 26, 2024
e84b682
switch createAndDeclareTree function to external
Da-Colon Oct 26, 2024
c9a5009
move Create Sablier Stream logic to internal function
Da-Colon Oct 26, 2024
d3c885d
fix sablier recipient for role hats
Da-Colon Oct 26, 2024
22b492a
update tests to latest
Da-Colon Oct 26, 2024
b0f9ec5
update eligibility mock contract to more align with live contract
Da-Colon Oct 27, 2024
44e1e2d
add `getNextId` method
Da-Colon Oct 27, 2024
81b9ac0
add 'create tree with term roles' tests
Da-Colon Oct 27, 2024
d2b15f1
eslint ignore ethers import
Da-Colon Oct 27, 2024
866716c
Update natspec
DarksightKellar Oct 25, 2024
4d4edb8
Put natspec update in the correct contract
DarksightKellar Oct 28, 2024
c9cde2b
Cleanup natspec
DarksightKellar Oct 28, 2024
6b0f5c8
Add natspec clarifying stream recipient difference between termed and…
DarksightKellar Oct 28, 2024
2551fbf
fix typo
Da-Colon Oct 29, 2024
b066efa
expect the hat wearer to lose hat
Da-Colon Oct 29, 2024
a58bad4
add test for `createTermedRoleHat`
Da-Colon Oct 29, 2024
0df6616
Revert misplaced natspec update
DarksightKellar Oct 29, 2024
0f211e0
Remove unused import from interface
adamgall Oct 29, 2024
2ecdbdc
Consolidate Mock Hats into a single contract
adamgall Oct 29, 2024
ba60829
Update test name
adamgall Oct 29, 2024
3d771f4
review feedback
Da-Colon Oct 29, 2024
4a93ed0
nominatedWearer now a single address to match business logic
adamgall Oct 29, 2024
aa4d6a6
Remove NAME from contract
adamgall Oct 29, 2024
d18ad25
Remove unused import
adamgall Oct 29, 2024
1c0c3b9
use error and revert
Da-Colon Oct 29, 2024
4ffbbe7
remove declaration and pass directly
Da-Colon Oct 29, 2024
eaea602
remove _createHat internal func and call directly
Da-Colon Oct 29, 2024
59e2c6b
remove _createElectionEligiblityModule and use function call directly
Da-Colon Oct 29, 2024
21fca7f
remove _createAccount and use function call directly
Da-Colon Oct 29, 2024
622cb09
add comments
Da-Colon Oct 29, 2024
b02cbe2
update to customError for test
Da-Colon Oct 29, 2024
1dbf281
update name to make sense
Da-Colon Oct 29, 2024
68f6730
Rename contract to DecentHatsCreationModule
adamgall Oct 30, 2024
0c51fb0
Remove code for modifying an existing hats tree (adding a hat)
adamgall Oct 30, 2024
2e2fa29
Remove "modifiying tree" (adding hats) external functions from contra…
adamgall Oct 30, 2024
ca2be1f
Move functions around, add some comments
adamgall Oct 30, 2024
971ba59
Remove unneeded struct via refactoring
adamgall Oct 30, 2024
302c147
Rename "election eligibility" to "elections eligibility", and "regist…
adamgall Oct 30, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 57 additions & 0 deletions contracts/DecentAutonomousAdmin.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
// SPDX-License-Identifier: MIT
pragma solidity 0.8.28;
adamgall marked this conversation as resolved.
Show resolved Hide resolved

import {IHats} from "./interfaces/hats/full/IHats.sol";
import {IHatsElectionEligibility} from "./interfaces/hats/full/IHatsElectionEligibility.sol";
import {FactoryFriendly} from "@gnosis.pm/zodiac/contracts/factory/FactoryFriendly.sol";
import {ERC165} from "@openzeppelin/contracts/utils/introspection/ERC165.sol";
import {IDecentAutonomousAdmin} from "./interfaces/IDecentAutonomousAdmin.sol";

contract DecentAutonomousAdmin is
IDecentAutonomousAdmin,
ERC165,
FactoryFriendly
{
// //////////////////////////////////////////////////////////////
// initializer
// //////////////////////////////////////////////////////////////
function setUp(bytes memory initializeParams) public override initializer {}
adamgall marked this conversation as resolved.
Show resolved Hide resolved

// //////////////////////////////////////////////////////////////
// Public Functions
// //////////////////////////////////////////////////////////////
function triggerStartNextTerm(TriggerStartArgs calldata args) public {
adamgall marked this conversation as resolved.
Show resolved Hide resolved
require(
args.userHatProtocol.isWearerOfHat(
args.currentWearer,
args.userHatId
),
"Not current wearer"
);
address hatsEligibilityModuleAddress = args
.userHatProtocol
.getHatEligibilityModule(args.userHatId);

IHatsElectionEligibility hatsElectionModule = IHatsElectionEligibility(
hatsEligibilityModuleAddress
);

hatsElectionModule.startNextTerm();

// This will burn the hat since wearer is no longer eligible
args.userHatProtocol.checkHatWearerStatus(
args.userHatId,
args.currentWearer
);
// This will mint the hat to the nominated wearer
args.userHatProtocol.mintHat(args.userHatId, args.nominatedWearer);
}

function supportsInterface(
bytes4 interfaceId
) public view override returns (bool) {
return
interfaceId == type(IDecentAutonomousAdmin).interfaceId ||
super.supportsInterface(interfaceId);
}
}
Loading