@etherisc/gif-next 0.0.2-790d44b-698 → 0.0.2-7acbd99-227

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 (222) hide show
  1. package/README.md +40 -25
  2. package/artifacts/contracts/components/BaseComponent.sol/BaseComponent.dbg.json +1 -1
  3. package/artifacts/contracts/components/BaseComponent.sol/BaseComponent.json +80 -41
  4. package/artifacts/contracts/components/Distribution.sol/Distribution.dbg.json +1 -1
  5. package/artifacts/contracts/components/Distribution.sol/Distribution.json +101 -61
  6. package/artifacts/contracts/components/IBaseComponent.sol/IBaseComponent.dbg.json +1 -1
  7. package/artifacts/contracts/components/IBaseComponent.sol/IBaseComponent.json +43 -40
  8. package/artifacts/contracts/components/IDistributionComponent.sol/IDistributionComponent.dbg.json +1 -1
  9. package/artifacts/contracts/components/IDistributionComponent.sol/IDistributionComponent.json +55 -52
  10. package/artifacts/contracts/components/IPoolComponent.sol/IPoolComponent.dbg.json +1 -1
  11. package/artifacts/contracts/components/IPoolComponent.sol/IPoolComponent.json +100 -113
  12. package/artifacts/contracts/components/IProductComponent.sol/IProductComponent.dbg.json +1 -1
  13. package/artifacts/contracts/components/IProductComponent.sol/IProductComponent.json +50 -47
  14. package/artifacts/contracts/components/Pool.sol/Pool.dbg.json +1 -1
  15. package/artifacts/contracts/components/Pool.sol/Pool.json +150 -126
  16. package/artifacts/contracts/components/Product.sol/Product.dbg.json +1 -1
  17. package/artifacts/contracts/components/Product.sol/Product.json +110 -52
  18. package/artifacts/contracts/experiment/errors/Require.sol/Require.dbg.json +1 -1
  19. package/artifacts/contracts/experiment/errors/Revert.sol/Revert.dbg.json +1 -1
  20. package/artifacts/contracts/experiment/inheritance/A.sol/A.dbg.json +1 -1
  21. package/artifacts/contracts/experiment/inheritance/A.sol/AShared.dbg.json +1 -1
  22. package/artifacts/contracts/experiment/inheritance/B.sol/B.dbg.json +1 -1
  23. package/artifacts/contracts/experiment/inheritance/C.sol/C.dbg.json +1 -1
  24. package/artifacts/contracts/experiment/inheritance/IA.sol/IA.dbg.json +1 -1
  25. package/artifacts/contracts/experiment/inheritance/IA.sol/ISharedA.dbg.json +1 -1
  26. package/artifacts/contracts/experiment/inheritance/IB.sol/IB.dbg.json +1 -1
  27. package/artifacts/contracts/experiment/inheritance/IC.sol/IC.dbg.json +1 -1
  28. package/artifacts/contracts/experiment/statemachine/Dummy.sol/LifeCycleModule.dbg.json +1 -1
  29. package/artifacts/contracts/experiment/statemachine/ISM.sol/ISM.dbg.json +1 -1
  30. package/artifacts/contracts/experiment/statemachine/ISM.sol/ISMEE.dbg.json +1 -1
  31. package/artifacts/contracts/experiment/statemachine/SM.sol/SM.dbg.json +1 -1
  32. package/artifacts/contracts/experiment/statemachine/SimpleStateMachine.sol/SimpleStateMachine.dbg.json +1 -1
  33. package/artifacts/contracts/experiment/types/TypeA.sol/TypeALib.dbg.json +1 -1
  34. package/artifacts/contracts/experiment/types/TypeB.sol/TypeBLib.dbg.json +1 -1
  35. package/artifacts/contracts/instance/IInstance.sol/IInstance.dbg.json +1 -1
  36. package/artifacts/contracts/instance/IInstance.sol/IInstance.json +196 -72
  37. package/artifacts/contracts/instance/IInstanceLinked.sol/IInstanceLinked.dbg.json +1 -1
  38. package/artifacts/contracts/instance/Instance.sol/Instance.dbg.json +1 -1
  39. package/artifacts/contracts/instance/Instance.sol/Instance.json +281 -155
  40. package/artifacts/contracts/instance/base/ComponentServiceBase.sol/ComponentServiceBase.dbg.json +1 -1
  41. package/artifacts/contracts/instance/base/ComponentServiceBase.sol/ComponentServiceBase.json +61 -32
  42. package/artifacts/contracts/instance/base/IInstanceBase.sol/IInstanceBase.dbg.json +1 -1
  43. package/artifacts/contracts/instance/base/IInstanceBase.sol/IInstanceBase.json +1 -1
  44. package/artifacts/contracts/instance/base/IKeyValueStore.sol/IKeyValueStore.dbg.json +1 -1
  45. package/artifacts/contracts/instance/base/ILifecycle.sol/ILifecycle.dbg.json +1 -1
  46. package/artifacts/contracts/instance/base/IService.sol/IService.dbg.json +1 -1
  47. package/artifacts/contracts/instance/base/IService.sol/IService.json +43 -40
  48. package/artifacts/contracts/instance/base/InstanceBase.sol/InstanceBase.dbg.json +1 -1
  49. package/artifacts/contracts/instance/base/InstanceBase.sol/InstanceBase.json +64 -48
  50. package/artifacts/contracts/instance/base/KeyValueStore.sol/KeyValueStore.dbg.json +1 -1
  51. package/artifacts/contracts/instance/base/Lifecycle.sol/Lifecycle.dbg.json +1 -1
  52. package/artifacts/contracts/instance/base/ModuleBase.sol/ModuleBase.dbg.json +1 -1
  53. package/artifacts/contracts/instance/base/ServiceBase.sol/ServiceBase.dbg.json +1 -1
  54. package/artifacts/contracts/instance/base/ServiceBase.sol/ServiceBase.json +57 -41
  55. package/artifacts/contracts/instance/module/access/Access.sol/AccessModule.dbg.json +1 -1
  56. package/artifacts/contracts/instance/module/access/IAccess.sol/IAccess.dbg.json +1 -1
  57. package/artifacts/contracts/instance/module/access/IAccess.sol/IAccessModule.dbg.json +1 -1
  58. package/artifacts/contracts/instance/module/bundle/BundleModule.sol/BundleModule.dbg.json +1 -1
  59. package/artifacts/contracts/instance/module/bundle/IBundle.sol/IBundle.dbg.json +1 -1
  60. package/artifacts/contracts/instance/module/bundle/IBundle.sol/IBundleModule.dbg.json +1 -1
  61. package/artifacts/contracts/instance/module/component/ComponentModule.sol/ComponentModule.dbg.json +1 -1
  62. package/artifacts/contracts/instance/module/component/IComponent.sol/IComponent.dbg.json +1 -1
  63. package/artifacts/contracts/instance/module/component/IComponent.sol/IComponentModule.dbg.json +1 -1
  64. package/artifacts/contracts/instance/module/distribution/DistributionModule.sol/DistributionModule.dbg.json +1 -1
  65. package/artifacts/contracts/instance/module/distribution/DistributionModule.sol/DistributionModule.json +2 -2
  66. package/artifacts/contracts/instance/module/distribution/IDistribution.sol/IDistribution.dbg.json +1 -1
  67. package/artifacts/contracts/instance/module/distribution/IDistribution.sol/IDistributionModule.dbg.json +1 -1
  68. package/artifacts/contracts/instance/module/policy/IPolicy.sol/IPolicy.dbg.json +1 -1
  69. package/artifacts/contracts/instance/module/policy/IPolicy.sol/IPolicyModule.dbg.json +1 -1
  70. package/artifacts/contracts/instance/module/policy/PolicyModule.sol/PolicyModule.dbg.json +1 -1
  71. package/artifacts/contracts/instance/module/pool/IPoolModule.sol/IPool.dbg.json +1 -1
  72. package/artifacts/contracts/instance/module/pool/IPoolModule.sol/IPoolModule.dbg.json +1 -1
  73. package/artifacts/contracts/instance/module/pool/IPoolModule.sol/IPoolModule.json +29 -9
  74. package/artifacts/contracts/instance/module/pool/PoolModule.sol/PoolModule.dbg.json +1 -1
  75. package/artifacts/contracts/instance/module/pool/PoolModule.sol/PoolModule.json +28 -8
  76. package/artifacts/contracts/instance/module/risk/IRisk.sol/IRisk.dbg.json +1 -1
  77. package/artifacts/contracts/instance/module/risk/IRisk.sol/IRiskModule.dbg.json +1 -1
  78. package/artifacts/contracts/instance/module/risk/RiskModule.sol/RiskModule.dbg.json +1 -1
  79. package/artifacts/contracts/instance/module/risk/RiskModule.sol/RiskModule.json +2 -2
  80. package/artifacts/contracts/instance/module/treasury/ITreasury.sol/ITreasury.dbg.json +1 -1
  81. package/artifacts/contracts/instance/module/treasury/ITreasury.sol/ITreasuryModule.dbg.json +1 -1
  82. package/artifacts/contracts/instance/module/treasury/ITreasury.sol/ITreasuryModule.json +138 -11
  83. package/artifacts/contracts/instance/module/treasury/TokenHandler.sol/TokenHandler.dbg.json +1 -1
  84. package/artifacts/contracts/instance/module/treasury/TokenHandler.sol/TokenHandler.json +2 -2
  85. package/artifacts/contracts/instance/module/treasury/TreasuryModule.sol/TreasuryModule.dbg.json +1 -1
  86. package/artifacts/contracts/instance/module/treasury/TreasuryModule.sol/TreasuryModule.json +138 -11
  87. package/artifacts/contracts/instance/service/ComponentOwnerService.sol/ComponentOwnerService.dbg.json +1 -1
  88. package/artifacts/contracts/instance/service/ComponentOwnerService.sol/ComponentOwnerService.json +164 -69
  89. package/artifacts/contracts/instance/service/DistributionService.sol/DistributionService.dbg.json +1 -1
  90. package/artifacts/contracts/instance/service/DistributionService.sol/DistributionService.json +86 -44
  91. package/artifacts/contracts/instance/service/IComponentOwnerService.sol/IComponentOwnerService.dbg.json +1 -1
  92. package/artifacts/contracts/instance/service/IComponentOwnerService.sol/IComponentOwnerService.json +43 -59
  93. package/artifacts/contracts/instance/service/IDistributionService.sol/IDistributionService.dbg.json +1 -1
  94. package/artifacts/contracts/instance/service/IDistributionService.sol/IDistributionService.json +43 -40
  95. package/artifacts/contracts/instance/service/IPoolService.sol/IPoolService.dbg.json +1 -1
  96. package/artifacts/contracts/instance/service/IPoolService.sol/IPoolService.json +43 -40
  97. package/artifacts/contracts/instance/service/IProductService.sol/IProductService.dbg.json +1 -1
  98. package/artifacts/contracts/instance/service/IProductService.sol/IProductService.json +43 -40
  99. package/artifacts/contracts/instance/service/PoolService.sol/PoolService.dbg.json +1 -1
  100. package/artifacts/contracts/instance/service/PoolService.sol/PoolService.json +88 -46
  101. package/artifacts/contracts/instance/service/ProductService.sol/ProductService.dbg.json +1 -1
  102. package/artifacts/contracts/instance/service/ProductService.sol/ProductService.json +110 -68
  103. package/artifacts/contracts/registry/ChainNft.sol/ChainNft.dbg.json +1 -1
  104. package/artifacts/contracts/registry/ChainNft.sol/ChainNft.json +141 -12
  105. package/artifacts/contracts/registry/IChainNft.sol/IChainNft.dbg.json +1 -1
  106. package/artifacts/contracts/registry/IChainNft.sol/IChainNft.json +5 -0
  107. package/artifacts/contracts/registry/IRegistry.sol/IRegistry.dbg.json +1 -1
  108. package/artifacts/contracts/registry/IRegistry.sol/IRegistry.json +293 -40
  109. package/artifacts/contracts/registry/IRegistryLinked.sol/IRegistryLinked.dbg.json +1 -1
  110. package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.dbg.json +4 -0
  111. package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.json +668 -0
  112. package/artifacts/contracts/registry/ITransferInterceptor.sol/ITransferInterceptor.dbg.json +4 -0
  113. package/artifacts/contracts/registry/ITransferInterceptor.sol/ITransferInterceptor.json +34 -0
  114. package/artifacts/contracts/registry/Registry.sol/Registry.dbg.json +1 -1
  115. package/artifacts/contracts/registry/Registry.sol/Registry.json +390 -292
  116. package/artifacts/contracts/registry/Registry.sol/RegistryCreationCode.dbg.json +4 -0
  117. package/artifacts/contracts/registry/Registry.sol/RegistryCreationCode.json +150 -0
  118. package/artifacts/contracts/registry/RegistryInstaller.sol/RegistryInstaller.dbg.json +4 -0
  119. package/artifacts/contracts/registry/RegistryInstaller.sol/RegistryInstaller.json +344 -0
  120. package/artifacts/contracts/registry/RegistryService.sol/RegistryService.dbg.json +4 -0
  121. package/artifacts/contracts/registry/RegistryService.sol/RegistryService.json +861 -0
  122. package/artifacts/contracts/shared/ERC165.sol/ERC165.dbg.json +1 -1
  123. package/artifacts/contracts/shared/ERC165.sol/ERC165.json +2 -2
  124. package/artifacts/contracts/shared/IOwnable.sol/IOwnable.dbg.json +1 -1
  125. package/artifacts/contracts/shared/IRegisterable.sol/IRegisterable.dbg.json +1 -1
  126. package/artifacts/contracts/shared/IRegisterable.sol/IRegisterable.json +43 -40
  127. package/artifacts/contracts/shared/IVersionable.sol/IVersionable.dbg.json +1 -1
  128. package/artifacts/contracts/shared/ProxyManager.sol/ProxyManager.dbg.json +4 -0
  129. package/artifacts/contracts/shared/ProxyManager.sol/ProxyManager.json +310 -0
  130. package/artifacts/contracts/shared/Registerable.sol/Registerable.dbg.json +1 -1
  131. package/artifacts/contracts/shared/Registerable.sol/Registerable.json +76 -37
  132. package/artifacts/contracts/shared/UpgradableProxyWithAdmin.sol/UpgradableProxyWithAdmin.dbg.json +4 -0
  133. package/artifacts/contracts/shared/{Proxy.sol/ProxyWithProxyAdminGetter.json → UpgradableProxyWithAdmin.sol/UpgradableProxyWithAdmin.json} +4 -4
  134. package/artifacts/contracts/shared/Versionable.sol/Versionable.dbg.json +1 -1
  135. package/artifacts/contracts/test/TestDistribution.sol/TestDistribution.dbg.json +1 -1
  136. package/artifacts/contracts/test/TestDistribution.sol/TestDistribution.json +101 -61
  137. package/artifacts/contracts/test/TestFee.sol/TestFee.dbg.json +1 -1
  138. package/artifacts/contracts/test/TestPool.sol/TestPool.dbg.json +1 -1
  139. package/artifacts/contracts/test/TestPool.sol/TestPool.json +150 -126
  140. package/artifacts/contracts/test/TestProduct.sol/TestProduct.dbg.json +1 -1
  141. package/artifacts/contracts/test/TestProduct.sol/TestProduct.json +115 -58
  142. package/artifacts/contracts/test/TestRegisterable.sol/TestRegisterable.dbg.json +1 -1
  143. package/artifacts/contracts/test/TestRegisterable.sol/TestRegisterable.json +93 -39
  144. package/artifacts/contracts/test/TestRoleId.sol/TestRoleId.dbg.json +1 -1
  145. package/artifacts/contracts/test/TestService.sol/TestService.dbg.json +1 -1
  146. package/artifacts/contracts/test/TestService.sol/TestService.json +80 -51
  147. package/artifacts/contracts/test/TestToken.sol/TestUsdc.dbg.json +1 -1
  148. package/artifacts/contracts/test/TestVersion.sol/TestVersion.dbg.json +1 -1
  149. package/artifacts/contracts/test/TestVersion.sol/TestVersion.json +2 -2
  150. package/artifacts/contracts/test/TestVersionable.sol/TestVersionable.dbg.json +1 -1
  151. package/artifacts/contracts/test/TestVersionable.sol/TestVersionable.json +2 -2
  152. package/artifacts/contracts/test/Usdc.sol/USDC.dbg.json +1 -1
  153. package/artifacts/contracts/types/AddressSet.sol/LibAddressSet.dbg.json +1 -1
  154. package/artifacts/contracts/types/Blocknumber.sol/BlocknumberLib.dbg.json +1 -1
  155. package/artifacts/contracts/types/ChainId.sol/ChainIdLib.dbg.json +1 -1
  156. package/artifacts/contracts/types/Fee.sol/FeeLib.dbg.json +1 -1
  157. package/artifacts/contracts/types/Key32.sol/Key32Lib.dbg.json +1 -1
  158. package/artifacts/contracts/types/NftId.sol/NftIdLib.dbg.json +1 -1
  159. package/artifacts/contracts/types/NftIdSet.sol/LibNftIdSet.dbg.json +1 -1
  160. package/artifacts/contracts/types/ObjectType.sol/ObjectTypeLib.dbg.json +1 -1
  161. package/artifacts/contracts/types/ReferralId.sol/ReferralIdLib.dbg.json +1 -1
  162. package/artifacts/contracts/types/RiskId.sol/RiskIdLib.dbg.json +1 -1
  163. package/artifacts/contracts/types/RoleId.sol/RoleIdLib.dbg.json +1 -1
  164. package/artifacts/contracts/types/StateId.sol/StateIdLib.dbg.json +1 -1
  165. package/artifacts/contracts/types/Timestamp.sol/TimestampLib.dbg.json +1 -1
  166. package/artifacts/contracts/types/UFixed.sol/UFixedMathLib.dbg.json +1 -1
  167. package/artifacts/contracts/types/Version.sol/VersionLib.dbg.json +1 -1
  168. package/artifacts/contracts/types/Version.sol/VersionLib.json +2 -2
  169. package/artifacts/contracts/types/Version.sol/VersionPartLib.dbg.json +1 -1
  170. package/artifacts/contracts/types/Version.sol/VersionPartLib.json +2 -2
  171. package/contracts/components/BaseComponent.sol +12 -27
  172. package/contracts/components/Distribution.sol +29 -6
  173. package/contracts/components/IBaseComponent.sol +2 -2
  174. package/contracts/components/IPoolComponent.sol +2 -8
  175. package/contracts/components/IProductComponent.sol +2 -1
  176. package/contracts/components/Pool.sol +84 -73
  177. package/contracts/components/Product.sol +85 -13
  178. package/contracts/instance/IInstance.sol +4 -3
  179. package/contracts/instance/Instance.sol +14 -3
  180. package/contracts/instance/base/ComponentServiceBase.sol +13 -6
  181. package/contracts/instance/base/IInstanceBase.sol +3 -2
  182. package/contracts/instance/base/InstanceBase.sol +6 -8
  183. package/contracts/instance/base/ServiceBase.sol +19 -13
  184. package/contracts/instance/module/component/ComponentModule.sol +5 -4
  185. package/contracts/instance/module/component/IComponent.sol +2 -2
  186. package/contracts/instance/module/pool/IPoolModule.sol +4 -3
  187. package/contracts/instance/module/pool/PoolModule.sol +12 -7
  188. package/contracts/instance/module/treasury/ITreasury.sol +7 -5
  189. package/contracts/instance/module/treasury/TokenHandler.sol +2 -2
  190. package/contracts/instance/module/treasury/TreasuryModule.sol +21 -28
  191. package/contracts/instance/service/ComponentOwnerService.sol +181 -66
  192. package/contracts/instance/service/DistributionService.sol +6 -11
  193. package/contracts/instance/service/IComponentOwnerService.sol +0 -2
  194. package/contracts/instance/service/PoolService.sol +19 -19
  195. package/contracts/instance/service/ProductService.sol +20 -20
  196. package/contracts/registry/ChainNft.sol +43 -15
  197. package/contracts/registry/IChainNft.sol +3 -2
  198. package/contracts/registry/IRegistry.sol +44 -28
  199. package/contracts/registry/IRegistryService.sol +29 -0
  200. package/contracts/registry/ITransferInterceptor.sol +6 -0
  201. package/contracts/registry/Registry.sol +368 -328
  202. package/contracts/registry/RegistryInstaller.sol +100 -0
  203. package/contracts/registry/RegistryService.sol +383 -0
  204. package/contracts/shared/ERC165.sol +1 -1
  205. package/contracts/shared/IRegisterable.sol +7 -9
  206. package/contracts/shared/IVersionable.sol +15 -13
  207. package/contracts/shared/ProxyManager.sol +115 -0
  208. package/contracts/shared/Registerable.sol +74 -43
  209. package/contracts/shared/UpgradableProxyWithAdmin.sol +16 -0
  210. package/contracts/shared/Versionable.sol +46 -40
  211. package/contracts/test/TestDistribution.sol +3 -2
  212. package/contracts/test/TestPool.sol +4 -2
  213. package/contracts/test/TestProduct.sol +4 -2
  214. package/contracts/test/TestRegisterable.sol +5 -6
  215. package/contracts/test/TestService.sol +5 -11
  216. package/contracts/types/Version.sol +1 -0
  217. package/package.json +1 -1
  218. package/artifacts/contracts/shared/Proxy.sol/ProxyDeployer.dbg.json +0 -4
  219. package/artifacts/contracts/shared/Proxy.sol/ProxyDeployer.json +0 -248
  220. package/artifacts/contracts/shared/Proxy.sol/ProxyWithProxyAdminGetter.dbg.json +0 -4
  221. package/contracts/experiment/statemachine/README.md +0 -112
  222. package/contracts/shared/Proxy.sol +0 -94
