@etherisc/gif-next 0.0.2-e922e07-736 → 0.0.2-e9a637d-547
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +0 -71
 - package/artifacts/contracts/components/Component.sol/Component.dbg.json +1 -1
 - package/artifacts/contracts/components/Component.sol/Component.json +68 -0
 - package/artifacts/contracts/components/Distribution.sol/Distribution.dbg.json +1 -1
 - package/artifacts/contracts/components/Distribution.sol/Distribution.json +68 -0
 - package/artifacts/contracts/components/IComponent.sol/IComponent.dbg.json +1 -1
 - package/artifacts/contracts/components/IComponent.sol/IComponent.json +158 -0
 - package/artifacts/contracts/components/IDistributionComponent.sol/IDistributionComponent.dbg.json +1 -1
 - package/artifacts/contracts/components/IDistributionComponent.sol/IDistributionComponent.json +158 -0
 - package/artifacts/contracts/components/IPoolComponent.sol/IPoolComponent.dbg.json +1 -1
 - package/artifacts/contracts/components/IPoolComponent.sol/IPoolComponent.json +184 -149
 - package/artifacts/contracts/components/IProductComponent.sol/IProductComponent.dbg.json +1 -1
 - package/artifacts/contracts/components/IProductComponent.sol/IProductComponent.json +158 -0
 - package/artifacts/contracts/components/Pool.sol/Pool.dbg.json +1 -1
 - package/artifacts/contracts/components/Pool.sol/Pool.json +114 -189
 - package/artifacts/contracts/components/Product.sol/Product.dbg.json +1 -1
 - package/artifacts/contracts/components/Product.sol/Product.json +68 -0
 - package/artifacts/contracts/instance/AccessManagerUpgradeableInitializeable.sol/AccessManagerUpgradeableInitializeable.dbg.json +4 -0
 - package/artifacts/contracts/instance/AccessManagerUpgradeableInitializeable.sol/AccessManagerUpgradeableInitializeable.json +1206 -0
 - package/artifacts/contracts/instance/BundleManager.sol/BundleManager.dbg.json +1 -1
 - package/artifacts/contracts/instance/BundleManager.sol/BundleManager.json +64 -50
 - package/artifacts/contracts/instance/Cloneable.sol/Cloneable.dbg.json +1 -1
 - package/artifacts/contracts/instance/Cloneable.sol/Cloneable.json +5 -0
 - package/artifacts/contracts/instance/IInstance.sol/IInstance.dbg.json +1 -1
 - package/artifacts/contracts/instance/IInstance.sol/IInstance.json +214 -2063
 - package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.dbg.json +1 -1
 - package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.json +196 -51
 - package/artifacts/contracts/instance/Instance.sol/Instance.dbg.json +1 -1
 - package/artifacts/contracts/instance/Instance.sol/Instance.json +363 -2832
 - package/artifacts/contracts/instance/InstanceAccessManager.sol/InstanceAccessManager.dbg.json +1 -1
 - package/artifacts/contracts/instance/InstanceAccessManager.sol/InstanceAccessManager.json +491 -127
 - package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.dbg.json +1 -1
 - package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.json +101 -167
 - package/artifacts/contracts/instance/InstanceService.sol/InstanceService.dbg.json +1 -1
 - package/artifacts/contracts/instance/InstanceService.sol/InstanceService.json +333 -171
 - package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.dbg.json +1 -1
 - package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.json +75 -23
 - package/artifacts/contracts/instance/InstanceStore.sol/InstanceStore.dbg.json +4 -0
 - package/artifacts/contracts/instance/InstanceStore.sol/InstanceStore.json +2677 -0
 - package/artifacts/contracts/instance/ObjectManager.sol/ObjectManager.dbg.json +1 -1
 - package/artifacts/contracts/instance/ObjectManager.sol/ObjectManager.json +8 -13
 - package/artifacts/contracts/instance/base/ComponentService.sol/ComponentService.dbg.json +1 -1
 - package/artifacts/contracts/instance/base/ComponentService.sol/ComponentService.json +85 -30
 - package/artifacts/contracts/instance/base/IKeyValueStore.sol/IKeyValueStore.dbg.json +1 -1
 - package/artifacts/contracts/instance/base/ILifecycle.sol/ILifecycle.dbg.json +1 -1
 - package/artifacts/contracts/instance/base/KeyValueStore.sol/KeyValueStore.dbg.json +1 -1
 - package/artifacts/contracts/instance/base/KeyValueStore.sol/KeyValueStore.json +40 -10
 - package/artifacts/contracts/instance/base/Lifecycle.sol/Lifecycle.dbg.json +1 -1
 - package/artifacts/contracts/instance/base/Lifecycle.sol/Lifecycle.json +36 -11
 - package/artifacts/contracts/instance/module/IAccess.sol/IAccess.dbg.json +1 -1
 - package/artifacts/contracts/instance/module/IAccess.sol/IAccess.json +56 -73
 - package/artifacts/contracts/instance/module/IBundle.sol/IBundle.dbg.json +1 -1
 - package/artifacts/contracts/instance/module/IComponents.sol/IComponents.dbg.json +4 -0
 - package/artifacts/contracts/instance/module/IComponents.sol/IComponents.json +10 -0
 - package/artifacts/contracts/instance/module/IDistribution.sol/IDistribution.dbg.json +1 -1
 - package/artifacts/contracts/instance/module/IPolicy.sol/IPolicy.dbg.json +1 -1
 - package/artifacts/contracts/instance/module/IRisk.sol/IRisk.dbg.json +1 -1
 - package/artifacts/contracts/instance/module/ISetup.sol/ISetup.dbg.json +1 -1
 - package/artifacts/contracts/instance/module/ITreasury.sol/ITreasury.dbg.json +1 -1
 - package/artifacts/contracts/instance/service/ApplicationService.sol/ApplicationService.dbg.json +1 -1
 - package/artifacts/contracts/instance/service/ApplicationService.sol/ApplicationService.json +124 -53
 - package/artifacts/contracts/instance/service/ApplicationServiceManager.sol/ApplicationServiceManager.dbg.json +1 -1
 - package/artifacts/contracts/instance/service/ApplicationServiceManager.sol/ApplicationServiceManager.json +21 -13
 - package/artifacts/contracts/instance/service/BundleService.sol/BundleService.dbg.json +1 -1
 - package/artifacts/contracts/instance/service/BundleService.sol/BundleService.json +384 -249
 - package/artifacts/contracts/instance/service/BundleServiceManager.sol/BundleServiceManager.dbg.json +1 -1
 - package/artifacts/contracts/instance/service/BundleServiceManager.sol/BundleServiceManager.json +74 -14
 - package/artifacts/contracts/instance/service/ClaimService.sol/ClaimService.dbg.json +1 -1
 - package/artifacts/contracts/instance/service/ClaimService.sol/ClaimService.json +104 -41
 - package/artifacts/contracts/instance/service/ClaimServiceManager.sol/ClaimServiceManager.dbg.json +1 -1
 - package/artifacts/contracts/instance/service/ClaimServiceManager.sol/ClaimServiceManager.json +11 -7
 - package/artifacts/contracts/instance/service/DistributionService.sol/DistributionService.dbg.json +1 -1
 - package/artifacts/contracts/instance/service/DistributionService.sol/DistributionService.json +195 -121
 - package/artifacts/contracts/instance/service/DistributionServiceManager.sol/DistributionServiceManager.dbg.json +1 -1
 - package/artifacts/contracts/instance/service/DistributionServiceManager.sol/DistributionServiceManager.json +51 -47
 - package/artifacts/contracts/instance/service/IApplicationService.sol/IApplicationService.dbg.json +1 -1
 - package/artifacts/contracts/instance/service/IApplicationService.sol/IApplicationService.json +80 -14
 - package/artifacts/contracts/instance/service/IBundleService.sol/IBundleService.dbg.json +1 -1
 - package/artifacts/contracts/instance/service/IBundleService.sol/IBundleService.json +212 -186
 - package/artifacts/contracts/instance/service/IClaimService.sol/IClaimService.dbg.json +1 -1
 - package/artifacts/contracts/instance/service/IClaimService.sol/IClaimService.json +80 -14
 - package/artifacts/contracts/instance/service/IDistributionService.sol/IDistributionService.dbg.json +1 -1
 - package/artifacts/contracts/instance/service/IDistributionService.sol/IDistributionService.json +101 -24
 - package/artifacts/contracts/instance/service/IPolicyService.sol/IPolicyService.dbg.json +1 -1
 - package/artifacts/contracts/instance/service/IPolicyService.sol/IPolicyService.json +90 -24
 - package/artifacts/contracts/instance/service/IPoolService.sol/IPoolService.dbg.json +1 -1
 - package/artifacts/contracts/instance/service/IPoolService.sol/IPoolService.json +511 -14
 - package/artifacts/contracts/instance/service/IProductService.sol/IProductService.dbg.json +1 -1
 - package/artifacts/contracts/instance/service/IProductService.sol/IProductService.json +80 -14
 - package/artifacts/contracts/instance/service/PolicyService.sol/PolicyService.dbg.json +1 -1
 - package/artifacts/contracts/instance/service/PolicyService.sol/PolicyService.json +136 -65
 - package/artifacts/contracts/instance/service/PolicyServiceManager.sol/PolicyServiceManager.dbg.json +1 -1
 - package/artifacts/contracts/instance/service/PolicyServiceManager.sol/PolicyServiceManager.json +27 -19
 - package/artifacts/contracts/instance/service/PoolService.sol/PoolService.dbg.json +1 -1
 - package/artifacts/contracts/instance/service/PoolService.sol/PoolService.json +561 -51
 - package/artifacts/contracts/instance/service/PoolServiceManager.sol/PoolServiceManager.dbg.json +1 -1
 - package/artifacts/contracts/instance/service/PoolServiceManager.sol/PoolServiceManager.json +24 -12
 - package/artifacts/contracts/instance/service/ProductService.sol/ProductService.dbg.json +1 -1
 - package/artifacts/contracts/instance/service/ProductService.sol/ProductService.json +114 -51
 - package/artifacts/contracts/instance/service/ProductServiceManager.sol/ProductServiceManager.dbg.json +1 -1
 - package/artifacts/contracts/instance/service/ProductServiceManager.sol/ProductServiceManager.json +16 -12
 - package/artifacts/contracts/registry/ChainNft.sol/ChainNft.dbg.json +1 -1
 - package/artifacts/contracts/registry/ChainNft.sol/ChainNft.json +15 -2
 - package/artifacts/contracts/registry/IRegistry.sol/IRegistry.dbg.json +1 -1
 - package/artifacts/contracts/registry/IRegistry.sol/IRegistry.json +19 -0
 - package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.dbg.json +1 -1
 - package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.json +0 -24
 - package/artifacts/contracts/registry/ITransferInterceptor.sol/ITransferInterceptor.dbg.json +1 -1
 - package/artifacts/contracts/registry/ITransferInterceptor.sol/ITransferInterceptor.json +18 -0
 - package/artifacts/contracts/registry/Registry.sol/Registry.dbg.json +1 -1
 - package/artifacts/contracts/registry/Registry.sol/Registry.json +31 -12
 - package/artifacts/contracts/registry/RegistryAccessManager.sol/RegistryAccessManager.dbg.json +1 -1
 - package/artifacts/contracts/registry/RegistryAccessManager.sol/RegistryAccessManager.json +2 -2
 - package/artifacts/contracts/registry/RegistryService.sol/RegistryService.dbg.json +1 -1
 - package/artifacts/contracts/registry/RegistryService.sol/RegistryService.json +17 -36
 - package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.dbg.json +1 -1
 - package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.json +7 -7
 - package/artifacts/contracts/registry/ReleaseManager.sol/ReleaseManager.dbg.json +1 -1
 - package/artifacts/contracts/registry/ReleaseManager.sol/ReleaseManager.json +23 -11
 - package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.dbg.json +1 -1
 - package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.json +2 -2
 - package/artifacts/contracts/shared/ContractDeployerLib.sol/ContractDeployerLib.dbg.json +1 -1
 - package/artifacts/contracts/shared/ERC165.sol/ERC165.dbg.json +1 -1
 - package/artifacts/contracts/shared/INftOwnable.sol/INftOwnable.dbg.json +1 -1
 - package/artifacts/contracts/shared/IPolicyHolder.sol/IPolicyHolder.dbg.json +1 -1
 - package/artifacts/contracts/shared/IRegisterable.sol/IRegisterable.dbg.json +1 -1
 - package/artifacts/contracts/shared/IRegistryLinked.sol/IRegistryLinked.dbg.json +1 -1
 - package/artifacts/contracts/shared/IService.sol/IService.dbg.json +1 -1
 - package/artifacts/contracts/shared/IService.sol/IService.json +80 -14
 - package/artifacts/contracts/shared/IVersionable.sol/IVersionable.dbg.json +1 -1
 - package/artifacts/contracts/shared/NftOwnable.sol/NftOwnable.dbg.json +1 -1
 - package/artifacts/contracts/shared/NftOwnable.sol/NftOwnable.json +2 -2
 - package/artifacts/contracts/shared/PolicyHolder.sol/PolicyHolder.dbg.json +1 -1
 - package/artifacts/contracts/shared/PolicyHolder.sol/PolicyHolder.json +2 -2
 - package/artifacts/contracts/shared/ProxyManager.sol/ProxyManager.dbg.json +1 -1
 - package/artifacts/contracts/shared/ProxyManager.sol/ProxyManager.json +2 -2
 - package/artifacts/contracts/shared/Registerable.sol/Registerable.dbg.json +1 -1
 - package/artifacts/contracts/shared/Registerable.sol/Registerable.json +2 -2
 - package/artifacts/contracts/shared/RegistryLinked.sol/RegistryLinked.dbg.json +1 -1
 - package/artifacts/contracts/shared/RegistryLinked.sol/RegistryLinked.json +2 -2
 - package/artifacts/contracts/shared/Service.sol/Service.dbg.json +1 -1
 - package/artifacts/contracts/shared/Service.sol/Service.json +86 -15
 - package/artifacts/contracts/shared/TokenHandler.sol/TokenHandler.dbg.json +1 -1
 - package/artifacts/contracts/shared/TokenHandler.sol/TokenHandler.json +2 -2
 - package/artifacts/contracts/shared/UpgradableProxyWithAdmin.sol/UpgradableProxyWithAdmin.dbg.json +1 -1
 - package/artifacts/contracts/shared/UpgradableProxyWithAdmin.sol/UpgradableProxyWithAdmin.json +2 -2
 - package/artifacts/contracts/shared/Versionable.sol/Versionable.dbg.json +1 -1
 - package/artifacts/contracts/test/TestFee.sol/TestFee.dbg.json +1 -1
 - package/artifacts/contracts/test/TestFee.sol/TestFee.json +2 -2
 - package/artifacts/contracts/test/TestRegisterable.sol/TestRegisterable.dbg.json +1 -1
 - package/artifacts/contracts/test/TestRegisterable.sol/TestRegisterable.json +2 -2
 - package/artifacts/contracts/test/TestRoleId.sol/TestRoleId.dbg.json +1 -1
 - package/artifacts/contracts/test/TestRoleId.sol/TestRoleId.json +6 -6
 - package/artifacts/contracts/test/TestService.sol/TestService.dbg.json +1 -1
 - package/artifacts/contracts/test/TestService.sol/TestService.json +101 -26
 - package/artifacts/contracts/test/TestToken.sol/TestUsdc.dbg.json +1 -1
 - package/artifacts/contracts/test/TestVersion.sol/TestVersion.dbg.json +1 -1
 - package/artifacts/contracts/test/TestVersion.sol/TestVersion.json +2 -2
 - package/artifacts/contracts/test/TestVersionable.sol/TestVersionable.dbg.json +1 -1
 - package/artifacts/contracts/test/TestVersionable.sol/TestVersionable.json +2 -2
 - package/artifacts/contracts/test/Usdc.sol/USDC.dbg.json +1 -1
 - package/artifacts/contracts/types/AddressSet.sol/LibAddressSet.dbg.json +1 -1
 - package/artifacts/contracts/types/Amount.sol/AmountLib.dbg.json +4 -0
 - package/artifacts/contracts/types/Amount.sol/AmountLib.json +161 -0
 - package/artifacts/contracts/types/Blocknumber.sol/BlocknumberLib.dbg.json +1 -1
 - package/artifacts/contracts/types/Blocknumber.sol/BlocknumberLib.json +2 -2
 - package/artifacts/contracts/types/ChainId.sol/ChainIdLib.dbg.json +1 -1
 - package/artifacts/contracts/types/ClaimId.sol/ClaimIdLib.dbg.json +1 -1
 - package/artifacts/contracts/types/DistributorType.sol/DistributorTypeLib.dbg.json +1 -1
 - package/artifacts/contracts/types/DistributorType.sol/DistributorTypeLib.json +2 -2
 - package/artifacts/contracts/types/Fee.sol/FeeLib.dbg.json +1 -1
 - package/artifacts/contracts/types/Fee.sol/FeeLib.json +40 -9
 - package/artifacts/contracts/types/Key32.sol/Key32Lib.dbg.json +1 -1
 - package/artifacts/contracts/types/Key32.sol/Key32Lib.json +2 -2
 - package/artifacts/contracts/types/NftId.sol/NftIdLib.dbg.json +1 -1
 - package/artifacts/contracts/types/NftId.sol/NftIdLib.json +17 -4
 - package/artifacts/contracts/types/NftIdSet.sol/LibNftIdSet.dbg.json +1 -1
 - package/artifacts/contracts/types/NftIdSet.sol/LibNftIdSet.json +2 -2
 - package/artifacts/contracts/types/NumberId.sol/NumberIdLib.dbg.json +1 -1
 - package/artifacts/contracts/types/ObjectType.sol/ObjectTypeLib.dbg.json +1 -1
 - package/artifacts/contracts/types/ObjectType.sol/ObjectTypeLib.json +2 -2
 - package/artifacts/contracts/types/PayoutId.sol/PayoutIdLib.dbg.json +1 -1
 - package/artifacts/contracts/types/Referral.sol/ReferralLib.dbg.json +1 -1
 - package/artifacts/contracts/types/Referral.sol/ReferralLib.json +2 -2
 - package/artifacts/contracts/types/RiskId.sol/RiskIdLib.dbg.json +1 -1
 - package/artifacts/contracts/types/RiskId.sol/RiskIdLib.json +2 -2
 - package/artifacts/contracts/types/RoleId.sol/RoleIdLib.dbg.json +1 -1
 - package/artifacts/contracts/types/RoleId.sol/RoleIdLib.json +2 -2
 - package/artifacts/contracts/types/Seconds.sol/SecondsLib.dbg.json +1 -1
 - package/artifacts/contracts/types/StateId.sol/StateIdLib.dbg.json +1 -1
 - package/artifacts/contracts/types/StateId.sol/StateIdLib.json +2 -2
 - package/artifacts/contracts/types/Timestamp.sol/TimestampLib.dbg.json +1 -1
 - package/artifacts/contracts/types/Timestamp.sol/TimestampLib.json +2 -2
 - package/artifacts/contracts/types/UFixed.sol/MathLib.dbg.json +1 -1
 - package/artifacts/contracts/types/UFixed.sol/MathLib.json +2 -2
 - package/artifacts/contracts/types/UFixed.sol/UFixedLib.dbg.json +1 -1
 - package/artifacts/contracts/types/UFixed.sol/UFixedLib.json +2 -2
 - package/artifacts/contracts/types/Version.sol/VersionLib.dbg.json +1 -1
 - package/artifacts/contracts/types/Version.sol/VersionLib.json +2 -2
 - package/artifacts/contracts/types/Version.sol/VersionPartLib.dbg.json +1 -1
 - package/artifacts/contracts/types/Version.sol/VersionPartLib.json +2 -2
 - package/contracts/components/Component.sol +42 -10
 - package/contracts/components/IComponent.sol +9 -1
 - package/contracts/components/IPoolComponent.sol +5 -43
 - package/contracts/components/Pool.sol +47 -122
 - package/contracts/components/Product.sol +4 -0
 - package/contracts/instance/AccessManagerUpgradeableInitializeable.sol +13 -0
 - package/contracts/instance/BundleManager.sol +6 -4
 - package/contracts/instance/Cloneable.sol +7 -2
 - package/contracts/instance/IInstance.sol +23 -55
 - package/contracts/instance/IInstanceService.sol +31 -6
 - package/contracts/instance/Instance.sol +90 -182
 - package/contracts/instance/InstanceAccessManager.sol +402 -159
 - package/contracts/instance/InstanceReader.sol +12 -12
 - package/contracts/instance/InstanceService.sol +287 -246
 - package/contracts/instance/InstanceStore.sol +219 -0
 - package/contracts/instance/ObjectManager.sol +6 -8
 - package/contracts/instance/base/ComponentService.sol +17 -30
 - package/contracts/instance/base/KeyValueStore.sol +13 -5
 - package/contracts/instance/base/Lifecycle.sol +11 -2
 - package/contracts/instance/module/IAccess.sol +21 -14
 - package/contracts/instance/module/IBundle.sol +6 -4
 - package/contracts/instance/module/IComponents.sol +41 -0
 - package/contracts/instance/module/ISetup.sol +3 -16
 - package/contracts/instance/service/ApplicationService.sol +18 -16
 - package/contracts/instance/service/BundleService.sol +213 -81
 - package/contracts/instance/service/ClaimService.sol +3 -3
 - package/contracts/instance/service/DistributionService.sol +57 -70
 - package/contracts/instance/service/IBundleService.sol +63 -25
 - package/contracts/instance/service/IDistributionService.sol +1 -0
 - package/contracts/instance/service/IPoolService.sol +82 -3
 - package/contracts/instance/service/PolicyService.sol +68 -100
 - package/contracts/instance/service/PoolService.sol +214 -20
 - package/contracts/instance/service/ProductService.sol +34 -58
 - package/contracts/registry/ChainNft.sol +8 -0
 - package/contracts/registry/IRegistry.sol +2 -0
 - package/contracts/registry/IRegistryService.sol +4 -3
 - package/contracts/registry/ITransferInterceptor.sol +1 -0
 - package/contracts/registry/Registry.sol +23 -20
 - package/contracts/registry/RegistryService.sol +10 -11
 - package/contracts/registry/ReleaseManager.sol +20 -18
 - package/contracts/shared/IService.sol +4 -6
 - package/contracts/shared/Service.sol +21 -7
 - package/contracts/shared/TokenHandler.sol +11 -5
 - package/contracts/test/TestService.sol +1 -1
 - package/contracts/types/Amount.sol +60 -0
 - package/contracts/types/Blocknumber.sol +1 -0
 - package/contracts/types/Fee.sol +13 -5
 - package/contracts/types/NftId.sol +8 -0
 - package/contracts/types/ObjectType.sol +1 -0
 - package/contracts/types/RoleId.sol +6 -4
 - package/contracts/types/StateId.sol +1 -0
 - package/contracts/types/Timestamp.sol +1 -0
 - package/contracts/types/UFixed.sol +1 -0
 - package/contracts/types/Version.sol +1 -0
 - package/package.json +1 -1
 
