Skip to content

Commit be65e2e

Browse files
authored
Merge pull request #28 from Synaps3Protocol/registries/hook
Registries/hook
2 parents 4af7b77 + a098741 commit be65e2e

File tree

20 files changed

+1237
-173
lines changed

20 files changed

+1237
-173
lines changed

broadcast/16_Upgrade_Rights_RightsPolicyAuthorizer.s.sol/80002/run-1747408115.json

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

broadcast/16_Upgrade_Rights_RightsPolicyAuthorizer.s.sol/80002/run-1747408579.json

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

broadcast/16_Upgrade_Rights_RightsPolicyAuthorizer.s.sol/80002/run-latest.json

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

contracts/core/interfaces/assets/IAssetReferendum.sol

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,10 @@ pragma solidity 0.8.26;
44

55
import { IAssetRegistrable } from "@synaps3/core/interfaces/assets/IAssetRegistrable.sol";
66
import { IAssetVerifiable } from "@synaps3/core/interfaces/assets/IAssetVerifiable.sol";
7+
import { IAssetRevokable } from "@synaps3/core/interfaces/assets/IAssetRevokable.sol";
78

89
/// @title IAssetReferendum
910
/// @notice Unified interface for managing content registration and verifications within a referendum-based system.
1011
/// @dev This interface extends both IAssetRegistrable and IAssetVerifiable to provide a single entry point for
1112
/// handling asset registration and verification processes.
12-
interface IAssetReferendum is IAssetRegistrable, IAssetVerifiable {}
13+
interface IAssetReferendum is IAssetRegistrable, IAssetVerifiable, IAssetRevokable {}

