@etherisc/gif-next 0.0.2-f29e479-370 → 0.0.2-f30e0eb-805

Sign up to get free protection for your applications and to get access to all the features.
Files changed (250) hide show
  1. package/artifacts/contracts/components/Component.sol/Component.dbg.json +1 -1
  2. package/artifacts/contracts/components/Component.sol/Component.json +68 -89
  3. package/artifacts/contracts/components/Distribution.sol/Distribution.dbg.json +1 -1
  4. package/artifacts/contracts/components/Distribution.sol/Distribution.json +113 -140
  5. package/artifacts/contracts/components/IComponent.sol/IComponent.dbg.json +1 -1
  6. package/artifacts/contracts/components/IComponent.sol/IComponent.json +65 -73
  7. package/artifacts/contracts/components/IDistributionComponent.sol/IDistributionComponent.dbg.json +1 -1
  8. package/artifacts/contracts/components/IDistributionComponent.sol/IDistributionComponent.json +91 -122
  9. package/artifacts/contracts/components/IPoolComponent.sol/IPoolComponent.dbg.json +1 -1
  10. package/artifacts/contracts/components/IPoolComponent.sol/IPoolComponent.json +256 -189
  11. package/artifacts/contracts/components/IProductComponent.sol/IProductComponent.dbg.json +1 -1
  12. package/artifacts/contracts/components/IProductComponent.sol/IProductComponent.json +69 -145
  13. package/artifacts/contracts/components/Pool.sol/Pool.dbg.json +1 -1
  14. package/artifacts/contracts/components/Pool.sol/Pool.json +279 -245
  15. package/artifacts/contracts/components/Product.sol/Product.dbg.json +1 -1
  16. package/artifacts/contracts/components/Product.sol/Product.json +73 -162
  17. package/artifacts/contracts/instance/AccessManagerUpgradeableInitializeable.sol/AccessManagerUpgradeableInitializeable.dbg.json +4 -0
  18. package/artifacts/contracts/instance/AccessManagerUpgradeableInitializeable.sol/AccessManagerUpgradeableInitializeable.json +1206 -0
  19. package/artifacts/contracts/instance/BundleManager.sol/BundleManager.dbg.json +1 -1
  20. package/artifacts/contracts/instance/BundleManager.sol/BundleManager.json +64 -50
  21. package/artifacts/contracts/instance/Cloneable.sol/Cloneable.dbg.json +1 -1
  22. package/artifacts/contracts/instance/Cloneable.sol/Cloneable.json +5 -0
  23. package/artifacts/contracts/instance/IInstance.sol/IInstance.dbg.json +1 -1
  24. package/artifacts/contracts/instance/IInstance.sol/IInstance.json +171 -308
  25. package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.dbg.json +1 -1
  26. package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.json +98 -40
  27. package/artifacts/contracts/instance/Instance.sol/Instance.dbg.json +1 -1
  28. package/artifacts/contracts/instance/Instance.sol/Instance.json +260 -379
  29. package/artifacts/contracts/instance/InstanceAccessManager.sol/InstanceAccessManager.dbg.json +1 -1
  30. package/artifacts/contracts/instance/InstanceAccessManager.sol/InstanceAccessManager.json +448 -121
  31. package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.dbg.json +1 -1
  32. package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.json +120 -227
  33. package/artifacts/contracts/instance/InstanceService.sol/InstanceService.dbg.json +1 -1
  34. package/artifacts/contracts/instance/InstanceService.sol/InstanceService.json +148 -161
  35. package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.dbg.json +1 -1
  36. package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.json +31 -23
  37. package/artifacts/contracts/instance/ObjectManager.sol/ObjectManager.dbg.json +1 -1
  38. package/artifacts/contracts/instance/ObjectManager.sol/ObjectManager.json +8 -13
  39. package/artifacts/contracts/instance/base/ComponentService.sol/ComponentService.dbg.json +1 -1
  40. package/artifacts/contracts/instance/base/ComponentService.sol/ComponentService.json +1 -1
  41. package/artifacts/contracts/instance/base/IKeyValueStore.sol/IKeyValueStore.dbg.json +1 -1
  42. package/artifacts/contracts/instance/base/ILifecycle.sol/ILifecycle.dbg.json +1 -1
  43. package/artifacts/contracts/instance/base/KeyValueStore.sol/KeyValueStore.dbg.json +1 -1
  44. package/artifacts/contracts/instance/base/KeyValueStore.sol/KeyValueStore.json +40 -10
  45. package/artifacts/contracts/instance/base/Lifecycle.sol/Lifecycle.dbg.json +1 -1
  46. package/artifacts/contracts/instance/base/Lifecycle.sol/Lifecycle.json +36 -11
  47. package/artifacts/contracts/instance/module/IAccess.sol/IAccess.dbg.json +1 -1
  48. package/artifacts/contracts/instance/module/IAccess.sol/IAccess.json +54 -71
  49. package/artifacts/contracts/instance/module/IBundle.sol/IBundle.dbg.json +1 -1
  50. package/artifacts/contracts/instance/module/IComponents.sol/IComponents.dbg.json +4 -0
  51. package/artifacts/contracts/instance/module/IComponents.sol/IComponents.json +10 -0
  52. package/artifacts/contracts/instance/module/IDistribution.sol/IDistribution.dbg.json +1 -1
  53. package/artifacts/contracts/instance/module/IPolicy.sol/IPolicy.dbg.json +1 -1
  54. package/artifacts/contracts/instance/module/IRisk.sol/IRisk.dbg.json +1 -1
  55. package/artifacts/contracts/instance/module/ISetup.sol/ISetup.dbg.json +1 -1
  56. package/artifacts/contracts/instance/module/ITreasury.sol/ITreasury.dbg.json +1 -1
  57. package/artifacts/contracts/instance/service/ApplicationService.sol/ApplicationService.dbg.json +1 -1
  58. package/artifacts/contracts/instance/service/ApplicationService.sol/ApplicationService.json +161 -62
  59. package/artifacts/contracts/instance/service/ApplicationServiceManager.sol/ApplicationServiceManager.dbg.json +1 -1
  60. package/artifacts/contracts/instance/service/ApplicationServiceManager.sol/ApplicationServiceManager.json +33 -25
  61. package/artifacts/contracts/instance/service/BundleService.sol/BundleService.dbg.json +1 -1
  62. package/artifacts/contracts/instance/service/BundleService.sol/BundleService.json +137 -140
  63. package/artifacts/contracts/instance/service/BundleServiceManager.sol/BundleServiceManager.dbg.json +1 -1
  64. package/artifacts/contracts/instance/service/BundleServiceManager.sol/BundleServiceManager.json +12 -12
  65. package/artifacts/contracts/instance/service/ClaimService.sol/ClaimService.dbg.json +1 -1
  66. package/artifacts/contracts/instance/service/ClaimService.sol/ClaimService.json +3 -3
  67. package/artifacts/contracts/instance/service/ClaimServiceManager.sol/ClaimServiceManager.dbg.json +1 -1
  68. package/artifacts/contracts/instance/service/ClaimServiceManager.sol/ClaimServiceManager.json +2 -2
  69. package/artifacts/contracts/instance/service/DistributionService.sol/DistributionService.dbg.json +1 -1
  70. package/artifacts/contracts/instance/service/DistributionService.sol/DistributionService.json +505 -91
  71. package/artifacts/contracts/instance/service/DistributionServiceManager.sol/DistributionServiceManager.dbg.json +1 -1
  72. package/artifacts/contracts/instance/service/DistributionServiceManager.sol/DistributionServiceManager.json +78 -42
  73. package/artifacts/contracts/instance/service/IApplicationService.sol/IApplicationService.dbg.json +1 -1
  74. package/artifacts/contracts/instance/service/IApplicationService.sol/IApplicationService.json +110 -27
  75. package/artifacts/contracts/instance/service/IBundleService.sol/IBundleService.dbg.json +1 -1
  76. package/artifacts/contracts/instance/service/IBundleService.sol/IBundleService.json +93 -96
  77. package/artifacts/contracts/instance/service/IClaimService.sol/IClaimService.dbg.json +1 -1
  78. package/artifacts/contracts/instance/service/IDistributionService.sol/IDistributionService.dbg.json +1 -1
  79. package/artifacts/contracts/instance/service/IDistributionService.sol/IDistributionService.json +350 -8
  80. package/artifacts/contracts/instance/service/IPolicyService.sol/IPolicyService.dbg.json +1 -1
  81. package/artifacts/contracts/instance/service/IPolicyService.sol/IPolicyService.json +21 -64
  82. package/artifacts/contracts/instance/service/IPoolService.sol/IPoolService.dbg.json +1 -1
  83. package/artifacts/contracts/instance/service/IPoolService.sol/IPoolService.json +81 -0
  84. package/artifacts/contracts/instance/service/IProductService.sol/IProductService.dbg.json +1 -1
  85. package/artifacts/contracts/instance/service/PolicyService.sol/PolicyService.dbg.json +1 -1
  86. package/artifacts/contracts/instance/service/PolicyService.sol/PolicyService.json +58 -157
  87. package/artifacts/contracts/instance/service/PolicyServiceManager.sol/PolicyServiceManager.dbg.json +1 -1
  88. package/artifacts/contracts/instance/service/PolicyServiceManager.sol/PolicyServiceManager.json +19 -47
  89. package/artifacts/contracts/instance/service/PoolService.sol/PoolService.dbg.json +1 -1
  90. package/artifacts/contracts/instance/service/PoolService.sol/PoolService.json +114 -17
  91. package/artifacts/contracts/instance/service/PoolServiceManager.sol/PoolServiceManager.dbg.json +1 -1
  92. package/artifacts/contracts/instance/service/PoolServiceManager.sol/PoolServiceManager.json +17 -9
  93. package/artifacts/contracts/instance/service/ProductService.sol/ProductService.dbg.json +1 -1
  94. package/artifacts/contracts/instance/service/ProductService.sol/ProductService.json +7 -7
  95. package/artifacts/contracts/instance/service/ProductServiceManager.sol/ProductServiceManager.dbg.json +1 -1
  96. package/artifacts/contracts/instance/service/ProductServiceManager.sol/ProductServiceManager.json +4 -4
  97. package/artifacts/contracts/registry/ChainNft.sol/ChainNft.dbg.json +1 -1
  98. package/artifacts/contracts/registry/ChainNft.sol/ChainNft.json +15 -2
  99. package/artifacts/contracts/registry/IRegistry.sol/IRegistry.dbg.json +1 -1
  100. package/artifacts/contracts/registry/IRegistry.sol/IRegistry.json +19 -0
  101. package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.dbg.json +1 -1
  102. package/artifacts/contracts/registry/ITransferInterceptor.sol/ITransferInterceptor.dbg.json +1 -1
  103. package/artifacts/contracts/registry/ITransferInterceptor.sol/ITransferInterceptor.json +18 -0
  104. package/artifacts/contracts/registry/Registry.sol/Registry.dbg.json +1 -1
  105. package/artifacts/contracts/registry/Registry.sol/Registry.json +31 -12
  106. package/artifacts/contracts/registry/RegistryAccessManager.sol/RegistryAccessManager.dbg.json +1 -1
  107. package/artifacts/contracts/registry/RegistryAccessManager.sol/RegistryAccessManager.json +2 -2
  108. package/artifacts/contracts/registry/RegistryService.sol/RegistryService.dbg.json +1 -1
  109. package/artifacts/contracts/registry/RegistryService.sol/RegistryService.json +5 -5
  110. package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.dbg.json +1 -1
  111. package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.json +3 -3
  112. package/artifacts/contracts/registry/ReleaseManager.sol/ReleaseManager.dbg.json +1 -1
  113. package/artifacts/contracts/registry/ReleaseManager.sol/ReleaseManager.json +7 -7
  114. package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.dbg.json +1 -1
  115. package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.json +2 -2
  116. package/artifacts/contracts/shared/ContractDeployerLib.sol/ContractDeployerLib.dbg.json +1 -1
  117. package/artifacts/contracts/shared/ERC165.sol/ERC165.dbg.json +1 -1
  118. package/artifacts/contracts/shared/INftOwnable.sol/INftOwnable.dbg.json +1 -1
  119. package/artifacts/contracts/shared/IPolicyHolder.sol/IPolicyHolder.dbg.json +1 -1
  120. package/artifacts/contracts/shared/IRegisterable.sol/IRegisterable.dbg.json +1 -1
  121. package/artifacts/contracts/shared/IRegistryLinked.sol/IRegistryLinked.dbg.json +1 -1
  122. package/artifacts/contracts/shared/IService.sol/IService.dbg.json +1 -1
  123. package/artifacts/contracts/shared/IVersionable.sol/IVersionable.dbg.json +1 -1
  124. package/artifacts/contracts/shared/NftOwnable.sol/NftOwnable.dbg.json +1 -1
  125. package/artifacts/contracts/shared/NftOwnable.sol/NftOwnable.json +2 -2
  126. package/artifacts/contracts/shared/PolicyHolder.sol/PolicyHolder.dbg.json +1 -1
  127. package/artifacts/contracts/shared/PolicyHolder.sol/PolicyHolder.json +2 -2
  128. package/artifacts/contracts/shared/ProxyManager.sol/ProxyManager.dbg.json +1 -1
  129. package/artifacts/contracts/shared/ProxyManager.sol/ProxyManager.json +2 -2
  130. package/artifacts/contracts/shared/Registerable.sol/Registerable.dbg.json +1 -1
  131. package/artifacts/contracts/shared/Registerable.sol/Registerable.json +3 -3
  132. package/artifacts/contracts/shared/RegistryLinked.sol/RegistryLinked.dbg.json +1 -1
  133. package/artifacts/contracts/shared/RegistryLinked.sol/RegistryLinked.json +2 -2
  134. package/artifacts/contracts/shared/Service.sol/Service.dbg.json +1 -1
  135. package/artifacts/contracts/shared/Service.sol/Service.json +1 -1
  136. package/artifacts/contracts/shared/TokenHandler.sol/TokenHandler.dbg.json +1 -1
  137. package/artifacts/contracts/shared/TokenHandler.sol/TokenHandler.json +2 -2
  138. package/artifacts/contracts/shared/UpgradableProxyWithAdmin.sol/UpgradableProxyWithAdmin.dbg.json +1 -1
  139. package/artifacts/contracts/shared/UpgradableProxyWithAdmin.sol/UpgradableProxyWithAdmin.json +2 -2
  140. package/artifacts/contracts/shared/Versionable.sol/Versionable.dbg.json +1 -1
  141. package/artifacts/contracts/test/TestFee.sol/TestFee.dbg.json +1 -1
  142. package/artifacts/contracts/test/TestFee.sol/TestFee.json +2 -2
  143. package/artifacts/contracts/test/TestRegisterable.sol/TestRegisterable.dbg.json +1 -1
  144. package/artifacts/contracts/test/TestRegisterable.sol/TestRegisterable.json +3 -3
  145. package/artifacts/contracts/test/TestRoleId.sol/TestRoleId.dbg.json +1 -1
  146. package/artifacts/contracts/test/TestRoleId.sol/TestRoleId.json +6 -6
  147. package/artifacts/contracts/test/TestService.sol/TestService.dbg.json +1 -1
  148. package/artifacts/contracts/test/TestService.sol/TestService.json +3 -3
  149. package/artifacts/contracts/test/TestToken.sol/TestUsdc.dbg.json +1 -1
  150. package/artifacts/contracts/test/TestVersion.sol/TestVersion.dbg.json +1 -1
  151. package/artifacts/contracts/test/TestVersion.sol/TestVersion.json +2 -2
  152. package/artifacts/contracts/test/TestVersionable.sol/TestVersionable.dbg.json +1 -1
  153. package/artifacts/contracts/test/TestVersionable.sol/TestVersionable.json +2 -2
  154. package/artifacts/contracts/test/Usdc.sol/USDC.dbg.json +1 -1
  155. package/artifacts/contracts/types/AddressSet.sol/LibAddressSet.dbg.json +1 -1
  156. package/artifacts/contracts/types/Blocknumber.sol/BlocknumberLib.dbg.json +1 -1
  157. package/artifacts/contracts/types/Blocknumber.sol/BlocknumberLib.json +2 -2
  158. package/artifacts/contracts/types/ChainId.sol/ChainIdLib.dbg.json +1 -1
  159. package/artifacts/contracts/types/ClaimId.sol/ClaimIdLib.dbg.json +1 -1
  160. package/artifacts/contracts/types/DistributorType.sol/DistributorTypeLib.dbg.json +1 -1
  161. package/artifacts/contracts/types/DistributorType.sol/DistributorTypeLib.json +2 -2
  162. package/artifacts/contracts/types/Fee.sol/FeeLib.dbg.json +1 -1
  163. package/artifacts/contracts/types/Fee.sol/FeeLib.json +2 -2
  164. package/artifacts/contracts/types/Key32.sol/Key32Lib.dbg.json +1 -1
  165. package/artifacts/contracts/types/Key32.sol/Key32Lib.json +2 -2
  166. package/artifacts/contracts/types/NftId.sol/NftIdLib.dbg.json +1 -1
  167. package/artifacts/contracts/types/NftId.sol/NftIdLib.json +17 -4
  168. package/artifacts/contracts/types/NftIdSet.sol/LibNftIdSet.dbg.json +1 -1
  169. package/artifacts/contracts/types/NftIdSet.sol/LibNftIdSet.json +2 -2
  170. package/artifacts/contracts/types/NumberId.sol/NumberIdLib.dbg.json +1 -1
  171. package/artifacts/contracts/types/ObjectType.sol/ObjectTypeLib.dbg.json +1 -1
  172. package/artifacts/contracts/types/ObjectType.sol/ObjectTypeLib.json +2 -2
  173. package/artifacts/contracts/types/PayoutId.sol/PayoutIdLib.dbg.json +1 -1
  174. package/artifacts/contracts/types/Referral.sol/ReferralLib.dbg.json +1 -1
  175. package/artifacts/contracts/types/Referral.sol/ReferralLib.json +23 -4
  176. package/artifacts/contracts/types/RiskId.sol/RiskIdLib.dbg.json +1 -1
  177. package/artifacts/contracts/types/RiskId.sol/RiskIdLib.json +2 -2
  178. package/artifacts/contracts/types/RoleId.sol/RoleIdLib.dbg.json +1 -1
  179. package/artifacts/contracts/types/RoleId.sol/RoleIdLib.json +2 -2
  180. package/artifacts/contracts/types/Seconds.sol/SecondsLib.dbg.json +4 -0
  181. package/artifacts/contracts/types/Seconds.sol/SecondsLib.json +124 -0
  182. package/artifacts/contracts/types/StateId.sol/StateIdLib.dbg.json +1 -1
  183. package/artifacts/contracts/types/StateId.sol/StateIdLib.json +2 -2
  184. package/artifacts/contracts/types/Timestamp.sol/TimestampLib.dbg.json +1 -1
  185. package/artifacts/contracts/types/Timestamp.sol/TimestampLib.json +25 -7
  186. package/artifacts/contracts/types/UFixed.sol/MathLib.dbg.json +1 -1
  187. package/artifacts/contracts/types/UFixed.sol/MathLib.json +2 -2
  188. package/artifacts/contracts/types/UFixed.sol/UFixedLib.dbg.json +1 -1
  189. package/artifacts/contracts/types/UFixed.sol/UFixedLib.json +2 -2
  190. package/artifacts/contracts/types/Version.sol/VersionLib.dbg.json +1 -1
  191. package/artifacts/contracts/types/Version.sol/VersionLib.json +2 -2
  192. package/artifacts/contracts/types/Version.sol/VersionPartLib.dbg.json +1 -1
  193. package/artifacts/contracts/types/Version.sol/VersionPartLib.json +2 -2
  194. package/contracts/components/Component.sol +95 -85
  195. package/contracts/components/Distribution.sol +12 -19
  196. package/contracts/components/IComponent.sol +37 -17
  197. package/contracts/components/IDistributionComponent.sol +1 -22
  198. package/contracts/components/IPoolComponent.sol +73 -47
  199. package/contracts/components/IProductComponent.sol +3 -2
  200. package/contracts/components/Pool.sol +171 -126
  201. package/contracts/components/Product.sol +26 -18
  202. package/contracts/instance/AccessManagerUpgradeableInitializeable.sol +13 -0
  203. package/contracts/instance/BundleManager.sol +7 -5
  204. package/contracts/instance/Cloneable.sol +7 -2
  205. package/contracts/instance/IInstance.sol +16 -10
  206. package/contracts/instance/IInstanceService.sol +18 -5
  207. package/contracts/instance/Instance.sol +45 -9
  208. package/contracts/instance/InstanceAccessManager.sol +382 -157
  209. package/contracts/instance/InstanceReader.sol +7 -10
  210. package/contracts/instance/InstanceService.sol +174 -155
  211. package/contracts/instance/ObjectManager.sol +6 -8
  212. package/contracts/instance/base/ComponentService.sol +5 -5
  213. package/contracts/instance/base/KeyValueStore.sol +5 -2
  214. package/contracts/instance/base/Lifecycle.sol +11 -2
  215. package/contracts/instance/module/IAccess.sol +20 -13
  216. package/contracts/instance/module/IBundle.sol +2 -1
  217. package/contracts/instance/module/IComponents.sol +35 -0
  218. package/contracts/instance/module/IDistribution.sol +2 -1
  219. package/contracts/instance/module/IPolicy.sol +26 -1
  220. package/contracts/instance/module/ISetup.sol +7 -22
  221. package/contracts/instance/service/ApplicationService.sol +123 -41
  222. package/contracts/instance/service/BundleService.sol +76 -38
  223. package/contracts/instance/service/DistributionService.sol +139 -47
  224. package/contracts/instance/service/IApplicationService.sol +7 -7
  225. package/contracts/instance/service/IBundleService.sol +19 -11
  226. package/contracts/instance/service/IDistributionService.sol +19 -4
  227. package/contracts/instance/service/IPolicyService.sol +3 -20
  228. package/contracts/instance/service/IPoolService.sol +17 -2
  229. package/contracts/instance/service/PolicyService.sol +59 -132
  230. package/contracts/instance/service/PoolService.sol +128 -17
  231. package/contracts/instance/service/ProductService.sol +10 -2
  232. package/contracts/registry/ChainNft.sol +8 -0
  233. package/contracts/registry/IRegistry.sol +2 -0
  234. package/contracts/registry/ITransferInterceptor.sol +1 -0
  235. package/contracts/registry/Registry.sol +23 -20
  236. package/contracts/registry/RegistryService.sol +5 -5
  237. package/contracts/shared/Registerable.sol +2 -2
  238. package/contracts/shared/TokenHandler.sol +11 -5
  239. package/contracts/types/Blocknumber.sol +1 -0
  240. package/contracts/types/Fee.sol +1 -0
  241. package/contracts/types/NftId.sol +8 -0
  242. package/contracts/types/ObjectType.sol +1 -0
  243. package/contracts/types/Referral.sol +4 -0
  244. package/contracts/types/RoleId.sol +13 -6
  245. package/contracts/types/Seconds.sol +54 -0
  246. package/contracts/types/StateId.sol +1 -0
  247. package/contracts/types/Timestamp.sol +13 -13
  248. package/contracts/types/UFixed.sol +1 -0
  249. package/contracts/types/Version.sol +1 -0
  250. package/package.json +1 -1