| 
         @@ -10,10 +10,11 @@ import {IPolicy} from "../module/IPolicy.sol"; 
     | 
|
| 
       10 
10 
     | 
    
         | 
| 
       11 
11 
     | 
    
         
             
            import {NftId, NftIdLib, zeroNftId} from "../../types/NftId.sol";
         
     | 
| 
       12 
12 
     | 
    
         
             
            import {Fee, FeeLib} from "../../types/Fee.sol";
         
     | 
| 
       13 
     | 
    
         
            -
            import {DISTRIBUTION_OWNER_ROLE} from "../../types/RoleId.sol";
         
     | 
| 
      
 13 
     | 
    
         
            +
            import {PRODUCT_SERVICE_ROLE, DISTRIBUTION_OWNER_ROLE} from "../../types/RoleId.sol";
         
     | 
| 
       14 
14 
     | 
    
         
             
            import {KEEP_STATE} from "../../types/StateId.sol";
         
     | 
| 
       15 
15 
     | 
    
         
             
            import {ObjectType, DISTRIBUTION, INSTANCE, DISTRIBUTION, DISTRIBUTOR} from "../../types/ObjectType.sol";
         
     | 
| 
       16 
16 
     | 
    
         
             
            import {Version, VersionLib} from "../../types/Version.sol";
         
     | 
