@etherisc/gif-next 0.0.2-bdcb44f-543 → 0.0.2-be8b3db-650

Sign up to get free protection for your applications and to get access to all the features.
Files changed (221) hide show
  1. package/artifacts/contracts/components/Component.sol/Component.dbg.json +1 -1
  2. package/artifacts/contracts/components/Component.sol/Component.json +40 -0
  3. package/artifacts/contracts/components/Distribution.sol/Distribution.dbg.json +1 -1
  4. package/artifacts/contracts/components/Distribution.sol/Distribution.json +41 -19
  5. package/artifacts/contracts/components/IComponent.sol/IComponent.dbg.json +1 -1
  6. package/artifacts/contracts/components/IComponent.sol/IComponent.json +40 -0
  7. package/artifacts/contracts/components/IDistributionComponent.sol/IDistributionComponent.dbg.json +1 -1
  8. package/artifacts/contracts/components/IDistributionComponent.sol/IDistributionComponent.json +41 -19
  9. package/artifacts/contracts/components/IPoolComponent.sol/IPoolComponent.dbg.json +1 -1
  10. package/artifacts/contracts/components/IPoolComponent.sol/IPoolComponent.json +57 -150
  11. package/artifacts/contracts/components/IProductComponent.sol/IProductComponent.dbg.json +1 -1
  12. package/artifacts/contracts/components/IProductComponent.sol/IProductComponent.json +40 -0
  13. package/artifacts/contracts/components/Pool.sol/Pool.dbg.json +1 -1
  14. package/artifacts/contracts/components/Pool.sol/Pool.json +76 -189
  15. package/artifacts/contracts/components/Product.sol/Product.dbg.json +1 -1
  16. package/artifacts/contracts/components/Product.sol/Product.json +40 -0
  17. package/artifacts/contracts/instance/BundleManager.sol/BundleManager.dbg.json +1 -1
  18. package/artifacts/contracts/instance/BundleManager.sol/BundleManager.json +30 -11
  19. package/artifacts/contracts/instance/Cloneable.sol/Cloneable.dbg.json +1 -1
  20. package/artifacts/contracts/instance/IInstance.sol/IInstance.dbg.json +1 -1
  21. package/artifacts/contracts/instance/IInstance.sol/IInstance.json +32 -174
  22. package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.dbg.json +1 -1
  23. package/artifacts/contracts/instance/Instance.sol/Instance.dbg.json +1 -1
  24. package/artifacts/contracts/instance/Instance.sol/Instance.json +103 -238
  25. package/artifacts/contracts/instance/InstanceAccessManager.sol/InstanceAccessManager.dbg.json +1 -1
  26. package/artifacts/contracts/instance/InstanceAccessManager.sol/InstanceAccessManager.json +2 -2
  27. package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.dbg.json +1 -1
  28. package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.json +73 -144
  29. package/artifacts/contracts/instance/InstanceService.sol/InstanceService.dbg.json +1 -1
  30. package/artifacts/contracts/instance/InstanceService.sol/InstanceService.json +32 -32
  31. package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.dbg.json +1 -1
  32. package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.json +17 -17
  33. package/artifacts/contracts/instance/ObjectManager.sol/ObjectManager.dbg.json +1 -1
  34. package/artifacts/contracts/instance/ObjectManager.sol/ObjectManager.json +2 -2
  35. package/artifacts/contracts/instance/base/ComponentService.sol/ComponentService.dbg.json +1 -1
  36. package/artifacts/contracts/instance/base/IKeyValueStore.sol/IKeyValueStore.dbg.json +1 -1
  37. package/artifacts/contracts/instance/base/ILifecycle.sol/ILifecycle.dbg.json +1 -1
  38. package/artifacts/contracts/instance/base/KeyValueStore.sol/KeyValueStore.dbg.json +1 -1
  39. package/artifacts/contracts/instance/base/KeyValueStore.sol/KeyValueStore.json +40 -10
  40. package/artifacts/contracts/instance/base/Lifecycle.sol/Lifecycle.dbg.json +1 -1
  41. package/artifacts/contracts/instance/base/Lifecycle.sol/Lifecycle.json +36 -11
  42. package/artifacts/contracts/instance/module/IAccess.sol/IAccess.dbg.json +1 -1
  43. package/artifacts/contracts/instance/module/IBundle.sol/IBundle.dbg.json +1 -1
  44. package/artifacts/contracts/instance/module/IComponents.sol/IComponents.dbg.json +4 -0
  45. package/artifacts/contracts/instance/module/IComponents.sol/IComponents.json +10 -0
  46. package/artifacts/contracts/instance/module/IDistribution.sol/IDistribution.dbg.json +1 -1
  47. package/artifacts/contracts/instance/module/IPolicy.sol/IPolicy.dbg.json +1 -1
  48. package/artifacts/contracts/instance/module/IRisk.sol/IRisk.dbg.json +1 -1
  49. package/artifacts/contracts/instance/module/ISetup.sol/ISetup.dbg.json +1 -1
  50. package/artifacts/contracts/instance/module/ITreasury.sol/ITreasury.dbg.json +1 -1
  51. package/artifacts/contracts/instance/service/ApplicationService.sol/ApplicationService.dbg.json +1 -1
  52. package/artifacts/contracts/instance/service/ApplicationService.sol/ApplicationService.json +14 -14
  53. package/artifacts/contracts/instance/service/ApplicationServiceManager.sol/ApplicationServiceManager.dbg.json +1 -1
  54. package/artifacts/contracts/instance/service/ApplicationServiceManager.sol/ApplicationServiceManager.json +8 -8
  55. package/artifacts/contracts/instance/service/BundleService.sol/BundleService.dbg.json +1 -1
  56. package/artifacts/contracts/instance/service/BundleService.sol/BundleService.json +132 -135
  57. package/artifacts/contracts/instance/service/BundleServiceManager.sol/BundleServiceManager.dbg.json +1 -1
  58. package/artifacts/contracts/instance/service/BundleServiceManager.sol/BundleServiceManager.json +12 -12
  59. package/artifacts/contracts/instance/service/ClaimService.sol/ClaimService.dbg.json +1 -1
  60. package/artifacts/contracts/instance/service/ClaimService.sol/ClaimService.json +2 -2
  61. package/artifacts/contracts/instance/service/ClaimServiceManager.sol/ClaimServiceManager.dbg.json +1 -1
  62. package/artifacts/contracts/instance/service/ClaimServiceManager.sol/ClaimServiceManager.json +2 -2
  63. package/artifacts/contracts/instance/service/DistributionService.sol/DistributionService.dbg.json +1 -1
  64. package/artifacts/contracts/instance/service/DistributionService.sol/DistributionService.json +234 -63
  65. package/artifacts/contracts/instance/service/DistributionServiceManager.sol/DistributionServiceManager.dbg.json +1 -1
  66. package/artifacts/contracts/instance/service/DistributionServiceManager.sol/DistributionServiceManager.json +40 -32
  67. package/artifacts/contracts/instance/service/IApplicationService.sol/IApplicationService.dbg.json +1 -1
  68. package/artifacts/contracts/instance/service/IBundleService.sol/IBundleService.dbg.json +1 -1
  69. package/artifacts/contracts/instance/service/IBundleService.sol/IBundleService.json +89 -92
  70. package/artifacts/contracts/instance/service/IClaimService.sol/IClaimService.dbg.json +1 -1
  71. package/artifacts/contracts/instance/service/IDistributionService.sol/IDistributionService.dbg.json +1 -1
  72. package/artifacts/contracts/instance/service/IDistributionService.sol/IDistributionService.json +156 -1
  73. package/artifacts/contracts/instance/service/IPolicyService.sol/IPolicyService.dbg.json +1 -1
  74. package/artifacts/contracts/instance/service/IPolicyService.sol/IPolicyService.json +21 -0
  75. package/artifacts/contracts/instance/service/IPoolService.sol/IPoolService.dbg.json +1 -1
  76. package/artifacts/contracts/instance/service/IPoolService.sol/IPoolService.json +81 -0
  77. package/artifacts/contracts/instance/service/IProductService.sol/IProductService.dbg.json +1 -1
  78. package/artifacts/contracts/instance/service/PolicyService.sol/PolicyService.dbg.json +1 -1
  79. package/artifacts/contracts/instance/service/PolicyService.sol/PolicyService.json +31 -10
  80. package/artifacts/contracts/instance/service/PolicyServiceManager.sol/PolicyServiceManager.dbg.json +1 -1
  81. package/artifacts/contracts/instance/service/PolicyServiceManager.sol/PolicyServiceManager.json +6 -6
  82. package/artifacts/contracts/instance/service/PoolService.sol/PoolService.dbg.json +1 -1
  83. package/artifacts/contracts/instance/service/PoolService.sol/PoolService.json +105 -16
  84. package/artifacts/contracts/instance/service/PoolServiceManager.sol/PoolServiceManager.dbg.json +1 -1
  85. package/artifacts/contracts/instance/service/PoolServiceManager.sol/PoolServiceManager.json +13 -9
  86. package/artifacts/contracts/instance/service/ProductService.sol/ProductService.dbg.json +1 -1
  87. package/artifacts/contracts/instance/service/ProductService.sol/ProductService.json +2 -2
  88. package/artifacts/contracts/instance/service/ProductServiceManager.sol/ProductServiceManager.dbg.json +1 -1
  89. package/artifacts/contracts/instance/service/ProductServiceManager.sol/ProductServiceManager.json +2 -2
  90. package/artifacts/contracts/registry/ChainNft.sol/ChainNft.dbg.json +1 -1
  91. package/artifacts/contracts/registry/ChainNft.sol/ChainNft.json +15 -2
  92. package/artifacts/contracts/registry/IRegistry.sol/IRegistry.dbg.json +1 -1
  93. package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.dbg.json +1 -1
  94. package/artifacts/contracts/registry/ITransferInterceptor.sol/ITransferInterceptor.dbg.json +1 -1
  95. package/artifacts/contracts/registry/Registry.sol/Registry.dbg.json +1 -1
  96. package/artifacts/contracts/registry/Registry.sol/Registry.json +4 -4
  97. package/artifacts/contracts/registry/RegistryAccessManager.sol/RegistryAccessManager.dbg.json +1 -1
  98. package/artifacts/contracts/registry/RegistryAccessManager.sol/RegistryAccessManager.json +2 -2
  99. package/artifacts/contracts/registry/RegistryService.sol/RegistryService.dbg.json +1 -1
  100. package/artifacts/contracts/registry/RegistryService.sol/RegistryService.json +12 -12
  101. package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.dbg.json +1 -1
  102. package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.json +7 -7
  103. package/artifacts/contracts/registry/ReleaseManager.sol/ReleaseManager.dbg.json +1 -1
  104. package/artifacts/contracts/registry/ReleaseManager.sol/ReleaseManager.json +3 -3
  105. package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.dbg.json +1 -1
  106. package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.json +2 -2
  107. package/artifacts/contracts/shared/ContractDeployerLib.sol/ContractDeployerLib.dbg.json +1 -1
  108. package/artifacts/contracts/shared/ERC165.sol/ERC165.dbg.json +1 -1
  109. package/artifacts/contracts/shared/INftOwnable.sol/INftOwnable.dbg.json +1 -1
  110. package/artifacts/contracts/shared/IPolicyHolder.sol/IPolicyHolder.dbg.json +1 -1
  111. package/artifacts/contracts/shared/IRegisterable.sol/IRegisterable.dbg.json +1 -1
  112. package/artifacts/contracts/shared/IRegistryLinked.sol/IRegistryLinked.dbg.json +1 -1
  113. package/artifacts/contracts/shared/IService.sol/IService.dbg.json +1 -1
  114. package/artifacts/contracts/shared/IVersionable.sol/IVersionable.dbg.json +1 -1
  115. package/artifacts/contracts/shared/NftOwnable.sol/NftOwnable.dbg.json +1 -1
  116. package/artifacts/contracts/shared/NftOwnable.sol/NftOwnable.json +2 -2
  117. package/artifacts/contracts/shared/PolicyHolder.sol/PolicyHolder.dbg.json +1 -1
  118. package/artifacts/contracts/shared/PolicyHolder.sol/PolicyHolder.json +2 -2
  119. package/artifacts/contracts/shared/ProxyManager.sol/ProxyManager.dbg.json +1 -1
  120. package/artifacts/contracts/shared/ProxyManager.sol/ProxyManager.json +2 -2
  121. package/artifacts/contracts/shared/Registerable.sol/Registerable.dbg.json +1 -1
  122. package/artifacts/contracts/shared/Registerable.sol/Registerable.json +2 -2
  123. package/artifacts/contracts/shared/RegistryLinked.sol/RegistryLinked.dbg.json +1 -1
  124. package/artifacts/contracts/shared/RegistryLinked.sol/RegistryLinked.json +2 -2
  125. package/artifacts/contracts/shared/Service.sol/Service.dbg.json +1 -1
  126. package/artifacts/contracts/shared/TokenHandler.sol/TokenHandler.dbg.json +1 -1
  127. package/artifacts/contracts/shared/TokenHandler.sol/TokenHandler.json +2 -2
  128. package/artifacts/contracts/shared/UpgradableProxyWithAdmin.sol/UpgradableProxyWithAdmin.dbg.json +1 -1
  129. package/artifacts/contracts/shared/UpgradableProxyWithAdmin.sol/UpgradableProxyWithAdmin.json +2 -2
  130. package/artifacts/contracts/shared/Versionable.sol/Versionable.dbg.json +1 -1
  131. package/artifacts/contracts/test/TestFee.sol/TestFee.dbg.json +1 -1
  132. package/artifacts/contracts/test/TestFee.sol/TestFee.json +2 -2
  133. package/artifacts/contracts/test/TestRegisterable.sol/TestRegisterable.dbg.json +1 -1
  134. package/artifacts/contracts/test/TestRegisterable.sol/TestRegisterable.json +2 -2
  135. package/artifacts/contracts/test/TestRoleId.sol/TestRoleId.dbg.json +1 -1
  136. package/artifacts/contracts/test/TestRoleId.sol/TestRoleId.json +2 -2
  137. package/artifacts/contracts/test/TestService.sol/TestService.dbg.json +1 -1
  138. package/artifacts/contracts/test/TestService.sol/TestService.json +2 -2
  139. package/artifacts/contracts/test/TestToken.sol/TestUsdc.dbg.json +1 -1
  140. package/artifacts/contracts/test/TestVersion.sol/TestVersion.dbg.json +1 -1
  141. package/artifacts/contracts/test/TestVersion.sol/TestVersion.json +2 -2
  142. package/artifacts/contracts/test/TestVersionable.sol/TestVersionable.dbg.json +1 -1
  143. package/artifacts/contracts/test/TestVersionable.sol/TestVersionable.json +2 -2
  144. package/artifacts/contracts/test/Usdc.sol/USDC.dbg.json +1 -1
  145. package/artifacts/contracts/types/AddressSet.sol/LibAddressSet.dbg.json +1 -1
  146. package/artifacts/contracts/types/Blocknumber.sol/BlocknumberLib.dbg.json +1 -1
  147. package/artifacts/contracts/types/Blocknumber.sol/BlocknumberLib.json +2 -2
  148. package/artifacts/contracts/types/ChainId.sol/ChainIdLib.dbg.json +1 -1
  149. package/artifacts/contracts/types/ClaimId.sol/ClaimIdLib.dbg.json +1 -1
  150. package/artifacts/contracts/types/DistributorType.sol/DistributorTypeLib.dbg.json +1 -1
  151. package/artifacts/contracts/types/DistributorType.sol/DistributorTypeLib.json +2 -2
  152. package/artifacts/contracts/types/Fee.sol/FeeLib.dbg.json +1 -1
  153. package/artifacts/contracts/types/Fee.sol/FeeLib.json +2 -2
  154. package/artifacts/contracts/types/Key32.sol/Key32Lib.dbg.json +1 -1
  155. package/artifacts/contracts/types/Key32.sol/Key32Lib.json +2 -2
  156. package/artifacts/contracts/types/NftId.sol/NftIdLib.dbg.json +1 -1
  157. package/artifacts/contracts/types/NftId.sol/NftIdLib.json +17 -4
  158. package/artifacts/contracts/types/NftIdSet.sol/LibNftIdSet.dbg.json +1 -1
  159. package/artifacts/contracts/types/NftIdSet.sol/LibNftIdSet.json +2 -2
  160. package/artifacts/contracts/types/NumberId.sol/NumberIdLib.dbg.json +1 -1
  161. package/artifacts/contracts/types/ObjectType.sol/ObjectTypeLib.dbg.json +1 -1
  162. package/artifacts/contracts/types/ObjectType.sol/ObjectTypeLib.json +2 -2
  163. package/artifacts/contracts/types/PayoutId.sol/PayoutIdLib.dbg.json +1 -1
  164. package/artifacts/contracts/types/Referral.sol/ReferralLib.dbg.json +1 -1
  165. package/artifacts/contracts/types/Referral.sol/ReferralLib.json +23 -4
  166. package/artifacts/contracts/types/RiskId.sol/RiskIdLib.dbg.json +1 -1
  167. package/artifacts/contracts/types/RiskId.sol/RiskIdLib.json +2 -2
  168. package/artifacts/contracts/types/RoleId.sol/RoleIdLib.dbg.json +1 -1
  169. package/artifacts/contracts/types/RoleId.sol/RoleIdLib.json +2 -2
  170. package/artifacts/contracts/types/Seconds.sol/SecondsLib.dbg.json +1 -1
  171. package/artifacts/contracts/types/StateId.sol/StateIdLib.dbg.json +1 -1
  172. package/artifacts/contracts/types/StateId.sol/StateIdLib.json +2 -2
  173. package/artifacts/contracts/types/Timestamp.sol/TimestampLib.dbg.json +1 -1
  174. package/artifacts/contracts/types/Timestamp.sol/TimestampLib.json +2 -2
  175. package/artifacts/contracts/types/UFixed.sol/MathLib.dbg.json +1 -1
  176. package/artifacts/contracts/types/UFixed.sol/MathLib.json +2 -2
  177. package/artifacts/contracts/types/UFixed.sol/UFixedLib.dbg.json +1 -1
  178. package/artifacts/contracts/types/UFixed.sol/UFixedLib.json +2 -2
  179. package/artifacts/contracts/types/Version.sol/VersionLib.dbg.json +1 -1
  180. package/artifacts/contracts/types/Version.sol/VersionLib.json +2 -2
  181. package/artifacts/contracts/types/Version.sol/VersionPartLib.dbg.json +1 -1
  182. package/artifacts/contracts/types/Version.sol/VersionPartLib.json +2 -2
  183. package/contracts/components/Component.sol +20 -0
  184. package/contracts/components/Distribution.sol +0 -13
  185. package/contracts/components/IComponent.sol +6 -0
  186. package/contracts/components/IDistributionComponent.sol +0 -8
  187. package/contracts/components/IPoolComponent.sol +5 -43
  188. package/contracts/components/Pool.sol +38 -117
  189. package/contracts/components/Product.sol +4 -0
  190. package/contracts/instance/BundleManager.sol +6 -4
  191. package/contracts/instance/IInstance.sol +3 -2
  192. package/contracts/instance/IInstanceService.sol +2 -1
  193. package/contracts/instance/Instance.sol +8 -4
  194. package/contracts/instance/InstanceReader.sol +4 -3
  195. package/contracts/instance/InstanceService.sol +5 -6
  196. package/contracts/instance/base/KeyValueStore.sol +5 -2
  197. package/contracts/instance/base/Lifecycle.sol +11 -2
  198. package/contracts/instance/module/IComponents.sol +35 -0
  199. package/contracts/instance/module/ISetup.sol +4 -17
  200. package/contracts/instance/service/ApplicationService.sol +6 -5
  201. package/contracts/instance/service/BundleService.sol +72 -35
  202. package/contracts/instance/service/DistributionService.sol +75 -19
  203. package/contracts/instance/service/IBundleService.sol +16 -9
  204. package/contracts/instance/service/IDistributionService.sol +13 -1
  205. package/contracts/instance/service/IPolicyService.sol +2 -0
  206. package/contracts/instance/service/IPoolService.sol +17 -2
  207. package/contracts/instance/service/PolicyService.sol +46 -45
  208. package/contracts/instance/service/PoolService.sol +72 -18
  209. package/contracts/registry/ChainNft.sol +4 -0
  210. package/contracts/registry/Registry.sol +10 -12
  211. package/contracts/shared/TokenHandler.sol +11 -5
  212. package/contracts/types/Blocknumber.sol +1 -0
  213. package/contracts/types/Fee.sol +1 -0
  214. package/contracts/types/NftId.sol +8 -0
  215. package/contracts/types/ObjectType.sol +1 -0
  216. package/contracts/types/Referral.sol +4 -0
  217. package/contracts/types/StateId.sol +1 -0
  218. package/contracts/types/Timestamp.sol +1 -0
  219. package/contracts/types/UFixed.sol +1 -0
  220. package/contracts/types/Version.sol +1 -0
  221. package/package.json +1 -1
