@etherisc/gif-next 0.0.2-f18fb8b-243 → 0.0.2-f1e0c66-773

Sign up to get free protection for your applications and to get access to all the features.
Files changed (355) hide show
  1. package/README.md +14 -2
  2. package/artifacts/contracts/authorization/AccessAdmin.sol/AccessAdmin.dbg.json +1 -1
  3. package/artifacts/contracts/authorization/AccessAdmin.sol/AccessAdmin.json +2 -2
  4. package/artifacts/contracts/authorization/AccessManagerCloneable.sol/AccessManagerCloneable.dbg.json +1 -1
  5. package/artifacts/contracts/authorization/Authorization.sol/Authorization.dbg.json +1 -1
  6. package/artifacts/contracts/authorization/Authorization.sol/Authorization.json +2 -2
  7. package/artifacts/contracts/authorization/IAccess.sol/IAccess.dbg.json +1 -1
  8. package/artifacts/contracts/authorization/IAccessAdmin.sol/IAccessAdmin.dbg.json +1 -1
  9. package/artifacts/contracts/authorization/IAuthorization.sol/IAuthorization.dbg.json +1 -1
  10. package/artifacts/contracts/authorization/IModuleAuthorization.sol/IModuleAuthorization.dbg.json +1 -1
  11. package/artifacts/contracts/authorization/IServiceAuthorization.sol/IServiceAuthorization.dbg.json +1 -1
  12. package/artifacts/contracts/authorization/ModuleAuthorization.sol/ModuleAuthorization.dbg.json +1 -1
  13. package/artifacts/contracts/authorization/ModuleAuthorization.sol/ModuleAuthorization.json +2 -2
  14. package/artifacts/contracts/authorization/ServiceAuthorization.sol/ServiceAuthorization.dbg.json +1 -1
  15. package/artifacts/contracts/authorization/ServiceAuthorization.sol/ServiceAuthorization.json +2 -2
  16. package/artifacts/contracts/distribution/BasicDistribution.sol/BasicDistribution.dbg.json +1 -1
  17. package/artifacts/contracts/distribution/BasicDistribution.sol/BasicDistribution.json +69 -26
  18. package/artifacts/contracts/distribution/BasicDistributionAuthorization.sol/BasicDistributionAuthorization.dbg.json +1 -1
  19. package/artifacts/contracts/distribution/BasicDistributionAuthorization.sol/BasicDistributionAuthorization.json +16 -16
  20. package/artifacts/contracts/distribution/Distribution.sol/Distribution.dbg.json +1 -1
  21. package/artifacts/contracts/distribution/Distribution.sol/Distribution.json +43 -0
  22. package/artifacts/contracts/distribution/DistributionService.sol/DistributionService.dbg.json +1 -1
  23. package/artifacts/contracts/distribution/DistributionService.sol/DistributionService.json +237 -74
  24. package/artifacts/contracts/distribution/DistributionServiceManager.sol/DistributionServiceManager.dbg.json +1 -1
  25. package/artifacts/contracts/distribution/DistributionServiceManager.sol/DistributionServiceManager.json +66 -38
  26. package/artifacts/contracts/distribution/IDistributionComponent.sol/IDistributionComponent.dbg.json +1 -1
  27. package/artifacts/contracts/distribution/IDistributionComponent.sol/IDistributionComponent.json +43 -0
  28. package/artifacts/contracts/distribution/IDistributionService.sol/IDistributionService.dbg.json +1 -1
  29. package/artifacts/contracts/distribution/IDistributionService.sol/IDistributionService.json +102 -0
  30. package/artifacts/contracts/instance/BundleSet.sol/BundleSet.dbg.json +4 -0
  31. package/artifacts/contracts/instance/BundleSet.sol/BundleSet.json +703 -0
  32. package/artifacts/contracts/instance/IInstance.sol/IInstance.dbg.json +1 -1
  33. package/artifacts/contracts/instance/IInstance.sol/IInstance.json +6 -6
  34. package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.dbg.json +1 -1
  35. package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.json +5 -5
  36. package/artifacts/contracts/instance/Instance.sol/Instance.dbg.json +1 -1
  37. package/artifacts/contracts/instance/Instance.sol/Instance.json +9 -9
  38. package/artifacts/contracts/instance/InstanceAdmin.sol/InstanceAdmin.dbg.json +1 -1
  39. package/artifacts/contracts/instance/InstanceAdmin.sol/InstanceAdmin.json +73 -73
  40. package/artifacts/contracts/instance/InstanceAuthorizationV3.sol/InstanceAuthorizationV3.dbg.json +1 -1
  41. package/artifacts/contracts/instance/InstanceAuthorizationV3.sol/InstanceAuthorizationV3.json +31 -31
  42. package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.dbg.json +1 -1
  43. package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.json +54 -59
  44. package/artifacts/contracts/instance/InstanceService.sol/InstanceService.dbg.json +1 -1
  45. package/artifacts/contracts/instance/InstanceService.sol/InstanceService.json +15 -15
  46. package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.dbg.json +1 -1
  47. package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.json +6 -6
  48. package/artifacts/contracts/instance/InstanceStore.sol/InstanceStore.dbg.json +1 -1
  49. package/artifacts/contracts/instance/InstanceStore.sol/InstanceStore.json +66 -76
  50. package/artifacts/contracts/instance/base/BalanceStore.sol/BalanceStore.dbg.json +1 -1
  51. package/artifacts/contracts/instance/base/BalanceStore.sol/BalanceStore.json +2 -2
  52. package/artifacts/contracts/instance/base/Cloneable.sol/Cloneable.dbg.json +1 -1
  53. package/artifacts/contracts/instance/base/ObjectCounter.sol/ObjectCounter.dbg.json +1 -1
  54. package/artifacts/contracts/instance/base/ObjectCounter.sol/ObjectCounter.json +2 -2
  55. package/artifacts/contracts/instance/base/ObjectLifecycle.sol/ObjectLifecycle.dbg.json +1 -1
  56. package/artifacts/contracts/instance/base/ObjectLifecycle.sol/ObjectLifecycle.json +2 -2
  57. package/artifacts/contracts/instance/base/ObjectSet.sol/ObjectSet.dbg.json +4 -0
  58. package/artifacts/contracts/instance/base/{ObjectManager.sol/ObjectManager.json → ObjectSet.sol/ObjectSet.json} +6 -6
  59. package/artifacts/contracts/instance/module/IAccess.sol/IAccess.dbg.json +1 -1
  60. package/artifacts/contracts/instance/module/IBundle.sol/IBundle.dbg.json +1 -1
  61. package/artifacts/contracts/instance/module/IComponents.sol/IComponents.dbg.json +1 -1
  62. package/artifacts/contracts/instance/module/IDistribution.sol/IDistribution.dbg.json +1 -1
  63. package/artifacts/contracts/instance/module/IPolicy.sol/IPolicy.dbg.json +1 -1
  64. package/artifacts/contracts/instance/module/IRisk.sol/IRisk.dbg.json +1 -1
  65. package/artifacts/contracts/mock/Dip.sol/Dip.dbg.json +1 -1
  66. package/artifacts/contracts/oracle/BasicOracle.sol/BasicOracle.dbg.json +1 -1
  67. package/artifacts/contracts/oracle/BasicOracle.sol/BasicOracle.json +46 -16
  68. package/artifacts/contracts/oracle/BasicOracleAuthorization.sol/BasicOracleAuthorization.dbg.json +1 -1
  69. package/artifacts/contracts/oracle/BasicOracleAuthorization.sol/BasicOracleAuthorization.json +2 -2
  70. package/artifacts/contracts/oracle/IOracle.sol/IOracle.dbg.json +1 -1
  71. package/artifacts/contracts/oracle/IOracleComponent.sol/IOracleComponent.dbg.json +1 -1
  72. package/artifacts/contracts/oracle/IOracleComponent.sol/IOracleComponent.json +30 -0
  73. package/artifacts/contracts/oracle/IOracleService.sol/IOracleService.dbg.json +1 -1
  74. package/artifacts/contracts/oracle/Oracle.sol/Oracle.dbg.json +1 -1
  75. package/artifacts/contracts/oracle/Oracle.sol/Oracle.json +30 -0
  76. package/artifacts/contracts/oracle/OracleService.sol/OracleService.dbg.json +1 -1
  77. package/artifacts/contracts/oracle/OracleService.sol/OracleService.json +2 -2
  78. package/artifacts/contracts/oracle/OracleServiceManager.sol/OracleServiceManager.dbg.json +1 -1
  79. package/artifacts/contracts/oracle/OracleServiceManager.sol/OracleServiceManager.json +2 -2
  80. package/artifacts/contracts/pool/BasicPool.sol/BasicPool.dbg.json +1 -1
  81. package/artifacts/contracts/pool/BasicPool.sol/BasicPool.json +43 -0
  82. package/artifacts/contracts/pool/BasicPoolAuthorization.sol/BasicPoolAuthorization.dbg.json +1 -1
  83. package/artifacts/contracts/pool/BasicPoolAuthorization.sol/BasicPoolAuthorization.json +16 -16
  84. package/artifacts/contracts/pool/BundleService.sol/BundleService.dbg.json +1 -1
  85. package/artifacts/contracts/pool/BundleService.sol/BundleService.json +221 -55
  86. package/artifacts/contracts/pool/BundleServiceManager.sol/BundleServiceManager.dbg.json +1 -1
  87. package/artifacts/contracts/pool/BundleServiceManager.sol/BundleServiceManager.json +55 -23
  88. package/artifacts/contracts/pool/IBundleService.sol/IBundleService.dbg.json +1 -1
  89. package/artifacts/contracts/pool/IBundleService.sol/IBundleService.json +102 -0
  90. package/artifacts/contracts/pool/IPoolComponent.sol/IPoolComponent.dbg.json +1 -1
  91. package/artifacts/contracts/pool/IPoolComponent.sol/IPoolComponent.json +43 -0
  92. package/artifacts/contracts/pool/IPoolService.sol/IPoolService.dbg.json +1 -1
  93. package/artifacts/contracts/pool/Pool.sol/Pool.dbg.json +1 -1
  94. package/artifacts/contracts/pool/Pool.sol/Pool.json +43 -0
  95. package/artifacts/contracts/pool/PoolService.sol/PoolService.dbg.json +1 -1
  96. package/artifacts/contracts/pool/PoolService.sol/PoolService.json +2 -2
  97. package/artifacts/contracts/pool/PoolServiceManager.sol/PoolServiceManager.dbg.json +1 -1
  98. package/artifacts/contracts/pool/PoolServiceManager.sol/PoolServiceManager.json +2 -2
  99. package/artifacts/contracts/product/ApplicationService.sol/ApplicationService.dbg.json +1 -1
  100. package/artifacts/contracts/product/ApplicationService.sol/ApplicationService.json +2 -2
  101. package/artifacts/contracts/product/ApplicationServiceManager.sol/ApplicationServiceManager.dbg.json +1 -1
  102. package/artifacts/contracts/product/ApplicationServiceManager.sol/ApplicationServiceManager.json +2 -2
  103. package/artifacts/contracts/product/BasicProduct.sol/BasicProduct.dbg.json +1 -1
  104. package/artifacts/contracts/product/BasicProduct.sol/BasicProduct.json +19 -0
  105. package/artifacts/contracts/product/BasicProductAuthorization.sol/BasicProductAuthorization.dbg.json +1 -1
  106. package/artifacts/contracts/product/BasicProductAuthorization.sol/BasicProductAuthorization.json +16 -16
  107. package/artifacts/contracts/product/ClaimService.sol/ClaimService.dbg.json +1 -1
  108. package/artifacts/contracts/product/ClaimService.sol/ClaimService.json +2 -2
  109. package/artifacts/contracts/product/ClaimServiceManager.sol/ClaimServiceManager.dbg.json +1 -1
  110. package/artifacts/contracts/product/ClaimServiceManager.sol/ClaimServiceManager.json +2 -2
  111. package/artifacts/contracts/product/IApplicationService.sol/IApplicationService.dbg.json +1 -1
  112. package/artifacts/contracts/product/IClaimService.sol/IClaimService.dbg.json +1 -1
  113. package/artifacts/contracts/product/IPolicyService.sol/IPolicyService.dbg.json +1 -1
  114. package/artifacts/contracts/product/IPolicyService.sol/IPolicyService.json +13 -0
  115. package/artifacts/contracts/product/IPricingService.sol/IPricingService.dbg.json +1 -1
  116. package/artifacts/contracts/product/IProductComponent.sol/IProductComponent.dbg.json +1 -1
  117. package/artifacts/contracts/product/IProductComponent.sol/IProductComponent.json +19 -0
  118. package/artifacts/contracts/product/IProductService.sol/IProductService.dbg.json +1 -1
  119. package/artifacts/contracts/product/PolicyService.sol/PolicyService.dbg.json +1 -1
  120. package/artifacts/contracts/product/PolicyService.sol/PolicyService.json +64 -51
  121. package/artifacts/contracts/product/PolicyServiceManager.sol/PolicyServiceManager.dbg.json +1 -1
  122. package/artifacts/contracts/product/PolicyServiceManager.sol/PolicyServiceManager.json +26 -26
  123. package/artifacts/contracts/product/PricingService.sol/PricingService.dbg.json +1 -1
  124. package/artifacts/contracts/product/PricingService.sol/PricingService.json +7 -2
  125. package/artifacts/contracts/product/PricingServiceManager.sol/PricingServiceManager.dbg.json +1 -1
  126. package/artifacts/contracts/product/PricingServiceManager.sol/PricingServiceManager.json +2 -2
  127. package/artifacts/contracts/product/Product.sol/Product.dbg.json +1 -1
  128. package/artifacts/contracts/product/Product.sol/Product.json +19 -0
  129. package/artifacts/contracts/product/ProductService.sol/ProductService.dbg.json +1 -1
  130. package/artifacts/contracts/product/ProductService.sol/ProductService.json +2 -2
  131. package/artifacts/contracts/product/ProductServiceManager.sol/ProductServiceManager.dbg.json +1 -1
  132. package/artifacts/contracts/product/ProductServiceManager.sol/ProductServiceManager.json +2 -2
  133. package/artifacts/contracts/registry/ChainNft.sol/ChainNft.dbg.json +1 -1
  134. package/artifacts/contracts/registry/IRegistry.sol/IRegistry.dbg.json +1 -1
  135. package/artifacts/contracts/registry/IRegistry.sol/IRegistry.json +50 -2
  136. package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.dbg.json +1 -1
  137. package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.json +0 -183
  138. package/artifacts/contracts/registry/ITransferInterceptor.sol/ITransferInterceptor.dbg.json +1 -1
  139. package/artifacts/contracts/registry/Registry.sol/Registry.dbg.json +1 -1
  140. package/artifacts/contracts/registry/Registry.sol/Registry.json +95 -23
  141. package/artifacts/contracts/registry/RegistryAdmin.sol/RegistryAdmin.dbg.json +1 -1
  142. package/artifacts/contracts/registry/RegistryAdmin.sol/RegistryAdmin.json +88 -88
  143. package/artifacts/contracts/registry/RegistryService.sol/RegistryService.dbg.json +1 -1
  144. package/artifacts/contracts/registry/RegistryService.sol/RegistryService.json +2 -2
  145. package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.dbg.json +1 -1
  146. package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.json +2 -2
  147. package/artifacts/contracts/registry/ReleaseLifecycle.sol/ReleaseLifecycle.dbg.json +1 -1
  148. package/artifacts/contracts/registry/ReleaseLifecycle.sol/ReleaseLifecycle.json +2 -2
  149. package/artifacts/contracts/registry/ReleaseRegistry.sol/ReleaseRegistry.dbg.json +4 -0
  150. package/artifacts/contracts/registry/ReleaseRegistry.sol/ReleaseRegistry.json +1159 -0
  151. package/artifacts/contracts/registry/ServiceAuthorizationV3.sol/ServiceAuthorizationV3.dbg.json +1 -1
  152. package/artifacts/contracts/registry/ServiceAuthorizationV3.sol/ServiceAuthorizationV3.json +6 -6
  153. package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.dbg.json +1 -1
  154. package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.json +2 -2
  155. package/artifacts/contracts/shared/Component.sol/Component.dbg.json +1 -1
  156. package/artifacts/contracts/shared/ComponentService.sol/ComponentService.dbg.json +1 -1
  157. package/artifacts/contracts/shared/ComponentService.sol/ComponentService.json +271 -62
  158. package/artifacts/contracts/shared/ComponentServiceManager.sol/ComponentServiceManager.dbg.json +1 -1
  159. package/artifacts/contracts/shared/ComponentServiceManager.sol/ComponentServiceManager.json +60 -32
  160. package/artifacts/contracts/shared/ComponentVerifyingService.sol/ComponentVerifyingService.dbg.json +1 -1
  161. package/artifacts/contracts/shared/IComponent.sol/IComponent.dbg.json +1 -1
  162. package/artifacts/contracts/shared/IComponentService.sol/IComponentService.dbg.json +1 -1
  163. package/artifacts/contracts/shared/IComponentService.sol/IComponentService.json +153 -0
  164. package/artifacts/contracts/shared/IInstanceLinkedComponent.sol/IInstanceLinkedComponent.dbg.json +1 -1
  165. package/artifacts/contracts/shared/IInstanceLinkedComponent.sol/IInstanceLinkedComponent.json +19 -0
  166. package/artifacts/contracts/shared/IKeyValueStore.sol/IKeyValueStore.dbg.json +1 -1
  167. package/artifacts/contracts/shared/ILifecycle.sol/ILifecycle.dbg.json +1 -1
  168. package/artifacts/contracts/shared/INftOwnable.sol/INftOwnable.dbg.json +1 -1
  169. package/artifacts/contracts/shared/IPolicyHolder.sol/IPolicyHolder.dbg.json +1 -1
  170. package/artifacts/contracts/shared/IRegisterable.sol/IRegisterable.dbg.json +1 -1
  171. package/artifacts/contracts/shared/IRegistryLinked.sol/IRegistryLinked.dbg.json +1 -1
  172. package/artifacts/contracts/shared/IService.sol/IService.dbg.json +1 -1
  173. package/artifacts/contracts/shared/InitializableCustom.sol/InitializableCustom.dbg.json +1 -1
  174. package/artifacts/contracts/shared/InitializableERC165.sol/InitializableERC165.dbg.json +4 -0
  175. package/artifacts/contracts/shared/{ERC165.sol/ERC165.json → InitializableERC165.sol/InitializableERC165.json} +4 -4
  176. package/artifacts/contracts/shared/InstanceLinkedComponent.sol/InstanceLinkedComponent.dbg.json +1 -1
  177. package/artifacts/contracts/shared/InstanceLinkedComponent.sol/InstanceLinkedComponent.json +19 -0
  178. package/artifacts/contracts/shared/KeyValueStore.sol/KeyValueStore.dbg.json +1 -1
  179. package/artifacts/contracts/shared/Lifecycle.sol/Lifecycle.dbg.json +1 -1
  180. package/artifacts/contracts/shared/NftIdSet.sol/NftIdSet.dbg.json +4 -0
  181. package/artifacts/contracts/shared/{NftIdSetManager.sol/NftIdSetManager.json → NftIdSet.sol/NftIdSet.json} +4 -4
  182. package/artifacts/contracts/shared/NftOwnable.sol/NftOwnable.dbg.json +1 -1
  183. package/artifacts/contracts/shared/NftOwnable.sol/NftOwnable.json +2 -2
  184. package/artifacts/contracts/shared/PolicyHolder.sol/PolicyHolder.dbg.json +1 -1
  185. package/artifacts/contracts/shared/PolicyHolder.sol/PolicyHolder.json +2 -2
  186. package/artifacts/contracts/shared/Registerable.sol/Registerable.dbg.json +1 -1
  187. package/artifacts/contracts/shared/Registerable.sol/Registerable.json +2 -2
  188. package/artifacts/contracts/shared/RegistryLinked.sol/RegistryLinked.dbg.json +1 -1
  189. package/artifacts/contracts/shared/RegistryLinked.sol/RegistryLinked.json +2 -2
  190. package/artifacts/contracts/shared/Service.sol/Service.dbg.json +1 -1
  191. package/artifacts/contracts/shared/TokenHandler.sol/TokenHandler.dbg.json +1 -1
  192. package/artifacts/contracts/shared/TokenHandler.sol/TokenHandler.json +2 -2
  193. package/artifacts/contracts/staking/IStaking.sol/IStaking.dbg.json +1 -1
  194. package/artifacts/contracts/staking/IStakingService.sol/IStakingService.dbg.json +1 -1
  195. package/artifacts/contracts/staking/StakeManagerLib.sol/StakeManagerLib.dbg.json +1 -1
  196. package/artifacts/contracts/staking/StakeManagerLib.sol/StakeManagerLib.json +12 -2
  197. package/artifacts/contracts/staking/Staking.sol/Staking.dbg.json +1 -1
  198. package/artifacts/contracts/staking/Staking.sol/Staking.json +36 -36
  199. package/artifacts/contracts/staking/StakingLifecycle.sol/StakingLifecycle.dbg.json +1 -1
  200. package/artifacts/contracts/staking/StakingLifecycle.sol/StakingLifecycle.json +2 -2
  201. package/artifacts/contracts/staking/StakingManager.sol/StakingManager.dbg.json +1 -1
  202. package/artifacts/contracts/staking/StakingManager.sol/StakingManager.json +19 -19
  203. package/artifacts/contracts/staking/StakingReader.sol/StakingReader.dbg.json +1 -1
  204. package/artifacts/contracts/staking/StakingReader.sol/StakingReader.json +2 -2
  205. package/artifacts/contracts/staking/StakingService.sol/StakingService.dbg.json +1 -1
  206. package/artifacts/contracts/staking/StakingService.sol/StakingService.json +2 -2
  207. package/artifacts/contracts/staking/StakingServiceManager.sol/StakingServiceManager.dbg.json +1 -1
  208. package/artifacts/contracts/staking/StakingServiceManager.sol/StakingServiceManager.json +2 -2
  209. package/artifacts/contracts/staking/StakingStore.sol/StakingStore.dbg.json +1 -1
  210. package/artifacts/contracts/staking/StakingStore.sol/StakingStore.json +20 -15
  211. package/artifacts/contracts/staking/TargetManagerLib.sol/TargetManagerLib.dbg.json +1 -1
  212. package/artifacts/contracts/staking/TargetManagerLib.sol/TargetManagerLib.json +7 -2
  213. package/artifacts/contracts/type/AddressSet.sol/LibAddressSet.dbg.json +1 -1
  214. package/artifacts/contracts/type/Amount.sol/AmountLib.dbg.json +1 -1
  215. package/artifacts/contracts/type/Amount.sol/AmountLib.json +37 -8
  216. package/artifacts/contracts/type/Blocknumber.sol/BlocknumberLib.dbg.json +1 -1
  217. package/artifacts/contracts/type/ClaimId.sol/ClaimIdLib.dbg.json +1 -1
  218. package/artifacts/contracts/type/ClaimId.sol/ClaimIdLib.json +2 -2
  219. package/artifacts/contracts/type/DistributorType.sol/DistributorTypeLib.dbg.json +1 -1
  220. package/artifacts/contracts/type/DistributorType.sol/DistributorTypeLib.json +2 -2
  221. package/artifacts/contracts/type/Fee.sol/FeeLib.dbg.json +1 -1
  222. package/artifacts/contracts/type/Fee.sol/FeeLib.json +7 -2
  223. package/artifacts/contracts/type/Key32.sol/Key32Lib.dbg.json +1 -1
  224. package/artifacts/contracts/type/Key32.sol/Key32Lib.json +2 -2
  225. package/artifacts/contracts/type/NftId.sol/NftIdLib.dbg.json +1 -1
  226. package/artifacts/contracts/type/NftId.sol/NftIdLib.json +2 -2
  227. package/artifacts/contracts/type/NftIdSet.sol/LibNftIdSet.dbg.json +1 -1
  228. package/artifacts/contracts/type/NftIdSet.sol/LibNftIdSet.json +2 -2
  229. package/artifacts/contracts/type/ObjectType.sol/ObjectTypeLib.dbg.json +1 -1
  230. package/artifacts/contracts/type/ObjectType.sol/ObjectTypeLib.json +2 -2
  231. package/artifacts/contracts/type/PayoutId.sol/PayoutIdLib.dbg.json +1 -1
  232. package/artifacts/contracts/type/PayoutId.sol/PayoutIdLib.json +2 -2
  233. package/artifacts/contracts/type/Referral.sol/ReferralLib.dbg.json +1 -1
  234. package/artifacts/contracts/type/Referral.sol/ReferralLib.json +2 -2
  235. package/artifacts/contracts/type/RequestId.sol/RequestIdLib.dbg.json +1 -1
  236. package/artifacts/contracts/type/RequestId.sol/RequestIdLib.json +2 -2
  237. package/artifacts/contracts/type/RiskId.sol/RiskIdLib.dbg.json +1 -1
  238. package/artifacts/contracts/type/RiskId.sol/RiskIdLib.json +2 -2
  239. package/artifacts/contracts/type/RoleId.sol/RoleIdLib.dbg.json +1 -1
  240. package/artifacts/contracts/type/RoleId.sol/RoleIdLib.json +2 -2
  241. package/artifacts/contracts/type/Seconds.sol/SecondsLib.dbg.json +1 -1
  242. package/artifacts/contracts/type/Selector.sol/SelectorLib.dbg.json +1 -1
  243. package/artifacts/contracts/type/Selector.sol/SelectorSetLib.dbg.json +1 -1
  244. package/artifacts/contracts/type/StateId.sol/StateIdLib.dbg.json +1 -1
  245. package/artifacts/contracts/type/String.sol/StrLib.dbg.json +1 -1
  246. package/artifacts/contracts/type/Timestamp.sol/TimestampLib.dbg.json +1 -1
  247. package/artifacts/contracts/type/UFixed.sol/MathLib.dbg.json +1 -1
  248. package/artifacts/contracts/type/UFixed.sol/MathLib.json +9 -3
  249. package/artifacts/contracts/type/UFixed.sol/UFixedLib.dbg.json +1 -1
  250. package/artifacts/contracts/type/UFixed.sol/UFixedLib.json +39 -2
  251. package/artifacts/contracts/type/Version.sol/VersionLib.dbg.json +1 -1
  252. package/artifacts/contracts/type/Version.sol/VersionLib.json +2 -2
  253. package/artifacts/contracts/type/Version.sol/VersionPartLib.dbg.json +1 -1
  254. package/artifacts/contracts/type/Version.sol/VersionPartLib.json +21 -2
  255. package/artifacts/contracts/upgradeability/IVersionable.sol/IVersionable.dbg.json +4 -0
  256. package/artifacts/contracts/{shared → upgradeability}/IVersionable.sol/IVersionable.json +1 -1
  257. package/artifacts/contracts/upgradeability/ProxyManager.sol/ProxyManager.dbg.json +4 -0
  258. package/artifacts/contracts/{shared → upgradeability}/ProxyManager.sol/ProxyManager.json +3 -3
  259. package/artifacts/contracts/upgradeability/UpgradableProxyWithAdmin.sol/UpgradableProxyWithAdmin.dbg.json +4 -0
  260. package/artifacts/contracts/{shared → upgradeability}/UpgradableProxyWithAdmin.sol/UpgradableProxyWithAdmin.json +3 -3
  261. package/artifacts/contracts/upgradeability/Versionable.sol/Versionable.dbg.json +4 -0
  262. package/artifacts/contracts/{shared → upgradeability}/Versionable.sol/Versionable.json +1 -1
  263. package/contracts/distribution/BasicDistribution.sol +4 -15
  264. package/contracts/distribution/BasicDistributionAuthorization.sol +5 -1
  265. package/contracts/distribution/Distribution.sol +22 -10
  266. package/contracts/distribution/DistributionService.sol +61 -26
  267. package/contracts/distribution/DistributionServiceManager.sol +2 -5
  268. package/contracts/distribution/IDistributionComponent.sol +8 -4
  269. package/contracts/distribution/IDistributionService.sol +12 -0
  270. package/contracts/instance/{BundleManager.sol → BundleSet.sol} +23 -23
  271. package/contracts/instance/IInstance.sol +5 -5
  272. package/contracts/instance/IInstanceService.sol +5 -5
  273. package/contracts/instance/Instance.sol +4 -4
  274. package/contracts/instance/InstanceAdmin.sol +2 -2
  275. package/contracts/instance/InstanceAuthorizationV3.sol +13 -11
  276. package/contracts/instance/InstanceService.sol +10 -10
  277. package/contracts/instance/InstanceServiceManager.sol +2 -6
  278. package/contracts/instance/InstanceStore.sol +2 -1
  279. package/contracts/instance/base/{ObjectManager.sol → ObjectSet.sol} +5 -5
  280. package/contracts/instance/module/IComponents.sol +0 -1
  281. package/contracts/instance/module/IDistribution.sol +0 -1
  282. package/contracts/oracle/IOracleComponent.sol +2 -1
  283. package/contracts/oracle/Oracle.sol +15 -6
  284. package/contracts/oracle/OracleServiceManager.sol +2 -5
  285. package/contracts/pool/BasicPoolAuthorization.sol +6 -0
  286. package/contracts/pool/BundleService.sol +72 -27
  287. package/contracts/pool/BundleServiceManager.sol +2 -5
  288. package/contracts/pool/IBundleService.sol +14 -0
  289. package/contracts/pool/IPoolComponent.sol +6 -0
  290. package/contracts/pool/Pool.sol +18 -1
  291. package/contracts/pool/PoolService.sol +11 -29
  292. package/contracts/pool/PoolServiceManager.sol +2 -5
  293. package/contracts/product/ApplicationService.sol +12 -36
  294. package/contracts/product/ApplicationServiceManager.sol +2 -2
  295. package/contracts/product/BasicProduct.sol +3 -33
  296. package/contracts/product/BasicProductAuthorization.sol +3 -0
  297. package/contracts/product/ClaimService.sol +7 -32
  298. package/contracts/product/ClaimServiceManager.sol +2 -2
  299. package/contracts/product/IPolicyService.sol +2 -0
  300. package/contracts/product/IProductComponent.sol +1 -0
  301. package/contracts/product/PolicyService.sol +28 -4
  302. package/contracts/product/PolicyServiceManager.sol +2 -5
  303. package/contracts/product/PricingServiceManager.sol +2 -5
  304. package/contracts/product/Product.sol +10 -1
  305. package/contracts/product/ProductService.sol +7 -32
  306. package/contracts/product/ProductServiceManager.sol +2 -5
  307. package/contracts/registry/IRegistry.sol +26 -13
  308. package/contracts/registry/IRegistryService.sol +6 -6
  309. package/contracts/registry/Registry.sol +80 -82
  310. package/contracts/registry/RegistryAdmin.sol +23 -23
  311. package/contracts/registry/RegistryService.sol +4 -18
  312. package/contracts/registry/RegistryServiceManager.sol +2 -2
  313. package/contracts/registry/{ReleaseManager.sol → ReleaseRegistry.sol} +48 -50
  314. package/contracts/registry/ServiceAuthorizationV3.sol +5 -5
  315. package/contracts/registry/TokenRegistry.sol +2 -2
  316. package/contracts/shared/Component.sol +13 -14
  317. package/contracts/shared/ComponentService.sol +82 -12
  318. package/contracts/shared/ComponentServiceManager.sol +2 -2
  319. package/contracts/shared/IComponentService.sol +15 -9
  320. package/contracts/shared/IInstanceLinkedComponent.sol +6 -0
  321. package/contracts/shared/IService.sol +1 -1
  322. package/contracts/shared/{ERC165.sol → InitializableERC165.sol} +1 -1
  323. package/contracts/shared/InstanceLinkedComponent.sol +21 -0
  324. package/contracts/shared/{NftIdSetManager.sol → NftIdSet.sol} +1 -1
  325. package/contracts/shared/NftOwnable.sol +2 -2
  326. package/contracts/shared/PolicyHolder.sol +2 -5
  327. package/contracts/shared/Service.sol +3 -4
  328. package/contracts/staking/IStaking.sol +1 -2
  329. package/contracts/staking/IStakingService.sol +12 -5
  330. package/contracts/staking/Staking.sol +20 -17
  331. package/contracts/staking/StakingManager.sol +2 -6
  332. package/contracts/staking/StakingReader.sol +12 -16
  333. package/contracts/staking/StakingServiceManager.sol +2 -2
  334. package/contracts/staking/StakingStore.sol +12 -22
  335. package/contracts/type/Amount.sol +12 -5
  336. package/contracts/type/ObjectType.sol +3 -7
  337. package/contracts/type/Referral.sol +1 -0
  338. package/contracts/type/UFixed.sol +29 -10
  339. package/contracts/type/Version.sol +3 -1
  340. package/contracts/{shared → upgradeability}/ProxyManager.sol +3 -4
  341. package/contracts/{shared → upgradeability}/UpgradableProxyWithAdmin.sol +1 -3
  342. package/package.json +1 -1
  343. package/artifacts/contracts/instance/BundleManager.sol/BundleManager.dbg.json +0 -4
  344. package/artifacts/contracts/instance/BundleManager.sol/BundleManager.json +0 -703
  345. package/artifacts/contracts/instance/base/ObjectManager.sol/ObjectManager.dbg.json +0 -4
  346. package/artifacts/contracts/registry/ReleaseManager.sol/ReleaseManager.dbg.json +0 -4
  347. package/artifacts/contracts/registry/ReleaseManager.sol/ReleaseManager.json +0 -1159
  348. package/artifacts/contracts/shared/ERC165.sol/ERC165.dbg.json +0 -4
  349. package/artifacts/contracts/shared/IVersionable.sol/IVersionable.dbg.json +0 -4
  350. package/artifacts/contracts/shared/NftIdSetManager.sol/NftIdSetManager.dbg.json +0 -4
  351. package/artifacts/contracts/shared/ProxyManager.sol/ProxyManager.dbg.json +0 -4
  352. package/artifacts/contracts/shared/UpgradableProxyWithAdmin.sol/UpgradableProxyWithAdmin.dbg.json +0 -4
  353. package/artifacts/contracts/shared/Versionable.sol/Versionable.dbg.json +0 -4
  354. /package/contracts/{shared → upgradeability}/IVersionable.sol +0 -0
  355. /package/contracts/{shared → upgradeability}/Versionable.sol +0 -0
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "_format": "hh-sol-artifact-1",
3
3
  "contractName": "UpgradableProxyWithAdmin",
