@etherisc/gif-next 0.0.2-c8cedfe-604 → 0.0.2-cbce707-667

Sign up to get free protection for your applications and to get access to all the features.
Files changed (141) hide show
  1. package/artifacts/contracts/components/BaseComponent.sol/BaseComponent.dbg.json +1 -1
  2. package/artifacts/contracts/components/Distribution.sol/Distribution.dbg.json +1 -1
  3. package/artifacts/contracts/components/Distribution.sol/Distribution.json +2 -2
  4. package/artifacts/contracts/components/IBaseComponent.sol/IBaseComponent.dbg.json +1 -1
  5. package/artifacts/contracts/components/IDistributionComponent.sol/IDistributionComponent.dbg.json +1 -1
  6. package/artifacts/contracts/components/IPoolComponent.sol/IPoolComponent.dbg.json +1 -1
  7. package/artifacts/contracts/components/IProductComponent.sol/IProductComponent.dbg.json +1 -1
  8. package/artifacts/contracts/components/Pool.sol/Pool.dbg.json +1 -1
  9. package/artifacts/contracts/components/Pool.sol/Pool.json +99 -16
  10. package/artifacts/contracts/components/Product.sol/Product.dbg.json +1 -1
  11. package/artifacts/contracts/components/Product.sol/Product.json +2 -2
  12. package/artifacts/contracts/experiment/cloning/Cloner.sol/Cloner.dbg.json +1 -1
  13. package/artifacts/contracts/experiment/cloning/Cloner.sol/Mock1.dbg.json +1 -1
  14. package/artifacts/contracts/experiment/cloning/Cloner.sol/Mock2.dbg.json +1 -1
  15. package/artifacts/contracts/experiment/errors/Require.sol/Require.dbg.json +1 -1
  16. package/artifacts/contracts/experiment/errors/Revert.sol/Revert.dbg.json +1 -1
  17. package/artifacts/contracts/experiment/inheritance/A.sol/A.dbg.json +1 -1
  18. package/artifacts/contracts/experiment/inheritance/A.sol/AShared.dbg.json +1 -1
  19. package/artifacts/contracts/experiment/inheritance/B.sol/B.dbg.json +1 -1
  20. package/artifacts/contracts/experiment/inheritance/C.sol/C.dbg.json +1 -1
  21. package/artifacts/contracts/experiment/inheritance/IA.sol/IA.dbg.json +1 -1
  22. package/artifacts/contracts/experiment/inheritance/IA.sol/ISharedA.dbg.json +1 -1
  23. package/artifacts/contracts/experiment/inheritance/IB.sol/IB.dbg.json +1 -1
  24. package/artifacts/contracts/experiment/inheritance/IC.sol/IC.dbg.json +1 -1
  25. package/artifacts/contracts/experiment/statemachine/Dummy.sol/LifeCycleModule.dbg.json +1 -1
  26. package/artifacts/contracts/experiment/statemachine/ISM.sol/ISM.dbg.json +1 -1
  27. package/artifacts/contracts/experiment/statemachine/ISM.sol/ISMEE.dbg.json +1 -1
  28. package/artifacts/contracts/experiment/statemachine/SM.sol/SM.dbg.json +1 -1
  29. package/artifacts/contracts/experiment/statemachine/SimpleStateMachine.sol/SimpleStateMachine.dbg.json +1 -1
  30. package/artifacts/contracts/experiment/types/TypeA.sol/TypeALib.dbg.json +1 -1
  31. package/artifacts/contracts/experiment/types/TypeB.sol/TypeBLib.dbg.json +1 -1
  32. package/artifacts/contracts/instance/AccessManagedSimple.sol/AccessManagedSimple.dbg.json +1 -1
  33. package/artifacts/contracts/instance/AccessManagerSimple.sol/AccessManagerSimple.dbg.json +1 -1
  34. package/artifacts/contracts/instance/IAccessManagerSimple.sol/IAccessManagerSimple.dbg.json +1 -1
  35. package/artifacts/contracts/instance/IInstance.sol/IInstance.dbg.json +1 -1
  36. package/artifacts/contracts/instance/IInstance.sol/IInstance.json +310 -1
  37. package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.dbg.json +1 -1
  38. package/artifacts/contracts/instance/Instance.sol/Instance.dbg.json +1 -1
  39. package/artifacts/contracts/instance/Instance.sol/Instance.json +100 -77
  40. package/artifacts/contracts/instance/InstanceAccessManager.sol/InstanceAccessManager.dbg.json +1 -1
  41. package/artifacts/contracts/instance/InstanceAccessManager.sol/InstanceAccessManager.json +2 -2
  42. package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.dbg.json +1 -1
  43. package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.json +143 -38
  44. package/artifacts/contracts/instance/InstanceService.sol/InstanceService.dbg.json +1 -1
  45. package/artifacts/contracts/instance/InstanceService.sol/InstanceService.json +113 -49
  46. package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.dbg.json +1 -1
  47. package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.json +43 -19
  48. package/artifacts/contracts/instance/base/ComponentServiceBase.sol/ComponentServiceBase.dbg.json +1 -1
  49. package/artifacts/contracts/instance/base/ComponentServiceBase.sol/ComponentServiceBase.json +5 -0
  50. package/artifacts/contracts/instance/base/IInstanceBase.sol/IInstanceBase.dbg.json +1 -1
  51. package/artifacts/contracts/instance/base/IKeyValueStore.sol/IKeyValueStore.dbg.json +1 -1
  52. package/artifacts/contracts/instance/base/ILifecycle.sol/ILifecycle.dbg.json +1 -1
  53. package/artifacts/contracts/instance/base/KeyValueStore.sol/KeyValueStore.dbg.json +1 -1
  54. package/artifacts/contracts/instance/base/Lifecycle.sol/Lifecycle.dbg.json +1 -1
  55. package/artifacts/contracts/instance/module/IAccess.sol/IAccess.dbg.json +1 -1
  56. package/artifacts/contracts/instance/module/IBundle.sol/IBundle.dbg.json +1 -1
  57. package/artifacts/contracts/instance/module/IDistribution.sol/IDistribution.dbg.json +1 -1
  58. package/artifacts/contracts/instance/module/IPolicy.sol/IPolicy.dbg.json +1 -1
  59. package/artifacts/contracts/instance/module/IRisk.sol/IRisk.dbg.json +1 -1
  60. package/artifacts/contracts/instance/module/ISetup.sol/ISetup.dbg.json +1 -1
  61. package/artifacts/contracts/instance/module/ITreasury.sol/ITreasury.dbg.json +1 -1
  62. package/artifacts/contracts/instance/service/ComponentOwnerService.sol/ComponentOwnerService.dbg.json +1 -1
  63. package/artifacts/contracts/instance/service/ComponentOwnerService.sol/ComponentOwnerService.json +2 -2
  64. package/artifacts/contracts/instance/service/DistributionService.sol/DistributionService.dbg.json +1 -1
  65. package/artifacts/contracts/instance/service/DistributionService.sol/DistributionService.json +35 -14
  66. package/artifacts/contracts/instance/service/DistributionServiceManager.sol/DistributionServiceManager.dbg.json +1 -1
  67. package/artifacts/contracts/instance/service/DistributionServiceManager.sol/DistributionServiceManager.json +16 -8
  68. package/artifacts/contracts/instance/service/IComponentOwnerService.sol/IComponentOwnerService.dbg.json +1 -1
  69. package/artifacts/contracts/instance/service/IDistributionService.sol/IDistributionService.dbg.json +1 -1
  70. package/artifacts/contracts/instance/service/IPoolService.sol/IPoolService.dbg.json +1 -1
  71. package/artifacts/contracts/instance/service/IProductService.sol/IProductService.dbg.json +1 -1
  72. package/artifacts/contracts/instance/service/PoolService.sol/PoolService.dbg.json +4 -0
  73. package/artifacts/contracts/instance/service/PoolService.sol/PoolService.json +796 -0
  74. package/artifacts/contracts/instance/service/PoolServiceManager.sol/PoolServiceManager.dbg.json +4 -0
  75. package/artifacts/contracts/instance/service/PoolServiceManager.sol/PoolServiceManager.json +448 -0
  76. package/artifacts/contracts/registry/ChainNft.sol/ChainNft.dbg.json +1 -1
  77. package/artifacts/contracts/registry/IRegistry.sol/IRegistry.dbg.json +1 -1
  78. package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.dbg.json +1 -1
  79. package/artifacts/contracts/registry/ITransferInterceptor.sol/ITransferInterceptor.dbg.json +1 -1
  80. package/artifacts/contracts/registry/Registry.sol/Registry.dbg.json +1 -1
  81. package/artifacts/contracts/registry/RegistryService.sol/RegistryService.dbg.json +1 -1
  82. package/artifacts/contracts/registry/RegistryService.sol/RegistryService.json +2 -2
  83. package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.dbg.json +1 -1
  84. package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.json +2 -2
  85. package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.dbg.json +1 -1
  86. package/artifacts/contracts/shared/ContractDeployerLib.sol/ContractDeployerLib.dbg.json +1 -1
  87. package/artifacts/contracts/shared/ERC165.sol/ERC165.dbg.json +1 -1
  88. package/artifacts/contracts/shared/INftOwnable.sol/INftOwnable.dbg.json +1 -1
  89. package/artifacts/contracts/shared/IRegisterable.sol/IRegisterable.dbg.json +1 -1
  90. package/artifacts/contracts/shared/IService.sol/IService.dbg.json +1 -1
  91. package/artifacts/contracts/shared/IVersionable.sol/IVersionable.dbg.json +1 -1
  92. package/artifacts/contracts/shared/NftOwnable.sol/NftOwnable.dbg.json +1 -1
  93. package/artifacts/contracts/shared/ProxyManager.sol/ProxyManager.dbg.json +1 -1
  94. package/artifacts/contracts/shared/Registerable.sol/Registerable.dbg.json +1 -1
  95. package/artifacts/contracts/shared/RegisterableUpgradable.sol/RegisterableUpgradable.dbg.json +1 -1
  96. package/artifacts/contracts/shared/Service.sol/Service.dbg.json +1 -1
  97. package/artifacts/contracts/shared/TokenHandler.sol/TokenHandler.dbg.json +1 -1
  98. package/artifacts/contracts/shared/UpgradableProxyWithAdmin.sol/UpgradableProxyWithAdmin.dbg.json +1 -1
  99. package/artifacts/contracts/shared/Versionable.sol/Versionable.dbg.json +1 -1
  100. package/artifacts/contracts/test/TestFee.sol/TestFee.dbg.json +1 -1
  101. package/artifacts/contracts/test/TestRegisterable.sol/TestRegisterable.dbg.json +1 -1
  102. package/artifacts/contracts/test/TestRoleId.sol/TestRoleId.dbg.json +1 -1
  103. package/artifacts/contracts/test/TestRoleId.sol/TestRoleId.json +2 -2
  104. package/artifacts/contracts/test/TestService.sol/TestService.dbg.json +1 -1
  105. package/artifacts/contracts/test/TestToken.sol/TestUsdc.dbg.json +1 -1
  106. package/artifacts/contracts/test/TestVersion.sol/TestVersion.dbg.json +1 -1
  107. package/artifacts/contracts/test/TestVersionable.sol/TestVersionable.dbg.json +1 -1
  108. package/artifacts/contracts/test/Usdc.sol/USDC.dbg.json +1 -1
  109. package/artifacts/contracts/types/AddressSet.sol/LibAddressSet.dbg.json +1 -1
  110. package/artifacts/contracts/types/Blocknumber.sol/BlocknumberLib.dbg.json +1 -1
  111. package/artifacts/contracts/types/ChainId.sol/ChainIdLib.dbg.json +1 -1
  112. package/artifacts/contracts/types/DistributorType.sol/DistributorTypeLib.dbg.json +1 -1
  113. package/artifacts/contracts/types/Fee.sol/FeeLib.dbg.json +1 -1
  114. package/artifacts/contracts/types/Key32.sol/Key32Lib.dbg.json +1 -1
  115. package/artifacts/contracts/types/NftId.sol/NftIdLib.dbg.json +1 -1
  116. package/artifacts/contracts/types/NftIdSet.sol/LibNftIdSet.dbg.json +1 -1
  117. package/artifacts/contracts/types/NumberId.sol/NumberIdLib.dbg.json +1 -1
  118. package/artifacts/contracts/types/ObjectType.sol/ObjectTypeLib.dbg.json +1 -1
  119. package/artifacts/contracts/types/Referral.sol/ReferralLib.dbg.json +1 -1
  120. package/artifacts/contracts/types/RiskId.sol/RiskIdLib.dbg.json +1 -1
  121. package/artifacts/contracts/types/RoleId.sol/RoleIdLib.dbg.json +1 -1
  122. package/artifacts/contracts/types/RoleId.sol/RoleIdLib.json +2 -2
  123. package/artifacts/contracts/types/StateId.sol/StateIdLib.dbg.json +1 -1
  124. package/artifacts/contracts/types/Timestamp.sol/TimestampLib.dbg.json +1 -1
  125. package/artifacts/contracts/types/UFixed.sol/MathLib.dbg.json +1 -1
  126. package/artifacts/contracts/types/UFixed.sol/UFixedLib.dbg.json +1 -1
  127. package/artifacts/contracts/types/Version.sol/VersionLib.dbg.json +1 -1
  128. package/artifacts/contracts/types/Version.sol/VersionPartLib.dbg.json +1 -1
  129. package/contracts/components/Pool.sol +14 -25
  130. package/contracts/instance/IInstance.sol +9 -3
  131. package/contracts/instance/Instance.sol +11 -11
  132. package/contracts/instance/InstanceReader.sol +17 -1
  133. package/contracts/instance/InstanceService.sol +26 -5
  134. package/contracts/instance/base/ComponentServiceBase.sol +2 -0
  135. package/contracts/instance/module/IBundle.sol +1 -0
  136. package/contracts/instance/module/ISetup.sol +1 -0
  137. package/contracts/instance/service/DistributionService.sol +12 -3
  138. package/contracts/instance/service/PoolService.sol +211 -0
  139. package/contracts/instance/service/PoolServiceManager.sol +53 -0
  140. package/contracts/types/RoleId.sol +1 -0
  141. package/package.json +1 -1
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "_format": "hh-sol-dbg-1",
3
- "buildInfo": "../../../build-info/e699570ad48a26ed8744892e7f745983.json"
3
+ "buildInfo": "../../../build-info/9b1b31e7555c19ad4e0c31747fc9ff54.json"
4
4
  }
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "_format": "hh-sol-dbg-1",
3
- "buildInfo": "../../../build-info/e699570ad48a26ed8744892e7f745983.json"
3
+ "buildInfo": "../../../build-info/9b1b31e7555c19ad4e0c31747fc9ff54.json"
4
4
  }
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "_format": "hh-sol-dbg-1",
3
- "buildInfo": "../../../build-info/e699570ad48a26ed8744892e7f745983.json"
3
+ "buildInfo": "../../../build-info/9b1b31e7555c19ad4e0c31747fc9ff54.json"
4
4
  }
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "_format": "hh-sol-dbg-1",
3
- "buildInfo": "../../../build-info/e699570ad48a26ed8744892e7f745983.json"
3
+ "buildInfo": "../../../build-info/9b1b31e7555c19ad4e0c31747fc9ff54.json"
4
4
  }
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "_format": "hh-sol-dbg-1",
3
- "buildInfo": "../../../build-info/e699570ad48a26ed8744892e7f745983.json"
3
+ "buildInfo": "../../../build-info/9b1b31e7555c19ad4e0c31747fc9ff54.json"
4
4
  }