@@ -6,20 +6,20 @@ import {IRegistry} from "../../registry/IRegistry.sol";
6
6
  import {IInstance} from "../../instance/IInstance.sol";
7
7
  import {IBundle} from "../../instance/module/IBundle.sol";
8
8
  import {TokenHandler} from "../../instance/module/ITreasury.sol";
9
- import {ISetup} from "../module/ISetup.sol";
9
+ import {IComponents} from "../module/IComponents.sol";
10
10
  import {IPolicy} from "../module/IPolicy.sol";
11
11
 
12
12
  import {IVersionable} from "../../shared/IVersionable.sol";
13
13
  import {Versionable} from "../../shared/Versionable.sol";
14
14
  import {INftOwnable} from "../../shared/INftOwnable.sol";
15
15
 
16
+ import {Fee, FeeLib} from "../../types/Fee.sol";
16
17
  import {NftId, NftIdLib, zeroNftId} from "../../types/NftId.sol";
17
18
  import {ObjectType, POOL, BUNDLE} from "../../types/ObjectType.sol";
18
- import {POOL_OWNER_ROLE, RoleId} from "../../types/RoleId.sol";
19
- import {Fee, FeeLib} from "../../types/Fee.sol";
20
- import {Version, VersionLib} from "../../types/Version.sol";
21
- import {KEEP_STATE, StateId} from "../../types/StateId.sol";
19
+ import {RoleId, POOL_OWNER_ROLE, PUBLIC_ROLE} from "../../types/RoleId.sol";
20
+ import {StateId, KEEP_STATE} from "../../types/StateId.sol";
22
21
  import {TimestampLib, zeroTimestamp} from "../../types/Timestamp.sol";