4
- "sourceName": "contracts/shared/UpgradableProxyWithAdmin.sol",
4
+ "sourceName": "contracts/upgradeability/UpgradableProxyWithAdmin.sol",
5
5
  "abi": [
6
6
  {
7
7
  "inputs": [
@@ -122,8 +122,8 @@
122
122
  "type": "function"
123
123
  }
124
124
  ],
125
- "bytecode": "0x60a060405234801561000f575f80fd5b50604051610e4c380380610e4c83398101604081905261002e9161037c565b828282828161003d828261009e565b50508160405161004c90610340565b6001600160a01b039091168152602001604051809103905ff080158015610075573d5f803e3d5ffd5b506001600160a01b031660805261009361008e60805190565b6100fc565b505050505050610463565b6100a782610169565b6040516001600160a01b038316907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b905f90a28051156100f0576100eb82826101e7565b505050565b6100f861025a565b5050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f61013b5f80516020610e2c833981519152546001600160a01b031690565b604080516001600160a01b03928316815291841660208301520160405180910390a16101668161027b565b50565b806001600160a01b03163b5f036101a357604051634c9c8ce360e01b81526001600160a01b03821660048201526024015b60405180910390fd5b807f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5b80546001600160a01b0319166001600160a01b039290921691909117905550565b60605f80846001600160a01b031684604051610203919061044d565b5f60405180830381855af49150503d805f811461023b576040519150601f19603f3d011682016040523d82523d5f602084013e610240565b606091505b5090925090506102518583836102b8565b95945050505050565b34156102795760405163b398979f60e01b815260040160405180910390fd5b565b6001600160a01b0381166102a457604051633173bdd160e11b81525f600482015260240161019a565b805f80516020610e2c8339815191526101c6565b6060826102cd576102c882610317565b610310565b81511580156102e457506001600160a01b0384163b155b1561030d57604051639996b31560e01b81526001600160a01b038516600482015260240161019a565b50805b9392505050565b8051156103275780518082602001fd5b604051630a12f52160e11b815260040160405180910390fd5b6104ef8061093d83390190565b80516001600160a01b0381168114610363575f80fd5b919050565b634e487b7160e01b5f52604160045260245ffd5b5f805f6060848603121561038e575f80fd5b6103978461034d565b92506103a56020850161034d565b60408501519092506001600160401b038111156103c0575f80fd5b8401601f810186136103d0575f80fd5b80516001600160401b038111156103e9576103e9610368565b604051601f8201601f19908116603f011681016001600160401b038111828210171561041757610417610368565b60405281815282820160200188101561042e575f80fd5b8160208401602083015e5f602083830101528093505050509250925092565b5f82518060208501845e5f920191825250919050565b6080516104bd6104805f395f818160350152607201526104bd5ff3fe60806040526004361061001d575f3560e01c80638b3240a014610027575b610025610070565b005b348015610032575f80fd5b507f00000000000000000000000000000000000000000000000000000000000000006040516001600160a01b03909116815260200160405180910390f35b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031633036100dc575f356001600160e01b03191663278f794360e11b146100d2576040516334ad5dbb60e21b815260040160405180910390fd5b6100da6100e9565b565b6100da610117565b905090565b5f806100f83660048184610365565b81019061010591906103a0565b915091506101138282610127565b5050565b6100da610122610181565b6101b3565b610130826101d1565b6040516001600160a01b038316907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b905f90a280511561017957610174828261024c565b505050565b6101136102be565b5f6100e47f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc546001600160a01b031690565b365f80375f80365f845af43d5f803e8080156101cd573d5ff35b3d5ffd5b806001600160a01b03163b5f0361020b57604051634c9c8ce360e01b81526001600160a01b03821660048201526024015b60405180910390fd5b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc80546001600160a01b0319166001600160a01b0392909216919091179055565b60605f80846001600160a01b0316846040516102689190610471565b5f60405180830381855af49150503d805f81146102a0576040519150601f19603f3d011682016040523d82523d5f602084013e6102a5565b606091505b50915091506102b58583836102dd565b95945050505050565b34156100da5760405163b398979f60e01b815260040160405180910390fd5b6060826102f2576102ed8261033c565b610335565b815115801561030957506001600160a01b0384163b155b1561033257604051639996b31560e01b81526001600160a01b0385166004820152602401610202565b50805b9392505050565b80511561034c5780518082602001fd5b604051630a12f52160e11b815260040160405180910390fd5b5f8085851115610373575f80fd5b8386111561037f575f80fd5b5050820193919092039150565b634e487b7160e01b5f52604160045260245ffd5b5f80604083850312156103b1575f80fd5b82356001600160a01b03811681146103c7575f80fd5b9150602083013567ffffffffffffffff8111156103e2575f80fd5b8301601f810185136103f2575f80fd5b803567ffffffffffffffff81111561040c5761040c61038c565b604051601f8201601f19908116603f0116810167ffffffffffffffff8111828210171561043b5761043b61038c565b604052818152828201602001871015610452575f80fd5b816020840160208301375f602083830101528093505050509250929050565b5f82518060208501845e5f92019182525091905056fea26469706673582212201032e5c276369f787ae3aa867466c332aa36322d2b088d73b91ce78ef067e22164736f6c634300081a0033608060405234801561000f575f80fd5b506040516104ef3803806104ef83398101604081905261002e916100bb565b806001600160a01b03811661005c57604051631e4fbdf760e01b81525f600482015260240160405180910390fd5b6100658161006c565b50506100e8565b5f80546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b5f602082840312156100cb575f80fd5b81516001600160a01b03811681146100e1575f80fd5b9392505050565b6103fa806100f55f395ff3fe608060405260043610610049575f3560e01c8063715018a61461004d5780638da5cb5b146100635780639623609d1461008e578063ad3cb1cc146100a1578063f2fde38b146100de575b5f80fd5b348015610058575f80fd5b506100616100fd565b005b34801561006e575f80fd5b505f546040516001600160a01b0390911681526020015b60405180910390f35b61006161009c366004610260565b610110565b3480156100ac575f80fd5b506100d1604051806040016040528060058152602001640352e302e360dc1b81525081565b6040516100859190610365565b3480156100e9575f80fd5b506100616100f836600461037e565b61017b565b6101056101bd565b61010e5f6101e9565b565b6101186101bd565b60405163278f794360e11b81526001600160a01b03841690634f1ef2869034906101489086908690600401610399565b5f604051808303818588803b15801561015f575f80fd5b505af1158015610171573d5f803e3d5ffd5b5050505050505050565b6101836101bd565b6001600160a01b0381166101b157604051631e4fbdf760e01b81525f60048201526024015b60405180910390fd5b6101ba816101e9565b50565b5f546001600160a01b0316331461010e5760405163118cdaa760e01b81523360048201526024016101a8565b5f80546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6001600160a01b03811681146101ba575f80fd5b634e487b7160e01b5f52604160045260245ffd5b5f805f60608486031215610272575f80fd5b833561027d81610238565b9250602084013561028d81610238565b9150604084013567ffffffffffffffff8111156102a8575f80fd5b8401601f810186136102b8575f80fd5b803567ffffffffffffffff8111156102d2576102d261024c565b604051601f8201601f19908116603f0116810167ffffffffffffffff811182821017156103015761030161024c565b604052818152828201602001881015610318575f80fd5b816020840160208301375f602083830101528093505050509250925092565b5f81518084528060208401602086015e5f602082860101526020601f19601f83011685010191505092915050565b602081525f6103776020830184610337565b9392505050565b5f6020828403121561038e575f80fd5b813561037781610238565b6001600160a01b03831681526040602082018190525f906103bc90830184610337565b94935050505056fea264697066735822122063012ab3c3421087c307802be7295f03bec95db9eea702a4c2db9595befa162464736f6c634300081a0033b53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103",
126
- "deployedBytecode": "0x60806040526004361061001d575f3560e01c80638b3240a014610027575b610025610070565b005b348015610032575f80fd5b507f00000000000000000000000000000000000000000000000000000000000000006040516001600160a01b03909116815260200160405180910390f35b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031633036100dc575f356001600160e01b03191663278f794360e11b146100d2576040516334ad5dbb60e21b815260040160405180910390fd5b6100da6100e9565b565b6100da610117565b905090565b5f806100f83660048184610365565b81019061010591906103a0565b915091506101138282610127565b5050565b6100da610122610181565b6101b3565b610130826101d1565b6040516001600160a01b038316907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b905f90a280511561017957610174828261024c565b505050565b6101136102be565b5f6100e47f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc546001600160a01b031690565b365f80375f80365f845af43d5f803e8080156101cd573d5ff35b3d5ffd5b806001600160a01b03163b5f0361020b57604051634c9c8ce360e01b81526001600160a01b03821660048201526024015b60405180910390fd5b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc80546001600160a01b0319166001600160a01b0392909216919091179055565b60605f80846001600160a01b0316846040516102689190610471565b5f60405180830381855af49150503d805f81146102a0576040519150601f19603f3d011682016040523d82523d5f602084013e6102a5565b606091505b50915091506102b58583836102dd565b95945050505050565b34156100da5760405163b398979f60e01b815260040160405180910390fd5b6060826102f2576102ed8261033c565b610335565b815115801561030957506001600160a01b0384163b155b1561033257604051639996b31560e01b81526001600160a01b0385166004820152602401610202565b50805b9392505050565b80511561034c5780518082602001fd5b604051630a12f52160e11b815260040160405180910390fd5b5f8085851115610373575f80fd5b8386111561037f575f80fd5b5050820193919092039150565b634e487b7160e01b5f52604160045260245ffd5b5f80604083850312156103b1575f80fd5b82356001600160a01b03811681146103c7575f80fd5b9150602083013567ffffffffffffffff8111156103e2575f80fd5b8301601f810185136103f2575f80fd5b803567ffffffffffffffff81111561040c5761040c61038c565b604051601f8201601f19908116603f0116810167ffffffffffffffff8111828210171561043b5761043b61038c565b604052818152828201602001871015610452575f80fd5b816020840160208301375f602083830101528093505050509250929050565b5f82518060208501845e5f92019182525091905056fea26469706673582212201032e5c276369f787ae3aa867466c332aa36322d2b088d73b91ce78ef067e22164736f6c634300081a0033",
125
+ "bytecode": "0x60a060405234801561000f575f80fd5b50604051610e4c380380610e4c83398101604081905261002e9161037c565b828282828161003d828261009e565b50508160405161004c90610340565b6001600160a01b039091168152602001604051809103905ff080158015610075573d5f803e3d5ffd5b506001600160a01b031660805261009361008e60805190565b6100fc565b505050505050610463565b6100a782610169565b6040516001600160a01b038316907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b905f90a28051156100f0576100eb82826101e7565b505050565b6100f861025a565b5050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f61013b5f80516020610e2c833981519152546001600160a01b031690565b604080516001600160a01b03928316815291841660208301520160405180910390a16101668161027b565b50565b806001600160a01b03163b5f036101a357604051634c9c8ce360e01b81526001600160a01b03821660048201526024015b60405180910390fd5b807f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5b80546001600160a01b0319166001600160a01b039290921691909117905550565b60605f80846001600160a01b031684604051610203919061044d565b5f60405180830381855af49150503d805f811461023b576040519150601f19603f3d011682016040523d82523d5f602084013e610240565b606091505b5090925090506102518583836102b8565b95945050505050565b34156102795760405163b398979f60e01b815260040160405180910390fd5b565b6001600160a01b0381166102a457604051633173bdd160e11b81525f600482015260240161019a565b805f80516020610e2c8339815191526101c6565b6060826102cd576102c882610317565b610310565b81511580156102e457506001600160a01b0384163b155b1561030d57604051639996b31560e01b81526001600160a01b038516600482015260240161019a565b50805b9392505050565b8051156103275780518082602001fd5b604051630a12f52160e11b815260040160405180910390fd5b6104ef8061093d83390190565b80516001600160a01b0381168114610363575f80fd5b919050565b634e487b7160e01b5f52604160045260245ffd5b5f805f6060848603121561038e575f80fd5b6103978461034d565b92506103a56020850161034d565b60408501519092506001600160401b038111156103c0575f80fd5b8401601f810186136103d0575f80fd5b80516001600160401b038111156103e9576103e9610368565b604051601f8201601f19908116603f011681016001600160401b038111828210171561041757610417610368565b60405281815282820160200188101561042e575f80fd5b8160208401602083015e5f602083830101528093505050509250925092565b5f82518060208501845e5f920191825250919050565b6080516104bd6104805f395f818160350152607201526104bd5ff3fe60806040526004361061001d575f3560e01c80638b3240a014610027575b610025610070565b005b348015610032575f80fd5b507f00000000000000000000000000000000000000000000000000000000000000006040516001600160a01b03909116815260200160405180910390f35b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031633036100dc575f356001600160e01b03191663278f794360e11b146100d2576040516334ad5dbb60e21b815260040160405180910390fd5b6100da6100e9565b565b6100da610117565b905090565b5f806100f83660048184610365565b81019061010591906103a0565b915091506101138282610127565b5050565b6100da610122610181565b6101b3565b610130826101d1565b6040516001600160a01b038316907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b905f90a280511561017957610174828261024c565b505050565b6101136102be565b5f6100e47f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc546001600160a01b031690565b365f80375f80365f845af43d5f803e8080156101cd573d5ff35b3d5ffd5b806001600160a01b03163b5f0361020b57604051634c9c8ce360e01b81526001600160a01b03821660048201526024015b60405180910390fd5b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc80546001600160a01b0319166001600160a01b0392909216919091179055565b60605f80846001600160a01b0316846040516102689190610471565b5f60405180830381855af49150503d805f81146102a0576040519150601f19603f3d011682016040523d82523d5f602084013e6102a5565b606091505b50915091506102b58583836102dd565b95945050505050565b34156100da5760405163b398979f60e01b815260040160405180910390fd5b6060826102f2576102ed8261033c565b610335565b815115801561030957506001600160a01b0384163b155b1561033257604051639996b31560e01b81526001600160a01b0385166004820152602401610202565b50805b9392505050565b80511561034c5780518082602001fd5b604051630a12f52160e11b815260040160405180910390fd5b5f8085851115610373575f80fd5b8386111561037f575f80fd5b5050820193919092039150565b634e487b7160e01b5f52604160045260245ffd5b5f80604083850312156103b1575f80fd5b82356001600160a01b03811681146103c7575f80fd5b9150602083013567ffffffffffffffff8111156103e2575f80fd5b8301601f810185136103f2575f80fd5b803567ffffffffffffffff81111561040c5761040c61038c565b604051601f8201601f19908116603f0116810167ffffffffffffffff8111828210171561043b5761043b61038c565b604052818152828201602001871015610452575f80fd5b816020840160208301375f602083830101528093505050509250929050565b5f82518060208501845e5f92019182525091905056fea26469706673582212205f12e4d638be8d591db7c67d942f3e9eeb14e9e44f78ba8cddaca37631bdc49764736f6c634300081a0033608060405234801561000f575f80fd5b506040516104ef3803806104ef83398101604081905261002e916100bb565b806001600160a01b03811661005c57604051631e4fbdf760e01b81525f600482015260240160405180910390fd5b6100658161006c565b50506100e8565b5f80546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b5f602082840312156100cb575f80fd5b81516001600160a01b03811681146100e1575f80fd5b9392505050565b6103fa806100f55f395ff3fe608060405260043610610049575f3560e01c8063715018a61461004d5780638da5cb5b146100635780639623609d1461008e578063ad3cb1cc146100a1578063f2fde38b146100de575b5f80fd5b348015610058575f80fd5b506100616100fd565b005b34801561006e575f80fd5b505f546040516001600160a01b0390911681526020015b60405180910390f35b61006161009c366004610260565b610110565b3480156100ac575f80fd5b506100d1604051806040016040528060058152602001640352e302e360dc1b81525081565b6040516100859190610365565b3480156100e9575f80fd5b506100616100f836600461037e565b61017b565b6101056101bd565b61010e5f6101e9565b565b6101186101bd565b60405163278f794360e11b81526001600160a01b03841690634f1ef2869034906101489086908690600401610399565b5f604051808303818588803b15801561015f575f80fd5b505af1158015610171573d5f803e3d5ffd5b5050505050505050565b6101836101bd565b6001600160a01b0381166101b157604051631e4fbdf760e01b81525f60048201526024015b60405180910390fd5b6101ba816101e9565b50565b5f546001600160a01b0316331461010e5760405163118cdaa760e01b81523360048201526024016101a8565b5f80546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6001600160a01b03811681146101ba575f80fd5b634e487b7160e01b5f52604160045260245ffd5b5f805f60608486031215610272575f80fd5b833561027d81610238565b9250602084013561028d81610238565b9150604084013567ffffffffffffffff8111156102a8575f80fd5b8401601f810186136102b8575f80fd5b803567ffffffffffffffff8111156102d2576102d261024c565b604051601f8201601f19908116603f0116810167ffffffffffffffff811182821017156103015761030161024c565b604052818152828201602001881015610318575f80fd5b816020840160208301375f602083830101528093505050509250925092565b5f81518084528060208401602086015e5f602082860101526020601f19601f83011685010191505092915050565b602081525f6103776020830184610337565b9392505050565b5f6020828403121561038e575f80fd5b813561037781610238565b6001600160a01b03831681526040602082018190525f906103bc90830184610337565b94935050505056fea264697066735822122063012ab3c3421087c307802be7295f03bec95db9eea702a4c2db9595befa162464736f6c634300081a0033b53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103",
126
+ "deployedBytecode": "0x60806040526004361061001d575f3560e01c80638b3240a014610027575b610025610070565b005b348015610032575f80fd5b507f00000000000000000000000000000000000000000000000000000000000000006040516001600160a01b03909116815260200160405180910390f35b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031633036100dc575f356001600160e01b03191663278f794360e11b146100d2576040516334ad5dbb60e21b815260040160405180910390fd5b6100da6100e9565b565b6100da610117565b905090565b5f806100f83660048184610365565b81019061010591906103a0565b915091506101138282610127565b5050565b6100da610122610181565b6101b3565b610130826101d1565b6040516001600160a01b038316907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b905f90a280511561017957610174828261024c565b505050565b6101136102be565b5f6100e47f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc546001600160a01b031690565b365f80375f80365f845af43d5f803e8080156101cd573d5ff35b3d5ffd5b806001600160a01b03163b5f0361020b57604051634c9c8ce360e01b81526001600160a01b03821660048201526024015b60405180910390fd5b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc80546001600160a01b0319166001600160a01b0392909216919091179055565b60605f80846001600160a01b0316846040516102689190610471565b5f60405180830381855af49150503d805f81146102a0576040519150601f19603f3d011682016040523d82523d5f602084013e6102a5565b606091505b50915091506102b58583836102dd565b95945050505050565b34156100da5760405163b398979f60e01b815260040160405180910390fd5b6060826102f2576102ed8261033c565b610335565b815115801561030957506001600160a01b0384163b155b1561033257604051639996b31560e01b81526001600160a01b0385166004820152602401610202565b50805b9392505050565b80511561034c5780518082602001fd5b604051630a12f52160e11b815260040160405180910390fd5b5f8085851115610373575f80fd5b8386111561037f575f80fd5b5050820193919092039150565b634e487b7160e01b5f52604160045260245ffd5b5f80604083850312156103b1575f80fd5b82356001600160a01b03811681146103c7575f80fd5b9150602083013567ffffffffffffffff8111156103e2575f80fd5b8301601f810185136103f2575f80fd5b803567ffffffffffffffff81111561040c5761040c61038c565b604051601f8201601f19908116603f0116810167ffffffffffffffff8111828210171561043b5761043b61038c565b604052818152828201602001871015610452575f80fd5b816020840160208301375f602083830101528093505050509250929050565b5f82518060208501845e5f92019182525091905056fea26469706673582212205f12e4d638be8d591db7c67d942f3e9eeb14e9e44f78ba8cddaca37631bdc49764736f6c634300081a0033",
127
127
  "linkReferences": {},
128
128
  "deployedLinkReferences": {}
129
129
  }
