@towns-protocol/contracts 0.0.455 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (61) hide show
  1. package/package.json +4 -4
  2. package/scripts/deployments/diamonds/DeployL1Resolver.s.sol +155 -0
  3. package/scripts/deployments/diamonds/DeployL2Registrar.s.sol +171 -0
  4. package/scripts/deployments/diamonds/DeployL2Resolver.s.sol +196 -0
  5. package/scripts/deployments/diamonds/DeploySpaceFactory.s.sol +0 -12
  6. package/scripts/deployments/facets/DeployAddrResolverFacet.s.sol +36 -0
  7. package/scripts/deployments/facets/DeployArchitect.s.sol +1 -3
  8. package/scripts/deployments/facets/DeployContentHashResolverFacet.s.sol +34 -0
  9. package/scripts/deployments/facets/DeployCreateSpace.s.sol +2 -1
  10. package/scripts/deployments/facets/{DeploySpaceFactoryInit.s.sol → DeployExtendedResolverFacet.s.sol} +10 -10
  11. package/scripts/deployments/facets/DeployL1ResolverFacet.s.sol +61 -0
  12. package/scripts/deployments/facets/DeployL2RegistrarFacet.s.sol +56 -0
  13. package/scripts/deployments/facets/DeployL2RegistryFacet.s.sol +71 -0
  14. package/scripts/deployments/facets/DeployNodeRegistry.s.sol +4 -1
  15. package/scripts/deployments/facets/DeployTextResolverFacet.s.sol +34 -0
  16. package/scripts/deployments/utils/DeployDomainFeeHook.s.sol +78 -0
  17. package/scripts/interactions/InteractAlphaPost.s.sol +0 -7
  18. package/scripts/interactions/InteractBaseAlpha.s.sol +1 -14
  19. package/scripts/interactions/InteractDomainFee.s.sol +62 -0
  20. package/scripts/interactions/InteractSetStreamDistributionBalancingAdvantage.s.sol +42 -0
  21. package/scripts/interactions/InteractSetStreamDistributionRequiredOperators.s.sol +32 -0
  22. package/scripts/interactions/helpers/RiverConfigValues.sol +6 -0
  23. package/src/domains/facets/l1/IL1ResolverService.sol +20 -0
  24. package/src/domains/facets/l1/L1ResolverFacet.sol +100 -0
  25. package/src/domains/facets/l1/L1ResolverMod.sol +245 -0
  26. package/src/domains/facets/l2/AddrResolverFacet.sol +59 -0
  27. package/src/domains/facets/l2/ContentHashResolverFacet.sol +41 -0
  28. package/src/domains/facets/l2/ExtendedResolverFacet.sol +38 -0
  29. package/src/domains/facets/l2/IL2Registry.sol +79 -0
  30. package/src/domains/facets/l2/L2RegistryFacet.sol +203 -0
  31. package/src/domains/facets/l2/TextResolverFacet.sol +43 -0
  32. package/src/domains/facets/l2/modules/AddrResolverMod.sol +110 -0
  33. package/src/domains/facets/l2/modules/ContentHashResolverMod.sol +60 -0
  34. package/src/domains/facets/l2/modules/L2RegistryMod.sol +286 -0
  35. package/src/domains/facets/l2/modules/TextResolverMod.sol +62 -0
  36. package/src/domains/facets/l2/modules/VersionRecordMod.sol +42 -0
  37. package/src/domains/facets/registrar/IL2Registrar.sol +57 -0
  38. package/src/domains/facets/registrar/L2RegistrarFacet.sol +127 -0
  39. package/src/domains/facets/registrar/L2RegistrarMod.sol +224 -0
  40. package/src/domains/hooks/DomainFeeHook.sol +212 -0
  41. package/src/factory/facets/architect/Architect.sol +48 -29
  42. package/src/factory/facets/architect/IArchitect.sol +2 -21
  43. package/src/factory/facets/architect/ImplementationStorage.sol +12 -20
  44. package/src/factory/facets/create/CreateSpace.sol +5 -0
  45. package/src/factory/facets/create/CreateSpaceBase.sol +32 -8
  46. package/src/factory/facets/create/ICreateSpace.sol +5 -0
  47. package/src/factory/facets/fee/FeeManagerFacet.sol +10 -0
  48. package/src/factory/facets/fee/FeeTypesLib.sol +3 -0
  49. package/src/river/registry/facets/node/INodeRegistry.sol +25 -0
  50. package/src/river/registry/facets/node/NodeRegistry.sol +53 -2
  51. package/src/river/registry/libraries/RegistryStorage.sol +5 -0
  52. package/src/spaces/facets/ProtocolFeeLib.sol +56 -1
  53. package/src/spaces/facets/proxy/SpaceProxyInitializer.sol +6 -8
  54. package/src/spaces/facets/xchain/SpaceEntitlementGated.sol +9 -0
  55. package/LICENSE.txt +0 -21
  56. package/scripts/bytecode-diff/README.md +0 -182
  57. package/scripts/deployments/utils/DeploySpaceProxyInitializer.s.sol +0 -28
  58. package/scripts/readme.md +0 -289
  59. package/src/diamond/readme.md +0 -50
  60. package/src/factory/SpaceFactoryInit.sol +0 -17
  61. package/src/factory/facets/architect/ArchitectBase.sol +0 -95