22
+ import {Version, VersionLib} from "../../types/Version.sol";
23
23
 
24
24
  import {IService} from "../../shared/IService.sol";
25
25
  import {Service} from "../../shared/Service.sol";
@@ -78,32 +78,86 @@ contract PoolService is
78
78
  POOL_OWNER_ROLE());
79
79
 
80
80
  IPoolComponent pool = IPoolComponent(poolAddress);
81
- IRegistry.ObjectInfo memory poolInfo = getRegistryService().registerPool(pool, owner);
81
+ IRegistry.ObjectInfo memory registryInfo = getRegistryService().registerPool(pool, owner);
82
82
  pool.linkToRegisteredNftId();
83
- poolNftId = poolInfo.nftId;
83
+ poolNftId = registryInfo.nftId;
84
+
85
+ // amend component info with pool specific token handler
86
+ IComponents.ComponentInfo memory componentInfo = pool.getComponentInfo();
87
+ componentInfo.tokenHandler = new TokenHandler(address(componentInfo.token));
88
+
89
+ // save amended component info with instance
90
+ instance.createPoolSetup(poolNftId, componentInfo);
84
91
 
85
- instance.createPoolSetup(poolNftId, pool.getSetupInfo());
86
92
  getInstanceService().createGifTarget(instanceNftId, poolAddress, pool.getName());