@@ -0,0 +1,4 @@
1
+ {
2
+ "_format": "hh-sol-dbg-1",
3
+ "buildInfo": "../../../build-info/8dd0451613123196cbb8bbbf43a69f7a.json"
4
+ }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "_format": "hh-sol-artifact-1",
3
3
  "contractName": "Versionable",
4
- "sourceName": "contracts/shared/Versionable.sol",
4
+ "sourceName": "contracts/upgradeability/Versionable.sol",
5
5
  "abi": [
6
6
  {
7
7
  "inputs": [],
@@ -1,25 +1,14 @@
1
1
  // SPDX-License-Identifier: Apache-2.0
2
2
  pragma solidity ^0.8.20;
3
3
 
4
- import {COMPONENT, DISTRIBUTION} from "../type/ObjectType.sol";
5
4
  import {Distribution} from "./Distribution.sol";
6
5
  import {IAuthorization} from "../authorization/IAuthorization.sol";
7
- import {IDistributionService} from "./IDistributionService.sol";
8
- import {IProductService} from "../product/IProductService.sol";
9
- import {NftId, NftIdLib} from "../type/NftId.sol";
10
- import {ReferralId, ReferralStatus, ReferralLib} from "../type/Referral.sol";
11
- import {Fee, FeeLib} from "../type/Fee.sol";
12
- import {InstanceLinkedComponent} from "../shared/InstanceLinkedComponent.sol";
13
- import {IComponentService} from "../shared/IComponentService.sol";
14
- import {IDistribution} from "../instance/module/IDistribution.sol";
15
- import {IDistributionComponent} from "./IDistributionComponent.sol";
16
- import {IRegistry} from "../registry/IRegistry.sol";
17
- import {TokenHandler} from "../shared/TokenHandler.sol";
18
- import {InstanceReader} from "../instance/InstanceReader.sol";
6
+ import {NftId} from "../type/NftId.sol";
7
+ import {ReferralId} from "../type/Referral.sol";
8
+ import {Fee} from "../type/Fee.sol";
19
9
  import {UFixed} from "../type/UFixed.sol";
20
10
  import {DistributorType} from "../type/DistributorType.sol";
21
- import {Timestamp, TimestampLib} from "../type/Timestamp.sol";
22
- import {ITransferInterceptor} from "../registry/ITransferInterceptor.sol";
11
+ import {Timestamp} from "../type/Timestamp.sol";
23
12
 
24
13
 
25
14
  contract BasicDistribution is
@@ -3,10 +3,11 @@ pragma solidity ^0.8.20;
3
3
 
4
4
  import {Authorization} from "../authorization/Authorization.sol";
5
5
  import {BasicDistribution} from "./BasicDistribution.sol";
6
+ import {Distribution} from "./Distribution.sol";
6
7
  import {DISTRIBUTION} from "../type/ObjectType.sol";
7
8
  import {IAccess} from "../authorization/IAccess.sol";
9
+ import {IInstanceLinkedComponent} from "../shared/IInstanceLinkedComponent.sol";
8
10
  import {PUBLIC_ROLE} from "../../contracts/type/RoleId.sol";
9
- import {RoleId} from "../type/RoleId.sol";
10
11
 
11
12
 
12
13
  contract BasicDistributionAuthorization
@@ -38,6 +39,9 @@ contract BasicDistributionAuthorization
38
39
  _authorize(functions, BasicDistribution.createDistributor.selector, "createDistributor");
39
40
  _authorize(functions, BasicDistribution.updateDistributorType.selector, "updateDistributorType");
40
41
  _authorize(functions, BasicDistribution.createReferral.selector, "createReferral");
42
+
43
+ _authorize(functions, IInstanceLinkedComponent.withdrawFees.selector, "withdrawFees");
44
+ _authorize(functions, Distribution.withdrawCommission.selector, "withdrawCommission");
41
45
  }
42
46
  }