@@ -0,0 +1,100 @@
1
+ // SPDX-License-Identifier: UNLICENSED
2
+ pragma solidity ^0.8.20;
3
+
4
+ import {IERC721Receiver} from "@openzeppelin5/contracts/token/ERC721/IERC721Receiver.sol";
5
+ import {Ownable} from "@openzeppelin5/contracts/access/Ownable.sol";
6
+
7
+ import {IChainNft} from "./IChainNft.sol";
8
+ import {IRegistry} from "./IRegistry.sol";
9
+ import {IVersionable} from "../shared/IVersionable.sol";
10
+ import {NftId} from "../types/NftId.sol";
11
+ import {ProxyManager} from "../shared/ProxyManager.sol";
12
+ import {Registry} from "./Registry.sol";
13
+ import {RegistryService} from "./RegistryService.sol";
14
+
15
+
16
+ contract RegistryInstaller is
17
+ Ownable,
18
+ IERC721Receiver
19
+ {
20
+ error ErrorProxyManagerWithZeroAddress();
21
+ error ErrorRegistryServiceWithZeroAddress();
22
+ error ErrorProxyManagerUnexpectedOwner(address expectedOwner, address actualOwner);
23
+ error ErrorInstallerNotProxyManagerOwner(address installer, address actualOwner);
24
+
25
+ ProxyManager private _proxyManager;
26
+ address private _implementation;
27
+ RegistryService private _registryService;
28
+ IRegistry private _registry;
29
+ IChainNft private _chainNft;
30
+
31
+ /// @dev initializes proxy manager with registry service implementation and deploys registry
32
+ constructor(
33
+ address proxyManagerAddress,
34
+ address registryServiceImplementationAddress
35
+ )
36
+ Ownable(msg.sender)
37
+ {
38
+ if (proxyManagerAddress == address(0)) { revert ErrorProxyManagerWithZeroAddress(); }
39
+ if (registryServiceImplementationAddress == address(0)) { revert ErrorRegistryServiceWithZeroAddress(); }
40
+
41
+ _proxyManager = ProxyManager(proxyManagerAddress);
42
+ // check proxy manager owner is owner of installer
43
+ if (_proxyManager.owner() != owner()) { revert ErrorProxyManagerUnexpectedOwner(_proxyManager.owner(), owner()); }
44
+
45
+ _implementation = registryServiceImplementationAddress;
46
+ }
47
+
48
+ function installRegistryServiceWithRegistry()
49
+ external
50
+ onlyOwner()
51
+ {
52
+ // check that this contract is now proxy manager owner
53
+ if (_proxyManager.owner() != address(this)) { revert ErrorInstallerNotProxyManagerOwner(address(this), _proxyManager.owner()); }
54
+
55
+ IVersionable versionable = _proxyManager.deploy(_implementation, type(Registry).creationCode);
56
+ _registryService = RegistryService(address(versionable));
57
+ _registry = _registryService.getRegistry();
58
+ _chainNft = _registry.getChainNft();
59
+
60
+ // transfer registry ownership back to owner
61
+ NftId registryNftId = _registry.getNftId(address(_registry));
62
+ _chainNft.safeTransferFrom(
63
+ address(this),
64
+ owner(),
65
+ registryNftId.toInt(),
66
+ "");
67
+
68
+ // transfer proxy manager back to owner
69
+ _proxyManager.transferOwnership(owner());
70
+ }
71
+
72
+ function getRegistryService()
73
+ external
74
+ view
75
+ returns (RegistryService registryService)
76
+ {
77
+ return _registryService;
78
+ }
79
+
80
+ function getRegistry()
81
+ external
82
+ view
83
+ returns (RegistryService registryService)
84
+ {
85
+ return _registryService;
86
+ }
87
+
88
+ //--- IERC721Receiver -----------------------------------//
89
+ function onERC721Received(
90
+ address operator,
91
+ address from,
92
+ uint256 tokenId,
93
+ bytes calldata data
94
+ )
95
+ external
96
+ returns (bytes4)
97
+ {
98
+ return IERC721Receiver.onERC721Received.selector;
99
+ }
100
+ }
@@ -0,0 +1,383 @@
1
+ // SPDX-License-Identifier: Apache-2.0
2
+ pragma solidity ^0.8.20;
3
+
4
+ import {IERC20Metadata} from "@openzeppelin5/contracts/token/ERC20/extensions/IERC20Metadata.sol";
5
+
6
+ import {IRegistry} from "../registry/IRegistry.sol";
7
+ import {IInstance} from "../instance/IInstance.sol";
8
+
9
+ //import {ITreasury, ITreasuryModule} from "../../contracts/instance/module/treasury/ITreasury.sol";
10
+ //import {TreasuryModule} from "../../contracts/instance/module/treasury/TreasuryModule.sol";
11
+ import {IComponent, IComponentModule} from "../../contracts/instance/module/component/IComponent.sol";
12
+ import {IPool} from "../../contracts/instance/module/pool/IPoolModule.sol";
13
+ import {IBaseComponent} from "../../contracts/components/IBaseComponent.sol";
14
+ import {IPoolComponent} from "../../contracts/components/IPoolComponent.sol";
15
+ import {IProductComponent} from "../../contracts/components/IProductComponent.sol";
16
+ import {IDistributionComponent} from "../../contracts/components/IDistributionComponent.sol";
17
+
18
+ import {IVersionable} from "../../contracts/shared/IVersionable.sol";
19
+ import {Versionable} from "../../contracts/shared/Versionable.sol";
20
+ import {IRegisterable} from "../../contracts/shared/IRegisterable.sol";
21
+
22
+ import {RoleId, PRODUCT_OWNER_ROLE, POOL_OWNER_ROLE, ORACLE_OWNER_ROLE} from "../../contracts/types/RoleId.sol";
23
+ import {ObjectType, REGISTRY, TOKEN, SERVICE, PRODUCT, ORACLE, POOL, TOKEN, INSTANCE, DISTRIBUTION, POLICY, BUNDLE} from "../../contracts/types/ObjectType.sol";
24
+ import {StateId, ACTIVE, PAUSED} from "../../contracts/types/StateId.sol";
25
+ import {NftId, NftIdLib, zeroNftId} from "../../contracts/types/NftId.sol";
26
+ import {Fee, FeeLib} from "../../contracts/types/Fee.sol";
27
+ import {Version, VersionPart, VersionLib} from "../../contracts/types/Version.sol";
28
+ //import {UFixed, UFixedMathLib} from "../../contracts/types/UFixed.sol";
29
+
30
+
31
+ import {ServiceBase} from "../../contracts/instance/base/ServiceBase.sol";
32
+ import {IService} from "../../contracts/instance/base/IService.sol";
33
+ import {IRegistryService} from "./IRegistryService.sol";
34
+ import {Registry} from "../registry/Registry.sol";
35
+
36
+ contract RegistryService is
37
+ ServiceBase,
38
+ IRegistryService
39
+ {
40
+ using NftIdLib for NftId;
41
+
42
+ error NotRegistryOwner();
43
+ error MissingAllowance();
44
+
45
+ error NotToken();
46
+ error NotService();
47
+ error NotComponent();
48
+ error NotInstance();
49
+
50
+ error InvalidAddress(address registerableAddress);
51
+ error InvalidInitialOwner(address initialOwner);
52
+ error SelfRegistration();
53
+ error InvalidType(ObjectType objectType);
54
+
55
+ string public constant NAME = "RegistryService";
56
+
57
+ bytes32 public constant REGISTRY_CREATIONCODE_HASH = 0x7e569c7200a12c63728b648d78f84be7e32ef6804f9ee723e15363ce34d01251;
58
+
59
+ address constant public NFT_LOCK_ADDRESS = address(0x1);
60
+
61
+ /// @dev
62
+ // msg.sender - ONLY registry owner
63
+ // CAN register ANY non IRegisterable address
64
+ // CAN register ONLY valid object-parent types combinations for TOKEN
65
+ // CAN NOT register itself
66
+ // IMPORTANT: MUST NOT call untrusted contract inbetween calls to registry/instance (trusted contracts)
67
+ // motivation: registry/instance state may change during external call
68
+ // TODO it may be usefull to have transferable token nft in order to delist token, make it invalid for new beginings
69
+ // TODO: MUST prohibit registration of precompiles addresses
70
+ function registerToken(address tokenAddress)
71
+ external
72
+ returns(NftId nftId)
73
+ {
74
+ IRegisterable registerable = IRegisterable(tokenAddress);
75
+ bool isRegisterable;
76
+
77
+ // registryOwner can not register IRegisterable as TOKEN
78
+ try registerable.supportsInterface(type(IRegisterable).interfaceId) returns(bool result) {
79
+ isRegisterable = result;
80
+ } catch {
81
+ isRegisterable = false;
82
+ }
83
+
84
+ if(isRegisterable) {
85
+ revert NotToken();
86
+ }
87
+
88
+ IRegistry registry = getRegistry();
89
+
90
+ if(msg.sender != registry.ownerOf(address(registry))) {
91
+ revert NotRegistryOwner();
92
+ }
93
+
94
+ IRegistry.ObjectInfo memory info = IRegistry.ObjectInfo(
95
+ zeroNftId(), // any value
96
+ registry.getNftId(address(registry)),
97
+ TOKEN(),
98
+ false, // isInterceptor
99
+ tokenAddress,
100
+ NFT_LOCK_ADDRESS,
101
+ "" // any value
102
+ );
103
+
104
+ nftId = registry.register(info);
105
+ }
106
+
107
+ /// @dev
108
+ // msg.sender - ONLY registry owner
109
+ // CAN register ONLY valid object-parent types combinations for SERVICE
110
+ // CAN register ONLY IRegisterable address he owns
111
+ // CAN NOT register itself
112
+ // IMPORTANT: MUST NOT check owner before calling external contract
113
+ function registerService(IService service)
114
+ external
115
+ returns(
116
+ IRegistry.ObjectInfo memory info,
117
+ bytes memory data
118
+ )
119
+ {
120
+ if(service.supportsInterface(type(IService).interfaceId) == false) {
121
+ revert NotService();
122
+ }
123
+
124
+ (
125
+ info,
126
+ data
127
+ ) = _getAndVerifyContractInfo(service, SERVICE(), msg.sender);
128
+
129
+ IRegistry registry = getRegistry();
130
+
131
+ if(msg.sender != registry.ownerOf(address(registry))) {
132
+ revert NotRegistryOwner();
133
+ }
134
+
135
+ info.initialOwner = NFT_LOCK_ADDRESS;//registry.getLockAddress();
136
+ info.nftId = registry.register(info);
137
+
138
+ return (
139
+ info,
140
+ data
141
+ );
142
+ }
143
+
144
+ // anybody can register component if instance gives a corresponding role
145
+ //function registerComponent(IBaseComponent component, ObjectType componentType)
146
+ function registerComponent(IBaseComponent component, ObjectType componentType, address owner)
147
+ external
148
+ returns(
149
+ IRegistry.ObjectInfo memory info,
150
+ bytes memory data
151
+ )
152
+ {
153
+ if(component.supportsInterface(type(IBaseComponent).interfaceId) == false) {
154
+ revert NotComponent();
155
+ }
156
+
157
+ (
158
+ info,
159
+ data
160
+ ) = _getAndVerifyContractInfo(component, componentType, owner);
161
+
162
+ IRegistry registry = getRegistry();
163
+ NftId serviceNftId = registry.getNftId(msg.sender);
164
+
165
+ if(registry.allowance(serviceNftId, componentType) == false) {
166
+ revert MissingAllowance();
167
+ }
168
+
169
+ info.nftId = registry.register(info);
170
+
171
+ return (
172
+ info,
173
+ data
174
+ );
175
+ }
176
+
177
+ // TODO: when called by approved service: add owner arg (service must pass it's msg.sender as owner) & check service allowance
178
+ //function registerInstance(IRegisterable instance, address owner)
179
+ function registerInstance(IRegisterable instance)
180
+ external
181
+ returns(
182
+ IRegistry.ObjectInfo memory info,
183
+ bytes memory data
184
+ )
185
+ {
186
+ if(instance.supportsInterface(type(IInstance).interfaceId) == false) {
187
+ revert NotInstance();
188
+ }
189
+
190
+ (
191
+ info,
192
+ data
193
+ ) = _getAndVerifyContractInfo(instance, INSTANCE(), msg.sender);// owner);
194
+
195
+ IRegistry registry = getRegistry();
196
+
197
+ //if(registry.allowance(registry.getNftId(msg.sender), INSTANCE()) == false) {
198
+ // revert MissingAllowance();
199
+ //}
200
+
201
+ info.nftId = registry.register(info);
202
+
203
+ return (
204
+ info,
205
+ data
206
+ );
207
+ }
208
+
209
+ function registerPolicy(IRegistry.ObjectInfo memory info)
210
+ external
211
+ returns(NftId nftId)
212
+ {
213
+ IRegistry registry = getRegistry();
214
+ NftId senderNftId = registry.getNftId(msg.sender);
215
+
216
+ if(registry.allowance(senderNftId, POLICY()) == false) {
217
+ revert MissingAllowance();
218
+ }
219
+
220
+ _verifyObjectInfo(info, POLICY());
221
+
222
+ nftId = registry.register(info);
223
+ }
224
+
225
+ function registerBundle(IRegistry.ObjectInfo memory info)
226
+ external
227
+ returns(NftId nftId)
228
+ {
229
+ IRegistry registry = getRegistry();
230
+ NftId senderNftId = registry.getNftId(msg.sender);
231
+
232
+ if(registry.allowance(senderNftId, BUNDLE()) == false) {
233
+ revert MissingAllowance();
234
+ }
235
+
236
+ _verifyObjectInfo(info, BUNDLE());
237
+
238
+ nftId = registry.register(info);
239
+ }
240
+
241
+
242
+ // From IService
243
+ function getName() public pure override(IService, ServiceBase) returns(string memory) {
244
+ return NAME;
245
+ }
246
+
247
+
248
+ // from Versionable
249
+
250
+ /// @dev top level initializer
251
+ // 1) registry is non upgradeable -> don't need a proxy and uses constructor !
252
+ // 2) deploy registry service first -> from its initialization func it is easier to deploy registry then vice versa
253
+ // 3) deploy registry -> pass registry service address as constructor argument
254
+ // registry is getting instantiated and locked to registry service address forever
255
+ function _initialize(address owner, bytes memory registryCreationCode)
256
+ internal
257
+ initializer
258
+ virtual override
259
+ {
260
+ // TODO check when stable
261
+ //require(keccak256(registryCreationCode) == REGISTRY_CREATIONCODE_HASH, "INVALID_REGISTRY_CREATIONCODE");
262
+
263
+ bytes memory bytecode = abi.encodePacked(
264
+ registryCreationCode,
265
+ abi.encode(
266
+ owner,
267
+ getMajorVersion()
268
+ )
269
+ );
270
+
271
+ address registryAddress;
272
+
273
+ assembly {
274
+ registryAddress := create(0, add(bytecode, 0x20), mload(bytecode))
275
+
276
+ if iszero(extcodesize(registryAddress)) {
277
+ revert(0, 0)
278
+ }
279
+ }
280
+
281
+ IRegistry registry = IRegistry(registryAddress);
282
+ NftId registryNftId = registry.getNftId(registryAddress);
283
+
284
+ _initializeServiceBase(registryAddress, registryNftId, owner);
285
+
286
+ _registerInterface(type(IRegistryService).interfaceId);
287
+ }
288
+
289
+ // parent check done in registry because of approve()
290
+ function _getAndVerifyContractInfo(
291
+ IRegisterable registerable,
292
+ ObjectType objectType,
293
+ address owner
294
+ )
295
+ internal
296
+ returns(
297
+ IRegistry.ObjectInfo memory info,
298
+ bytes memory data
299
+ )
300
+ {
301
+ (
302
+ info,
303
+ data
304
+ ) = registerable.getInitialInfo();
305
+
306
+ if(info.objectAddress != address(registerable)) {
307
+ revert InvalidAddress(info.objectAddress);
308
+ }
309
+
310
+ if(
311
+ getRegistry().isRegistered(owner) ||
312
+ info.initialOwner != owner) { // contract owner protection
313
+ revert InvalidInitialOwner(info.initialOwner);
314
+ }
315
+
316
+ if(msg.sender == address(registerable)) {
317
+ revert SelfRegistration();
318
+ }
319
+
320
+ if(info.objectType != objectType) {
321
+ revert InvalidType(info.objectType);
322
+ }
323
+
324
+ /*NftId parentNftId = info.parentNftId;
325
+ IRegistry.ObjectInfo memory parentInfo = getRegistry().getObjectInfo(parentNftId);
326
+
327
+ if(parentInfo.objectType != parentType) { // parent registration + type
328
+ revert InvalidParent(parentNftId);
329
+ }*/
330
+
331
+ return(
332
+ info,
333
+ data
334
+ );
335
+ }
336
+
337
+ // parent checks done in registry because of approve()
338
+ function _verifyObjectInfo(
339
+ IRegistry.ObjectInfo memory info,
340
+ ObjectType objectType
341
+ )
342
+ internal
343
+ view
344
+ {
345
+ if(info.objectAddress > address(0)) {
346
+ revert InvalidAddress(info.objectAddress);
347
+ }
348
+
349
+ if(
350
+ getRegistry().isRegistered(info.initialOwner) ||
351
+ info.initialOwner == address(0)) {
352
+ // TODO non registered address can register object(e.g. POLICY()) and then transfer associated nft to registered contract
353
+ // what are motivations to do so?
354
+ // at least registered contract can not register objects by itself, SERVICE,
355
+ revert InvalidInitialOwner(info.initialOwner);
356
+ }
357
+
358
+ // can catch all 3 if check that initialOwner is not registered
359
+ /*if(info.initialOwner == msg.sender) {
360
+ revert InitialOwnerIsParent();
361
+ }
362
+
363
+ if(info.initialOwner == address(this)) {
364
+ revert InitialOwnerIsService();
365
+ }
366
+
367
+ if(info.initialOwner == address(getRegistry())) {
368
+ revert InitialOwnerIsRegistry();
369
+ }*/
370
+
371
+
372
+ if(info.objectType != objectType) {
373
+ revert InvalidType(info.objectType);
374
+ }
375
+
376
+ /*NftId parentNftId = info.parentNftId;
377
+ IRegistry.ObjectInfo memory parentInfo = getRegistry().getObjectInfo(parentNftId);
378
+
379
+ if(parentInfo.objectType != parentType) { // parent registration + type
380
+ revert InvalidParent(parentNftId);
381
+ }*/
382
+ }
383
+ }
@@ -1,7 +1,7 @@
1
1
  // SPDX-License-Identifier: Apache-2.0