87
93
  getInstanceService().grantPoolDefaultPermissions(instanceNftId, poolAddress, pool.getName());
88
94
  }
89
95
 
96
+
97
+ function setMaxCapitalAmount(uint256 maxCapitalAmount)
98
+ external
99
+ virtual
100
+ {
101
+ (IRegistry.ObjectInfo memory registryInfo, IInstance instance) = _getAndVerifyComponentInfoAndInstance(POOL());
102
+ InstanceReader instanceReader = instance.getInstanceReader();
103
+ NftId poolNftId = registryInfo.nftId;
104
+
105
+ IComponents.ComponentInfo memory componentInfo = instanceReader.getComponentInfo(poolNftId);
106
+ IComponents.PoolInfo memory poolInfo = abi.decode(componentInfo.data, (IComponents.PoolInfo));
107
+ uint256 previousMaxCapitalAmount = poolInfo.maxCapitalAmount;
108
+
109
+ poolInfo.maxCapitalAmount = maxCapitalAmount;
110
+ componentInfo.data = abi.encode(poolInfo);
111
+ instance.updatePoolSetup(poolNftId, componentInfo, KEEP_STATE());
112
+
113
+ emit LogPoolServiceMaxCapitalAmountUpdated(poolNftId, previousMaxCapitalAmount, maxCapitalAmount);
114
+ }
115
+
116
+ function setBundleOwnerRole(RoleId bundleOwnerRole)
117
+ external
118
+ virtual
119
+ {
120
+ (IRegistry.ObjectInfo memory registryInfo, IInstance instance) = _getAndVerifyComponentInfoAndInstance(POOL());
121
+ InstanceReader instanceReader = instance.getInstanceReader();
122
+ NftId poolNftId = registryInfo.nftId;
123
+
124
+ IComponents.ComponentInfo memory componentInfo = instanceReader.getComponentInfo(poolNftId);
125
+ IComponents.PoolInfo memory poolInfo = abi.decode(componentInfo.data, (IComponents.PoolInfo));
126
+
127
+ // bundle owner role may only be set once per pool
128
+ if(poolInfo.bundleOwnerRole != PUBLIC_ROLE()) {
129
+ revert ErrorPoolServiceBundleOwnerRoleAlreadySet(poolNftId);
130
+ }
131
+
132
+ poolInfo.bundleOwnerRole = bundleOwnerRole;
133
+ componentInfo.data = abi.encode(poolInfo);
134
+ instance.updatePoolSetup(poolNftId, componentInfo, KEEP_STATE());
135
+
136
+ emit LogPoolServiceBundleOwnerRoleSet(poolNftId, bundleOwnerRole);
137
+ }
138
+
139
+
90
140
  function setFees(
91
141
  Fee memory poolFee,
92
142
  Fee memory stakingFee,
93
143
  Fee memory performanceFee
94
144
  )