| 
      
 17 
     | 
    
         
            +
            import {RoleId} from "../../types/RoleId.sol";
         
     | 
| 
       17 
18 
     | 
    
         | 
| 
       18 
19 
     | 
    
         
             
            import {IVersionable} from "../../shared/IVersionable.sol";
         
     | 
| 
       19 
20 
     | 
    
         
             
            import {Versionable} from "../../shared/Versionable.sol";
         
     | 
| 
         @@ -32,6 +33,7 @@ import {ReferralId, ReferralStatus, ReferralLib} from "../../types/Referral.sol" 
     | 
|
| 
       32 
33 
     | 
    
         
             
            import {Timestamp, TimestampLib, zeroTimestamp} from "../../types/Timestamp.sol";
         
     | 
| 
       33 
34 
     | 
    
         
             
            import {Key32} from "../../types/Key32.sol";
         
     | 
| 
       34 
35 
     | 
    
         
             
            import {IDistribution} from "../module/IDistribution.sol";
         
     | 
| 
      
 36 
     | 
    
         
            +
            import {InstanceStore} from "../InstanceStore.sol";
         
     | 
| 
       35 
37 
     | 
    
         | 
| 
       36 
38 
     | 
    
         | 
| 
       37 
39 
     | 
    
         
             
            contract DistributionService is
         
     | 
| 
         @@ -59,11 +61,11 @@ contract DistributionService is 
     | 
|
| 
       59 
61 
     | 
    
         
             
                    (registryAddress, initialOwner) = abi.decode(data, (address, address));
         
     | 
| 
       60 
62 
     | 
    
         
             
                    // TODO while DistributionService is not deployed in DistributionServiceManager constructor
         
     | 
| 
       61 
63 
     | 
    
         
             
                    //      owner is DistributionServiceManager deployer
         
     | 
| 
       62 
     | 
    
         
            -
                    initializeService(registryAddress, owner);
         
     | 
| 
      
 64 
     | 
    
         
            +
                    initializeService(registryAddress, address(0), owner);
         
     | 
| 
       63 
65 
     | 
    
         
             
                    registerInterface(type(IDistributionService).interfaceId);
         
     | 
| 
       64 
66 
     | 
    
         
             
                }
         
     | 
| 
       65 
67 
     | 
    
         | 
| 
       66 
     | 
    
         
            -
                function getDomain() public pure override 
     | 
| 
      
 68 
     | 
    
         
            +
                function getDomain() public pure override returns(ObjectType) {
         
     | 
| 
       67 
69 
     | 
    
         
             
                    return DISTRIBUTION();
         
     | 
| 
       68 
70 
     | 
    
         
             
                }
         
     | 
| 
       69 
71 
     | 
    
         | 
| 
         @@ -86,9 +88,25 @@ contract DistributionService is 
     | 
|
| 
       86 
88 
     | 
    
         
             
                    distribution.linkToRegisteredNftId();
         
     | 
| 
       87 
89 
     | 
    
         
             
                    distributionNftId = distributionInfo.nftId;
         
     | 
| 
       88 
90 
     | 
    
         | 
| 
       89 
     | 
    
         
            -
                    instance.createDistributionSetup(distributionNftId, distribution.getSetupInfo());
         
     | 
| 
       90 
     | 
    
         
            -
                     
     | 
| 
       91 
     | 
    
         
            -
                     
     | 
| 
      
 91 
     | 
    
         
            +
                    instance.getInstanceStore().createDistributionSetup(distributionNftId, distribution.getSetupInfo());
         
     | 
| 
      
 92 
     | 
    
         
            +
                    // TODO move to distribution?
         
     | 
| 
      
 93 
     | 
    
         
            +
                    bytes4[][] memory selectors = new bytes4[][](2);
         
     | 