2
2
  pragma solidity ^0.8.19;
3
3
 
4
- import {IERC165} from "@openzeppelin/contracts/utils/introspection/IERC165.sol";
4
+ import {IERC165} from "@openzeppelin5/contracts/utils/introspection/IERC165.sol";
5
5
 
6
6
  contract ERC165 is IERC165 {
7
7
  mapping(bytes4 => bool) private _isSupported;
@@ -1,7 +1,7 @@
1
1
  // SPDX-License-Identifier: Apache-2.0
2
- pragma solidity ^0.8.19;
2
+ pragma solidity ^0.8.20;
3
3
 
4
- import {IERC165} from "@openzeppelin/contracts/utils/introspection/IERC165.sol";
4
+ import {IERC165} from "@openzeppelin5/contracts/utils/introspection/IERC165.sol";
5
5
 
6
6
  import {IRegistry} from "../registry/IRegistry.sol";
7
7
  import {NftId} from "../types/NftId.sol";
@@ -12,13 +12,11 @@ import {IOwnable} from "./IOwnable.sol";
12
12
  interface IRegisterable is IERC165, IOwnable {
13
13
  function getRegistry() external view returns (IRegistry registry);
14
14
 
15
- function register() external returns (NftId nftId);
16
-
17
- function getType() external pure returns (ObjectType objectType);
18
-
19
15
  function getNftId() external view returns (NftId nftId);
20
16
 
21
- function getParentNftId() external view returns (NftId nftId);
17
+ function getInitialInfo()
18
+ external
19
+ view
20
+ returns (IRegistry.ObjectInfo memory, bytes memory data);
22
21
 
23
- function getData() external view returns (bytes memory data);
24
- }
22
+ }
@@ -1,5 +1,5 @@
1
1
  // SPDX-License-Identifier: Apache-2.0