@@ -12,7 +12,7 @@ import {CreateSpaceFacet} from "src/factory/facets/create/CreateSpace.sol";
12
12
 
13
13
  library DeployCreateSpace {
14
14
  function selectors() internal pure returns (bytes4[] memory _selectors) {
15
- _selectors = new bytes4[](5);
15
+ _selectors = new bytes4[](6);
16
16
  // createSpace(SpaceInfo) - Basic space creation with SpaceInfo struct
17
17
  _selectors[0] = 0xf822028d;
18
18
  // createSpaceWithPrepay(CreateSpace) - Space creation with prepay (new format)
@@ -23,6 +23,7 @@ library DeployCreateSpace {
23
23
  _selectors[3] = CreateSpaceFacet.createSpaceV2.selector;
24
24
  // createSpace(Action, bytes) - Unified entry point with action dispatch
25
25
  _selectors[4] = bytes4(keccak256("createSpace(uint8,bytes)"));
26
+ _selectors[5] = CreateSpaceFacet.getProxyInitializer.selector;
26
27
  }
27
28
 
28
29
  function makeCut(
@@ -1,5 +1,5 @@
1
- // SPDX-License-Identifier: Apache-2.0
2
- pragma solidity ^0.8.19;
1
+ // SPDX-License-Identifier: MIT
2
+ pragma solidity ^0.8.29;
3
3
 
4
4
  // interfaces
5
5
  import {IDiamond} from "@towns-protocol/diamond/src/IDiamond.sol";
@@ -8,12 +8,12 @@ import {IDiamond} from "@towns-protocol/diamond/src/IDiamond.sol";
8
8
  import {LibDeploy} from "@towns-protocol/diamond/src/utils/LibDeploy.sol";
9
9
 
10
10
  // contracts
11
- import {SpaceFactoryInit} from "src/factory/SpaceFactoryInit.sol";
11
+ import {ExtendedResolverFacet} from "src/domains/facets/l2/ExtendedResolverFacet.sol";
12
12
 
13
- library DeploySpaceFactoryInit {
14
- function selectors() internal pure returns (bytes4[] memory _selectors) {
15
- _selectors = new bytes4[](1);
16
- _selectors[0] = SpaceFactoryInit.initialize.selector;
13
+ library DeployExtendedResolverFacet {
14
+ function selectors() internal pure returns (bytes4[] memory res) {
15
+ res = new bytes4[](1);
16
+ res[0] = ExtendedResolverFacet.resolve.selector;
17
17
  }
18
18
 
19
19
  function makeCut(
@@ -23,11 +23,11 @@ library DeploySpaceFactoryInit {
23
23
  return IDiamond.FacetCut(facetAddress, action, selectors());
24
24
  }
25
25
 
26
- function makeInitData(address _proxyInitializer) internal pure returns (bytes memory) {
27
- return abi.encodeCall(SpaceFactoryInit.initialize, (_proxyInitializer));
26
+ function makeInitData() internal pure returns (bytes memory) {
27
+ return abi.encodeCall(ExtendedResolverFacet.__ExtendedResolverFacet_init, ());
28
28
  }
29
29
 
30
30
  function deploy() internal returns (address) {
31
- return LibDeploy.deployCode("SpaceFactoryInit.sol", "");
31
+ return LibDeploy.deployCode("ExtendedResolverFacet.sol", "");
32
32
  }
33
33
  }
@@ -0,0 +1,61 @@
1
+ // SPDX-License-Identifier: MIT
2
+ pragma solidity ^0.8.29;
3
+
4
+ // interfaces
5
+ import {IDiamond} from "@towns-protocol/diamond/src/IDiamond.sol";
6
+
7
+ // libraries
8
+ import {LibDeploy} from "@towns-protocol/diamond/src/utils/LibDeploy.sol";
9
+ import {DynamicArrayLib} from "solady/utils/DynamicArrayLib.sol";
10
+
11
+ // contracts
12
+ import {L1ResolverFacet} from "src/domains/facets/l1/L1ResolverFacet.sol";
13
+
14
+ library DeployL1ResolverFacet {
15
+ using DynamicArrayLib for DynamicArrayLib.DynamicArray;
16
+
17
+ function selectors() internal pure returns (bytes4[] memory res) {
18
+ DynamicArrayLib.DynamicArray memory arr = DynamicArrayLib.p().reserve(8);
19
+
20
+ // IExtendedResolver
21
+ arr.p(L1ResolverFacet.resolve.selector);
22
+
23
+ // CCIP-Read callback
24
+ arr.p(L1ResolverFacet.resolveWithProof.selector);
25
+
26
+ // Registry management
27
+ arr.p(L1ResolverFacet.setL2Registry.selector);
28
+ arr.p(L1ResolverFacet.getL2Registry.selector);
29
+
30
+ // Gateway URL configuration
31
+ arr.p(L1ResolverFacet.setGatewayURL.selector);
32
+ arr.p(L1ResolverFacet.getGatewayURL.selector);
33
+
34
+ // Gateway signer configuration
35
+ arr.p(L1ResolverFacet.setGatewaySigner.selector);
36
+ arr.p(L1ResolverFacet.getGatewaySigner.selector);
37
+
38
+ bytes32[] memory selectors_ = arr.asBytes32Array();
39
+ assembly ("memory-safe") {
40
+ res := selectors_
41
+ }
42
+ }
43
+
44
+ function makeCut(
45
+ address facetAddress,
46
+ IDiamond.FacetCutAction action
47
+ ) internal pure returns (IDiamond.FacetCut memory) {
48
+ return IDiamond.FacetCut(facetAddress, action, selectors());
49
+ }
50
+
51
+ function makeInitData(
52
+ string memory gatewayUrl,
53
+ address gatewaySigner
54
+ ) internal pure returns (bytes memory) {
55
+ return abi.encodeCall(L1ResolverFacet.__L1Resolver_init, (gatewayUrl, gatewaySigner));
56
+ }
57
+
58
+ function deploy() internal returns (address) {
59
+ return LibDeploy.deployCode("L1ResolverFacet.sol", "");
60
+ }
61
+ }
@@ -0,0 +1,56 @@
1
+ // SPDX-License-Identifier: MIT
2
+ pragma solidity ^0.8.29;
3
+
4
+ // interfaces
5
+ import {IDiamond} from "@towns-protocol/diamond/src/IDiamond.sol";
6
+
7
+ // libraries
8
+ import {LibDeploy} from "@towns-protocol/diamond/src/utils/LibDeploy.sol";
9
+ import {DynamicArrayLib} from "solady/utils/DynamicArrayLib.sol";
10
+
11
+ // contracts
12
+ import {L2RegistrarFacet} from "src/domains/facets/registrar/L2RegistrarFacet.sol";
13
+
14
+ library DeployL2RegistrarFacet {
15
+ using DynamicArrayLib for DynamicArrayLib.DynamicArray;
16
+
17
+ function selectors() internal pure returns (bytes4[] memory res) {
18
+ DynamicArrayLib.DynamicArray memory arr = DynamicArrayLib.p().reserve(10);
19
+
20
+ arr.p(L2RegistrarFacet.register.selector);
21
+ arr.p(L2RegistrarFacet.isAvailable.selector);
22
+ arr.p(L2RegistrarFacet.isValidLabel.selector);
23
+ arr.p(L2RegistrarFacet.getRegistry.selector);
24
+ arr.p(L2RegistrarFacet.getCoinType.selector);
25
+ arr.p(L2RegistrarFacet.getSpaceFactory.selector);
26
+ arr.p(L2RegistrarFacet.setSpaceFactory.selector);
27
+ arr.p(L2RegistrarFacet.setRegistry.selector);
28
+ arr.p(L2RegistrarFacet.setCurrency.selector);
29
+ arr.p(L2RegistrarFacet.getCurrency.selector);
30
+
31
+ bytes32[] memory selectors_ = arr.asBytes32Array();
32
+ assembly ("memory-safe") {
33
+ res := selectors_
34
+ }
35
+ }
36
+
37
+ function makeCut(
38
+ address facetAddress,
39
+ IDiamond.FacetCutAction action
40
+ ) internal pure returns (IDiamond.FacetCut memory) {
41
+ return IDiamond.FacetCut(facetAddress, action, selectors());
42
+ }
43
+
44
+ function makeInitData(
45
+ address registry,
46
+ address spaceFactory,
47
+ address currency
48
+ ) internal pure returns (bytes memory) {
49
+ return
50
+ abi.encodeCall(L2RegistrarFacet.__L2Registrar_init, (registry, spaceFactory, currency));
51
+ }
52
+
53
+ function deploy() internal returns (address) {
54
+ return LibDeploy.deployCode("L2RegistrarFacet.sol", "");
55
+ }
56
+ }
@@ -0,0 +1,71 @@
1
+ // SPDX-License-Identifier: MIT
2
+ pragma solidity ^0.8.29;
3
+
4
+ // interfaces
5
+ import {IDiamond} from "@towns-protocol/diamond/src/IDiamond.sol";
6
+
7
+ // libraries
8
+ import {LibDeploy} from "@towns-protocol/diamond/src/utils/LibDeploy.sol";
9
+ import {DynamicArrayLib} from "solady/utils/DynamicArrayLib.sol";
10
+
11
+ // contracts
12
+ import {L2RegistryFacet} from "src/domains/facets/l2/L2RegistryFacet.sol";
13
+
14
+ library DeployL2RegistryFacet {
15
+ using DynamicArrayLib for DynamicArrayLib.DynamicArray;
16
+
17
+ function selectors() internal pure returns (bytes4[] memory res) {
18
+ DynamicArrayLib.DynamicArray memory arr = DynamicArrayLib.p().reserve(24);
19
+
20
+ // Registry functions
21
+ arr.p(L2RegistryFacet.createSubdomain.selector);
22
+ arr.p(L2RegistryFacet.addRegistrar.selector);
23
+ arr.p(L2RegistryFacet.removeRegistrar.selector);
24
+ arr.p(L2RegistryFacet.setMetadata.selector);
25
+ arr.p(L2RegistryFacet.getMetadata.selector);
26
+ arr.p(L2RegistryFacet.domainOwner.selector);
27
+ arr.p(L2RegistryFacet.subdomainOwner.selector);
28
+ arr.p(L2RegistryFacet.baseDomainHash.selector);
29
+ arr.p(L2RegistryFacet.namehash.selector);
30
+ arr.p(L2RegistryFacet.decodeName.selector);
31
+ arr.p(L2RegistryFacet.encodeSubdomain.selector);
32
+
33
+ // ERC721 functions
34
+ arr.p(L2RegistryFacet.totalSupply.selector);
35
+ arr.p(L2RegistryFacet.balanceOf.selector);
36
+ arr.p(L2RegistryFacet.ownerOf.selector);
37
+ arr.p(L2RegistryFacet.transferFrom.selector);
38
+ arr.p(bytes4(keccak256("safeTransferFrom(address,address,uint256)")));
39
+ arr.p(bytes4(keccak256("safeTransferFrom(address,address,uint256,bytes)")));
40
+ arr.p(L2RegistryFacet.approve.selector);
41
+ arr.p(L2RegistryFacet.setApprovalForAll.selector);
42
+ arr.p(L2RegistryFacet.getApproved.selector);
43
+ arr.p(L2RegistryFacet.isApprovedForAll.selector);
44
+ arr.p(L2RegistryFacet.name.selector);
45
+ arr.p(L2RegistryFacet.symbol.selector);
46
+ arr.p(L2RegistryFacet.tokenURI.selector);
47
+
48
+ bytes32[] memory selectors_ = arr.asBytes32Array();
49
+ assembly ("memory-safe") {
50
+ res := selectors_
51
+ }
52
+ }
53
+
54
+ function makeCut(
55
+ address facetAddress,
56
+ IDiamond.FacetCutAction action
57
+ ) internal pure returns (IDiamond.FacetCut memory) {
58
+ return IDiamond.FacetCut(facetAddress, action, selectors());
59
+ }
60
+
61
+ function makeInitData(
62
+ string memory domain,
63
+ address admin
64
+ ) internal pure returns (bytes memory) {
65
+ return abi.encodeCall(L2RegistryFacet.__L2RegistryFacet_init, (domain, admin));
66
+ }
67
+
68
+ function deploy() internal returns (address) {
69
+ return LibDeploy.deployCode("L2RegistryFacet.sol", "");
70
+ }
71
+ }
@@ -12,7 +12,7 @@ import {NodeRegistry} from "src/river/registry/facets/node/NodeRegistry.sol";
12
12
 
13
13
  library DeployNodeRegistry {
14
14
  function selectors() internal pure returns (bytes4[] memory res) {
15
- res = new bytes4[](9);
15
+ res = new bytes4[](12);
16
16
  res[0] = NodeRegistry.isNode.selector;
17
17
  res[1] = NodeRegistry.registerNode.selector;
18
18
  res[2] = NodeRegistry.removeNode.selector;
@@ -22,6 +22,9 @@ library DeployNodeRegistry {
22
22
  res[6] = NodeRegistry.getNodeCount.selector;
23
23
  res[7] = NodeRegistry.getAllNodeAddresses.selector;
24
24
  res[8] = NodeRegistry.getAllNodes.selector;
25
+ res[9] = NodeRegistry.backfillPermanentIndices.selector;
26
+ res[10] = NodeRegistry.setNodeCometBftPubKey.selector;
27
+ res[11] = NodeRegistry.getLastNodeIndex.selector;
25
28
  }
26
29
 
27
30
  function makeCut(
@@ -0,0 +1,34 @@
1
+ // SPDX-License-Identifier: MIT
2
+ pragma solidity ^0.8.29;
3
+
4
+ // interfaces
5
+ import {IDiamond} from "@towns-protocol/diamond/src/IDiamond.sol";
6
+
7
+ // libraries
8
+ import {LibDeploy} from "@towns-protocol/diamond/src/utils/LibDeploy.sol";
9
+
10
+ // contracts
11
+ import {TextResolverFacet} from "src/domains/facets/l2/TextResolverFacet.sol";
12
+
13
+ library DeployTextResolverFacet {
14
+ function selectors() internal pure returns (bytes4[] memory res) {
15
+ res = new bytes4[](2);
16
+ res[0] = TextResolverFacet.setText.selector;
17
+ res[1] = TextResolverFacet.text.selector;
18
+ }
19
+
20
+ function makeCut(
21
+ address facetAddress,
22
+ IDiamond.FacetCutAction action
23
+ ) internal pure returns (IDiamond.FacetCut memory) {
24
+ return IDiamond.FacetCut(facetAddress, action, selectors());
25
+ }
26
+
27
+ function makeInitData() internal pure returns (bytes memory) {
28
+ return abi.encodeCall(TextResolverFacet.__TextResolverFacet_init, ());
29
+ }
30
+
31
+ function deploy() internal returns (address) {
32
+ return LibDeploy.deployCode("TextResolverFacet.sol", "");
33
+ }
34
+ }
@@ -0,0 +1,78 @@
1
+ // SPDX-License-Identifier: MIT
2
+ pragma solidity ^0.8.29;
3
+
4
+ // interfaces
5
+
6
+ // libraries
7
+
8
+ // contracts
9
+ import {Deployer} from "../../common/Deployer.s.sol";
10
+ import {DomainFeeHook} from "src/domains/hooks/DomainFeeHook.sol";
11
+
12
+ contract DeployDomainFeeHook is Deployer {
13
+ /// @dev Default price for domain registration (5 USDC with 6 decimals)
14
+ uint256 internal constant DEFAULT_PRICE = 5e6;
15
+
16
+ address internal owner;
17
+ address internal feeManager;
18
+ uint256 internal defaultPrice;
19
+
20
+ function versionName() public pure override returns (string memory) {
21
+ return "utils/domainFeeHook";
22
+ }
23
+
24
+ /// @notice Set the owner address
25
+ /// @param owner_ The owner address for the DomainFeeHook
26
+ function setOwner(address owner_) external {
27
+ owner = owner_;
28
+ }
29
+
30
+ /// @notice Set the fee manager address
31
+ /// @param feeManager_ The fee manager address authorized to call onChargeFee
32
+ function setFeeManager(address feeManager_) external {
33
+ feeManager = feeManager_;
34
+ }
35
+
36
+ /// @notice Set the default price for registrations
37
+ /// @param defaultPrice_ The default price in USDC (6 decimals)
38
+ function setDefaultPrice(uint256 defaultPrice_) external {
39
+ defaultPrice = defaultPrice_;
40
+ }
41
+
42
+ /// @notice Set all deployment parameters at once
43
+ /// @param owner_ The owner address
44
+ /// @param feeManager_ The fee manager address
45
+ /// @param defaultPrice_ The default price for registrations
46
+ function setParams(address owner_, address feeManager_, uint256 defaultPrice_) external {
47
+ owner = owner_;
48
+ feeManager = feeManager_;
49
+ defaultPrice = defaultPrice_;
50
+ }
51
+
52
+ function __deploy(address deployer) internal override returns (address) {
53
+ address ownerAddr = _getOwner(deployer);
54
+ address feeManagerAddr = _getFeeManager();
55
+ uint256 price = _getDefaultPrice();
56
+
57
+ require(ownerAddr != address(0), "DeployDomainFeeHook: owner not set");
58
+ require(feeManagerAddr != address(0), "DeployDomainFeeHook: feeManager not set");
59
+
60
+ vm.broadcast(deployer);
61
+ return address(new DomainFeeHook(ownerAddr, feeManagerAddr, price));
62
+ }
63
+
64
+ function _getOwner(address deployer) internal view returns (address) {
65
+ return owner == address(0) ? deployer : owner;
66
+ }
67
+
68
+ function _getFeeManager() internal returns (address) {
69
+ if (feeManager != address(0)) return feeManager;
70
+
71
+ // Try to get from existing deployments (spaceFactory acts as fee manager)
72
+ return getDeployment("spaceFactory");
73
+ }
74
+
75
+ function _getDefaultPrice() internal view returns (uint256) {
76
+ return defaultPrice == 0 ? DEFAULT_PRICE : defaultPrice;
77
+ }
78
+ }
@@ -2,10 +2,7 @@
2
2
  pragma solidity ^0.8.23;
3
3
 
4
4
  // interfaces
5
- import {IArchitect} from "src/factory/facets/architect/IArchitect.sol";
6
-
7
5
  import {IPricingModules} from "src/factory/facets/architect/pricing/IPricingModules.sol";
8
- import {ISpaceProxyInitializer} from "src/spaces/facets/proxy/ISpaceProxyInitializer.sol";
9
6
 
10
7
  // deployment
11
8
  import {DeployTieredLogPricingV3} from "scripts/deployments/utils/DeployTieredLogPricingV3.s.sol";
@@ -19,13 +16,9 @@ contract InteractAlphaPost is Interaction {
19
16
  function __interact(address deployer) internal override {
20
17
  address spaceFactory = getDeployment("spaceFactory");
21
18
 
22
- vm.setEnv("OVERRIDE_DEPLOYMENTS", "1");
23
- vm.broadcast(deployer);
24
- address spaceProxyInitializer = deployCode("SpaceProxyInitializer.sol", "");
25
19
  address tieredLogPricing = deployTieredLogPricingV3.deploy(deployer);
26
20
 
27
21
  vm.startBroadcast(deployer);
28
- IArchitect(spaceFactory).setProxyInitializer(ISpaceProxyInitializer(spaceProxyInitializer));
29
22
  IPricingModules(spaceFactory).addPricingModule(tieredLogPricing);
30
23
  vm.stopBroadcast();
31
24
  }
@@ -37,20 +37,7 @@ contract InteractBaseAlpha is AlphaHelper {
37
37
 
38
38
  executeDiamondCutsWithLogging(deployer, space, "Space", deploySpace);
39
39
  executeDiamondCutsWithLogging(deployer, spaceOwner, "SpaceOwner", deploySpaceOwner);
40
-
41
- deploySpaceFactory.diamondInitParams(deployer);
42
- address spaceFactoryInit = deploySpaceFactory.spaceFactoryInit();
43
- bytes memory initData = deploySpaceFactory.spaceFactoryInitData();
44
- deploySpaceFactory.clearCuts();
45
-
46
- executeDiamondCutsWithLogging(
47
- deployer,
48
- spaceFactory,
49
- "SpaceFactory",
50
- deploySpaceFactory,
51
- spaceFactoryInit,
52
- initData
53
- );
40
+ executeDiamondCutsWithLogging(deployer, spaceFactory, "SpaceFactory", deploySpaceFactory);
54
41
 
55
42
  executeDiamondCutsWithLogging(deployer, baseRegistry, "BaseRegistry", deployBaseRegistry);
56
43
  executeDiamondCutsWithLogging(deployer, riverAirdrop, "RiverAirdrop", deployRiverAirdrop);
@@ -0,0 +1,62 @@
1
+ // SPDX-License-Identifier: MIT
2
+ pragma solidity ^0.8.23;
3
+
4
+ // interfaces
5
+ import {IFeeManager} from "src/factory/facets/fee/IFeeManager.sol";
6
+ import {IPlatformRequirements} from "src/factory/facets/platform/requirements/IPlatformRequirements.sol";
7
+
8
+ // libraries
9
+ import {FeeTypesLib} from "src/factory/facets/fee/FeeTypesLib.sol";
10
+ import {FeeCalculationMethod} from "src/factory/facets/fee/FeeManagerStorage.sol";
11
+ import {console} from "forge-std/console.sol";
12
+
13
+ // contracts
14
+ import {Interaction} from "../common/Interaction.s.sol";
15
+
16
+ /// @title InteractDomainFee
17
+ /// @notice Interaction script to configure domain registration fee and hook
18
+ contract InteractDomainFee is Interaction {
19
+ function __interact(address deployer) internal override {
20
+ address spaceFactory = getDeployment("spaceFactory");
21
+ address domainFeeHook = getDeployment("utils/domainFeeHook");
22
+
23
+ console.log("SpaceFactory Diamond:", spaceFactory);
24
+ console.log("Domain Fee Hook:", domainFeeHook);
25
+
26
+ // Get fee recipient from PlatformRequirementsFacet
27
+ address feeRecipient = IPlatformRequirements(spaceFactory).getFeeRecipient();
28
+ console.log("Fee Recipient:", feeRecipient);
29
+
30
+ // Set fee configuration for domain registration
31
+ // The hook will override the fee calculation, so we use FIXED with 0 values
32
+ console.log("\n=== Setting Fee Config for Domain Registration ===");
33
+ vm.broadcast(deployer);
34
+ IFeeManager(spaceFactory).setFeeConfig(
35
+ FeeTypesLib.DOMAIN_REGISTRATION,
36
+ feeRecipient, // recipient from PlatformRequirements
37
+ FeeCalculationMethod.FIXED, // method (hook overrides the calculation)
38
+ 0, // bps (not used for FIXED)
39
+ 0, // fixedFee (hook overrides)
40
+ true // enabled
41
+ );
42
+ console.log("Fee config set for DOMAIN_REGISTRATION");
43
+ console.log(" Recipient:", feeRecipient);
44
+ console.log(" Method: FIXED (hook overrides)");
45
+ console.log(" Enabled: true");
46
+
47
+ // Set the domain fee hook
48
+ console.log("\n=== Setting Domain Fee Hook ===");
49
+ vm.broadcast(deployer);
50
+ IFeeManager(spaceFactory).setFeeHook(FeeTypesLib.DOMAIN_REGISTRATION, domainFeeHook);
51
+ console.log("Fee hook set for DOMAIN_REGISTRATION:", domainFeeHook);
52
+
53
+ // Verify configuration
54
+ console.log("\n=== Verifying Configuration ===");
55
+ address configuredHook = IFeeManager(spaceFactory).getFeeHook(
56
+ FeeTypesLib.DOMAIN_REGISTRATION
57
+ );
58
+ console.log("Configured hook:", configuredHook);
59
+
60
+ console.log("\n=== Domain Fee Configuration Complete ===");
61
+ }
62
+ }
@@ -0,0 +1,42 @@
1
+ // SPDX-License-Identifier: MIT
2
+ pragma solidity ^0.8.24;
3
+
4
+ // interfaces
5
+ import {IRiverConfig} from "src/river/registry/facets/config/IRiverConfig.sol";
6
+
7
+ // libraries
8
+ import {RiverConfigValues} from "scripts/interactions/helpers/RiverConfigValues.sol";
9
+
10
+ // contracts
11
+ import {Interaction} from "scripts/common/Interaction.s.sol";
12
+
13
+ /// @notice Sets the min and max balancing advantage for required operator node selection.
14
+ /// @dev Values are in basis points (e.g., 500 = 5%, 750 = 7.5%).
15
+ /// These settings control load balancing when selecting among required operator nodes:
16
+ /// - MinBalancingAdvantage: Minimum advantage for less-loaded nodes (default: 500 = 5%)
17
+ /// - MaxBalancingAdvantage: Maximum advantage for less-loaded nodes (default: 750 = 7.5%)
18
+ contract InteractSetStreamDistributionBalancingAdvantage is Interaction {
19
+ function __interact(address deployer) internal override {
20
+ address riverRegistry = getDeployment("riverRegistry");
21
+
22
+ // Values in basis points (100 = 1%, 500 = 5%, 750 = 7.5%)
23
+ uint64 minBalancingAdvantage = 500; // 5%
24
+ uint64 maxBalancingAdvantage = 750; // 7.5%
25
+
26
+ vm.startBroadcast(deployer);
27
+
28
+ IRiverConfig(riverRegistry).setConfiguration(
29
+ RiverConfigValues.STREAM_DISTRIBUTION_MIN_BALANCING_ADVANTAGE,
30
+ 0, // blockNumber: 0 means effective immediately
31
+ abi.encode(minBalancingAdvantage)
32
+ );
33
+
34
+ IRiverConfig(riverRegistry).setConfiguration(
35
+ RiverConfigValues.STREAM_DISTRIBUTION_MAX_BALANCING_ADVANTAGE,
36
+ 0, // blockNumber: 0 means effective immediately
37
+ abi.encode(maxBalancingAdvantage)
38
+ );
39
+
40
+ vm.stopBroadcast();
41
+ }
42
+ }
@@ -0,0 +1,32 @@
1
+ // SPDX-License-Identifier: MIT
2
+ pragma solidity ^0.8.24;
3
+
4
+ // interfaces
5
+ import {IRiverConfig} from "src/river/registry/facets/config/IRiverConfig.sol";
6
+
7
+ // libraries
8
+ import {RiverConfigValues} from "scripts/interactions/helpers/RiverConfigValues.sol";
9
+
10
+ // contracts
11
+ import {Interaction} from "scripts/common/Interaction.s.sol";
12
+
13
+ /// @notice Sets the required operators for stream placement.
14
+ /// @dev When placing a stream, at least one node from a required operator must be selected
15
+ /// if any required operator has operational nodes available.
16
+ contract InteractSetStreamDistributionRequiredOperators is Interaction {
17
+ function __interact(address deployer) internal override {
18
+ address riverRegistry = getDeployment("riverRegistry");
19
+
20
+ // Configure the required operator addresses here
21
+ address[] memory requiredOperators = new address[](1);
22
+ requiredOperators[0] = address(0); // Replace with actual operator address
23
+
24
+ vm.startBroadcast(deployer);
25
+ IRiverConfig(riverRegistry).setConfiguration(
26
+ RiverConfigValues.STREAM_DISTRIBUTION_REQUIRED_OPERATORS,
27
+ 0, // blockNumber: 0 means effective immediately
28
+ abi.encode(requiredOperators)
29
+ );
30
+ vm.stopBroadcast();
31
+ }
32
+ }
@@ -24,4 +24,10 @@ library RiverConfigValues {
24
24
  bytes32 public constant STREAM_TRIM_ACTIVATION_FACTOR =
25
25
  keccak256("stream.trimactivationfactor");
26
26
  bytes32 public constant STREAM_TRIM_BY_STREAM_ID = keccak256("stream.trimbystreamid");
27
+ bytes32 public constant STREAM_DISTRIBUTION_REQUIRED_OPERATORS =
28
+ keccak256("stream.distribution.requiredoperators");
29
+ bytes32 public constant STREAM_DISTRIBUTION_MIN_BALANCING_ADVANTAGE =
30
+ keccak256("stream.distribution.minbalancingadvantage");
31
+ bytes32 public constant STREAM_DISTRIBUTION_MAX_BALANCING_ADVANTAGE =
32
+ keccak256("stream.distribution.maxbalancingadvantage");
27
33
  }
@@ -0,0 +1,20 @@
1
+ // SPDX-License-Identifier: MIT
2
+ pragma solidity ^0.8.29;
3
+
4
+ /// @notice Interface for the resolver service
5
+ interface IL1ResolverService {
6
+ /// @notice Resolves a name on the L1 registry
7
+ /// @param name The name to resolve
8
+ /// @param data The data to resolve
9
+ /// @param targetChainId The chain ID of the target registry
10
+ /// @param targetRegistryAddress The address of the target registry
11
+ /// @return result The result of the resolve
12
+ /// @return expires The expiration time of the resolve
13
+ /// @return sig The signature of the resolve
14
+ function stuffedResolveCall(
15
+ bytes calldata name,
16
+ bytes calldata data,
17
+ uint64 targetChainId,
18
+ address targetRegistryAddress
19
+ ) external view returns (bytes memory result, uint64 expires, bytes memory sig);
20
+ }