95
145
  external
96
- override
146
+ virtual
97
147
  {
98
- (IRegistry.ObjectInfo memory poolInfo, IInstance instance) = _getAndVerifyComponentInfoAndInstance(POOL());
148
+ (IRegistry.ObjectInfo memory registryInfo, IInstance instance) = _getAndVerifyComponentInfoAndInstance(POOL());
99
149
  InstanceReader instanceReader = instance.getInstanceReader();
100
- NftId poolNftId = poolInfo.nftId;
101
-
102
- ISetup.PoolSetupInfo memory poolSetupInfo = instanceReader.getPoolSetupInfo(poolNftId);
103
- poolSetupInfo.poolFee = poolFee;
104
- poolSetupInfo.stakingFee = stakingFee;
105
- poolSetupInfo.performanceFee = performanceFee;
106
-
107
- instance.updatePoolSetup(poolNftId, poolSetupInfo, KEEP_STATE());
150
+ NftId poolNftId = registryInfo.nftId;
151
+
152
+ IComponents.ComponentInfo memory componentInfo = instanceReader.getComponentInfo(poolNftId);
153
+ IComponents.PoolInfo memory poolInfo = abi.decode(componentInfo.data, (IComponents.PoolInfo));
154
+
155
+ poolInfo.poolFee = poolFee;
156
+ poolInfo.stakingFee = stakingFee;
157
+ poolInfo.performanceFee = performanceFee;
158
+ componentInfo.data = abi.encode(poolInfo);
159
+ instance.updatePoolSetup(poolNftId, componentInfo, KEEP_STATE());
160
+
161
+ // TODO add logging
108
162
  }