2
- pragma solidity ^0.8.19;
2
+ pragma solidity ^0.8.20;
3
3
 
4
4
  import {Blocknumber} from "../types/Blocknumber.sol";
5
5
  import {Timestamp} from "../types/Timestamp.sol";
@@ -13,25 +13,22 @@ import {Version} from "../types/Version.sol";
13
13
  // 3) implement internal _initialize() function with onlyInitializing modifier
14
14
  // 4) implement internal _upgrade() function with onlyInitializing modifier (1st version MUST revert)
15
15
  // 5) have onlyInitialising modifier for each function callable inside _initialize()/_upgrade() (MUST use different functions for initialization/upgrade and normal operations)
16
- // 6) use default empty constructor -> _disableInitializer() called from Versionable contructor
16
+ // 6) use default empty constructor -> _disableInitializer() is called from Versionable contructor
17
17
  // 7) use namespace storage
18
+ // 8) since now inheritance is used for upgradability, contract MUST BE inherited ONLY by the next version
19
+ // Upgradeable contract SHOULD:
20
+ // 9) define all non private methods as virtual (in order to be able to upgrade them latter)
21
+ // otherwise, it is still possible to upgrade contract, but everyone who is using it will have to switch to a new fucntions
22
+ // in some cases this ok but not in the others...
18
23
  //