@@ -6,12 +6,14 @@ import {IERC20Metadata} from "@openzeppelin/contracts/token/ERC20/extensions/IER
6
6
  import {IRisk} from "../instance/module/IRisk.sol";
7
7
  import {IApplicationService} from "../instance/service/IApplicationService.sol";
8
8
  import {IPolicyService} from "../instance/service/IPolicyService.sol";
9
+ import {IProductService} from "../instance/service/IProductService.sol";
9
10
  import {IClaimService} from "../instance/service/IClaimService.sol";
10
11
  import {IProductComponent} from "./IProductComponent.sol";
11
12
  import {NftId, NftIdLib} from "../types/NftId.sol";
12
13
  import {PRODUCT, APPLICATION, POLICY, CLAIM } from "../types/ObjectType.sol";
13
14
  import {ReferralId} from "../types/Referral.sol";
14
15
  import {RiskId, RiskIdLib} from "../types/RiskId.sol";
16
+ import {Seconds} from "../types/Seconds.sol";
15
17
  import {StateId} from "../types/StateId.sol";
16
18
  import {Timestamp} from "../types/Timestamp.sol";
17
19
  import {Fee} from "../types/Fee.sol";
@@ -20,7 +22,9 @@ import {Component} from "./Component.sol";
20
22
  import {TokenHandler} from "../shared/TokenHandler.sol";