109
163
  }
@@ -195,6 +195,10 @@ contract ChainNft is ERC721Enumerable {
195
195
  _chainIdDigits;
196
196
  }
197
197
 
198
+ function getNextTokenId() external view returns (uint256) {
199
+ return calculateTokenId(_idNext);
200
+ }
201
+
198
202
  function _getNextTokenId() private returns (uint256 id) {
199
203
  id = calculateTokenId(_idNext);
200
204
  _idNext++;
@@ -149,7 +149,6 @@ contract Registry is
149
149
  }
150
150
 
151
151
  if(
152
-
153
152
  parentType == PROTOCOL() ||
154
153
  parentType == REGISTRY() ||
155
154
  parentType == SERVICE()
@@ -287,18 +286,9 @@ contract Registry is
287
286
  }
288
287
 
289
288
  address interceptor = _getInterceptor(info.isInterceptor, info.objectAddress, parentInfo.isInterceptor, parentAddress);
289
+ uint256 tokenId = _chainNft.getNextTokenId();
290
+ nftId = toNftId(tokenId);
290
291
 
291
- // TODO does external call
292
- // compute next nftId, do all checks and stores, mint() at most end...
293
- uint256 mintedTokenId = _chainNft.mint(
294
- info.initialOwner,
295
- interceptor,
296
- EMPTY_URI);
297
- nftId = toNftId(mintedTokenId);
298
-
299
- // TODO move nftId out of info struct
300
- // getters by nftId -> return struct without nftId
301
- // getters by address -> return nftId AND struct
302
292
  info.nftId = nftId;