| 
      
 94 
     | 
    
         
            +
                    selectors[0] = new bytes4[](1);
         
     | 
| 
      
 95 
     | 
    
         
            +
                    selectors[1] = new bytes4[](2);
         
     | 
| 
      
 96 
     | 
    
         
            +
             
     | 
| 
      
 97 
     | 
    
         
            +
                    selectors[0][0] = IDistributionComponent.setFees.selector;
         
     | 
| 
      
 98 
     | 
    
         
            +
                    selectors[1][0] = IDistributionComponent.processRenewal.selector;
         
     | 
| 
      
 99 
     | 
    
         
            +
             
     | 
| 
      
 100 
     | 
    
         
            +
                    RoleId[] memory roles = new RoleId[](2);
         
     | 
| 
      
 101 
     | 
    
         
            +
                    roles[0] = DISTRIBUTION_OWNER_ROLE();
         
     | 
| 
      
 102 
     | 
    
         
            +
                    roles[1] = PRODUCT_SERVICE_ROLE();
         
     | 
| 
      
 103 
     | 
    
         
            +
             
     | 
| 
      
 104 
     | 
    
         
            +
                    getInstanceService().createGifTarget(
         
     | 
| 
      
 105 
     | 
    
         
            +
                        instanceNftId, 
         
     | 
| 
      
 106 
     | 
    
         
            +
                        distributionAddress, 
         
     | 
| 
      
 107 
     | 
    
         
            +
                        distribution.getName(), 
         
     | 
| 
      
 108 
     | 
    
         
            +
                        selectors, 
         
     | 
| 
      
 109 
     | 
    
         
            +
                        roles);
         
     | 
| 
       92 
110 
     | 
    
         
             
                }
         
     | 
| 
       93 
111 
     | 
    
         | 
| 
       94 
112 
     | 
    
         
             
                function setFees(
         
     | 
| 
         @@ -102,15 +120,14 @@ contract DistributionService is 
     | 
|
| 
       102 
120 
     | 
    
         
             
                        revert ErrorIDistributionServiceMinFeeTooHigh(minDistributionOwnerFee.fractionalFee.toInt(), distributionFee.fractionalFee.toInt());
         
     | 
| 
       103 
121 
     | 
    
         
             
                    }
         
     | 
| 
       104 
122 
     | 
    
         | 
| 
       105 
     | 
    
         
            -
                    (IRegistry.ObjectInfo memory info , IInstance instance) = _getAndVerifyComponentInfoAndInstance(DISTRIBUTION());
         
     | 
| 
      
 123 
     | 
    
         
            +
                    (NftId distributionNftId, IRegistry.ObjectInfo memory info , IInstance instance) = _getAndVerifyComponentInfoAndInstance(DISTRIBUTION());
         
     | 
| 
       106 
124 
     | 
    
         
             
                    InstanceReader instanceReader = instance.getInstanceReader();
         
     | 
| 
       107 
     | 
    
         
            -
                    NftId distributionNftId = info.nftId;
         
     | 
| 
       108 
125 
     | 
    
         | 
| 
       109 
126 
     | 
    
         
             
                    ISetup.DistributionSetupInfo memory distSetupInfo = instanceReader.getDistributionSetupInfo(distributionNftId);
         
     | 
| 
       110 
127 
     | 
    
         
             
                    distSetupInfo.minDistributionOwnerFee = minDistributionOwnerFee;
         
     | 
| 
       111 
128 
     | 
    
         
             
                    distSetupInfo.distributionFee = distributionFee;
         
     | 
| 
       112 
129 
     | 
    
         | 
| 
       113 
     | 
    
         
            -
                    instance.updateDistributionSetup(distributionNftId, distSetupInfo, KEEP_STATE());
         
     | 
| 
      
 130 
     | 
    
         
            +
                    instance.getInstanceStore().updateDistributionSetup(distributionNftId, distSetupInfo, KEEP_STATE());
         
     | 
| 
       114 
131 
     | 
    
         
             
                }
         
     | 
| 
       115 
132 
     | 
    
         | 
| 
       116 