43
47
 
@@ -1,24 +1,19 @@
1
1
  // SPDX-License-Identifier: Apache-2.0
2
2
  pragma solidity ^0.8.20;
3
3
 
4
+ import {Amount} from "../type/Amount.sol";
4
5
  import {COMPONENT, DISTRIBUTION} from "../type/ObjectType.sol";
5
6
  import {IAuthorization} from "../authorization/IAuthorization.sol";
6
7
  import {IDistributionService} from "./IDistributionService.sol";
7
- import {IProductService} from "../product/IProductService.sol";
8
8
  import {NftId, NftIdLib} from "../type/NftId.sol";
9
9
  import {ReferralId, ReferralStatus, ReferralLib} from "../type/Referral.sol";
10
- import {Fee, FeeLib} from "../type/Fee.sol";
10
+ import {Fee} from "../type/Fee.sol";
11
11
  import {InstanceLinkedComponent} from "../shared/InstanceLinkedComponent.sol";
12
12
  import {IComponentService} from "../shared/IComponentService.sol";
13
- import {IDistribution} from "../instance/module/IDistribution.sol";
14
13
  import {IDistributionComponent} from "./IDistributionComponent.sol";
15
- import {IRegistry} from "../registry/IRegistry.sol";
16
- import {TokenHandler} from "../shared/TokenHandler.sol";
17
- import {InstanceReader} from "../instance/InstanceReader.sol";
18
14
  import {UFixed} from "../type/UFixed.sol";