@@ -75,8 +75,8 @@
75
75
  "type": "function"
76
76
  }
77
77
  ],
78
- "bytecode": "0x608060405234801561001057600080fd5b5061032e806100206000396000f3fe608060405234801561001057600080fd5b50600436106100575760003560e01c80631fa8a7301461005c5780635312fdc214610082578063775a404814610095578063b844f20e1461009d578063c4ce6e5b146100b2575b600080fd5b6100646100ba565b60405167ffffffffffffffff90911681526020015b60405180910390f35b610064610090366004610260565b6100c9565b610064610146565b6100a5610150565b6040516100799190610279565b6100a561017f565b60006100c46101ab565b905090565b6040516368aebf7b60e01b81526004810182905260009073__$cd131c2b3ba46b9dbe046aaf4458b9777d$__906368aebf7b90602401602060405180830381865af415801561011c573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061014091906102c7565b92915050565b60006100c4610224565b60606100c460408051808201909152601081526f50726f647563744f776e6572526f6c6560801b602082015290565b60606100c460408051808201909152600d81526c506f6f6c4f776e6572526f6c6560981b602082015290565b6040516368aebf7b60e01b815261012c600482015260009073__$cd131c2b3ba46b9dbe046aaf4458b9777d$__906368aebf7b906024015b602060405180830381865af4158015610200573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906100c491906102c7565b6040516368aebf7b60e01b8152610190600482015260009073__$cd131c2b3ba46b9dbe046aaf4458b9777d$__906368aebf7b906024016101e3565b60006020828403121561027257600080fd5b5035919050565b600060208083528351808285015260005b818110156102a65785810183015185820160400152820161028a565b506000604082860101526040601f19601f8301168501019250505092915050565b6000602082840312156102d957600080fd5b815167ffffffffffffffff811681146102f157600080fd5b939250505056fea2646970667358221220bcb7f9a82f089c5586455a1892a1c75106d3efc6d793738d6e511562a8b1cf3664736f6c63430008140033",
79
- "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100575760003560e01c80631fa8a7301461005c5780635312fdc214610082578063775a404814610095578063b844f20e1461009d578063c4ce6e5b146100b2575b600080fd5b6100646100ba565b60405167ffffffffffffffff90911681526020015b60405180910390f35b610064610090366004610260565b6100c9565b610064610146565b6100a5610150565b6040516100799190610279565b6100a561017f565b60006100c46101ab565b905090565b6040516368aebf7b60e01b81526004810182905260009073__$cd131c2b3ba46b9dbe046aaf4458b9777d$__906368aebf7b90602401602060405180830381865af415801561011c573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061014091906102c7565b92915050565b60006100c4610224565b60606100c460408051808201909152601081526f50726f647563744f776e6572526f6c6560801b602082015290565b60606100c460408051808201909152600d81526c506f6f6c4f776e6572526f6c6560981b602082015290565b6040516368aebf7b60e01b815261012c600482015260009073__$cd131c2b3ba46b9dbe046aaf4458b9777d$__906368aebf7b906024015b602060405180830381865af4158015610200573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906100c491906102c7565b6040516368aebf7b60e01b8152610190600482015260009073__$cd131c2b3ba46b9dbe046aaf4458b9777d$__906368aebf7b906024016101e3565b60006020828403121561027257600080fd5b5035919050565b600060208083528351808285015260005b818110156102a65785810183015185820160400152820161028a565b506000604082860101526040601f19601f8301168501019250505092915050565b6000602082840312156102d957600080fd5b815167ffffffffffffffff811681146102f157600080fd5b939250505056fea2646970667358221220bcb7f9a82f089c5586455a1892a1c75106d3efc6d793738d6e511562a8b1cf3664736f6c63430008140033",
78
+ "bytecode": "0x608060405234801561001057600080fd5b5061032e806100206000396000f3fe608060405234801561001057600080fd5b50600436106100575760003560e01c80631fa8a7301461005c5780635312fdc214610082578063775a404814610095578063b844f20e1461009d578063c4ce6e5b146100b2575b600080fd5b6100646100ba565b60405167ffffffffffffffff90911681526020015b60405180910390f35b610064610090366004610260565b6100c9565b610064610146565b6100a5610150565b6040516100799190610279565b6100a561017f565b60006100c46101ab565b905090565b6040516368aebf7b60e01b81526004810182905260009073__$cd131c2b3ba46b9dbe046aaf4458b9777d$__906368aebf7b90602401602060405180830381865af415801561011c573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061014091906102c7565b92915050565b60006100c4610224565b60606100c460408051808201909152601081526f50726f647563744f776e6572526f6c6560801b602082015290565b60606100c460408051808201909152600d81526c506f6f6c4f776e6572526f6c6560981b602082015290565b6040516368aebf7b60e01b815261012c600482015260009073__$cd131c2b3ba46b9dbe046aaf4458b9777d$__906368aebf7b906024015b602060405180830381865af4158015610200573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906100c491906102c7565b6040516368aebf7b60e01b8152610190600482015260009073__$cd131c2b3ba46b9dbe046aaf4458b9777d$__906368aebf7b906024016101e3565b60006020828403121561027257600080fd5b5035919050565b600060208083528351808285015260005b818110156102a65785810183015185820160400152820161028a565b506000604082860101526040601f19601f8301168501019250505092915050565b6000602082840312156102d957600080fd5b815167ffffffffffffffff811681146102f157600080fd5b939250505056fea2646970667358221220c4e0b89e238c0b5ffaee28b3e926c6c02a61cb9b8019d795524fe3d63668b97064736f6c63430008140033",
79
+ "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100575760003560e01c80631fa8a7301461005c5780635312fdc214610082578063775a404814610095578063b844f20e1461009d578063c4ce6e5b146100b2575b600080fd5b6100646100ba565b60405167ffffffffffffffff90911681526020015b60405180910390f35b610064610090366004610260565b6100c9565b610064610146565b6100a5610150565b6040516100799190610279565b6100a561017f565b60006100c46101ab565b905090565b6040516368aebf7b60e01b81526004810182905260009073__$cd131c2b3ba46b9dbe046aaf4458b9777d$__906368aebf7b90602401602060405180830381865af415801561011c573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061014091906102c7565b92915050565b60006100c4610224565b60606100c460408051808201909152601081526f50726f647563744f776e6572526f6c6560801b602082015290565b60606100c460408051808201909152600d81526c506f6f6c4f776e6572526f6c6560981b602082015290565b6040516368aebf7b60e01b815261012c600482015260009073__$cd131c2b3ba46b9dbe046aaf4458b9777d$__906368aebf7b906024015b602060405180830381865af4158015610200573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906100c491906102c7565b6040516368aebf7b60e01b8152610190600482015260009073__$cd131c2b3ba46b9dbe046aaf4458b9777d$__906368aebf7b906024016101e3565b60006020828403121561027257600080fd5b5035919050565b600060208083528351808285015260005b818110156102a65785810183015185820160400152820161028a565b506000604082860101526040601f19601f8301168501019250505092915050565b6000602082840312156102d957600080fd5b815167ffffffffffffffff811681146102f157600080fd5b939250505056fea2646970667358221220c4e0b89e238c0b5ffaee28b3e926c6c02a61cb9b8019d795524fe3d63668b97064736f6c63430008140033",
80
80
  "linkReferences": {
81
81
  "contracts/types/RoleId.sol": {
82
82
  "RoleIdLib": [
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "_format": "hh-sol-dbg-1",
3
- "buildInfo": "../../../build-info/e699570ad48a26ed8744892e7f745983.json"
3
+ "buildInfo": "../../../build-info/9b1b31e7555c19ad4e0c31747fc9ff54.json"
4
4
  }
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "_format": "hh-sol-dbg-1",
3
- "buildInfo": "../../../build-info/e699570ad48a26ed8744892e7f745983.json"
3
+ "buildInfo": "../../../build-info/9b1b31e7555c19ad4e0c31747fc9ff54.json"
4
4
  }
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "_format": "hh-sol-dbg-1",
3
- "buildInfo": "../../../build-info/e699570ad48a26ed8744892e7f745983.json"
3
+ "buildInfo": "../../../build-info/9b1b31e7555c19ad4e0c31747fc9ff54.json"
4
4
  }
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "_format": "hh-sol-dbg-1",
3
- "buildInfo": "../../../build-info/e699570ad48a26ed8744892e7f745983.json"
3
+ "buildInfo": "../../../build-info/9b1b31e7555c19ad4e0c31747fc9ff54.json"
4
4
  }
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "_format": "hh-sol-dbg-1",
3
- "buildInfo": "../../../build-info/e699570ad48a26ed8744892e7f745983.json"
3
+ "buildInfo": "../../../build-info/9b1b31e7555c19ad4e0c31747fc9ff54.json"
4
4
  }
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "_format": "hh-sol-dbg-1",
3
- "buildInfo": "../../../build-info/e699570ad48a26ed8744892e7f745983.json"
3
+ "buildInfo": "../../../build-info/9b1b31e7555c19ad4e0c31747fc9ff54.json"
4
4
  }
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "_format": "hh-sol-dbg-1",
3
- "buildInfo": "../../../build-info/e699570ad48a26ed8744892e7f745983.json"
3
+ "buildInfo": "../../../build-info/9b1b31e7555c19ad4e0c31747fc9ff54.json"
4
4
  }
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "_format": "hh-sol-dbg-1",
3
- "buildInfo": "../../../build-info/e699570ad48a26ed8744892e7f745983.json"
3
+ "buildInfo": "../../../build-info/9b1b31e7555c19ad4e0c31747fc9ff54.json"
4
4
  }
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "_format": "hh-sol-dbg-1",
3
- "buildInfo": "../../../build-info/e699570ad48a26ed8744892e7f745983.json"
3
+ "buildInfo": "../../../build-info/9b1b31e7555c19ad4e0c31747fc9ff54.json"
4
4
  }
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "_format": "hh-sol-dbg-1",
3
- "buildInfo": "../../../build-info/e699570ad48a26ed8744892e7f745983.json"
3
+ "buildInfo": "../../../build-info/9b1b31e7555c19ad4e0c31747fc9ff54.json"
4
4
  }
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "_format": "hh-sol-dbg-1",
3
- "buildInfo": "../../../build-info/e699570ad48a26ed8744892e7f745983.json"
3
+ "buildInfo": "../../../build-info/9b1b31e7555c19ad4e0c31747fc9ff54.json"
4
4
  }
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "_format": "hh-sol-dbg-1",
3
- "buildInfo": "../../../build-info/e699570ad48a26ed8744892e7f745983.json"
3
+ "buildInfo": "../../../build-info/9b1b31e7555c19ad4e0c31747fc9ff54.json"
4
4
  }
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "_format": "hh-sol-dbg-1",
3
- "buildInfo": "../../../build-info/e699570ad48a26ed8744892e7f745983.json"
3
+ "buildInfo": "../../../build-info/9b1b31e7555c19ad4e0c31747fc9ff54.json"
4
4
  }
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "_format": "hh-sol-dbg-1",
3
- "buildInfo": "../../../build-info/e699570ad48a26ed8744892e7f745983.json"
3
+ "buildInfo": "../../../build-info/9b1b31e7555c19ad4e0c31747fc9ff54.json"
4
4
  }
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "_format": "hh-sol-dbg-1",
3
- "buildInfo": "../../../build-info/e699570ad48a26ed8744892e7f745983.json"
3
+ "buildInfo": "../../../build-info/9b1b31e7555c19ad4e0c31747fc9ff54.json"
4
4
  }
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "_format": "hh-sol-dbg-1",
3
- "buildInfo": "../../../build-info/e699570ad48a26ed8744892e7f745983.json"
3
+ "buildInfo": "../../../build-info/9b1b31e7555c19ad4e0c31747fc9ff54.json"
4
4
  }
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "_format": "hh-sol-dbg-1",
3
- "buildInfo": "../../../build-info/e699570ad48a26ed8744892e7f745983.json"
3
+ "buildInfo": "../../../build-info/9b1b31e7555c19ad4e0c31747fc9ff54.json"
4
4
  }
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "_format": "hh-sol-dbg-1",
3
- "buildInfo": "../../../build-info/e699570ad48a26ed8744892e7f745983.json"
3
+ "buildInfo": "../../../build-info/9b1b31e7555c19ad4e0c31747fc9ff54.json"
4
4
  }