contracts/core/interfaces/assets/IAssetRegistrable.sol

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,4 @@ interface IAssetRegistrable {
1515
/// @dev Once approved, the asset is considered verified and usable within the system.
1616
/// @param assetId The unique identifier of the asset to be approved.
1717
function approve(uint256 assetId) external;
18-
19-
/// @notice Rejects an asset proposition in the referendum.
20-
/// @dev If rejected, the asset cannot be used in the system unless resubmitted.
21-
/// @param assetId The unique identifier of the asset to be rejected.
22-
function reject(uint256 assetId) external;
23-
24-
/// @notice Revokes a previously approved asset.
25-
/// @dev This function allows the system to remove approval from an asset, disabling its functionality.
26-
/// @param assetId The unique identifier of the asset to be revoked.
27-
function revoke(uint256 assetId) external;
2818
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
// SPDX-License-Identifier: BUSL-1.1
2+
// NatSpec format convention - https://docs.soliditylang.org/en/v0.5.10/natspec-format.html
3+
pragma solidity 0.8.26;
4+
5+
/// @title IAssetRevokable Interface
6+
/// @notice Defines the functions for invalidating or withdrawing assets from the system.
7+
/// @dev This interface focuses on asset rejection and revocation, used in the governance lifecycle.
8+
interface IAssetRevokable {
9+
/// @notice Rejects an asset proposition in the referendum.
10+
/// @dev If rejected, the asset cannot be used in the system unless resubmitted.
11+
/// @param assetId The unique identifier of the asset to be rejected.
12+
function reject(uint256 assetId) external;
13+
14+
/// @notice Revokes a previously approved asset.
15+
/// @dev This function allows the system to remove approval from an asset, disabling its functionality.
16+
/// @param assetId The unique identifier of the asset to be revoked.
17+
function revoke(uint256 assetId) external;
18+
}

contracts/core/interfaces/custody/ICustodian.sol

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

5-
import { IBalanceVerifiable } from "@synaps3/core/interfaces/base/IBalanceVerifiable.sol";
6-
import { IBalanceWithdrawable } from "@synaps3/core/interfaces/base/IBalanceWithdrawable.sol";
7-
85
/// @title ICustodian
96
/// @notice Interface for custodian contracts responsible for managing content custody.
10-
interface ICustodian is IBalanceVerifiable, IBalanceWithdrawable {
7+
interface ICustodian {
118
/// @notice Set the endpoint of the custodian.
129
/// @dev This function can only be called by the owner of the contract.
1310
/// @param _endpoint The new custodian's endpoint.

contracts/core/interfaces/economics/ITreasury.sol

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

5-
import { IBalanceOperator } from "@synaps3/core/interfaces/base/IBalanceOperator.sol";
6-
75
/// @title ITreasury Interface
86
/// @notice Defines the standard functions for a Treasury contract.
9-
interface ITreasury is IBalanceOperator {
7+
interface ITreasury {
108
/// @notice Collects accrued fees for a specified currency from an authorized fee collector.
119
/// @param collector The address of an authorized fee collector.
1210
/// @param currency The address of the currency for which fees are being collected.

contracts/core/interfaces/rights/IRightsAssetCustodianRegistrable.sol

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,17 @@ pragma solidity 0.8.26;
66
/// @notice Interface for registering and managing custodial rights over assets.
77
/// @dev This interface provides functions for granting and revoking custodial rights.
88
interface IRightsAssetCustodianRegistrable {
9-
/// @notice Grants custodial rights over the asset held by a holder to a custodian.
10-
/// @dev Assigns the specified custodian as a custodian, allowing them to manage the holder's asset.
11-
/// @param custodian The address of the custodian who will receive custodial rights.
9+
/// @notice Assigns custodial rights over the caller's content to a specified custodian.
10+
/// @param custodian The address of the custodian to assign.
1211
function grantCustody(address custodian) external;
1312

1413
/// @notice Revokes custodial rights of a custodian for the caller's assets.
15-
/// @dev Removes the specified custodian from the custody registry of the caller.
1614
/// @param custodian The address of the custodian to revoke custody from.
1715
function revokeCustody(address custodian) external;
16+
17+
/// @notice Sets a custom priority value for a specific custodian assigned to the caller.
18+
/// @dev Influences the weighting in the balancing algorithm used to select custodians.
19+
/// @param custodian The custodian whose priority is being set.
20+
/// @param priority The priority value to assign. Must be >= 1.
21+
function setPriority(address custodian, uint256 priority) external;
1822
}

contracts/core/interfaces/rights/IRightsAssetCustodianVerifiable.sol

Lines changed: 24 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,25 +3,34 @@
33
pragma solidity 0.8.26;
44

55
/// @title IRightsAssetCustodianVerifiable
6-
/// @notice Interface for verifying and retrieving custody-related data.
7-
/// @dev This interface provides read-access functions to check custodianship status and custody records.
6+
/// @notice Interface for verifying custodian assignments and querying custody-related data.
7+
/// @dev Includes read-access functions used in balancing and audit operations.
88
interface IRightsAssetCustodianVerifiable {
9-
/// @notice Checks if a given custodian is a custodian for the specified content holder.
10-
/// @dev Returns true if the custodian has custodial rights over the holder's assets.
9+
/// @notice Checks whether a custodian is currently assigned to a holder.
10+
/// @dev Returns true only if the custodian is active and listed for the specified holder.
1111
/// @param holder The address of the asset rights holder.
12-
/// @param custodian The address of the custodian to check.
13-
/// @return True if the custodian is a custodian, false otherwise.
12+
/// @param custodian The address of the custodian to verify.
13+
/// @return True if `custodian` is valid and assigned to `holder`, false otherwise.
1414
function isCustodian(address holder, address custodian) external view returns (bool);
1515

16-
/// @notice Retrieves the addresses of all custodians assigned to a given content holder.
17-
/// @dev Returns an array of addresses representing custodians for the specified asset holder.
18-
/// @param holder The address of the asset rights holder whose custodians are being retrieved.
19-
/// @return An array of addresses of assigned custodians.
20-
function getCustodians(address holder) external view returns (address[] memory);
16+
/// @notice Returns a custodian selected by a probabilistic balancing algorithm.
17+
/// @dev The selection is based on priority, demand and economic weight (balance).
18+
/// @param holder The address of the asset holder requesting a custodian.
19+
/// @param currency The currency used to evaluate the custodian's balance.
20+
/// @return The selected custodian address.
21+
function getBalancedCustodian(address holder, address currency) external view returns (address);
2122

22-
/// @notice Retrieves the total number of asset items in custody for a given custodian.
23-
/// @dev Returns the number of assets managed by the specified custodian.
24-
/// @param custodian The address of the custodian whose custodial content count is being requested.
25-
/// @return The total number of assets held in custody by the custodian.
23+
/// @notice Retrieves the total number of holders assigned to a custodian.
24+
/// @dev Represents the current load (demand) of a custodian in terms of assignments.
25+
/// @param custodian The custodian address to query.
26+
/// @return The number of holders currently assigned to the custodian.
2627
function getCustodyCount(address custodian) external view returns (uint256);
28+
29+
/// @notice Calculates the weighted score of a custodian for a specific holder and currency.
30+
/// @dev Used to externally query the score that influences custodian selection.
31+
/// @param holder The address of the rights holder.
32+
/// @param custodian The address of the custodian.
33+
/// @param currency The token used to evaluate economic backing.
34+
/// @return The computed weight used in the balancing algorithm.
35+
function calcWeight(address holder, address custodian, address currency) external view returns (uint256);
2736
}

0 commit comments

Comments
 (0)