Skip to content

Commit 030adcc

Browse files
authored
Merge pull request #27 from Synaps3Protocol/registries/hook
Registries/hook
2 parents 73ea95a + daec772 commit 030adcc

File tree

62 files changed

+1056
-601
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+1056
-601
lines changed

.env.vault

Lines changed: 8 additions & 8 deletions
Large diffs are not rendered by default.

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ force-compile:
5454

5555
.PHONY: test ## run tests
5656
test:
57-
@CI=true && forge test --show-progress --gas-report -vvv --fail-fast
57+
@export CI=true && forge test --show-progress --gas-report -vvvv
5858

5959
.PHONY: coverage ## run tests coverage report
6060
coverage:

contracts/access/AccessManager.sol

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,44 @@ contract AccessManager is Initializable, UUPSUpgradeable, AccessManagerUpgradeab
3131
// return (true, getRoleAdmin(roleId), 0); // => (true, 0, 0)
3232
// }
3333

34+
// Strategic roles for governance classification within the protocol:
35+
//
36+
// Community Governance Role:
37+
// - GOV_ROLE: Represents decentralized community governance.
38+
// Decisions are made through collective voting mechanisms (e.g., token-weighted, quadratic).
39+
//
40+
// Group/Sub-DAO Based Roles:
41+
// - ADMIN_ROLE: Managed by a smart account or sub-DAO.
42+
// Handles protocol upgrades, pause mechanisms, and operational role assignments.
43+
// - MOD_ROLE: Managed by a smart account or sub-DAO.
44+
// Approves policy submissions and moderates hook operations.
45+
// - REF_ROLE: Managed by a smart account or sub-DAO.
46+
// Participates in governance referenda for content curation and distributor selection.
47+
//
48+
// Individual/Contract Based Roles:
49+
// - OPS_ROLE: Internal operational role assigned to protocol-trusted contracts
50+
// for direct module interactions. No human involvement.
51+
// - VER_ROLE: Individual role assigned to trusted creators, enabling
52+
// content uploads without conventional verification.
53+
54+
/*
55+
GOV_ROLE (Community Governance)
56+
57+
├── ADMIN_ROLE (Smart Account / Sub-DAO)
58+
│ │
59+
│ ├── MOD_ROLE (Smart Account / Sub-DAO)
60+
│ │
61+
│ └── OPS_ROLE (Internal Contract Role)
62+
63+
├── REF_ROLE (Smart Account / Sub-DAO)
64+
65+
├── VER_ROLE (Individual Trusted Creator)
66+
*/
67+
68+
_setRoleAdmin(C.VER_ROLE, C.GOV_ROLE);
69+
_setRoleAdmin(C.REF_ROLE, C.GOV_ROLE);
3470
_setRoleAdmin(C.MOD_ROLE, C.ADMIN_ROLE);
3571
_setRoleAdmin(C.OPS_ROLE, C.ADMIN_ROLE);
36-
_setRoleAdmin(C.VER_ROLE, C.GOV_ROLE);
3772
}
3873

3974
// TODO pause protocol based on permission and roles

contracts/access/eg.PauseManager

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
// pause protocol using:
2+
// pause manager + pausable

contracts/assets/AssetOwnership.sol

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,12 @@ contract AssetOwnership is
3838
/// @dev Emitted when a new asset is registered on the platform.
3939
/// @param owner The address of the creator or owner of the registered asset.
4040
/// @param assetId The unique identifier for the registered asset.
41-
event RegisteredAsset(address indexed owner, uint256 assetId);
41+
event RegisteredAsset(address indexed owner, uint256 indexed assetId);
4242

4343
/// @dev Emitted when an asset is revoked and removed from the platform.
4444
/// @param owner The address of the owner of the revoked asset.
4545
/// @param assetId The unique identifier for the revoked asset.
46-
event RevokedAsset(address indexed owner, uint256 assetId);
46+
event RevokedAsset(address indexed owner, uint256 indexed assetId);
4747

4848
/// @dev Emitted when an asset is transferred from one owner to another.
4949
/// @param from The address of the current owner of the asset.
@@ -112,6 +112,7 @@ contract AssetOwnership is
112112
}
113113

114114
// TODO: build getURI => from custodian /erc721-metadata
115+
// TODO: Update asset info control version restricted/approved by governance
115116
// TODO: Transfer Ownership Fee: Introducing a fee for transferring
116117
// ownership discourages frequent or unnecessary transfers,
117118
// adding an economic cost to any potential abuse of the system. Like bypassing content

contracts/assets/AssetReferendum.sol

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,13 @@
33
pragma solidity 0.8.26;
44

55
import { UUPSUpgradeable } from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";
6-
import { EIP712Upgradeable } from "@openzeppelin/contracts-upgradeable/utils/cryptography/EIP712Upgradeable.sol";
7-
import { NoncesUpgradeable } from "@openzeppelin/contracts-upgradeable/utils/NoncesUpgradeable.sol";
86
import { Initializable } from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
97
import { EnumerableSet } from "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";
108

119
import { AccessControlledUpgradeable } from "@synaps3/core/primitives/upgradeable/AccessControlledUpgradeable.sol";
1210
import { QuorumUpgradeable } from "@synaps3/core/primitives/upgradeable/QuorumUpgradeable.sol";
1311
import { IAssetReferendum } from "@synaps3/core/interfaces/assets/IAssetReferendum.sol";
12+
import { T } from "@synaps3/core/primitives/Types.sol";
1413
import { C } from "@synaps3/core/primitives/Constants.sol";
1514