@@ -131,8 +131,8 @@
131
131
  "type": "function"
132
132
  }
133
133
  ],
134
- "bytecode": "0x6102a461003a600b82828239805160001a60731461002d57634e487b7160e01b600052600060045260246000fd5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600436106100875760003560e01c806368aebf7b1161006557806368aebf7b14610119578063a42e52e914610127578063bc1b392d14610144578063f37f38f01461014b57600080fd5b8063057182b41461008c578063545ce21c146100bd57806367cb8ec1146100e7575b600080fd5b6100a861009a36600461020b565b67ffffffffffffffff161590565b60405190151581526020015b60405180910390f35b6100ce6100cb36600461020b565b90565b60405167ffffffffffffffff90911681526020016100b4565b6101066100f536600461020b565b60081b68ffffffffffffffff001690565b60405160ff1990911681526020016100b4565b6100ce6100cb36600461023c565b6100a861013536600461020b565b67ffffffffffffffff16151590565b60006100ce565b61015e61015936600461020b565b61016c565b6040519081526020016100b4565b600073__$c8f743efd2b4f0c9300f2558c784479d3e$__63f48016ce6014600885901b68ffffffffffffffff00166040516001600160e01b031960e085901b16815260ff909216600483015260ff19166024820152604401602060405180830381865af41580156101e1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102059190610255565b92915050565b60006020828403121561021d57600080fd5b813567ffffffffffffffff8116811461023557600080fd5b9392505050565b60006020828403121561024e57600080fd5b5035919050565b60006020828403121561026757600080fd5b505191905056fea26469706673582212207d0e6c66d99957c657e0e225c34b93931622129ac81b0c5422f979205662592d64736f6c63430008140033",
135
- "deployedBytecode": "0x73000000000000000000000000000000000000000030146080604052600436106100875760003560e01c806368aebf7b1161006557806368aebf7b14610119578063a42e52e914610127578063bc1b392d14610144578063f37f38f01461014b57600080fd5b8063057182b41461008c578063545ce21c146100bd57806367cb8ec1146100e7575b600080fd5b6100a861009a36600461020b565b67ffffffffffffffff161590565b60405190151581526020015b60405180910390f35b6100ce6100cb36600461020b565b90565b60405167ffffffffffffffff90911681526020016100b4565b6101066100f536600461020b565b60081b68ffffffffffffffff001690565b60405160ff1990911681526020016100b4565b6100ce6100cb36600461023c565b6100a861013536600461020b565b67ffffffffffffffff16151590565b60006100ce565b61015e61015936600461020b565b61016c565b6040519081526020016100b4565b600073__$c8f743efd2b4f0c9300f2558c784479d3e$__63f48016ce6014600885901b68ffffffffffffffff00166040516001600160e01b031960e085901b16815260ff909216600483015260ff19166024820152604401602060405180830381865af41580156101e1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102059190610255565b92915050565b60006020828403121561021d57600080fd5b813567ffffffffffffffff8116811461023557600080fd5b9392505050565b60006020828403121561024e57600080fd5b5035919050565b60006020828403121561026757600080fd5b505191905056fea26469706673582212207d0e6c66d99957c657e0e225c34b93931622129ac81b0c5422f979205662592d64736f6c63430008140033",
134
+ "bytecode": "0x6102a461003a600b82828239805160001a60731461002d57634e487b7160e01b600052600060045260246000fd5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600436106100875760003560e01c806368aebf7b1161006557806368aebf7b14610119578063a42e52e914610127578063bc1b392d14610144578063f37f38f01461014b57600080fd5b8063057182b41461008c578063545ce21c146100bd57806367cb8ec1146100e7575b600080fd5b6100a861009a36600461020b565b67ffffffffffffffff161590565b60405190151581526020015b60405180910390f35b6100ce6100cb36600461020b565b90565b60405167ffffffffffffffff90911681526020016100b4565b6101066100f536600461020b565b60081b68ffffffffffffffff001690565b60405160ff1990911681526020016100b4565b6100ce6100cb36600461023c565b6100a861013536600461020b565b67ffffffffffffffff16151590565b60006100ce565b61015e61015936600461020b565b61016c565b6040519081526020016100b4565b600073__$c8f743efd2b4f0c9300f2558c784479d3e$__63f48016ce6014600885901b68ffffffffffffffff00166040516001600160e01b031960e085901b16815260ff909216600483015260ff19166024820152604401602060405180830381865af41580156101e1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102059190610255565b92915050565b60006020828403121561021d57600080fd5b813567ffffffffffffffff8116811461023557600080fd5b9392505050565b60006020828403121561024e57600080fd5b5035919050565b60006020828403121561026757600080fd5b505191905056fea2646970667358221220fc6a35bb293dd84eb5ac7cbc5613951d9b8b18b87ff3cf51dcc60822256afeaa64736f6c63430008140033",
135
+ "deployedBytecode": "0x73000000000000000000000000000000000000000030146080604052600436106100875760003560e01c806368aebf7b1161006557806368aebf7b14610119578063a42e52e914610127578063bc1b392d14610144578063f37f38f01461014b57600080fd5b8063057182b41461008c578063545ce21c146100bd57806367cb8ec1146100e7575b600080fd5b6100a861009a36600461020b565b67ffffffffffffffff161590565b60405190151581526020015b60405180910390f35b6100ce6100cb36600461020b565b90565b60405167ffffffffffffffff90911681526020016100b4565b6101066100f536600461020b565b60081b68ffffffffffffffff001690565b60405160ff1990911681526020016100b4565b6100ce6100cb36600461023c565b6100a861013536600461020b565b67ffffffffffffffff16151590565b60006100ce565b61015e61015936600461020b565b61016c565b6040519081526020016100b4565b600073__$c8f743efd2b4f0c9300f2558c784479d3e$__63f48016ce6014600885901b68ffffffffffffffff00166040516001600160e01b031960e085901b16815260ff909216600483015260ff19166024820152604401602060405180830381865af41580156101e1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102059190610255565b92915050565b60006020828403121561021d57600080fd5b813567ffffffffffffffff8116811461023557600080fd5b9392505050565b60006020828403121561024e57600080fd5b5035919050565b60006020828403121561026757600080fd5b505191905056fea2646970667358221220fc6a35bb293dd84eb5ac7cbc5613951d9b8b18b87ff3cf51dcc60822256afeaa64736f6c63430008140033",
136
136
  "linkReferences": {
137
137
  "contracts/types/Key32.sol": {
138
138
  "Key32Lib": [
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "_format": "hh-sol-dbg-1",
3
- "buildInfo": "../../../build-info/e699570ad48a26ed8744892e7f745983.json"
3
+ "buildInfo": "../../../build-info/9b1b31e7555c19ad4e0c31747fc9ff54.json"
4
4
  }
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "_format": "hh-sol-dbg-1",
3
- "buildInfo": "../../../build-info/e699570ad48a26ed8744892e7f745983.json"
3
+ "buildInfo": "../../../build-info/9b1b31e7555c19ad4e0c31747fc9ff54.json"
4
4
  }
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "_format": "hh-sol-dbg-1",
3
- "buildInfo": "../../../build-info/e699570ad48a26ed8744892e7f745983.json"
3
+ "buildInfo": "../../../build-info/9b1b31e7555c19ad4e0c31747fc9ff54.json"
4
4
  }
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "_format": "hh-sol-dbg-1",
3
- "buildInfo": "../../../build-info/e699570ad48a26ed8744892e7f745983.json"
3
+ "buildInfo": "../../../build-info/9b1b31e7555c19ad4e0c31747fc9ff54.json"
4
4
  }
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "_format": "hh-sol-dbg-1",
3
- "buildInfo": "../../../build-info/e699570ad48a26ed8744892e7f745983.json"
3
+ "buildInfo": "../../../build-info/9b1b31e7555c19ad4e0c31747fc9ff54.json"
4
4
  }
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "_format": "hh-sol-dbg-1",
3
- "buildInfo": "../../../build-info/e699570ad48a26ed8744892e7f745983.json"
3
+ "buildInfo": "../../../build-info/9b1b31e7555c19ad4e0c31747fc9ff54.json"
4
4
  }