21
23
 
22
24
  import {InstanceReader} from "../instance/InstanceReader.sol";
25
+ import {IPolicy} from "../instance/module/IPolicy.sol";
23
26
  import {ISetup} from "../instance/module/ISetup.sol";
27
+ import {IComponents} from "../instance/module/IComponents.sol";
24
28
  import {Pool} from "../components/Pool.sol";
25
29
  import {Distribution} from "../components/Distribution.sol";
26
30
 
@@ -32,6 +36,7 @@ abstract contract Product is
32
36
  bytes32 public constant PRODUCT_STORAGE_LOCATION_V1 = 0x0bb7aafdb8e380f81267337bc5b5dfdf76e6d3a380ecadb51ec665246d9d6800;
33
37
 
34
38
  struct ProductStorage {
39
+ IProductService _productService;
35
40
  IApplicationService _applicationService;
36
41
  IPolicyService _policyService;
37
42
  IClaimService _claimService;
@@ -55,20 +60,21 @@ abstract contract Product is
55
60
  Fee memory productFee,
56
61
  Fee memory processingFee,
57
62
  address initialOwner,
58
- bytes memory data
63
+ bytes memory registryData // writeonly data that will saved in the object info record of the registry
59
64
  )
60
65
  public
61
66
  virtual
62
67
  onlyInitializing()