19
15
  import {DistributorType} from "../type/DistributorType.sol";
20
- import {Timestamp, TimestampLib} from "../type/Timestamp.sol";
21
- import {ITransferInterceptor} from "../registry/ITransferInterceptor.sol";
16
+ import {Timestamp} from "../type/Timestamp.sol";
22
17
 
23
18
 
24
19
  abstract contract Distribution is
@@ -41,13 +36,13 @@ abstract contract Distribution is
41
36
  _;
42
37
  }
43
38
 
44
-
45
39
  function register()
46
40
  external
47
41
  virtual
48
42
  onlyOwner()
49
43
  {
50
44
  _getDistributionStorage()._componentService.registerDistribution();
45
+ _approveTokenHandler(type(uint256).max);
51
46
  }
52
47
 
53
48
 
@@ -127,7 +122,18 @@ abstract contract Distribution is
127
122
  return true;
128
123
  }
129
124
 
130
-
125
+ /// @inheritdoc IDistributionComponent
126
+ function withdrawCommission(NftId distributorNftId, Amount amount)
127
+ external
128
+ virtual
129
+ restricted()
130
+ onlyDistributor()
131
+ onlyNftOwner(distributorNftId)
132
+ returns (Amount withdrawnAmount)
133
+ {
134
+ return _withdrawCommission(distributorNftId, amount);
135
+ }
136
+
131
137
  function _initializeDistribution(
132
138
  address registry,
133
139
  NftId instanceNftId,
@@ -266,6 +272,12 @@ abstract contract Distribution is
266
272
  data);