@@ -74,8 +74,8 @@ contract Pool is BaseComponent, IPoolComponent {
74
74
  _initialStakingFee = stakingFee;
75
75
  _initialPerformanceFee = performanceFee;
76
76
 
77
+ _poolService = _instance.getPoolService();
77
78
  // TODO: reactivate when services are available again
78
- // _poolService = _instance.getPoolService();
79
79
  // _productService = _instance.getProductService();
80
80
 
81
81
  _registerInterface(type(IPoolComponent).interfaceId);
@@ -168,21 +168,19 @@ contract Pool is BaseComponent, IPoolComponent {
168
168
  _poolService.setBundleFee(bundleNftId, fee);
169
169
  }
170
170
 
171
+ function getInitialSetupInfo() public view returns (ISetup.PoolSetupInfo memory setupInfo) {
172
+ return ISetup.PoolSetupInfo(
173
+ _productNftId,
174
+ TokenHandler(address(_token)),
175
+ _collateralizationLevel,
176
+ _initialPoolFee,
177
+ _initialStakingFee,
178
+ _initialPerformanceFee,
179
+ _isVerifying,
180
+ _wallet
181
+ );
182
+ }
171
183
  function getSetupInfo() public view returns (ISetup.PoolSetupInfo memory setupInfo) {
172
- // TODO fix this
173
- if (getNftId().eq(zeroNftId())) {
174
- return ISetup.PoolSetupInfo(
175
- _productNftId,
176
- TokenHandler(address(0)),
177
- _collateralizationLevel,
178
- _initialPoolFee,
179
- _initialStakingFee,
180
- _initialPerformanceFee,
181
- _isVerifying,
182
- _wallet
183
- );
184
- }
185
-
186
184
  InstanceReader reader = _instance.getInstanceReader();
187
185
  return reader.getPoolSetupInfo(getNftId());
188
186
  }
@@ -205,16 +203,7 @@ contract Pool is BaseComponent, IPoolComponent {
205
203
  return (
206
204
  info,
207
205
  abi.encode(
208
- ISetup.PoolSetupInfo(
209
- getProductNftId(),
210
- TokenHandler(address(0)),
211
- _collateralizationLevel,
212
- _initialPoolFee,
213
- _initialStakingFee,
214
- _initialPerformanceFee,
215
- _isVerifying,
216
- _wallet
217
- )
206
+ getInitialSetupInfo()
218
207
  )
219
208
  );
220
209
  }
@@ -9,6 +9,7 @@ import {IComponentOwnerService} from "./service/IComponentOwnerService.sol";
9
9
  import {IDistributionService} from "./service/IDistributionService.sol";
10
10
  import {IPoolService} from "./service/IPoolService.sol";
11
11
  import {IProductService} from "./service/IProductService.sol";
12
+ import {IBundle} from "./module/IBundle.sol";
12
13
  import {ISetup} from "./module/ISetup.sol";
13
14
  import {NftId} from "../types/NftId.sol";
14
15
  import {StateId} from "../types/StateId.sol";
@@ -16,10 +17,9 @@ import {StateId} from "../types/StateId.sol";
16
17
  interface IInstance is IERC165 {
17
18
 
18
19
  function getComponentOwnerService() external view returns (IComponentOwnerService);
19
- // TODO: renable these when we have the services
20
20
  function getDistributionService() external view returns (IDistributionService);
21
21
  // function getProductService() external view returns (IProductService);
22
- // function getPoolService() external view returns (IPoolService);
22
+ function getPoolService() external view returns (IPoolService);
23
23
 
24
24
  function createProductSetup(NftId productNftId, ISetup.ProductSetupInfo memory setup) external;
25
25
 
@@ -27,7 +27,13 @@ interface IInstance is IERC165 {
27
27
  function updateDistributionSetup(NftId distributionNftId, ISetup.DistributionSetupInfo memory setup, StateId newState) external;
28
28
  function updateDistributionSetupState(NftId distributionNftId, StateId newState) external;
29
29
 
30
- function createPoolSetup(NftId distributionNftId, ISetup.PoolSetupInfo memory setup) external;
30
+ function createPoolSetup(NftId poolNftId, ISetup.PoolSetupInfo memory setup) external;
31
+ function updatePoolSetup(NftId poolNftId, ISetup.PoolSetupInfo memory setup, StateId newState) external;
32
+ function updatePoolSetupState(NftId poolNftId, StateId newState) external;
33
+
34
+ function createBundle(NftId bundleNftId, IBundle.BundleInfo memory bundle) external;
35
+ function updateBundle(NftId bundleNftId, IBundle.BundleInfo memory bundle, StateId newState) external;
36
+ function updateBundleState(NftId bundleNftId, StateId newState) external;
31
37
 
32
38
  function getInstanceReader() external view returns (InstanceReader);
33
39
  }
@@ -26,6 +26,7 @@ import {Registerable} from "../shared/Registerable.sol";
26
26
  import {ComponentOwnerService} from "./service/ComponentOwnerService.sol";
27
27
  import {IComponentOwnerService} from "./service/IComponentOwnerService.sol";
28
28
  import {IDistributionService} from "./service/IDistributionService.sol";
29
+ import {IPoolService} from "./service/IPoolService.sol";
29
30
  import {VersionPart} from "../types/Version.sol";
30
31
 
31
32
  contract Instance is
@@ -62,7 +63,7 @@ contract Instance is
62
63
  require(!_initialized, "Contract instance has already been initialized");
63
64
 
64
65
  initializeAccessManagedSimple(accessManagerAddress);
65
-
66
+
66
67
  _accessManager = AccessManagerSimple(accessManagerAddress);
67
68
  _createRole(RoleIdLib.toRoleId(ADMIN_ROLE), "AdminRole", false, false);
68
69
  _createRole(RoleIdLib.toRoleId(PUBLIC_ROLE), "PublicRole", false, false);
@@ -220,16 +221,16 @@ contract Instance is
220
221
  }
221
222
 
222
223
  //--- PoolSetup ------------------------------------------------------//
223
- function createPoolSetup(NftId distributionNftId, ISetup.PoolSetupInfo memory setup) external restricted() {
224
- create(_toNftKey32(distributionNftId, POOL()), abi.encode(setup));
224
+ function createPoolSetup(NftId poolNftId, ISetup.PoolSetupInfo memory setup) external restricted() {
225
+ create(_toNftKey32(poolNftId, POOL()), abi.encode(setup));
225
226
  }
226
227
 
227
- function updatePoolSetup(NftId distributionNftId, ISetup.PoolSetupInfo memory setup, StateId newState) external restricted() {
228
- update(_toNftKey32(distributionNftId, POOL()), abi.encode(setup), newState);
228
+ function updatePoolSetup(NftId poolNftId, ISetup.PoolSetupInfo memory setup, StateId newState) external restricted() {
229
+ update(_toNftKey32(poolNftId, POOL()), abi.encode(setup), newState);
229
230
  }
230
231
 
231
- function updatePoolSetupState(NftId distributionNftId, StateId newState) external restricted() {
232
- updateState(_toNftKey32(distributionNftId, POOL()), newState);
232
+ function updatePoolSetupState(NftId poolNftId, StateId newState) external restricted() {
233
+ updateState(_toNftKey32(poolNftId, POOL()), newState);
233
234
  }
234
235
 
235
236
  //--- DistributorType ---------------------------------------------------//
@@ -427,10 +428,9 @@ contract Instance is
427
428
  // return ProductService(_registry.getServiceAddress("ProductService", VersionPart.wrap(3)));
428
429
  // }
429
430
 
430
- // TODO reactivate when services are available
431
- // function getPoolService() external view returns (IPoolService) {
432
- // return PoolService(_registry.getServiceAddress("PoolService", VersionPart.wrap(3)));
433
- // }
431
+ function getPoolService() external view returns (IPoolService) {
432
+ return IPoolService(_registry.getServiceAddress("PoolService", VersionPart.wrap(3)));
433
+ }
434
434
 
435
435
  function setInstanceReader(InstanceReader instanceReader) external restricted() {
436
436
  require(address(_instanceReader) == address(0), "InstanceReader is set");
@@ -7,7 +7,7 @@ import {DistributorType} from "../types/DistributorType.sol";
7
7
  import {Fee, FeeLib} from "../types/Fee.sol";
8
8
  import {Key32} from "../types/Key32.sol";
9
9
  import {NftId} from "../types/NftId.sol";
10
- import {ObjectType, DISTRIBUTOR, DISTRIBUTION, INSTANCE, PRODUCT, POLICY, POOL, TREASURY} from "../types/ObjectType.sol";
10
+ import {ObjectType, DISTRIBUTOR, DISTRIBUTION, INSTANCE, PRODUCT, POLICY, POOL, TREASURY, BUNDLE} from "../types/ObjectType.sol";
11
11
  import {ReferralId, ReferralStatus, ReferralLib, REFERRAL_OK, REFERRAL_ERROR_UNKNOWN, REFERRAL_ERROR_EXPIRED, REFERRAL_ERROR_EXHAUSTED} from "../types/Referral.sol";
12
12
  import {Registerable} from "../shared/Registerable.sol";
13
13
  import {RiskId} from "../types/RiskId.sol";
@@ -15,6 +15,7 @@ import {UFixed, MathLib, UFixedLib} from "../types/UFixed.sol";
15
15
  import {Version} from "../types/Version.sol";
16
16
 
17
17
  import {IRegistry} from "../registry/IRegistry.sol";
18
+ import {IBundle} from "../instance/module/IBundle.sol";
18
19
  import {IDistribution} from "../instance/module/IDistribution.sol";
19
20
  import {IInstance} from "./IInstance.sol";
20
21
  import {IKeyValueStore} from "../instance/base/IKeyValueStore.sol";
@@ -114,6 +115,17 @@ contract InstanceReader {
114
115
  return abi.decode(data, (ITreasury.TreasuryInfo));
115
116
  }
116
117
  }
118
+
119
+ function getBundleInfo(NftId bundleNftId)
120
+ public
121
+ view
122
+ returns (IBundle.BundleInfo memory info)
123
+ {
124
+ bytes memory data = _store.getData(toBundleKey(bundleNftId));
125
+ if (data.length > 0) {
126
+ return abi.decode(data, (IBundle.BundleInfo));
127
+ }
128
+ }
117
129
 
118
130
  function getDistributorTypeInfo(DistributorType distributorType)
119
131
  public
@@ -259,6 +271,10 @@ contract InstanceReader {
259
271
  return distributionNftId.toKey32(DISTRIBUTION());
260
272
  }
261
273
 
274
+ function toBundleKey(NftId poolNftId) public pure returns (Key32) {
275
+ return poolNftId.toKey32(BUNDLE());
276
+ }
277
+
262
278
  function toPoolKey(NftId poolNftId) public pure returns (Key32) {
263
279
  return poolNftId.toKey32(POOL());
264
280
  }
@@ -15,8 +15,9 @@ import {Service} from "../../contracts/shared/Service.sol";
15
15
  import {IService} from "../shared/IService.sol";
16
16
  import {ContractDeployerLib} from "../shared/ContractDeployerLib.sol";
17
17
  import {NftId, NftIdLib, zeroNftId} from "../../contracts/types/NftId.sol";
18
+ import {RoleId} from "../types/RoleId.sol";
18
19
  import {VersionLib} from "../types/Version.sol";
19
- import {ADMIN_ROLE, INSTANCE_SERVICE_ROLE, DISTRIBUTION_SERVICE_ROLE} from "../types/RoleId.sol";
20
+ import {ADMIN_ROLE, INSTANCE_SERVICE_ROLE, DISTRIBUTION_SERVICE_ROLE, POOL_SERVICE_ROLE} from "../types/RoleId.sol";
20
21
 
21
22
  contract InstanceService is Service, IInstanceService {
22
23
 
@@ -61,7 +62,7 @@ contract InstanceService is Service, IInstanceService {
61
62
  _grantInitialAuthorizations(clonedAccessManager, clonedInstance);
62
63
 
63
64
  clonedInstance.setInstanceReader(clonedInstanceReader);
64
-
65
+
65
66
  // to complete setup switch instance ownership to the instance owner
66
67
  // TODO: use a role less powerful than admin, maybe INSTANCE_ADMIN (does not exist yet)
67
68
  clonedAccessManager.grantRole(ADMIN_ROLE().toInt(), instanceOwner, 0);
@@ -72,7 +73,6 @@ contract InstanceService is Service, IInstanceService {
72
73
 
73
74
  function _grantInitialAuthorizations(AccessManagerSimple clonedAccessManager, Instance clonedInstance) internal {
74
75
  address distributionServiceAddress = _registry.getServiceAddress("DistributionService", VersionLib.toVersion(3, 0, 0).toMajorPart());
75
-
76
76
  clonedAccessManager.grantRole(DISTRIBUTION_SERVICE_ROLE().toInt(), distributionServiceAddress, 0);
77
77
  bytes4[] memory instanceDistributionServiceSelectors = new bytes4[](2);
78
78
  instanceDistributionServiceSelectors[0] = clonedInstance.createDistributionSetup.selector;
@@ -81,6 +81,19 @@ contract InstanceService is Service, IInstanceService {
81
81
  address(clonedInstance),
82
82
  instanceDistributionServiceSelectors,
83
83
  DISTRIBUTION_SERVICE_ROLE().toInt());
84
+
85
+ address poolServiceAddress = _registry.getServiceAddress("PoolService", VersionLib.toVersion(3, 0, 0).toMajorPart());
86
+ clonedAccessManager.grantRole(POOL_SERVICE_ROLE().toInt(), address(poolServiceAddress), 0);
87
+ bytes4[] memory instancePoolServiceSelectors = new bytes4[](4);
88
+ instancePoolServiceSelectors[0] = clonedInstance.createPoolSetup.selector;
89
+ instancePoolServiceSelectors[1] = clonedInstance.updatePoolSetup.selector;
90
+ instancePoolServiceSelectors[2] = clonedInstance.createBundle.selector;
91
+ instancePoolServiceSelectors[3] = clonedInstance.updateBundle.selector;
92
+ clonedAccessManager.setTargetFunctionRole(
93
+ address(clonedInstance),
94
+ instancePoolServiceSelectors,
95
+ POOL_SERVICE_ROLE().toInt());
96
+
84
97
  }
85
98
 
86
99
  function setAccessManagerMaster(address accessManagerMaster) external {
@@ -154,8 +167,16 @@ contract InstanceService is Service, IInstanceService {
154
167
  _registerInterface(type(IInstanceService).interfaceId);
155
168
  }
156
169
 
157
- function getInstance() external view returns (Instance) {
158
- return Instance(address(this));
170
+ function hasRole(address account, RoleId role, NftId instanceNftId) external view returns (bool) {
171
+ IRegistry.ObjectInfo memory instanceObjectInfo = getRegistry().getObjectInfo(instanceNftId);
172
+ address instanceAddress = instanceObjectInfo.objectAddress;
173
+ Instance instance = Instance(instanceAddress);
174
+ AccessManagerSimple accessManager = AccessManagerSimple(instance.authority());
175
+ (bool isMember, uint32 executionDelay) = accessManager.hasRole(role.toInt(), account);
176
+ if (executionDelay > 0) {
177
+ return false;
178
+ }
179
+ return isMember;
159
180
  }
160
181
  }
161
182
 
@@ -12,6 +12,8 @@ import {Version, VersionPart, VersionLib} from "../../types/Version.sol";
12
12
 
13
13
  abstract contract ComponentServiceBase is Service {
14
14
 
15
+ error CallerIsNotComponentOwner();
16
+
15
17
  function _getAndVerifyComponentInfoAndInstance(
16
18
  ObjectType objectType
17
19
  )
@@ -13,6 +13,7 @@ interface IBundle {
13
13
  uint256 capitalAmount; // net investment capital + net premiums - payouts
14
14
  uint256 lockedAmount; // capital amount linked to collateralizaion of non-closed policies (<= balance)
15
15
  uint256 balanceAmount; // total amount of funds: capitalAmount + fees (balance >= captial)
16
+ uint256 lifetime;
16
17
  Timestamp expiredAt; // no new policies
17
18
  Timestamp closedAt; // no open policies, locked amount = 0
18
19
  }
@@ -5,6 +5,7 @@ import {IERC20Metadata} from "@openzeppelin/contracts/token/ERC20/extensions/IER
5
5
 
6
6
  import {Fee} from "../../types/Fee.sol";
7
7
  import {NftId} from "../../types/NftId.sol";
8
+ import {LibNftIdSet} from "../../types/NftIdSet.sol";
8
9
  import {UFixed} from "../../types/UFixed.sol";
9
10
  import {TokenHandler} from "../../shared/TokenHandler.sol";
10
11
 
@@ -10,6 +10,7 @@ import {ITreasury} from "../../instance/module/ITreasury.sol";
10
10
 
11
11
  import {NftId, NftIdLib} from "../../types/NftId.sol";
12
12
  import {Fee} from "../../types/Fee.sol";
13
+ import {DISTRIBUTION_OWNER_ROLE} from "../../types/RoleId.sol";
13
14
  import {KEEP_STATE} from "../../types/StateId.sol";
14
15
  import {DISTRIBUTION} from "../../types/ObjectType.sol";
15
16
  import {Version, VersionLib} from "../../types/Version.sol";
@@ -22,6 +23,9 @@ import {Service} from "../../shared/Service.sol";
22
23
  import {ComponentServiceBase} from "../base/ComponentServiceBase.sol";
23
24
  import {IDistributionService} from "./IDistributionService.sol";
24
25
  import {Distribution} from "../../components/Distribution.sol";
26
+ import {InstanceService} from "../InstanceService.sol";
27
+ import {Instance} from "../Instance.sol";
28
+ import {INftOwnable} from "../../shared/INftOwnable.sol";
25
29
 
26
30
  string constant DISTRIBUTION_SERVICE_NAME = "DistributionService";
27
31
 
@@ -34,6 +38,7 @@ contract DistributionService is
34
38
  string public constant NAME = "DistributionService";
35
39
 
36
40
  address internal _registryAddress;
41
+ InstanceService internal _instanceService;
37
42
 
38
43
  function _initialize(
39
44
  address owner,
@@ -46,7 +51,8 @@ contract DistributionService is
46
51
  address initialOwner = address(0);
47
52
  (_registryAddress, initialOwner) = abi.decode(data, (address, address));
48
53
 
49
- // IRegistry registry = IRegistry(_registryAddress);
54
+ IRegistry registry = IRegistry(_registryAddress);
55
+ _instanceService = InstanceService(registry.getServiceAddress("InstanceService", getMajorVersion()));
50
56
 
51
57
  _initializeService(_registryAddress, initialOwner);
52
58
 
@@ -64,8 +70,12 @@ contract DistributionService is
64
70
  returns (NftId distributionNftId)
65
71
  {
66
72
  address componentOwner = msg.sender;
67
- // TODO validate permission of componentOwner. check if componentOwner has correct permission on instance via InstanceService - DISTRIBUTION_OWNER
68
73
  Distribution distribution = Distribution(distributionComponentAddress);
74
+ IInstance instance = distribution.getInstance();
75
+ INftOwnable nftOwnable = INftOwnable(address(instance));
76
+
77
+ require(_instanceService.hasRole(componentOwner, DISTRIBUTION_OWNER_ROLE(), nftOwnable.getNftId()), "ERROR:DIS-001:NOT_DISTRIBUTION_OWNER_ROLE");
78
+
69
79
  IRegistryService registryService = getRegistryService();
70
80
  (IRegistry.ObjectInfo memory distributionObjInfo, ) = registryService.registerDistribution(
71
81
  distribution,
@@ -74,7 +84,6 @@ contract DistributionService is
74
84
  distributionNftId = distributionObjInfo.nftId;
75
85
 
76
86
  ISetup.DistributionSetupInfo memory initialSetup = distribution.getInitialSetupInfo();
77
- IInstance instance = distribution.getInstance();
78
87
  instance.createDistributionSetup(distributionNftId, initialSetup);
79
88
  }
80
89