1615
/// @title AssetReferendum
@@ -20,8 +19,6 @@ contract AssetReferendum is
2019
Initializable,
2120
UUPSUpgradeable,
2221
AccessControlledUpgradeable,
23-
NoncesUpgradeable,
24-
EIP712Upgradeable,
2522
QuorumUpgradeable,
2623
IAssetReferendum
2724
{
@@ -34,19 +31,19 @@ contract AssetReferendum is
3431
/// @dev Event emitted when a content is submitted for referendum.
3532
/// @param assetId The ID of the asset that has been submitted.
3633
/// @param initiator The address of the initiator who submitted the asset.
37-
event Submitted(address indexed initiator, uint256 assetId);
34+
event Submitted(address indexed initiator, uint256 indexed assetId);
3835

3936
/// @dev Event emitted when a content is approved.
4037
/// @param assetId The ID of the asset that has been approved.
41-
event Approved(uint256 assetId);
38+
event Approved(uint256 indexed assetId);
4239

4340
/// @dev Event emitted when a content is revoked.
4441
/// @param assetId The ID of the asset that has been revoked.
45-
event Revoked(uint256 assetId);
42+
event Revoked(uint256 indexed assetId);
4643

4744
/// @dev Event emitted when a content is rejected.
4845
/// @param assetId The ID of the asset that has been rejected.
49-
event Rejected(uint256 assetId);
46+
event Rejected(uint256 indexed assetId);
5047

5148
/// @dev Error thrown when asset submission fails.
5249
/// @param initiator The address of the user who attempted to submit the asset.
@@ -66,7 +63,6 @@ contract AssetReferendum is
6663
function initialize(address accessManager) public initializer {
6764
__Quorum_init();
6865
__UUPSUpgradeable_init();
69-
__EIP712_init("Referendum", "1");
7066
__AccessControlled_init(accessManager);
7167
}
7268

@@ -133,7 +129,7 @@ contract AssetReferendum is
133129
/// @notice Checks if the asset is active nor blocked.
134130
/// @param assetId The ID of the asset.
135131
function isActive(uint256 assetId) public view returns (bool) {
136-
return _status(assetId) == Status.Active;
132+
return _status(assetId) == T.Status.Active;
137133
}
138134

139135
/// @notice Function that should revert when msg.sender is not authorized to upgrade the contract.

contracts/assets/eg.AssetDisputes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
// dispute rights via governance

contracts/core/interfaces/assets/IAssetRegistrable.sol

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@ pragma solidity 0.8.26;
44

55
/// @title IAssetRegistrable Interface
66
/// @notice Defines the essential functions for managing asset registration and governance through a referendum process.
7-
/// @dev Implement this interface in a referendum contract to allow
8-
/// asset proposals, approvals, rejections, and revocations.
7+
/// @dev This interface mirrors the FSM behavior from `IQuorum`, but scoped to asset governance.
98
interface IAssetRegistrable {
109
/// @notice Submits a new asset proposition for a referendum.
1110
/// @dev This function should allow entities to propose an asset for approval.

contracts/core/interfaces/base/IBalanceOperator.sol

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@
22
// NatSpec format convention - https://docs.soliditylang.org/en/v0.5.10/natspec-format.html
33
pragma solidity 0.8.26;
44

5-
/// @title IBalanceOperator Interface
6-
/// @notice Combines functionalities for verifying, depositing, withdrawing, and transferring balances.
7-
/// @dev This interface aggregates multiple interfaces to standardize balance-related operations.
85
import { IBalanceDepositor } from "@synaps3/core/interfaces/base/IBalanceDepositor.sol";
96
import { IBalanceWithdrawable } from "@synaps3/core/interfaces/base/IBalanceWithdrawable.sol";
107
import { IBalanceTransferable } from "@synaps3/core/interfaces/base/IBalanceTransferable.sol";
118
import { IBalanceVerifiable } from "@synaps3/core/interfaces/base/IBalanceVerifiable.sol";
129

10+
/// @title IBalanceOperator Interface
11+
/// @notice Combines functionalities for verifying, depositing, withdrawing, and transferring balances.
12+
/// @dev This interface aggregates multiple interfaces to standardize balance-related operations.
1313
/// @dev The `IBalanceOperator` interface extends multiple interfaces to provide a comprehensive suite of
1414
/// balance-related operations, including deposit, withdrawal, transfer, reserve, and balance verification.
1515
interface IBalanceOperator is IBalanceDepositor, IBalanceWithdrawable, IBalanceTransferable, IBalanceVerifiable {}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// SPDX-License-Identifier: BUSL-1.1
2+
pragma solidity 0.8.26;
3+
4+
import { IQuorumRegistrable } from "@synaps3/core/interfaces/base/IQuorumRegistrable.sol";
5+
import { IQuorumRevokable } from "@synaps3/core/interfaces/base/IQuorumRevokable.sol";
6+
import { IQuorumInspectable } from "@synaps3/core/interfaces/base/IQuorumInspectable.sol";
7+
8+
/// @title IQuorum
9+
/// @notice Aggregates the full lifecycle of an FSM-driven entity registration system.
10+
/// @dev Combines registration, approval, rejection, revocation, and status inspection.
11+
/// Intended for systems that use `QuorumUpgradeable` as FSM logic layer.
12+
interface IQuorum is IQuorumRegistrable, IQuorumRevokable, IQuorumInspectable {}

0 commit comments

Comments
 (0)