267
273
  }
268
274
 
275
+ function _withdrawCommission(NftId distributorNftId, Amount amount)
276
+ internal
277
+ returns (Amount withdrawnAmount)
278
+ {
279
+ return _getDistributionStorage()._distributionService.withdrawCommission(distributorNftId, amount);
280
+ }
269
281
 
270
282
  function _nftTransferFrom(address from, address to, uint256 tokenId) internal virtual override {
271
283
  // keep track of distributor nft owner
@@ -1,6 +1,8 @@
1
1
  // SPDX-License-Identifier: Apache-2.0
2
2
  pragma solidity ^0.8.20;
3
3
 
4
+ import {IERC20Metadata} from "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol";
5
+
4
6
  import {IRegistry} from "../registry/IRegistry.sol";
5
7
  import {IInstance} from "../instance/IInstance.sol";
6
8
  import {IComponentService} from "../shared/IComponentService.sol";
@@ -15,26 +17,12 @@ import {NftId, NftIdLib} from "../type/NftId.sol";
15
17
  import {Fee, FeeLib} from "../type/Fee.sol";
16
18
  import {KEEP_STATE} from "../type/StateId.sol";
17
19
  import {ObjectType, COMPONENT, DISTRIBUTION, INSTANCE, DISTRIBUTION, DISTRIBUTOR, REGISTRY} from "../type/ObjectType.sol";
18
- import {Version, VersionLib} from "../type/Version.sol";
19
- import {RoleId} from "../type/RoleId.sol";
20
-
21
- import {IVersionable} from "../shared/IVersionable.sol";
22
- import {Versionable} from "../shared/Versionable.sol";
23
-
24
- import {IService} from "../shared/IService.sol";
25
- import {Service} from "../shared/Service.sol";
26
20
  import {ComponentVerifyingService} from "../shared/ComponentVerifyingService.sol";
27
- import {InstanceService} from "../instance/InstanceService.sol";
28
- import {IComponent} from "../shared/IComponent.sol";
29
- import {IDistributionComponent} from "../distribution/IDistributionComponent.sol";
30
21
  import {IDistributionService} from "./IDistributionService.sol";
31
- import {IPricingService} from "../product/IPricingService.sol";
32
-
33
22
  import {UFixed, UFixedLib} from "../type/UFixed.sol";
34
23
  import {DistributorType, DistributorTypeLib} from "../type/DistributorType.sol";
35
- import {ReferralId, ReferralStatus, ReferralLib} from "../type/Referral.sol";
36
- import {Timestamp, TimestampLib, zeroTimestamp} from "../type/Timestamp.sol";
37
- import {Key32} from "../type/Key32.sol";
24
+ import {ReferralId, ReferralLib} from "../type/Referral.sol";
25
+ import {Timestamp, TimestampLib} from "../type/Timestamp.sol";
38
26
  import {IDistribution} from "../instance/module/IDistribution.sol";
39
27
  import {InstanceStore} from "../instance/InstanceStore.sol";
40
28
 
@@ -43,12 +31,6 @@ contract DistributionService is
43
31
  ComponentVerifyingService,
44
32
  IDistributionService
45
33
  {
46
- using NftIdLib for NftId;
47
- using TimestampLib for Timestamp;
48
- using UFixedLib for UFixed;
49
- using FeeLib for Fee;
50
- using ReferralLib for ReferralId;
51
-
52
34
  IComponentService private _componentService;
53
35
  IInstanceService private _instanceService;
54
36
  IRegistryService private _registryService;
@@ -152,7 +134,6 @@ contract DistributionService is
152
134
  distributorType,
153
135
  true, // active
154
136
  data,
155
- AmountLib.zero(),
156
137
  0);
157
138
 
158
139
  instance.getInstanceStore().createDistributor(distributorNftId, info);
@@ -257,19 +238,73 @@ contract DistributionService is
257
238
  referralInfo.usedReferrals += 1;
258
239
  store.updateReferral(referralId, referralInfo, KEEP_STATE());
259
240
 
241
+ _componentService.increaseDistributorBalance(store, referralInfo.distributorNftId, AmountLib.zero(), commissionAmount);
242
+
260
243
  // update book keeping for distributor info
261
244
  IDistribution.DistributorInfo memory distributorInfo = reader.getDistributorInfo(referralInfo.distributorNftId);
262
- // TODO refactor sum of commission amount into a fee balance for distributors
263
- distributorInfo.commissionAmount = distributorInfo.commissionAmount + commissionAmount;
264
245
  distributorInfo.numPoliciesSold += 1;
265
246
  store.updateDistributor(referralInfo.distributorNftId, distributorInfo, KEEP_STATE());
266
247
  } else {
267
-
268
248
  // increase distribution balance by distribution owner fee
269
249
  _componentService.increaseDistributionBalance(store, distributionNftId, AmountLib.zero(), distributionOwnerFee);
270
250
  }