63
68
  {
64
- initializeComponent(registry, instanceNftId, name, token, PRODUCT(), isInterceptor, initialOwner, data);
69
+ initializeComponent(registry, instanceNftId, name, token, PRODUCT(), isInterceptor, initialOwner, registryData);
65
70
 
66
71
  ProductStorage storage $ = _getProductStorage();
67
72
  // TODO add validation
68
73
  // TODO refactor to go via registry
69
- $._applicationService = IApplicationService(getServiceAddress(APPLICATION()));
70
- $._policyService = IPolicyService(getServiceAddress(POLICY()));
71
- $._claimService = IClaimService(getServiceAddress(CLAIM()));
74
+ $._productService = IProductService(_getServiceAddress(PRODUCT()));
75
+ $._applicationService = IApplicationService(_getServiceAddress(APPLICATION()));
76
+ $._policyService = IPolicyService(_getServiceAddress(POLICY()));
77
+ $._claimService = IClaimService(_getServiceAddress(CLAIM()));
72
78
  $._pool = Pool(pool);
73
79
  $._distribution = Distribution(distribution);
74
80
  $._initialProductFee = productFee;
@@ -84,7 +90,7 @@ abstract contract Product is
84
90
  function calculatePremium(
85
91
  uint256 sumInsuredAmount,
86
92
  RiskId riskId,
87
- uint256 lifetime,
93
+ Seconds lifetime,
88
94
  bytes memory applicationData,
89
95
  NftId bundleNftId,
90
96
  ReferralId referralId
@@ -94,7 +100,8 @@ abstract contract Product is
94
100
  override
95
101
  returns (uint256 premiumAmount)
96
102
  {
97
- (premiumAmount,,,,) = _getProductStorage()._policyService.calculatePremium(
103
+ IPolicy.Premium memory premium = _getProductStorage()._applicationService.calculatePremium(
104
+ getNftId(),
98
105
  riskId,
99
106
  sumInsuredAmount,
100
107
  lifetime,
@@ -102,13 +109,14 @@ abstract contract Product is
102
109
  bundleNftId,
103
110
  referralId
104
111
  );
112
+ premiumAmount = premium.premiumAmount;
105
113
  }
106
114
 
107
115
 
108
116
  function calculateNetPremium(
109
117
  uint256 sumInsuredAmount,
110
118
  RiskId riskId,
111
- uint256 lifetime,
119
+ Seconds lifetime,
112
120
  bytes memory applicationData
113
121
  )
114
122
  external
@@ -128,7 +136,7 @@ abstract contract Product is
128
136
  RiskId id,
129
137
  bytes memory data
130
138
  ) internal {
131
- getProductService().createRisk(
139
+ _getProductService().createRisk(
132
140
  id,
133
141
  data
134
142
  );
@@ -138,7 +146,7 @@ abstract contract Product is
138
146
  RiskId id,
139
147
  bytes memory data
140
148
  ) internal {
141
- getProductService().updateRisk(
149
+ _getProductService().updateRisk(
142
150
  id,
143
151
  data
144
152
  );
@@ -148,7 +156,7 @@ abstract contract Product is
148
156
  RiskId id,
149
157
  StateId state
150
158
  ) internal {
151
- getProductService().updateRiskState(
159
+ _getProductService().updateRiskState(
152
160
  id,
153
161
  state
154
162
  );
@@ -162,7 +170,7 @@ abstract contract Product is
162
170
  address applicationOwner,
163
171
  RiskId riskId,
164
172
  uint256 sumInsuredAmount,
165
- uint256 lifetime,
173
+ Seconds lifetime,
166
174
  NftId bundleNftId,
167
175
  ReferralId referralId,
168
176
  bytes memory applicationData
@@ -242,7 +250,7 @@ abstract contract Product is
242
250
  restricted()
243
251
  override
244
252
  {
245
- getProductService().setFees(productFee, processingFee);
253
+ _getProductService().setFees(productFee, processingFee);
246
254
  }
247
255
 
248
256
  function getSetupInfo() public view returns (ISetup.ProductSetupInfo memory setupInfo) {
@@ -259,19 +267,15 @@ abstract contract Product is
259
267
  ProductStorage storage $ = _getProductStorage();
260
268
 
261
269
  ISetup.DistributionSetupInfo memory distributionSetupInfo = $._distribution.getSetupInfo();
262
- ISetup.PoolSetupInfo memory poolSetupInfo = $._pool.getSetupInfo();
270
+ IComponents.PoolInfo memory poolInfo = $._pool.getPoolInfo();
263
271
 
264
272
  return ISetup.ProductSetupInfo(
265
273
  getToken(),
266
274
  $._tokenHandler,
267
275
  $._distributionNftId,
268
276
  $._poolNftId,
269
- distributionSetupInfo.distributionFee,
270
277
  $._initialProductFee,
271
278
  $._initialProcessingFee,
272
- poolSetupInfo.poolFee,
273
- poolSetupInfo.stakingFee,
274
- poolSetupInfo.performanceFee,
275
279
  false,
276
280
  getWallet()
277
281
  );
@@ -282,4 +286,8 @@ abstract contract Product is
282
286
  $.slot := PRODUCT_STORAGE_LOCATION_V1
283
287
  }
284
288
  }
289
+
290
+ function _getProductService() internal view returns (IProductService) {
291
+ return _getProductStorage()._productService;
292
+ }
285
293
  }
@@ -0,0 +1,13 @@
1
+ // SPDX-License-Identifier: Apache-2.0
2
+ pragma solidity ^0.8.20;
3
+
4
+ import {AccessManagerUpgradeable} from "@openzeppelin/contracts-upgradeable/access/manager/AccessManagerUpgradeable.sol";
5
+
6
+
7
+ contract AccessManagerUpgradeableInitializeable is AccessManagerUpgradeable {
8
+
9
+ function initialize(address initialAdmin) initializer public {
10
+ __AccessManager_init(initialAdmin);
11
+ }
12
+
13
+ }
@@ -22,9 +22,10 @@ contract BundleManager is
22
22
  event LogBundleManagerBundleAdded(NftId poolNftId, NftId bundleNftId);
23
23
  event LogBundleManagerBundleUnlocked(NftId poolNftId, NftId bundleNftId);
24
24
  event LogBundleManagerBundleLocked(NftId poolNftId, NftId bundleNftId);
25
+ event LogBundleManagerBundleClosed(NftId poolNftId, NftId bundleNftId);
25
26
 
26
- error ErrorBundleManagerErrorPolicyAlreadyActivated(NftId policyNftId);
27
- error ErrorBundleManagerErrorBundleLocked(NftId bundleNftId, NftId policyNftId);
27
+ error ErrorBundleManagerPolicyAlreadyActivated(NftId policyNftId);
28
+ error ErrorBundleManagerBundleLocked(NftId bundleNftId, NftId policyNftId);
28
29
  error ErrorBundleManagerPolicyWithOpenClaims(NftId policyNftId, uint256 openClaimsCount);
29
30
  error ErrorBundleManagerPolicyNotCloseable(NftId policyNftId);
30
31
  error ErrorBundleManagerBundleUnknown(NftId bundleNftId);
@@ -32,7 +33,7 @@ contract BundleManager is
32
33
 
33
34
  mapping(NftId bundleNftId => LibNftIdSet.Set policies) internal _activePolicies;
34
35
 
35
- /// @dev links a policy with its bundle
36
+ /// @dev links a policy to its bundle
36
37
  // to link a policy it MUST NOT yet have been activated
37
38
  // the bundle MUST be unlocked (active) for linking (underwriting) and registered with this instance
38
39
  function linkPolicy(NftId policyNftId) external restricted() {
@@ -42,7 +43,7 @@ contract BundleManager is
42
43
 
43
44
  // ensure bundle is unlocked (in active set) and registered with this instance
44
45
  if (!_isActive(poolNftId, bundleNftId)) {
45
- revert ErrorBundleManagerErrorBundleLocked(bundleNftId, policyNftId);
46
+ revert ErrorBundleManagerBundleLocked(bundleNftId, policyNftId);
46
47
  }
47
48
 
48
49
  LibNftIdSet.add(_activePolicies[bundleNftId], policyNftId);
@@ -71,7 +72,7 @@ contract BundleManager is
71
72
  }
72
73
 
73
74
 
74
- /// @dev add a new bundle to a riskpool registerd with this instance
75
+ /// @dev add a new bundle to a pool registerd with this instance
75
76
  // the corresponding pool is fetched via instance reader
76
77
  function add(NftId bundleNftId) external restricted() {
77
78
  NftId poolNftId = _instance.getInstanceReader().getBundleInfo(bundleNftId).poolNftId;
@@ -85,6 +86,7 @@ contract BundleManager is
85
86
  emit LogBundleManagerBundleAdded(poolNftId, bundleNftId);
86
87
  }
87
88
 
89
+
88
90
  /// @dev unlocked (active) bundles are available to underwrite new policies
89
91
  function unlock(NftId bundleNftId) external restricted() {
90
92
  NftId poolNftId = _instance.getInstanceReader().getBundleInfo(bundleNftId).poolNftId;
@@ -10,7 +10,8 @@ abstract contract Cloneable is
10
10
  AccessManagedUpgradeable
11
11
  {
12
12
  event CloneableInitialized(address authority, address registry);
13
-
13
+
14
+ error CloneableAuthorityZero();
14
15
  error CloneableRegistryInvalid(address registry);
15
16
 
16
17
  IRegistry internal _registry;
@@ -25,9 +26,13 @@ abstract contract Cloneable is
25
26
  address registry
26
27
  )
27
28
  public
28
- initializer
29
+ onlyInitializing
29
30
  {
30
31
  // check/handle access managed
32
+ if(authority == address(0)) {
33
+ revert CloneableAuthorityZero();
34
+ }
35
+
31
36
  __AccessManaged_init(authority);
32
37
 
33
38
  // check/handle registry
@@ -6,15 +6,20 @@ import {IAccessManaged} from "@openzeppelin/contracts/access/manager/IAccessMana
6
6
  import {NftId} from "../types/NftId.sol";
7
7
  import {StateId} from "../types/StateId.sol";
8
8
  import {RiskId} from "../types/RiskId.sol";
9
+ import {VersionPart} from "../types/Version.sol";
10
+ import {Key32} from "../types/Key32.sol";
9
11
 
10
12
  import {IRegisterable} from "../shared/IRegisterable.sol";
11
13
 
14
+ import {ITransferInterceptor} from "../registry/ITransferInterceptor.sol";
15
+
12
16
  import {InstanceAccessManager} from "./InstanceAccessManager.sol";
13
17
  import {BundleManager} from "./BundleManager.sol";
14
18
  import {InstanceReader} from "./InstanceReader.sol";
15
19
 
16
20
  import {IBundle} from "./module/IBundle.sol";
17
21
  import {IBundleService} from "./service/IBundleService.sol";
22
+ import {IComponents} from "./module/IComponents.sol";
18
23
  import {IDistributionService} from "./service/IDistributionService.sol";
19
24
  import {InstanceAccessManager} from "./InstanceAccessManager.sol";
20
25
  import {IKeyValueStore} from "./base/IKeyValueStore.sol";
@@ -27,17 +32,15 @@ import {IPolicyService} from "./service/IPolicyService.sol";
27
32
  import {IBundleService} from "./service/IBundleService.sol";
28
33
  import {IRisk} from "./module/IRisk.sol";
29
34
  import {ISetup} from "./module/ISetup.sol";
30
- import {NftId} from "../types/NftId.sol";
31
- import {RiskId} from "../types/RiskId.sol";
32
- import {StateId} from "../types/StateId.sol";
33
- import {VersionPart} from "../types/Version.sol";
34
- import {Key32} from "../types/Key32.sol";
35
-
36
35
 
37
36
 
38
37
 
39
- interface IInstance is IRegisterable, IKeyValueStore, IAccessManaged {
40
-
38
+ interface IInstance is
39
+ IRegisterable,
40
+ ITransferInterceptor,
41
+ IAccessManaged,
42
+ IKeyValueStore
43
+ {
41
44
  function getDistributionService() external view returns (IDistributionService);
42
45
  function getProductService() external view returns (IProductService);
43
46
  function getPoolService() external view returns (IPoolService);
@@ -48,8 +51,8 @@ interface IInstance is IRegisterable, IKeyValueStore, IAccessManaged {
48
51
  function updateDistributionSetup(NftId distributionNftId, ISetup.DistributionSetupInfo memory setup, StateId newState) external;
49
52
  function updateDistributionSetupState(NftId distributionNftId, StateId newState) external;
50
53
 
51
- function createPoolSetup(NftId poolNftId, ISetup.PoolSetupInfo memory setup) external;
52
- function updatePoolSetup(NftId poolNftId, ISetup.PoolSetupInfo memory setup, StateId newState) external;
54
+ function createPoolSetup(NftId poolNftId, IComponents.ComponentInfo memory info) external;
55
+ function updatePoolSetup(NftId poolNftId, IComponents.ComponentInfo memory info, StateId newState) external;
53
56
  function updatePoolSetupState(NftId poolNftId, StateId newState) external;
54
57
 
55
58
  function createBundle(NftId bundleNftId, IBundle.BundleInfo memory bundle) external;
@@ -89,4 +92,7 @@ interface IInstance is IRegisterable, IKeyValueStore, IAccessManaged {
89
92
  function getMajorVersion() external pure returns (VersionPart majorVersion);
90
93
  function getInstanceReader() external view returns (InstanceReader);
91
94
  function getBundleManager() external view returns (BundleManager);
95
+
96
+ function setInstanceAccessManager(InstanceAccessManager accessManager) external;
97
+ function getInstanceAccessManager() external view returns (InstanceAccessManager);
92
98
  }
@@ -10,6 +10,7 @@ import {IRegistry} from "../registry/IRegistry.sol";
10
10
  import {IRegisterable} from "../shared/IRegisterable.sol";
11
11
  import {IComponent} from "../components/IComponent.sol";
12
12
 
13
+ import {AccessManagerUpgradeableInitializeable} from "./AccessManagerUpgradeableInitializeable.sol";
13
14
  import {InstanceAccessManager} from "./InstanceAccessManager.sol";
14
15
  import {Instance} from "./Instance.sol";
15
16
  import {InstanceReader} from "./InstanceReader.sol";
@@ -18,6 +19,7 @@ import {BundleManager} from "./BundleManager.sol";
18
19
  interface IInstanceService is IService {
19
20
 
20
21
  error ErrorInstanceServiceMasterInstanceAlreadySet();
22
+ error ErrorInstanceServiceMasterOzAccessManagerAlreadySet();
21
23
  error ErrorInstanceServiceMasterInstanceAccessManagerAlreadySet();
22
24
  error ErrorInstanceServiceMasterBundleManagerAlreadySet();
23
25
  error ErrorInstanceServiceInstanceAddressZero();
@@ -27,33 +29,44 @@ interface IInstanceService is IService {
27
29
  error ErrorInstanceServiceInstanceReaderSameAsMasterInstanceReader();
28
30
  error ErrorInstanceServiceInstanceReaderInstanceMismatch();
29
31
 
30
- error ErrorInstanceServiceAccessManagerZero();
32
+ error ErrorInstanceServiceOzAccessManagerZero();
33
+ error ErrorInstanceServiceInstanceAccessManagerZero();
31
34
  error ErrorInstanceServiceInstanceReaderZero();
32
35
  error ErrorInstanceServiceBundleManagerZero();
33
36
 
34
37
  error ErrorInstanceServiceInstanceAuthorityMismatch();
38
+ error ErrorInstanceServiceBundleManagerAuthorityMismatch();
35
39
  error ErrorInstanceServiceInstanceReaderInstanceMismatch2();
36
40
  error ErrorInstanceServiceBundleMangerInstanceMismatch();
37
41
 
38
42
  error ErrorInstanceServiceRequestUnauhorized(address caller);
39
43
  error ErrorInstanceServiceNotInstanceOwner(address caller, NftId instanceNftId);
44
+ error ErrorInstanceServiceNotInstance(NftId nftId);
40
45
  error ErrorInstanceServiceComponentNotRegistered(address componentAddress);
46
+ error ErrorInstanceServiceInstanceComponentMismatch(NftId instanceNftId, NftId componentNftId);
41
47
  error ErrorInstanceServiceInvalidComponentType(address componentAddress, ObjectType expectedType, ObjectType componentType);
42
48
 
43
- event LogInstanceCloned(address clonedAccessManagerAddress, address clonedInstanceAddress, address clonedInstanceReaderAddress, NftId clonedInstanceNftId);
49
+ event LogInstanceCloned(address clonedOzAccessManager, address clonedInstanceAccessManager, address clonedInstance, address clonedBundleManager, address clonedInstanceReader, NftId clonedInstanceNftId);
44
50
 
45
51
  function createInstanceClone()
46
52
  external
47
53
  returns (
48
- InstanceAccessManager clonedAccessManager,
54
+ AccessManagerUpgradeableInitializeable clonedOzAccessManager,
55
+ InstanceAccessManager clonedInstanceAccessManager,
49
56
  Instance clonedInstance,
50
57
  NftId instanceNftId,
51
58
  InstanceReader clonedInstanceReader,
52
59
  BundleManager clonedBundleManager
53
60
  );
54
61
 
55
- function hasRole(address account, RoleId role, address instanceAddress) external returns (bool);
56
- function setTargetLocked(string memory targetName, bool locked) external;
62
+ function createGifTarget(
63
+ NftId instanceNftId,
64
+ address targetAddress,
65
+ string memory targetName,
66
+ bytes4[][] memory selectors,
67
+ RoleId[] memory roles
68
+ ) external;
57
69
 
70
+ function setComponentLocked(bool locked) external;
58
71
  }
59
72
 
@@ -9,14 +9,16 @@ import {ClaimId} from "../types/ClaimId.sol";
9
9
  import {NumberId} from "../types/NumberId.sol";
10
10
  import {ObjectType, BUNDLE, DISTRIBUTION, INSTANCE, POLICY, POOL, ROLE, PRODUCT, TARGET, COMPONENT, DISTRIBUTOR, DISTRIBUTOR_TYPE} from "../types/ObjectType.sol";
11
11
  import {RiskId, RiskIdLib} from "../types/RiskId.sol";
12
- import {RoleId, RoleIdLib} from "../types/RoleId.sol";
12
+ import {RoleId, RoleIdLib, INSTANCE_ROLE, INSTANCE_OWNER_ROLE} from "../types/RoleId.sol";
13
13
  import {StateId, ACTIVE} from "../types/StateId.sol";
14
14
  import {TimestampLib} from "../types/Timestamp.sol";
15
- import {VersionPart} from "../types/Version.sol";
15
+ import {VersionPart, VersionPartLib} from "../types/Version.sol";
16
16
 
17
17
  import {ERC165} from "../shared/ERC165.sol";
18
18
  import {Registerable} from "../shared/Registerable.sol";
19
19
 
20
+ import {IRegistry} from "../registry/IRegistry.sol";
21
+
20
22
  import {IInstance} from "./IInstance.sol";
21
23
  import {InstanceReader} from "./InstanceReader.sol";
22
24
  import {InstanceAccessManager} from "./InstanceAccessManager.sol";
@@ -26,6 +28,7 @@ import {KeyValueStore} from "./base/KeyValueStore.sol";
26
28
 
27
29
  import {IAccess} from "./module/IAccess.sol";
28
30
  import {IBundle} from "./module/IBundle.sol";
31
+ import {IComponents} from "./module/IComponents.sol";
29
32
  import {IDistribution} from "./module/IDistribution.sol";
30
33
  import {IPolicy} from "./module/IPolicy.sol";
31
34
  import {IRisk} from "./module/IRisk.sol";
@@ -36,6 +39,7 @@ import {IPoolService} from "./service/IPoolService.sol";
36
39
  import {IProductService} from "./service/IProductService.sol";
37
40
  import {IPolicyService} from "./service/IPolicyService.sol";
38
41
  import {IBundleService} from "./service/IBundleService.sol";
42
+ import {TokenHandler} from "../shared/TokenHandler.sol";
39
43
  import {VersionPart, VersionPartLib} from "../types/Version.sol";
40
44
 
41
45
  contract Instance is
@@ -59,13 +63,23 @@ contract Instance is
59
63
  InstanceReader internal _instanceReader;
60
64
  BundleManager internal _bundleManager;
61
65
 
62
- function initialize(address accessManagerAddress, address registryAddress, NftId registryNftId, address initialOwner)
66
+ modifier onlyChainNft() {
67
+ if(msg.sender != getRegistry().getChainNftAddress()) {
68
+ revert();
69
+ }
70
+ _;
71
+ }
72
+
73
+ function initialize(address authority, address registryAddress, address initialOwner)
63
74
  public
64
75
  initializer()
65
76
  {
66
- __AccessManaged_init(accessManagerAddress);
77
+ __AccessManaged_init(authority);
67
78
 
68
- initializeRegisterable(registryAddress, registryNftId, INSTANCE(), false, initialOwner, "");
79
+ IRegistry registry = IRegistry(registryAddress);
80
+ initializeRegisterable(registryAddress, registry.getNftId(), INSTANCE(), true, initialOwner, "");
81
+ initializeLifecycle();
82
+
69
83
  registerInterface(type(IInstance).interfaceId);
70
84
  }
71
85
 
@@ -96,12 +110,12 @@ contract Instance is
96
110
  }
97
111
 
98
112
  //--- PoolSetup ------------------------------------------------------//
99
- function createPoolSetup(NftId poolNftId, ISetup.PoolSetupInfo memory setup) external restricted() {
100
- create(_toNftKey32(poolNftId, POOL()), abi.encode(setup));
113
+ function createPoolSetup(NftId poolNftId, IComponents.ComponentInfo memory info) external restricted() {
114
+ create(_toNftKey32(poolNftId, POOL()), abi.encode(info));
101
115
  }
102
116
 
103
- function updatePoolSetup(NftId poolNftId, ISetup.PoolSetupInfo memory setup, StateId newState) external restricted() {
104
- update(_toNftKey32(poolNftId, POOL()), abi.encode(setup), newState);
117
+ function updatePoolSetup(NftId poolNftId, IComponents.ComponentInfo memory info, StateId newState) external restricted() {
118
+ update(_toNftKey32(poolNftId, POOL()), abi.encode(info), newState);
105
119
  }
106
120
 
107
121
  function updatePoolSetupState(NftId poolNftId, StateId newState) external restricted() {
@@ -221,6 +235,17 @@ contract Instance is
221
235
  updateState(toPolicyKey32(policyNftId), newState);
222
236
  }
223
237
 
238
+ //--- ITransferInterceptor ------------------------------------------------------------//
239
+ function nftMint(address to, uint256 tokenId) external onlyChainNft {
240
+ assert(_accessManager.roleMembers(INSTANCE_OWNER_ROLE()) == 0);// temp
241
+ assert(_accessManager.grantRole(INSTANCE_OWNER_ROLE(), to) == true);
242
+ }
243
+
244
+ function nftTransferFrom(address from, address to, uint256 tokenId) external onlyChainNft {
245
+ assert(_accessManager.revokeRole(INSTANCE_OWNER_ROLE(), from) == true);
246
+ assert(_accessManager.grantRole(INSTANCE_OWNER_ROLE(), to) == true);
247
+ }
248
+
224
249
  //--- internal view/pure functions --------------------------------------//
225
250
  function _toNftKey32(NftId nftId, ObjectType objectType) internal pure returns (Key32) {
226
251
  return nftId.toKey32(objectType);
@@ -282,10 +307,21 @@ contract Instance is
282
307
  function setBundleManager(BundleManager bundleManager) external restricted() {
283
308
  require(address(_bundleManager) == address(0), "BundleManager is set");
284
309
  require(bundleManager.getInstance() == Instance(this), "BundleManager instance mismatch");
310
+ require(bundleManager.authority() == authority(), "BundleManager authority mismatch");
285
311
  _bundleManager = bundleManager;
286
312
  }
287
313
 
288
314
  function getBundleManager() external view returns (BundleManager) {
289
315
  return _bundleManager;
290
316
  }
317
+
318
+ function setInstanceAccessManager(InstanceAccessManager accessManager) external restricted {
319
+ require(address(_accessManager) == address(0), "InstanceAccessManager is set");
320
+ require(accessManager.authority() == authority(), "InstanceAccessManager authority mismatch");
321
+ _accessManager = accessManager;
322
+ }
323
+
324
+ function getInstanceAccessManager() external view returns (InstanceAccessManager) {
325
+ return _accessManager;
326
+ }
291
327
  }