133 
     | 
    
         
             
                function createDistributorType(
         
     | 
| 
         @@ -127,7 +144,7 @@ contract DistributionService is 
     | 
|
| 
       127 
144 
     | 
    
         
             
                    external
         
     | 
| 
       128 
145 
     | 
    
         
             
                    returns (DistributorType distributorType)
         
     | 
| 
       129 
146 
     | 
    
         
             
                {
         
     | 
| 
       130 
     | 
    
         
            -
                    ( 
     | 
| 
      
 147 
     | 
    
         
            +
                    (NftId distributionNftId, IInstance instance) = _getAndVerifyCallingDistribution();
         
     | 
| 
       131 
148 
     | 
    
         | 
| 
       132 
149 
     | 
    
         
             
                    {
         
     | 
| 
       133 
150 
     | 
    
         
             
                        ISetup.DistributionSetupInfo memory setupInfo = instance.getInstanceReader().getDistributionSetupInfo(distributionNftId);
         
     | 
| 
         @@ -141,7 +158,7 @@ contract DistributionService is 
     | 
|
| 
       141 
158 
     | 
    
         
             
                    distributorType = DistributorTypeLib.toDistributorType(distributionNftId, name);
         
     | 
| 
       142 
159 
     | 
    
         
             
                    Key32 key32 = distributorType.toKey32();
         
     | 
| 
       143 
160 
     | 
    
         | 
| 
       144 
     | 
    
         
            -
                    if(!instance.exists(key32)) {
         
     | 
| 
      
 161 
     | 
    
         
            +
                    if(!instance.getInstanceStore().exists(key32)) {
         
     | 
| 
       145 
162 
     | 
    
         
             
                        IDistribution.DistributorTypeInfo memory info = IDistribution.DistributorTypeInfo(
         
     | 
| 
       146 
163 
     | 
    
         
             
                            name,
         
     | 
| 
       147 
164 
     | 
    
         
             
                            minDiscountPercentage,
         
     | 
| 
         @@ -153,7 +170,7 @@ contract DistributionService is 
     | 
|
| 
       153 
170 
     | 
    
         
             
                            allowRenewals,
         
     | 
| 
       154 
171 
     | 
    
         
             
                            data);
         
     | 
| 
       155 
172 
     | 
    
         | 
| 
       156 
     | 
    
         
            -
                        instance.createDistributorType(key32, info);
         
     | 
| 
      
 173 
     | 
    
         
            +
                        instance.getInstanceStore().createDistributorType(key32, info);
         
     | 
| 
       157 
174 
     | 
    
         
             
                    }
         
     | 
| 
       158 
175 
     | 
    
         
             
                }
         
     | 
| 
       159 
176 
     | 
    
         | 
| 
         @@ -163,7 +180,7 @@ contract DistributionService is 
     | 
|
| 
       163 
180 
     | 
    
         
             
                    bytes memory data
         
     | 
| 
       164 
181 
     | 
    
         
             
                ) external returns (NftId distributorNftId)
         
     | 
| 
       165 
182 
     | 
    
         
             
                {
         
     | 
| 
       166 
     | 
    
         
            -
                    ( 
     | 
| 
      
 183 
     | 
    
         
            +
                    (NftId distributionNftId, IInstance instance) = _getAndVerifyCallingDistribution();
         
     | 
| 
       167 
184 
     | 
    
         | 
| 
       168 
185 
     | 
    
         
             
                    distributorNftId = getRegistryService().registerDistributor(
         
     | 
| 
       169 
186 
     | 
    
         
             
                        IRegistry.ObjectInfo(
         
     | 
| 
         @@ -183,7 +200,7 @@ contract DistributionService is 
     | 
|
| 
       183 
200 
     | 
    
         
             
                        0,
         
     | 
| 
       184 
201 
     | 
    
         
             
                        0);
         
     | 
| 
       185 
202 
     | 
    
         | 
| 
       186 
     | 
    
         
            -
                    instance.createDistributor(distributorNftId, info);
         
     | 
| 
      
 203 
     | 
    
         
            +
                    instance.getInstanceStore().createDistributor(distributorNftId, info);
         
     | 
| 
       187 
204 
     | 
    
         
             
                }
         
     | 
| 
       188 
205 
     | 
    
         | 
| 
       189 
206 
     | 
    
         
             
                function updateDistributorType(
         
     | 
| 
         @@ -192,12 +209,12 @@ contract DistributionService is 
     | 
|
| 
       192 
209 
     | 
    
         
             
                    bytes memory data
         
     | 
| 
       193 
210 
     | 
    
         
             
                ) external virtual
         
     | 
| 
       194 
211 
     | 
    
         
             
                {
         
     | 
| 
       195 
     | 
    
         
            -
                    ( 
     | 
| 
      
 212 
     | 
    
         
            +
                    (, IInstance instance) = _getAndVerifyCallingDistribution();
         
     | 
| 
       196 
213 
     | 
    
         
             
                    InstanceReader instanceReader = instance.getInstanceReader();
         
     | 
| 
       197 
214 
     | 
    
         
             
                    IDistribution.DistributorInfo memory distributorInfo = instanceReader.getDistributorInfo(distributorNftId);
         
     | 
| 
       198 
215 
     | 
    
         
             
                    distributorInfo.distributorType = distributorType;
         
     | 
| 
       199 
216 
     | 
    
         
             
                    distributorInfo.data = data;
         
     | 
| 
       200 
     | 
    
         
            -
                    instance.updateDistributor(distributorNftId, distributorInfo, KEEP_STATE());
         
     | 
| 
      
 217 
     | 
    
         
            +
                    instance.getInstanceStore().updateDistributor(distributorNftId, distributorInfo, KEEP_STATE());
         
     | 
| 
       201 
218 
     | 
    
         
             
                }
         
     | 
| 
       202 
219 
     | 
    
         | 
| 
       203 
220 
     | 
    
         | 
| 
         @@ -213,7 +230,7 @@ contract DistributionService is 
     | 
|
| 
       213 
230 
     | 
    
         
             
                    virtual
         
     | 
| 
       214 
231 
     | 
    
         
             
                    returns (ReferralId referralId)
         
     | 
| 
       215 
232 
     | 
    
         
             
                {
         
     | 
| 
       216 
     | 
    
         
            -
                    ( 
     | 
| 
      
 233 
     | 
    
         
            +
                    (NftId distributionNftId, IInstance instance) = _getAndVerifyCallingDistribution();
         
     | 
| 
       217 
234 
     | 
    
         | 
| 
       218 
235 
     | 
    
         
             
                    if (bytes(code).length == 0) {
         
     | 
| 
       219 
236 
     | 
    
         
             
                        revert ErrorIDistributionServiceInvalidReferral(code);
         
     | 
| 
         @@ -251,7 +268,7 @@ contract DistributionService is 
     | 
|
| 
       251 
268 
     | 
    
         
             
                        data
         
     | 
| 
       252 
269 
     | 
    
         
             
                    );
         
     | 
| 
       253 
270 
     | 
    
         | 
| 
       254 
     | 
    
         
            -
                    instance.createReferral(referralId.toKey32(), info);
         
     | 
| 
      
 271 
     | 
    
         
            +
                    instance.getInstanceStore().createReferral(referralId.toKey32(), info);
         
     | 
| 
       255 
272 
     | 
    
         
             
                    return referralId;
         
     | 
| 
       256 
273 
     | 
    
         
             
                }
         
     | 
| 
       257 
274 
     | 
    
         | 
| 
         @@ -271,8 +288,9 @@ contract DistributionService is 
     | 
|
| 
       271 
288 
     | 
    
         
             
                        revert ErrorIDistributionServiceReferralInvalid(distributionNftId, referralId);
         
     | 
| 
       272 
289 
     | 
    
         
             
                    }
         
     | 
| 
       273 
290 
     | 
    
         | 
| 
       274 
     | 
    
         
            -
                     
     | 
| 
      
 291 
     | 
    
         
            +
                    IInstance instance = _getInstanceForDistribution(distributionNftId);
         
     | 
| 
       275 
292 
     | 
    
         
             
                    InstanceReader reader = instance.getInstanceReader();
         
     | 
| 
      
 293 
     | 
    
         
            +
                    InstanceStore store = instance.getInstanceStore();
         
     | 
| 
       276 
294 
     | 
    
         
             
                    IDistribution.ReferralInfo memory referralInfo = reader.getReferralInfo(referralId);
         
     | 
| 
       277 
295 
     | 
    
         
             
                    IDistribution.DistributorInfo memory distributorInfo = reader.getDistributorInfo(referralInfo.distributorNftId);
         
     | 
| 
       278 
296 
     | 
    
         
             
                    ISetup.DistributionSetupInfo memory setupInfo = reader.getDistributionSetupInfo(distributionNftId);
         
     | 
| 
         @@ -287,17 +305,17 @@ contract DistributionService is 
     | 
|
| 
       287 
305 
     | 
    
         | 
| 
       288 
306 
     | 
    
         
             
                    if (distributionOwnerFee > 0) {
         
     | 
| 
       289 
307 
     | 
    
         
             
                        setupInfo.sumDistributionOwnerFees += distributionOwnerFee;
         
     | 
| 
       290 
     | 
    
         
            -
                         
     | 
| 
      
 308 
     | 
    
         
            +
                        store.updateDistributionSetup(distributionNftId, setupInfo, KEEP_STATE());
         
     | 
| 
       291 
309 
     | 
    
         
             
                    }
         
     | 
| 
       292 
310 
     | 
    
         | 
| 
       293 
311 
     | 
    
         
             
                    if (isReferral) {
         
     | 
| 
       294 
312 
     | 
    
         
             
                        referralInfo.usedReferrals += 1;
         
     | 
| 
       295 
     | 
    
         
            -
                         
     | 
| 
      
 313 
     | 
    
         
            +
                        store.updateReferral(referralId.toKey32(), referralInfo, KEEP_STATE());
         
     | 
| 
       296 
314 
     | 
    
         | 
| 
       297 
315 
     | 
    
         
             
                        if (commissionAmount > 0) {
         
     | 
| 
       298 
316 
     | 
    
         
             
                            distributorInfo.sumCommisions += commissionAmount;
         
     | 
| 
       299 
317 
     | 
    
         
             
                            distributorInfo.numPoliciesSold += 1;
         
     | 
| 
       300 
     | 
    
         
            -
                             
     | 
| 
      
 318 
     | 
    
         
            +
                            store.updateDistributor(referralInfo.distributorNftId, distributorInfo, KEEP_STATE());
         
     | 
| 
       301 
319 
     | 
    
         
             
                        }
         
     | 
| 
       302 
320 
     | 
    
         
             
                    }
         
     | 
| 
       303 
321 
     | 
    
         
             
                }
         
     | 
| 
         @@ -312,7 +330,7 @@ contract DistributionService is 
     | 
|
| 
       312 
330 
     | 
    
         
             
                    view 
         
     | 
| 
       313 
331 
     | 
    
         
             
                    returns (IPolicy.Premium memory finalPremium)
         
     | 
| 
       314 
332 
     | 
    
         
             
                {
         
     | 
| 
       315 
     | 
    
         
            -
                     
     | 
| 
      
 333 
     | 
    
         
            +
                    IInstance instance = _getInstanceForDistribution(distributionNftId);
         
     | 
| 
       316 
334 
     | 
    
         
             
                    InstanceReader reader = instance.getInstanceReader();
         
     | 
| 
       317 
335 
     | 
    
         | 
| 
       318 
336 
     | 
    
         
             
                    // first calculate all fixed and variable fees for the distribution - this will defined the fullPremium
         
     | 
| 
         @@ -373,7 +391,7 @@ contract DistributionService is 
     | 
|
| 
       373 
391 
     | 
    
         | 
| 
       374 
392 
     | 
    
         
             
                // TODO: zero should return false
         
     | 
| 
       375 
393 
     | 
    
         
             
                function referralIsValid(NftId distributionNftId, ReferralId referralId) public view returns (bool isValid) {
         
     | 
| 
       376 
     | 
    
         
            -
                     
     | 
| 
      
 394 
     | 
    
         
            +
                    IInstance instance = _getInstanceForDistribution(distributionNftId);
         
     | 
| 
       377 
395 
     | 
    
         
             
                    IDistribution.ReferralInfo memory info = instance.getInstanceReader().getReferralInfo(referralId);
         
     | 
| 
       378 
396 
     | 
    
         | 
| 
       379 
397 
     | 
    
         
             
                    if (info.distributorNftId.eqz()) {
         
     | 
| 
         @@ -388,63 +406,32 @@ contract DistributionService is 
     | 
|
| 
       388 
406 
     | 
    
         
             
                    internal
         
     | 
| 
       389 
407 
     | 
    
         
             
                    view
         
     | 
| 
       390 
408 
     | 
    
         
             
                    returns(
         
     | 
| 
       391 
     | 
    
         
            -
                        address distributionAddress,
         
     | 
| 
       392 
409 
     | 
    
         
             
                        NftId distributionNftId,
         
     | 
| 
       393 
410 
     | 
    
         
             
                        IInstance instance
         
     | 
| 
       394 
411 
     | 
    
         
             
                    )
         
     | 
| 
       395 
412 
     | 
    
         
             
                {
         
     | 
| 
       396 
     | 
    
         
            -
                     
     | 
| 
       397 
     | 
    
         
            -
                    (
         
     | 
| 
       398 
     | 
    
         
            -
                         
     | 
| 
       399 
     | 
    
         
            -
                        distributionNftId,
         
     | 
| 
       400 
     | 
    
         
            -
                        objectType,
         
     | 
| 
       401 
     | 
    
         
            -
                        instance
         
     | 
| 
       402 
     | 
    
         
            -
                    ) = _getAndVerifyCaller();
         
     | 
| 
       403 
     | 
    
         
            -
             
     | 
| 
       404 
     | 
    
         
            -
                    if(objectType != DISTRIBUTION()) {
         
     | 
| 
       405 
     | 
    
         
            -
                        revert ErrorIDistributionServiceCallerNotDistributor(msg.sender);
         
     | 
| 
      
 413 
     | 
    
         
            +
                    distributionNftId = getRegistry().getNftId(msg.sender);
         
     | 
| 
      
 414 
     | 
    
         
            +
                    if (distributionNftId.eqz()) {
         
     | 
| 
      
 415 
     | 
    
         
            +
                        revert ErrorDistributionServiceCallerNotRegistered(msg.sender);
         
     | 
| 
       406 
416 
     | 
    
         
             
                    }
         
     | 
| 
       407 
     | 
    
         
            -
                }
         
     | 
| 
       408 
417 
     | 
    
         | 
| 
       409 
     | 
    
         
            -
                function _getAndVerifyDistribution(NftId distributionNftId)
         
     | 
| 
       410 
     | 
    
         
            -
                    internal
         
     | 
| 
       411 
     | 
    
         
            -
                    view
         
     | 
| 
       412 
     | 
    
         
            -
                    returns(
         
     | 
| 
       413 
     | 
    
         
            -
                        address distributionAddress,
         
     | 
| 
       414 
     | 
    
         
            -
                        IInstance instance
         
     | 
| 
       415 
     | 
    
         
            -
                    )
         
     | 
| 
       416 
     | 
    
         
            -
                {
         
     | 
| 
       417 
418 
     | 
    
         
             
                    IRegistry.ObjectInfo memory info = getRegistry().getObjectInfo(distributionNftId);
         
     | 
| 
       418 
     | 
    
         
            -
                     
     | 
| 
       419 
     | 
    
         
            -
             
     | 
| 
       420 
     | 
    
         
            -
                        revert ErrorIDistributionServiceParentNftIdNotInstance(distributionNftId, info.parentNftId);
         
     | 
| 
      
 419 
     | 
    
         
            +
                    if(info.objectType != DISTRIBUTION()) {
         
     | 
| 
      
 420 
     | 
    
         
            +
                        revert ErrorIDistributionServiceCallerNotDistributor(msg.sender);
         
     | 
| 
       421 
421 
     | 
    
         
             
                    }
         
     | 
| 
       422 
     | 
    
         
            -
             
     | 
| 
      
 422 
     | 
    
         
            +
             
     | 
| 
      
 423 
     | 
    
         
            +
                    address instanceAddress = getRegistry().getObjectInfo(info.parentNftId).objectAddress;
         
     | 
| 
      
 424 
     | 
    
         
            +
                    instance = IInstance(instanceAddress);
         
     | 
| 
       423 
425 
     | 
    
         
             
                }
         
     | 
| 
       424 
426 
     | 
    
         | 
| 
       425 
     | 
    
         
            -
             
     | 
| 
      
 427 
     | 
    
         
            +
             
     | 
| 
      
 428 
     | 
    
         
            +
                function _getInstanceForDistribution(NftId distributionNftId)
         
     | 
| 
       426 
429 
     | 
    
         
             
                    internal
         
     | 
| 
       427 
430 
     | 
    
         
             
                    view
         
     | 
| 
       428 
     | 
    
         
            -
                    returns(
         
     | 
| 
       429 
     | 
    
         
            -
                        address objectAddress,
         
     | 
| 
       430 
     | 
    
         
            -
                        NftId objectNftId,
         
     | 
| 
       431 
     | 
    
         
            -
                        ObjectType objectType,
         
     | 
| 
       432 
     | 
    
         
            -
                        IInstance instance
         
     | 
| 
       433 
     | 
    
         
            -
                    )
         
     | 
| 
      
 431 
     | 
    
         
            +
                    returns(IInstance instance)
         
     | 
| 
       434 
432 
     | 
    
         
             
                {
         
     | 
| 
       435 
     | 
    
         
            -
                     
     | 
| 
       436 
     | 
    
         
            -
                     
     | 
| 
       437 
     | 
    
         
            -
                     
     | 
| 
       438 
     | 
    
         
            -
                        revert ErrorIServiceCallerUnknown(objectAddress);
         
     | 
| 
       439 
     | 
    
         
            -
                    }
         
     | 
| 
       440 
     | 
    
         
            -
                    IRegistry.ObjectInfo memory info = getRegistry().getObjectInfo(objectNftId);
         
     | 
| 
       441 
     | 
    
         
            -
                    objectType = info.objectType;
         
     | 
| 
       442 
     | 
    
         
            -
             
     | 
| 
       443 
     | 
    
         
            -
                    IRegistry.ObjectInfo memory parentInfo = getRegistry().getObjectInfo(info.parentNftId);
         
     | 
| 
       444 
     | 
    
         
            -
                    if (parentInfo.objectType != INSTANCE()) {
         
     | 
| 
       445 
     | 
    
         
            -
                        revert ErrorIDistributionServiceParentNftIdNotInstance(objectNftId, info.parentNftId);
         
     | 
| 
       446 
     | 
    
         
            -
                    }
         
     | 
| 
       447 
     | 
    
         
            -
                    instance = IInstance(parentInfo.objectAddress);
         
     | 
| 
      
 433 
     | 
    
         
            +
                    NftId instanceNftId = getRegistry().getObjectInfo(distributionNftId).parentNftId;
         
     | 
| 
      
 434 
     | 
    
         
            +
                    address instanceAddress = getRegistry().getObjectInfo(instanceNftId).objectAddress;
         
     | 
| 
      
 435 
     | 
    
         
            +
                    return IInstance(instanceAddress);
         
     | 
| 
       448 
436 
     | 
    
         
             
                }
         
     | 
| 
       449 
     | 
    
         
            -
             
     | 
| 
       450 
     | 
    
         
            -
            }
         
     | 
| 
      
 437 
     | 
    
         
            +
            }
         
     | 
| 
         @@ -1,6 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            // SPDX-License-Identifier: Apache-2.0
         
     | 
| 
       2 
2 
     | 
    
         
             
            pragma solidity ^0.8.19;
         
     | 
| 
       3 
3 
     | 
    
         | 
| 
      
 4 
     | 
    
         
            +
            import {Amount} from "../../types/Amount.sol";
         
     | 
| 
       4 
5 
     | 
    
         
             
            import {NftId} from "../../types/NftId.sol";
         
     | 
| 
       5 
6 
     | 
    
         
             
            import {Fee} from "../../types/Fee.sol";
         
     | 
| 
       6 
7 
     | 
    
         
             
            import {IService} from "../../shared/IService.sol";
         
     | 
| 
         @@ -8,48 +9,85 @@ import {IBundle} from "../module/IBundle.sol"; 
     | 
|
| 
       8 
9 
     | 
    
         
             
            import {IInstance} from "../../instance/IInstance.sol";
         
     | 
| 
       9 
10 
     | 
    
         
             
            import {Seconds} from "../../types/Seconds.sol";
         
     | 
| 
       10 
11 
     | 
    
         
             
            import {StateId} from "../../types/StateId.sol";
         
     | 
| 
      
 12 
     | 
    
         
            +
            import {Timestamp} from "../../types/Timestamp.sol";
         
     | 
| 
       11 
13 
     | 
    
         | 
| 
       12 
14 
     | 
    
         
             
            interface IBundleService is IService {
         
     | 
| 
       13 
     | 
    
         
            -
                error ErrorIBundleServiceInsufficientAllowance(address bundleOwner, address tokenHandlerAddress, uint256 amount);
         
     | 
| 
       14 
15 
     | 
    
         | 
| 
       15 
     | 
    
         
            -
                 
     | 
| 
       16 
     | 
    
         
            -
             
     | 
| 
       17 
     | 
    
         
            -
                    Fee memory fee, 
         
     | 
| 
       18 
     | 
    
         
            -
                    uint256 amount,
         
     | 
| 
       19 
     | 
    
         
            -
                    Seconds lifetime, 
         
     | 
| 
       20 
     | 
    
         
            -
                    bytes calldata filter
         
     | 
| 
       21 
     | 
    
         
            -
                ) external returns(NftId bundleNftId);
         
     | 
| 
      
 16 
     | 
    
         
            +
                event LogBundleServiceBundleActivated(NftId bundleNftId);
         
     | 
| 
      
 17 
     | 
    
         
            +
                event LogBundleServiceBundleLocked(NftId bundleNftId);
         
     | 
| 
       22 
18 
     | 
    
         | 
| 
       23 
     | 
    
         
            -
                 
     | 
| 
      
 19 
     | 
    
         
            +
                error ErrorBundleServiceInsufficientAllowance(address bundleOwner, address tokenHandlerAddress, uint256 amount);
         
     | 
| 
      
 20 
     | 
    
         
            +
                error ErrorBundleServiceBundleNotOpen(NftId bundleNftId, StateId state, Timestamp expiredAt);
         
     | 
| 
      
 21 
     | 
    
         
            +
                error ErrorBundleServiceCapacityInsufficient(NftId bundleNftId, uint capacityAmount, uint collateralAmount);
         
     | 
| 
      
 22 
     | 
    
         
            +
                error ErrorBundleServiceBundleWithOpenPolicies(NftId bundleNftId, uint256 openPoliciesCount);
         
     | 
| 
      
 23 
     | 
    
         
            +
             
     | 
| 
      
 24 
     | 
    
         
            +
                /// @dev create a new bundle for the specified attributes
         
     | 
| 
      
 25 
     | 
    
         
            +
                /// may only be called by pool service
         
     | 
| 
      
 26 
     | 
    
         
            +
                function create(
         
     | 
| 
      
 27 
     | 
    
         
            +
                    IInstance instance, // instance relevant for bundle
         
     | 
| 
      
 28 
     | 
    
         
            +
                    NftId poolNftId, // the pool the bundle will be linked to
         
     | 
| 
      
 29 
     | 
    
         
            +
                    address owner, // initial bundle owner
         
     | 
| 
      
 30 
     | 
    
         
            +
                    Fee memory fee, // fees deducted from premium that go to bundle owner
         
     | 
| 
      
 31 
     | 
    
         
            +
                    Amount stakingAmount, // staking amount - staking fees result in initial bundle capital
         
     | 
| 
      
 32 
     | 
    
         
            +
                    Seconds lifetime, // initial duration for which new policies are covered
         
     | 
| 
      
 33 
     | 
    
         
            +
                    bytes calldata filter // optional use case specific criteria that define if a policy may be covered by this bundle
         
     | 
| 
      
 34 
     | 
    
         
            +
                )
         
     | 
| 
      
 35 
     | 
    
         
            +
                    external 
         
     | 
| 
      
 36 
     | 
    
         
            +
                    returns(NftId bundleNftId); // the nft id of the newly created bundle
         
     | 
| 
      
 37 
     | 
    
         
            +
             
     | 
| 
      
 38 
     | 
    
         
            +
                /// @dev locks the specified bundle, locked bundles are not available to collateralize new policies
         
     | 
| 
      
 39 
     | 
    
         
            +
                /// only active bundles may be locked
         
     | 
| 
      
 40 
     | 
    
         
            +
                /// may only be called by registered and unlocked pool components
         
     | 
| 
      
 41 
     | 
    
         
            +
                function lock(NftId bundleNftId) external;
         
     | 
| 
      
 42 
     | 
    
         
            +
             
     | 
| 
      
 43 
     | 
    
         
            +
                /// @dev activates the specified bundle
         
     | 
| 
      
 44 
     | 
    
         
            +
                /// only locked bundles may be unlocked
         
     | 
| 
      
 45 
     | 
    
         
            +
                /// may only be called by registered and unlocked pool components
         
     | 
| 
      
 46 
     | 
    
         
            +
                function unlock(NftId bundleNftId) external;
         
     | 
| 
      
 47 
     | 
    
         
            +
             
     | 
| 
      
 48 
     | 
    
         
            +
                /// @dev closes the specified bundle
         
     | 
| 
      
 49 
     | 
    
         
            +
                /// only open bundles (active or locked) may be closed
         
     | 
| 
      
 50 
     | 
    
         
            +
                /// to close a bundle it may not have any non-closed polices attached to it
         
     | 
| 
      
 51 
     | 
    
         
            +
                /// may only be called by registered and unlocked pool components
         
     | 
| 
      
 52 
     | 
    
         
            +
                function close(
         
     | 
| 
      
 53 
     | 
    
         
            +
                    IInstance instance, 
         
     | 
| 
      
 54 
     | 
    
         
            +
                    NftId bundleNftId
         
     | 
| 
      
 55 
     | 
    
         
            +
                ) external;
         
     | 
| 
      
 56 
     | 
    
         
            +
             
     | 
| 
      
 57 
     | 
    
         
            +
                /// @dev set bundle fee to provided value
         
     | 
| 
      
 58 
     | 
    
         
            +
                /// may only be called by registered and unlocked pool components
         
     | 
| 
      
 59 
     | 
    
         
            +
                function setFee(
         
     | 
| 
       24 
60 
     | 
    
         
             
                    NftId bundleNftId,
         
     | 
| 
       25 
61 
     | 
    
         
             
                    Fee memory fee
         
     | 
| 
       26 
62 
     | 
    
         
             
                ) external;
         
     | 
| 
       27 
63 
     | 
    
         | 
| 
       28 
     | 
    
         
            -
                function updateBundle(NftId instanceNftId, NftId bundleNftId, IBundle.BundleInfo memory bundleInfo, StateId state) external;
         
     | 
| 
       29 
64 
     | 
    
         | 
| 
      
 65 
     | 
    
         
            +
                /// @dev locks the specified collateral in the bundle
         
     | 
| 
      
 66 
     | 
    
         
            +
                /// the locked collateral is added to the bundle locked capital
         
     | 
| 
      
 67 
     | 
    
         
            +
                /// the bundles' fees are updated with the fees for this premium
         
     | 
| 
      
 68 
     | 
    
         
            +
                /// the premium (minus bundle fee) is added to the bundle capital
         
     | 
| 
      
 69 
     | 
    
         
            +
                /// may only be called by pool service
         
     | 
| 
       30 
70 
     | 
    
         
             
                function lockCollateral(
         
     | 
| 
       31 
71 
     | 
    
         
             
                    IInstance instanceNftId, 
         
     | 
| 
       32 
72 
     | 
    
         
             
                    NftId policyNftId, 
         
     | 
| 
       33 
73 
     | 
    
         
             
                    NftId bundleNftId, 
         
     | 
| 
       34 
74 
     | 
    
         
             
                    uint256 collateralAmount, 
         
     | 
| 
       35 
     | 
    
         
            -
                    uint256  
     | 
| 
       36 
     | 
    
         
            -
                )
         
     | 
| 
       37 
     | 
    
         
            -
                    external
         
     | 
| 
       38 
     | 
    
         
            -
                    returns (
         
     | 
| 
       39 
     | 
    
         
            -
                        IBundle.BundleInfo memory bundleInfo
         
     | 
| 
       40 
     | 
    
         
            -
                    );
         
     | 
| 
       41 
     | 
    
         
            -
             
     | 
| 
       42 
     | 
    
         
            -
                function increaseBalance(IInstance instance, NftId bundleNftId,  uint256 amount) external;
         
     | 
| 
       43 
     | 
    
         
            -
             
     | 
| 
       44 
     | 
    
         
            -
                function closePolicy(IInstance instance, NftId policyNftId, NftId bundleNftId, uint256 collateralAmount) external;
         
     | 
| 
      
 75 
     | 
    
         
            +
                    uint256 premium // premium amount after pool fee
         
     | 
| 
      
 76 
     | 
    
         
            +
                ) external;
         
     | 
| 
       45 
77 
     | 
    
         | 
| 
       46 
     | 
    
         
            -
                // function fundBundle(NftId bundleNftId, uint256 amount) external returns(uint256 netAmount);
         
     | 
| 
       47 
78 
     | 
    
         | 
| 
       48 
     | 
    
         
            -
                 
     | 
| 
      
 79 
     | 
    
         
            +
                /// @dev releases the specified collateral in the bundle
         
     | 
| 
      
 80 
     | 
    
         
            +
                /// may only be called by pool service
         
     | 
| 
      
 81 
     | 
    
         
            +
                function releaseCollateral(
         
     | 
| 
      
 82 
     | 
    
         
            +
                    IInstance instance, 
         
     | 
| 
      
 83 
     | 
    
         
            +
                    NftId policyNftId, 
         
     | 
| 
      
 84 
     | 
    
         
            +
                    NftId bundleNftId, 
         
     | 
| 
      
 85 
     | 
    
         
            +
                    uint256 collateralAmount
         
     | 
| 
      
 86 
     | 
    
         
            +
                ) external;
         
     | 
| 
       49 
87 
     | 
    
         | 
| 
       50 
     | 
    
         
            -
                function  
     | 
| 
      
 88 
     | 
    
         
            +
                function increaseBalance(IInstance instance, NftId bundleNftId,  uint256 amount) external;
         
     | 
| 
       51 
89 
     | 
    
         | 
| 
       52 
     | 
    
         
            -
                function  
     | 
| 
      
 90 
     | 
    
         
            +
                // function stake(NftId bundleNftId, uint256 amount) external returns(uint256 netAmount);
         
     | 
| 
       53 
91 
     | 
    
         | 
| 
       54 
     | 
    
         
            -
                // function  
     | 
| 
      
 92 
     | 
    
         
            +
                // function unstake(NftId bundleNftId, uint256 amount) external returns(uint256 netAmount);
         
     | 
| 
       55 
93 
     | 
    
         
             
            }
         
     | 
| 
         @@ -12,6 +12,7 @@ import {Timestamp} from "../../types/Timestamp.sol"; 
     | 
|
| 
       12 
12 
     | 
    
         | 
| 
       13 
13 
     | 
    
         | 
| 
       14 
14 
     | 
    
         
             
            interface IDistributionService is IService {
         
     | 
| 
      
 15 
     | 
    
         
            +
                error ErrorDistributionServiceCallerNotRegistered(address caller);
         
     | 
| 
       15 
16 
     | 
    
         
             
                error ErrorIDistributionServiceParentNftIdNotInstance(NftId nftId, NftId parentNftId);
         
     | 
| 
       16 
17 
     | 
    
         
             
                error ErrorIDistributionServiceCallerNotDistributor(address caller);
         
     | 
| 
       17 
18 
     | 
    
         
             
                error ErrorIDistributionServiceInvalidReferralId(ReferralId referralId);
         
     | 
| 
         @@ -1,20 +1,99 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            // SPDX-License-Identifier: Apache-2.0
         
     | 
| 
       2 
2 
     | 
    
         
             
            pragma solidity ^0.8.19;
         
     | 
| 
       3 
3 
     | 
    
         | 
| 
       4 
     | 
    
         
            -
            import { 
     | 
| 
      
 4 
     | 
    
         
            +
            import {Amount} from "../../types/Amount.sol";
         
     | 
| 
       5 
5 
     | 
    
         
             
            import {Fee} from "../../types/Fee.sol";
         
     | 
| 
       6 
     | 
    
         
            -
            import { 
     | 
| 
       7 
     | 
    
         
            -
            import {IService} from "../../shared/IService.sol";
         
     | 
| 
      
 6 
     | 
    
         
            +
            import {NftId} from "../../types/NftId.sol";
         
     | 
| 
       8 
7 
     | 
    
         
             
            import {IBundle} from "../module/IBundle.sol";
         
     | 
| 
       9 
8 
     | 
    
         
             
            import {IInstance} from "../../instance/IInstance.sol";
         
     | 
| 
      
 9 
     | 
    
         
            +
            import {IPolicy} from "../module/IPolicy.sol";
         
     | 
| 
      
 10 
     | 
    
         
            +
            import {IService} from "../../shared/IService.sol";
         
     | 
| 
      
 11 
     | 
    
         
            +
            import {RoleId} from "../../types/RoleId.sol";
         
     | 
| 
      
 12 
     | 
    
         
            +
            import {Seconds} from "../../types/Seconds.sol";
         
     | 
| 
      
 13 
     | 
    
         
            +
            import {StateId} from "../../types/StateId.sol";
         
     | 
| 
       10 
14 
     | 
    
         | 
| 
       11 
15 
     | 
    
         
             
            interface IPoolService is IService {
         
     | 
| 
       12 
16 
     | 
    
         | 
| 
      
 17 
     | 
    
         
            +
                event LogPoolServiceMaxCapitalAmountUpdated(NftId poolNftId, uint256 previousMaxCapitalAmount, uint256 currentMaxCapitalAmount);
         
     | 
| 
      
 18 
     | 
    
         
            +
                event LogPoolServiceBundleOwnerRoleSet(NftId poolNftId, RoleId bundleOwnerRole);
         
     | 
| 
      
 19 
     | 
    
         
            +
             
     | 
| 
      
 20 
     | 
    
         
            +
                event LogPoolServiceBundleCreated(NftId instanceNftId, NftId poolNftId, NftId bundleNftId);
         
     | 
| 
      
 21 
     | 
    
         
            +
                event LogPoolServiceBundleClosed(NftId instanceNftId, NftId poolNftId, NftId bundleNftId);
         
     | 
| 
      
 22 
     | 
    
         
            +
             
     | 
| 
      
 23 
     | 
    
         
            +
                error ErrorPoolServiceBundleOwnerRoleAlreadySet(NftId poolNftId);
         
     | 
| 
      
 24 
     | 
    
         
            +
                error ErrorPoolServiceBundlePoolMismatch(NftId bundlePoolNftId, NftId productPoolNftId);
         
     | 
| 
      
 25 
     | 
    
         
            +
             
     | 
| 
      
 26 
     | 
    
         
            +
                /// @dev registers a new pool with the registry service
         
     | 
| 
       13 
27 
     | 
    
         
             
                function register(address poolAddress) external returns(NftId);
         
     | 
| 
       14 
28 
     | 
    
         | 
| 
      
 29 
     | 
    
         
            +
                /// @dev defines the required role for bundle owners for the calling pool
         
     | 
| 
      
 30 
     | 
    
         
            +
                /// default implementation returns PUBLIC ROLE
         
     | 
| 
      
 31 
     | 
    
         
            +
                function setBundleOwnerRole(RoleId bundleOwnerRole) external;
         
     | 
| 
      
 32 
     | 
    
         
            +
             
     | 
| 
      
 33 
     | 
    
         
            +
                /// @dev sets the max capital amount for the calling pool
         
     | 
| 
      
 34 
     | 
    
         
            +
                function setMaxCapitalAmount(uint256 maxCapitalAmount) external;
         
     | 
| 
      
 35 
     | 
    
         
            +
             
     | 
| 
      
 36 
     | 
    
         
            +
                /// @dev set pool sepecific fees
         
     | 
| 
       15 
37 
     | 
    
         
             
                function setFees(
         
     | 
| 
       16 
38 
     | 
    
         
             
                    Fee memory poolFee,
         
     | 
| 
       17 
39 
     | 
    
         
             
                    Fee memory stakingFee,
         
     | 
| 
       18 
40 
     | 
    
         
             
                    Fee memory performanceFee
         
     | 
| 
       19 
41 
     | 
    
         
             
                ) external;
         
     | 
| 
      
 42 
     | 
    
         
            +
             
     | 
| 
      
 43 
     | 
    
         
            +
             
     | 
| 
      
 44 
     | 
    
         
            +
                /// @dev locks required collateral to cover the specified application (and turn it into a policy)
         
     | 
| 
      
 45 
     | 
    
         
            +
                /// - retention level == 1: the full collateral amount will be locked by the specified bundle
         
     | 
| 
      
 46 
     | 
    
         
            +
                /// - retention level < 1: a part of the coverage is provided by the specified bundle, the rest by the pool component
         
     | 
| 
      
 47 
     | 
    
         
            +
                /// in which case the pool component might hold a re-insurance policy
         
     | 
| 
      
 48 
     | 
    
         
            +
                /// may only be called by the policy service for unlocked pool components
         
     | 
| 
      
 49 
     | 
    
         
            +
                function lockCollateral(
         
     | 
| 
      
 50 
     | 
    
         
            +
                    IInstance instance, 
         
     | 
| 
      
 51 
     | 
    
         
            +
                    NftId productNftId,
         
     | 
| 
      
 52 
     | 
    
         
            +
                    NftId applicationNftId,
         
     | 
| 
      
 53 
     | 
    
         
            +
                    IPolicy.PolicyInfo memory applicationInfo,
         
     | 
| 
      
 54 
     | 
    
         
            +
                    uint256 premiumAmount
         
     | 
| 
      
 55 
     | 
    
         
            +
                ) external;
         
     | 
| 
      
 56 
     | 
    
         
            +
             
     | 
| 
      
 57 
     | 
    
         
            +
             
     | 
| 
      
 58 
     | 
    
         
            +
                /// @dev releases the remaining collateral linked to the specified policy
         
     | 
| 
      
 59 
     | 
    
         
            +
                /// may only be called by the policy service for unlocked pool components
         
     | 
| 
      
 60 
     | 
    
         
            +
                function releaseCollateral(
         
     | 
| 
      
 61 
     | 
    
         
            +
                    IInstance instance, 
         
     | 
| 
      
 62 
     | 
    
         
            +
                    NftId policyNftId, 
         
     | 
| 
      
 63 
     | 
    
         
            +
                    IPolicy.PolicyInfo memory policyInfo
         
     | 
| 
      
 64 
     | 
    
         
            +
                ) external;
         
     | 
| 
      
 65 
     | 
    
         
            +
             
     | 
| 
      
 66 
     | 
    
         
            +
             
     | 
| 
      
 67 
     | 
    
         
            +
                /// @dev create a new bundle for the provided parameters
         
     | 
| 
      
 68 
     | 
    
         
            +
                /// staking fees will be deducted by the pool service from the staking amount
         
     | 
| 
      
 69 
     | 
    
         
            +
                /// may only be called by registered and unlocked pool components
         
     | 
| 
      
 70 
     | 
    
         
            +
                function createBundle(
         
     | 
| 
      
 71 
     | 
    
         
            +
                    address owner, // initial bundle owner
         
     | 
| 
      
 72 
     | 
    
         
            +
                    Fee memory fee, // fees deducted from premium that go to bundle owner
         
     | 
| 
      
 73 
     | 
    
         
            +
                    Amount stakingAmount, // staking amount - staking fees result in initial bundle capital
         
     | 
| 
      
 74 
     | 
    
         
            +
                    Seconds lifetime, // initial duration for which new policies are covered
         
     | 
| 
      
 75 
     | 
    
         
            +
                    bytes calldata filter // optional use case specific criteria that define if a policy may be covered by this bundle
         
     | 
| 
      
 76 
     | 
    
         
            +
                )
         
     | 
| 
      
 77 
     | 
    
         
            +
                    external 
         
     | 
| 
      
 78 
     | 
    
         
            +
                    returns(NftId bundleNftId); // the nft id of the newly created bundle
         
     | 
| 
      
 79 
     | 
    
         
            +
             
     | 
| 
      
 80 
     | 
    
         
            +
             
     | 
| 
      
 81 
     | 
    
         
            +
                /// @dev closes the specified bundle
         
     | 
| 
      
 82 
     | 
    
         
            +
                /// only open bundles (active or locked) may be closed
         
     | 
| 
      
 83 
     | 
    
         
            +
                /// to close a bundle it may not have any non-closed polices attached to it
         
     | 
| 
      
 84 
     | 
    
         
            +
                /// bundle fees and remaining capital (after deduction of the performance fee) will be transferred to the bundle owner
         
     | 
| 
      
 85 
     | 
    
         
            +
                /// may only be called by registered and unlocked pool components
         
     | 
| 
      
 86 
     | 
    
         
            +
                function closeBundle(NftId bundleNftId) external;
         
     | 
| 
      
 87 
     | 
    
         
            +
             
     | 
| 
      
 88 
     | 
    
         
            +
             
     | 
| 
      
 89 
     | 
    
         
            +
                /// @dev increase stakes for bundle
         
     | 
| 
      
 90 
     | 
    
         
            +
                /// staking fees will be deducted by the pool service from the staking amount
         
     | 
| 
      
 91 
     | 
    
         
            +
                /// may only be called by registered and unlocked pool components
         
     | 
| 
      
 92 
     | 
    
         
            +
                // function stake(NftId bundleNftId, uint256 amount) external returns(uint256 netAmount);
         
     | 
| 
      
 93 
     | 
    
         
            +
             
     | 
| 
      
 94 
     | 
    
         
            +
             
     | 
| 
      
 95 
     | 
    
         
            +
                /// @dev decrease stakes for bundle
         
     | 
| 
      
 96 
     | 
    
         
            +
                /// performance fees will be deducted by the pool service from the staking amount
         
     | 
| 
      
 97 
     | 
    
         
            +
                /// may only be called by registered and unlocked pool components
         
     | 
| 
      
 98 
     | 
    
         
            +
                // function unstake(NftId bundleNftId, uint256 amount) external returns(uint256 netAmount);
         
     | 
| 
       20 
99 
     | 
    
         
             
            }
         
     |