271
251
  }
272
252
 
253
+ /// @inheritdoc IDistributionService
254
+ function withdrawCommission(NftId distributorNftId, Amount amount)
255
+ public
256
+ virtual
257
+ // TODO: restricted() (once #462 is done)
258
+ returns (Amount withdrawnAmount)
259
+ {
260
+ (NftId distributionNftId,, IInstance instance) = _getAndVerifyActiveComponent(DISTRIBUTION());
261
+ InstanceReader reader = instance.getInstanceReader();
262
+
263
+ IComponents.ComponentInfo memory distributionInfo = reader.getComponentInfo(distributionNftId);
264
+ address distributionWallet = distributionInfo.wallet;
265
+
266
+ Amount commissionAmount = reader.getFeeAmount(distributorNftId);
267
+
268
+ // determine withdrawn amount
269
+ withdrawnAmount = amount;
270
+ if (withdrawnAmount.gte(AmountLib.max())) {
271
+ withdrawnAmount = commissionAmount;
272
+ } else {
273
+ if (withdrawnAmount.gt(commissionAmount)) {
274
+ revert ErrorDistributionServiceCommissionWithdrawAmountExceedsLimit(withdrawnAmount, commissionAmount);
275
+ }
276
+ }
277
+
278
+ if (withdrawnAmount.eqz()) {
279
+ revert ErrorDistributionServiceCommissionWithdrawAmountIsZero();
280
+ }
281
+
282
+ // check allowance
283
+ IERC20Metadata token = IERC20Metadata(distributionInfo.token);
284
+ uint256 tokenAllowance = token.allowance(distributionWallet, address(distributionInfo.tokenHandler));
285
+ if (tokenAllowance < withdrawnAmount.toInt()) {
286
+ revert ErrorDistributionServiceWalletAllowanceTooSmall(distributionWallet, address(distributionInfo.tokenHandler), tokenAllowance, withdrawnAmount.toInt());
287
+ }
288
+
289
+ // decrease fee counters by withdrawnAmount and update distributor info
290
+ {
291
+ InstanceStore store = instance.getInstanceStore();
292
+ // decrease fee counter for distribution balance
293
+ _componentService.decreaseDistributionBalance(store, distributionNftId, withdrawnAmount, AmountLib.zero());
294
+ // decrease fee counter for distributor fee
295
+ _componentService.decreaseDistributorBalance(store, distributorNftId, AmountLib.zero(), withdrawnAmount);
296
+ }
297
+
298
+ // transfer amount to distributor
299
+ {
300
+ address distributor = getRegistry().ownerOf(distributorNftId);
301
+ // TODO: centralize token handling (issue #471)
302
+ distributionInfo.tokenHandler.transfer(distributionWallet, distributor, withdrawnAmount);
303
+
304
+ emit LogDistributionServiceCommissionWithdrawn(distributorNftId, distributor, address(token), withdrawnAmount);
305
+ }
306
+ }
307
+
273
308
  function referralIsValid(NftId distributionNftId, ReferralId referralId) public view returns (bool isValid) {
274
309
  if (distributionNftId.eqz() || referralId.eqz()) {
275
310
  return false;
@@ -1,12 +1,9 @@
1
1
  // SPDX-License-Identifier: Apache-2.0
2
2
  pragma solidity ^0.8.20;
3
3
 
4
- import {IVersionable} from "../shared/IVersionable.sol";
5
- import {ProxyManager} from "../shared/ProxyManager.sol";
4
+ import {IVersionable} from "../upgradeability/IVersionable.sol";
5
+ import {ProxyManager} from "../upgradeability/ProxyManager.sol";
6
6
  import {DistributionService} from "./DistributionService.sol";
7
- import {Registry} from "../registry/Registry.sol";
8
- import {RegistryService} from "../registry/RegistryService.sol";
9
- import {REGISTRY} from "../type/ObjectType.sol";
10
7
 
11
8
  contract DistributionServiceManager is ProxyManager {
12
9
 
@@ -1,13 +1,11 @@
1
1
  // SPDX-License-Identifier: Apache-2.0
2
2
  pragma solidity ^0.8.20;
3
3
 
4
- import {Fee} from "../type/Fee.sol";
4
+ import {Amount} from "../type/Amount.sol";
5
5
  import {IInstanceLinkedComponent} from "../shared/IInstanceLinkedComponent.sol";
6
- import {ReferralId, ReferralStatus} from "../type/Referral.sol";
7
6
  import {NftId} from "../type/NftId.sol";
8
- import {DistributorType} from "../type/DistributorType.sol";
7
+ import {ReferralId, ReferralStatus} from "../type/Referral.sol";
9
8
  import {UFixed} from "../type/UFixed.sol";
10
- import {Timestamp} from "../type/Timestamp.sol";
11
9
 
12
10
  interface IDistributionComponent is IInstanceLinkedComponent {
13
11
 
@@ -45,4 +43,10 @@ interface IDistributionComponent is IInstanceLinkedComponent {
45
43
 
46
44
  /// @dev Returns true to ensure component is called when transferring distributor Nft Ids.
47
45
  function isVerifying() external view returns (bool verifying);
46
+
47
+ /// @dev Withdraw commission for the distributor
48
+ /// @param distributorNftId the distributor Nft Id
49
+ /// @param amount the amount to withdraw. If set to AMOUNT_MAX, the full commission available is withdrawn
50
+ /// @return withdrawnAmount the effective withdrawn amount
51
+ function withdrawCommission(NftId distributorNftId, Amount amount) external returns (Amount withdrawnAmount);
48
52
  }
@@ -27,12 +27,18 @@ interface IDistributionService is IService {
27
27
  error ErrorIDistributionServiceCommissionTooHigh(uint256 commissionPercentage, uint256 maxCommissionPercentage);
28
28
  error ErrorIDistributionServiceMinFeeTooHigh(uint256 minFee, uint256 limit);
29
29
 
30
+ error ErrorDistributionServiceCommissionWithdrawAmountExceedsLimit(Amount amount, Amount limit);
31
+ error ErrorDistributionServiceCommissionWithdrawAmountIsZero();
32
+ error ErrorDistributionServiceWalletAllowanceTooSmall(address wallet, address tokenHandler, uint256 allowance, uint256 amount);
33
+
30
34
  error ErrorDistributionServiceVariableFeesTooHight(uint256 maxDiscountPercentage, uint256 limit);
31
35
  error ErrorDistributionServiceMaxDiscountTooHigh(uint256 maxDiscountPercentage, uint256 limit);
32
36
 
33
37
  error ErrorIDistributionServiceReferralInvalid(NftId distributionNftId, ReferralId referralId);
34
38
  error ErrorDistributionServiceInvalidFeeTransferred(Amount transferredDistributionFeeAmount, Amount expectedDistributionFeeAmount);
35
39
 
40
+ event LogDistributionServiceCommissionWithdrawn(NftId distributorNftId, address recipient, address tokenAddress, Amount amount);
41
+
36
42
  function createDistributorType(
37
43
  string memory name,
38
44
  UFixed minDiscountPercentage,
@@ -82,4 +88,10 @@ interface IDistributionService is IService {
82
88
  NftId distributorNftId,
83
89
  ReferralId referralId
84
90
  ) external view returns (bool isValid);
91
+
92
+ /// @dev Withdraw commission for the distributor
93
+ /// @param distributorNftId the distributor Nft Id
94
+ /// @param amount the amount to withdraw. If set to AMOUNT_MAX, the full commission available is withdrawn
95
+ /// @return withdrawnAmount the effective withdrawn amount
96
+ function withdrawCommission(NftId distributorNftId, Amount amount) external returns (Amount withdrawnAmount);
85
97
  }
@@ -10,26 +10,26 @@ import {LibNftIdSet} from "../type/NftIdSet.sol";
10
10
  import {NftId} from "../type/NftId.sol";
11
11
  import {TimestampLib} from "../type/Timestamp.sol";
12
12
 
13
- import {ObjectManager} from "./base/ObjectManager.sol";
13
+ import {ObjectSet} from "./base/ObjectSet.sol";
14
14
 
15
- contract BundleManager is
16
- ObjectManager
15
+ contract BundleSet is
16
+ ObjectSet
17
17
  {
18
18
 
19
- event LogBundleManagerPolicyLinked(NftId bundleNftId, NftId policyNftId);
20
- event LogBundleManagerPolicyUnlinked(NftId bundleNftId, NftId policyNftId);
19
+ event LogBundleSetPolicyLinked(NftId bundleNftId, NftId policyNftId);
20
+ event LogBundleSetPolicyUnlinked(NftId bundleNftId, NftId policyNftId);
21
21
 
22
- event LogBundleManagerBundleAdded(NftId poolNftId, NftId bundleNftId);
23
- event LogBundleManagerBundleUnlocked(NftId poolNftId, NftId bundleNftId);
24
- event LogBundleManagerBundleLocked(NftId poolNftId, NftId bundleNftId);
25
- event LogBundleManagerBundleClosed(NftId poolNftId, NftId bundleNftId);
22
+ event LogBundleSetBundleAdded(NftId poolNftId, NftId bundleNftId);
23
+ event LogBundleSetBundleUnlocked(NftId poolNftId, NftId bundleNftId);
24
+ event LogBundleSetBundleLocked(NftId poolNftId, NftId bundleNftId);
25
+ event LogBundleSetBundleClosed(NftId poolNftId, NftId bundleNftId);
26
26
 
27
- error ErrorBundleManagerPolicyAlreadyActivated(NftId policyNftId);
28
- error ErrorBundleManagerBundleLocked(NftId bundleNftId, NftId policyNftId);
29
- error ErrorBundleManagerPolicyWithOpenClaims(NftId policyNftId, uint256 openClaimsCount);
30
- error ErrorBundleManagerPolicyNotCloseable(NftId policyNftId);
31
- error ErrorBundleManagerBundleUnknown(NftId bundleNftId);
32
- error ErrorBundleManagerBundleNotRegistered(NftId bundleNftId);
27
+ error ErrorBundleSetPolicyAlreadyActivated(NftId policyNftId);
28
+ error ErrorBundleSetBundleLocked(NftId bundleNftId, NftId policyNftId);
29
+ error ErrorBundleSetPolicyWithOpenClaims(NftId policyNftId, uint256 openClaimsCount);
30
+ error ErrorBundleSetPolicyNotCloseable(NftId policyNftId);
31
+ error ErrorBundleSetBundleUnknown(NftId bundleNftId);
32
+ error ErrorBundleSetBundleNotRegistered(NftId bundleNftId);
33
33
 
34
34
  mapping(NftId bundleNftId => LibNftIdSet.Set policies) internal _activePolicies;
35
35
 
@@ -42,11 +42,11 @@ contract BundleManager is
42
42
 
43
43
  // ensure bundle is unlocked (in active set) and registered with this instance
44
44
  if (!_isActive(poolNftId, bundleNftId)) {
45
- revert ErrorBundleManagerBundleLocked(bundleNftId, policyNftId);
45
+ revert ErrorBundleSetBundleLocked(bundleNftId, policyNftId);
46
46
  }
47
47
 
48
48
  LibNftIdSet.add(_activePolicies[bundleNftId], policyNftId);
49
- emit LogBundleManagerPolicyLinked(bundleNftId, policyNftId);
49
+ emit LogBundleSetPolicyLinked(bundleNftId, policyNftId);
50
50
  }
51
51
 
52
52
 
@@ -63,11 +63,11 @@ contract BundleManager is
63
63
 
64
64
  // ensure bundle is registered with this instance
65
65
  if (!_contains(poolNftId, bundleNftId)) {
66
- revert ErrorBundleManagerBundleUnknown(bundleNftId);
66
+ revert ErrorBundleSetBundleUnknown(bundleNftId);
67
67
  }
68
68
 
69
69
  LibNftIdSet.remove(_activePolicies[bundleNftId], policyNftId);
70
- emit LogBundleManagerPolicyUnlinked(policyInfo.bundleNftId, policyNftId);
70
+ emit LogBundleSetPolicyUnlinked(policyInfo.bundleNftId, policyNftId);
71
71
  }
72
72
 
73
73
 
@@ -78,11 +78,11 @@ contract BundleManager is
78
78
 
79
79
  // ensure pool is registered with instance
80
80
  if(poolNftId.eqz()) {
81
- revert ErrorBundleManagerBundleNotRegistered(bundleNftId);
81
+ revert ErrorBundleSetBundleNotRegistered(bundleNftId);
82
82
  }
83
83
 
84
84
  _add(poolNftId, bundleNftId);
85
- emit LogBundleManagerBundleAdded(poolNftId, bundleNftId);
85
+ emit LogBundleSetBundleAdded(poolNftId, bundleNftId);
86
86
  }
87
87
 
88
88
 
@@ -90,14 +90,14 @@ contract BundleManager is
90
90
  function unlock(NftId bundleNftId) external restricted() {
91
91
  NftId poolNftId = _instance.getInstanceReader().getBundleInfo(bundleNftId).poolNftId;
92
92
  _activate(poolNftId, bundleNftId);
93
- emit LogBundleManagerBundleUnlocked(poolNftId, bundleNftId);
93
+ emit LogBundleSetBundleUnlocked(poolNftId, bundleNftId);
94
94
  }
95
95
 
96
96
  /// @dev locked (deactivated) bundles may not collateralize any new policies
97
97
  function lock(NftId bundleNftId) external restricted() {
98
98
  NftId poolNftId = _instance.getInstanceReader().getBundleInfo(bundleNftId).poolNftId;
99
99
  _deactivate(poolNftId, bundleNftId);
100
- emit LogBundleManagerBundleLocked(poolNftId, bundleNftId);
100
+ emit LogBundleSetBundleLocked(poolNftId, bundleNftId);
101
101
  }
102
102
 
103
103
  function bundles(NftId poolNftId) external view returns(uint256) {
@@ -22,7 +22,7 @@ import {IRegisterable} from "../shared/IRegisterable.sol";
22
22
  import {ITransferInterceptor} from "../registry/ITransferInterceptor.sol";
23
23
 
24
24
  import {InstanceAdmin} from "./InstanceAdmin.sol";
25
- import {BundleManager} from "./BundleManager.sol";
25
+ import {BundleSet} from "./BundleSet.sol";
26
26
  import {InstanceReader} from "./InstanceReader.sol";
27
27
  import {InstanceStore} from "./InstanceStore.sol";
28
28
 
@@ -48,9 +48,9 @@ interface IInstance is
48
48
  error ErrorInstanceInstanceAdminAlreadySet(address InstanceAdmin);
49
49
  error ErrorInstanceInstanceAdminAuthorityMismatch(address instanceAuthority);
50
50
 
51
- error ErrorInstanceBundleManagerAlreadySet(address instanceBundleManager);
52
- error ErrorInstanceBundleManagerInstanceMismatch(address instance);
53
- error ErrorInstanceBundleManagerAuthorityMismatch(address instanceAuthority);
51
+ error ErrorInstanceBundleSetAlreadySet(address instanceBundleSet);
52
+ error ErrorInstanceBundleSetInstanceMismatch(address instance);
53
+ error ErrorInstanceBundleSetAuthorityMismatch(address instanceAuthority);
54
54
 
55
55
  error ErrorInstanceInstanceReaderInstanceMismatch(address instanceAuthority);
56
56
 
@@ -80,7 +80,7 @@ interface IInstance is
80
80
  // get instance release and supporting contracts
81
81
  function getMajorVersion() external pure returns (VersionPart majorVersion);
82
82
  function getInstanceReader() external view returns (InstanceReader);
83
- function getBundleManager() external view returns (BundleManager);
83
+ function getBundleSet() external view returns (BundleSet);
84
84
  function getInstanceAdmin() external view returns (InstanceAdmin);
85
85
  function getInstanceStore() external view returns (InstanceStore);
86
86
  }
@@ -2,7 +2,7 @@
2
2
  pragma solidity ^0.8.20;
3
3
 
4
4
  import {Amount} from "../type/Amount.sol";
5
- import {BundleManager} from "./BundleManager.sol";
5
+ import {BundleSet} from "./BundleSet.sol";
6
6
  import {Instance} from "./Instance.sol";
7
7
  import {IInstanceLinkedComponent} from "../shared/IInstanceLinkedComponent.sol";
8
8
  import {IService} from "../shared/IService.sol";
@@ -24,7 +24,7 @@ interface IInstanceService is IService {
24
24
 
25
25
  error ErrorInstanceServiceMasterInstanceAlreadySet();
26
26
  error ErrorInstanceServiceMasterInstanceAdminAlreadySet();
27
- error ErrorInstanceServiceMasterBundleManagerAlreadySet();
27
+ error ErrorInstanceServiceMasterBundleSetAlreadySet();
28
28
  error ErrorInstanceServiceInstanceAddressZero();
29
29
 
30
30
  error ErrorInstanceServiceMasterInstanceReaderNotSet();
@@ -35,11 +35,11 @@ interface IInstanceService is IService {
35
35
  error ErrorInstanceServiceAccessManagerZero();
36
36
  error ErrorInstanceServiceInstanceAdminZero();
37
37
  error ErrorInstanceServiceInstanceReaderZero();
38
- error ErrorInstanceServiceBundleManagerZero();
38
+ error ErrorInstanceServiceBundleSetZero();
39
39
  error ErrorInstanceServiceInstanceStoreZero();
40
40
 
41
41
  error ErrorInstanceServiceInstanceAuthorityMismatch();
42
- error ErrorInstanceServiceBundleManagerAuthorityMismatch();
42
+ error ErrorInstanceServiceBundleSetAuthorityMismatch();
43
43
  error ErrorInstanceServiceInstanceReaderInstanceMismatch2();
44
44
  error ErrorInstanceServiceBundleMangerInstanceMismatch();
45
45
  error ErrorInstanceServiceInstanceStoreAuthorityMismatch();
@@ -52,7 +52,7 @@ interface IInstanceService is IService {
52
52
 
53
53
  event LogInstanceCloned(NftId instanceNftId, address instance);
54
54
 
55
- function createInstanceClone()
55
+ function createInstance()
56
56
  external
57
57
  returns (
58
58
  // TODO check if Instance can be changed to IInstance
@@ -26,7 +26,7 @@ import {IInstance} from "./IInstance.sol";
26
26
  import {IInstanceService} from "./IInstanceService.sol";
27
27
  import {InstanceReader} from "./InstanceReader.sol";
28
28
  import {InstanceAdmin} from "./InstanceAdmin.sol";
29
- import {BundleManager} from "./BundleManager.sol";
29
+ import {BundleSet} from "./BundleSet.sol";
30
30
  import {InstanceStore} from "./InstanceStore.sol";
31
31
 
32
32
  import {KeyValueStore} from "../shared/KeyValueStore.sol";
@@ -55,7 +55,7 @@ contract Instance is
55
55
  IInstanceService internal _instanceService;
56
56
  InstanceAdmin internal _instanceAdmin;
57
57
  InstanceReader internal _instanceReader;
58
- BundleManager internal _bundleManager;
58
+ BundleSet internal _bundleManager;
59
59
  InstanceStore internal _instanceStore;
60
60
 
61
61
  modifier onlyChainNft() {
@@ -68,7 +68,7 @@ contract Instance is
68
68
  function initialize(
69
69
  InstanceAdmin instanceAdmin,
70
70
  InstanceStore instanceStore,
71
- BundleManager bundleManager,
71
+ BundleSet bundleManager,
72
72
  InstanceReader instanceReader,
73
73
  IRegistry registry,
74
74
  address initialOwner
@@ -234,7 +234,7 @@ contract Instance is
234
234
  return _instanceReader;
235
235
  }
236
236
 
237
- function getBundleManager() external view returns (BundleManager) {
237
+ function getBundleSet() external view returns (BundleSet) {
238
238
  return _bundleManager;
239
239
  }
240
240
 
@@ -23,7 +23,7 @@ contract InstanceAdmin is
23
23
  string public constant INSTANCE_TARGET_NAME = "Instance";
24
24
  string public constant INSTANCE_STORE_TARGET_NAME = "InstanceStore";
25
25
  string public constant INSTANCE_ADMIN_TARGET_NAME = "InstanceAdmin";
26
- string public constant BUNDLE_MANAGER_TARGET_NAME = "BundleManager";
26
+ string public constant BUNDLE_SET_TARGET_NAME = "BundleSet";
27
27
 
28
28
  uint64 public constant CUSTOM_ROLE_ID_MIN = 10000; // MUST be even
29
29
 
@@ -248,7 +248,7 @@ contract InstanceAdmin is
248
248
  _checkAndCreateTargetWithRole(address(_instance), INSTANCE_TARGET_NAME);
249
249
  _checkAndCreateTargetWithRole(address(_instance.getInstanceStore()), INSTANCE_STORE_TARGET_NAME);
250
250
  _checkAndCreateTargetWithRole(address(_instance.getInstanceAdmin()), INSTANCE_ADMIN_TARGET_NAME);
251
- _checkAndCreateTargetWithRole(address(_instance.getBundleManager()), BUNDLE_MANAGER_TARGET_NAME);
251
+ _checkAndCreateTargetWithRole(address(_instance.getBundleSet()), BUNDLE_SET_TARGET_NAME);
252
252
 
253
253
  // create targets for services that need to access the module targets
254
254
  ObjectType[] memory serviceDomains = _instanceAuthorization.getServiceDomains();