303
293
  _info[nftId] = info;
304
294
 
@@ -314,6 +304,14 @@ contract Registry is
314
304
  }
315
305
 
316
306
  emit LogRegistration(nftId, parentNftId, objectType, info.isInterceptor, info.objectAddress, info.initialOwner);
307
+
308
+ // calls nft receiver(1) and interceptor(2)
309
+ uint256 mintedTokenId = _chainNft.mint(
310
+ info.initialOwner,
311
+ interceptor,
312
+ EMPTY_URI);
313
+ assert(mintedTokenId == tokenId);
314
+
317
315
  }
318
316
 
319
317
  /// @dev obtain interceptor address for this nft if applicable, address(0) otherwise
@@ -4,6 +4,8 @@ pragma solidity ^0.8.20;
4
4
  import {IERC20Metadata} from "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol";
5
5
  import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
6
6
 
7
+ /// @dev token specific transfer helper
8
+ /// relies internally on oz SafeERC20.safeTransferFrom
7
9
  contract TokenHandler {
8
10
  IERC20Metadata private _token;
9
11
 
@@ -11,17 +13,21 @@ contract TokenHandler {
11
13
  _token = IERC20Metadata(token);
12
14
  }
13
15
 
14
- // TODO add logging
15
16
  function transfer(
16
17
  address from,
17
18
  address to,
18
- uint256 amount // TODO add authz (only treasury/instance/product/pool/ service)
19
- ) external {
19
+ uint256 amount
20
+ )
21
+ external
22
+ {
20
23
  SafeERC20.safeTransferFrom(_token, from, to, amount);
21
- // _token.transferFrom(from, to, amount);
22
24
  }
23
25
 
24
- function getToken() external view returns (IERC20Metadata) {
26
+ function getToken()
27
+ external
28
+ view
29
+ returns (IERC20Metadata)
30
+ {
25
31
  return _token;
26
32
  }
27
33
  }
@@ -52,6 +52,7 @@ function blockBlocknumber() view returns (Blocknumber) {
52
52
  return toBlocknumber(block.number);
53
53
  }
54
54
 
55
+ // TODO move to BlocknumberLib and rename to zero()
55
56
  /// @dev Return the Blocknumber zero (0)
56
57
  function zeroBlocknumber() pure returns (Blocknumber) {
57
58
  return toBlocknumber(0);
@@ -40,6 +40,7 @@ library FeeLib {
40
40
  return Fee(UFixedLib.toUFixed(percent, -2), 0);
41
41
  }
42
42
 
43
+ // TODO rename to zero
43
44
  /// @dev Return a zero fee struct (0, 0)
44
45
  function zeroFee() public pure returns (Fee memory fee) {
45
46
  return Fee(UFixed.wrap(0), 0);
@@ -24,6 +24,7 @@ function toNftId(uint256 id) pure returns (NftId) {
24
24
  return NftId.wrap(uint96(id));
25
25
  }
26
26
 
27
+ // TODO move to NftIdLib and rename to zero()
27
28
  /// @dev Return the NftId zero (0)
28
29
  function zeroNftId() pure returns (NftId) {
29
30
  return NftId.wrap(0);
@@ -40,6 +41,13 @@ function neNftId(NftId a, NftId b) pure returns (bool isDifferent) {
40
41
 
41
42
  // library functions that operate on user defined type
42
43
  library NftIdLib {
44
+
45
+ /// @dev the zero nft id
46
+ /// is never a valid nft id and implies a non-initialized value
47
+ function zero() public pure returns (NftId) {
48
+ return NftId.wrap(0);
49
+ }
50
+
43
51
  /// @dev Converts the NftId to a uint256.
44
52
  function toInt(NftId nftId) public pure returns (uint96) {
45
53
  return uint96(NftId.unwrap(nftId));
@@ -115,6 +115,7 @@ function toObjectType(uint256 objectType) pure returns (ObjectType) {
115
115
  return ObjectType.wrap(uint8(objectType));
116
116
  }
117
117
 
118
+ // TODO move to ObjecTypeLib and rename to zero()
118
119
  /// @dev Return the ObjectType zero (0)
119
120
  function zeroObjectType() pure returns (ObjectType) {
120
121
  return ObjectType.wrap(0);
@@ -82,4 +82,8 @@ library ReferralLib {
82
82
  function toKeyId(ReferralId id) public pure returns (KeyId keyId) {
83
83
  return KeyId.wrap(bytes31(ReferralId.unwrap(id)));
84
84
  }
85
+
86
+ function eqz(ReferralId id) public pure returns (bool) {
87
+ return eqReferralId(id, zero());
88
+ }
85
89
  }
@@ -67,6 +67,7 @@ function toStateId(uint256 id) pure returns (StateId) {
67
67
  return StateId.wrap(uint8(id));
68
68
  }
69
69
 
70
+ // TODO move to StateIdLib and rename to zero()
70
71
  /// @dev Return the StateId zero (0)
71
72
  function zeroStateId() pure returns (StateId) {
72
73
  return StateId.wrap(0);
@@ -53,6 +53,7 @@ function toTimestamp(uint256 timestamp) pure returns (Timestamp) {
53
53
  return Timestamp.wrap(uint40(timestamp));
54
54
  }
55
55
 
56
+ // TODO move to TimestampLib and rename to zero()
56
57
  /// @dev Return the Timestamp zero (0)
57
58
  function zeroTimestamp() pure returns (Timestamp) {
58
59
  return toTimestamp(0);
@@ -19,6 +19,7 @@ using {
19
19
  UFixedLib.gtz
20
20
  } for UFixed global;
21
21
 
22
+ // TODO move to UFixedLib and rename to zero()
22
23
  function zeroUFixed() pure returns (UFixed zero) {
23
24
  return UFixed.wrap(0);
24
25
  }
@@ -101,6 +101,7 @@ library VersionLib {
101
101
  return Version.wrap(uint24(versionNumber));
102
102
  }
103
103
 
104
+ // TODO rename to zero()
104
105
  function zeroVersion() external pure returns(Version) {
105
106
  return Version.wrap(0);
106
107
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@etherisc/gif-next",
3
- "version": "0.0.2-bdcb44f-543",
3
+ "version": "0.0.2-be8b3db-650",
4
4
  "description": "This is the repository for the next version of the Generic Insurance Framework (GIF) smart contracts. ",
5
5
  "main": "index.js",
6
6
  "scripts": {