19
24
  // IMPORTANT
20
25
  // Each version MUST:
21
- // 1) ALWAYS define namespace storage struct (even if no changes were introduced)
26
+ // 1) define namespace storage struct if accessing storage
22
27
  // - DO NOT use structs inside, except
23
28
  // - CAN use structs ONLY inside mappings
24
- // 2) ALWAYS define private getter (even if no changes were introduced)
29
+ // 2) ALWAYS define private getter if accessing storage
25
30
  // - MUST use default implementation, CAN change ONLY return type
26
31
  // - MUST use the same "LOCATION_V1"
27
- // Optional:
28
- // 4) implement public initialize()
29
- // - MUST use intializer modifier
30
- // - MUST call Versionable._updateVersionHistory()
31
- // 5) implement public upgrade()
32
- // - 1st version MUST revert
33
- // - MUST use reinitializer(VersionLib.toUint64(getVersion())) modifier
34
- // - MUST call Versionable._updateVersionHistory()
35
32
 
36
33
  interface IVersionable {
37
34
 
@@ -69,7 +66,9 @@ interface IVersionable {
69
66
  function isInitialized(Version version) external view returns(bool);
70
67
 
71
68
  /**
72
- * @dev returns currently active version of this contract
69
+ * @dev returns version of this contract
70
+ * each new implementation MUST implement this function
71
+ * version number MUST increase
73
72
  */
74
73
  function getVersion() external pure returns(Version);
75
74
 
@@ -89,6 +88,9 @@ interface IVersionable {
89
88
  function getVersionInfo(Version version) external view returns(VersionInfo memory versionInfo);
90
89
 
91
90
  // TODO make sure it is needed here
91
+ /**
92
+ * @dev returns currently active version
93
+ */
92
94
  function getInitializedVersion() external view returns(uint64);
93
95
 
94
96
  }
@@ -0,0 +1,115 @@
1
+ // SPDX-License-Identifier: Apache-2.0
2
+ pragma solidity ^0.8.20;
3
+
4
+ import {Ownable} from "@openzeppelin5/contracts/access/Ownable.sol";
5
+ import {ProxyAdmin} from "@openzeppelin5/contracts/proxy/transparent/ProxyAdmin.sol";
6
+ import {ITransparentUpgradeableProxy} from "@openzeppelin5/contracts/proxy/transparent/TransparentUpgradeableProxy.sol";
7
+
8
+ import {IVersionable} from "./IVersionable.sol";
9
+ import {UpgradableProxyWithAdmin} from "./UpgradableProxyWithAdmin.sol";
10
+ import {IVersionable} from "./IVersionable.sol";
11
+
12
+ /// @dev manages proxy deployments for upgradable contracs of type IVersionable
13
+ contract ProxyManager is Ownable {
14
+
15
+ event LogProxyDeployed(address indexed proxy, address initialImplementation);
16
+ event LogProxyDeployedWithSalt(address indexed proxy, address initialImplementation);
17
+ event LogProxyUpgraded(address indexed proxy, address upgradedImplementation);
18
+
19
+ error ErrorAlreadyDeployed();
20
+ error ErrorAlreadyDeployedWithSalt();
21
+ error ErrorNotYetDeployed();
22
+
23
+ UpgradableProxyWithAdmin private _proxy;
24
+ bool private _isDeployed;
25
+
26
+ /// @dev only used to capture proxy owner
27
+ constructor()
28
+ Ownable(msg.sender)
29
+ { }
30
+
31
+ /// @dev deploy initial contract
32
+ function deploy(address initialImplementation, bytes memory initializationData)
33
+ public
34
+ onlyOwner()
35
+ returns (IVersionable versionable)
36
+ {
37
+ if (_isDeployed) { revert ErrorAlreadyDeployed(); }
38
+
39
+ address currentProxyOwner = owner(); // used by implementation
40
+ address initialProxyAdminOwner = address(this); // used by proxy
41
+ bytes memory data = getDeployData(initialImplementation, currentProxyOwner, initializationData);
42
+
43
+ _proxy = new UpgradableProxyWithAdmin(
44
+ initialImplementation,
45
+ initialProxyAdminOwner,
46
+ data
47
+ );
48
+
49
+ _isDeployed = true;
50
+ versionable = IVersionable(address(_proxy));
51
+
52
+ emit LogProxyDeployed(address(_proxy), initialImplementation);
53
+ }
54
+
55
+ function deployWithSalt(address initialImplementation, bytes memory initializationData, bytes32 salt)
56
+ public
57
+ onlyOwner()
58
+ returns (IVersionable versionable)
59
+ {
60
+ if (_isDeployed) { revert ErrorAlreadyDeployedWithSalt(); }
61
+
62
+ address currentProxyOwner = owner(); // used by implementation
63
+ address initialProxyAdminOwner = address(this); // used by proxy
64
+ bytes memory data = getDeployData(initialImplementation, currentProxyOwner, initializationData);
65
+
66
+ // via create2
67
+ _proxy = new UpgradableProxyWithAdmin{salt: salt}(
68
+ initialImplementation,
69
+ initialProxyAdminOwner,
70
+ data
71
+ );
72
+
73
+ _isDeployed = true;
74
+ versionable = IVersionable(address(_proxy));
75
+
76
+ emit LogProxyDeployedWithSalt(address(_proxy), initialImplementation);
77
+ }
78
+
79
+ /// @dev upgrade existing contract
80
+ function upgrade(address newImplementation, bytes memory upgradeData)
81
+ public
82
+ virtual
83
+ onlyOwner()
84
+ returns (IVersionable versionable)
85
+ {
86
+ if (!_isDeployed) { revert ErrorNotYetDeployed(); }
87
+
88
+ address currentProxyOwner = owner();
89
+ ProxyAdmin proxyAdmin = getProxyAdmin();
90
+ ITransparentUpgradeableProxy proxy = ITransparentUpgradeableProxy(address(_proxy));
91
+ bytes memory data = getUpgradeData(newImplementation, currentProxyOwner, upgradeData);
92
+
93
+ proxyAdmin.upgradeAndCall(
94
+ proxy,
95
+ newImplementation,
96
+ data);
97
+
98
+ versionable = IVersionable(address(_proxy));
99
+
100
+ emit LogProxyUpgraded(address(_proxy), newImplementation);
101
+
102
+ }
103
+
104
+ function getDeployData(address implementation, address proxyOwner, bytes memory deployData) public pure returns (bytes memory data) {
105
+ return abi.encodeWithSelector(IVersionable.initialize.selector, implementation, proxyOwner, deployData);
106
+ }
107
+
108
+ function getUpgradeData(address implementation, address proxyOwner, bytes memory upgradeData) public pure returns (bytes memory data) {
109
+ return abi.encodeWithSelector(IVersionable.upgrade.selector, implementation, proxyOwner, upgradeData);
110
+ }
111
+
112
+ function getProxyAdmin() public returns (ProxyAdmin) {
113
+ return _proxy.getProxyAdmin();
114
+ }
115
+ }