@etherisc/gif-next 0.0.2-e922e07-736 → 0.0.2-e94f4c7-084
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 +6 -83
 - 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 +84 -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 +457 -268
 - package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.dbg.json +1 -1
 - package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.json +175 -51
 - package/artifacts/contracts/instance/Instance.sol/Instance.dbg.json +1 -1
 - package/artifacts/contracts/instance/Instance.sol/Instance.json +426 -476
 - package/artifacts/contracts/instance/InstanceAccessManager.sol/InstanceAccessManager.dbg.json +1 -1
 - package/artifacts/contracts/instance/InstanceAccessManager.sol/InstanceAccessManager.json +472 -126
 - package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.dbg.json +1 -1
 - package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.json +217 -169
 - package/artifacts/contracts/instance/InstanceService.sol/InstanceService.dbg.json +1 -1
 - package/artifacts/contracts/instance/InstanceService.sol/InstanceService.json +304 -210
 - package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.dbg.json +1 -1
 - package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.json +71 -23
 - 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 +175 -83
 - package/artifacts/contracts/instance/service/ApplicationServiceManager.sol/ApplicationServiceManager.dbg.json +1 -1
 - package/artifacts/contracts/instance/service/ApplicationServiceManager.sol/ApplicationServiceManager.json +29 -13
 - package/artifacts/contracts/instance/service/BundleService.sol/BundleService.dbg.json +1 -1
 - package/artifacts/contracts/instance/service/BundleService.sol/BundleService.json +426 -233
 - package/artifacts/contracts/instance/service/BundleServiceManager.sol/BundleServiceManager.dbg.json +1 -1
 - package/artifacts/contracts/instance/service/BundleServiceManager.sol/BundleServiceManager.json +78 -14
 - package/artifacts/contracts/instance/service/ClaimService.sol/ClaimService.dbg.json +1 -1
 - package/artifacts/contracts/instance/service/ClaimService.sol/ClaimService.json +372 -86
 - package/artifacts/contracts/instance/service/ClaimServiceManager.sol/ClaimServiceManager.dbg.json +1 -1
 - package/artifacts/contracts/instance/service/ClaimServiceManager.sol/ClaimServiceManager.json +55 -7
 - package/artifacts/contracts/instance/service/DistributionService.sol/DistributionService.dbg.json +1 -1
 - package/artifacts/contracts/instance/service/DistributionService.sol/DistributionService.json +189 -139
 - package/artifacts/contracts/instance/service/DistributionServiceManager.sol/DistributionServiceManager.dbg.json +1 -1
 - package/artifacts/contracts/instance/service/DistributionServiceManager.sol/DistributionServiceManager.json +48 -56
 - package/artifacts/contracts/instance/service/IApplicationService.sol/IApplicationService.dbg.json +1 -1
 - package/artifacts/contracts/instance/service/IApplicationService.sol/IApplicationService.json +111 -40
 - package/artifacts/contracts/instance/service/IBundleService.sol/IBundleService.dbg.json +1 -1
 - package/artifacts/contracts/instance/service/IBundleService.sol/IBundleService.json +246 -170
 - package/artifacts/contracts/instance/service/IClaimService.sol/IClaimService.dbg.json +1 -1
 - package/artifacts/contracts/instance/service/IClaimService.sol/IClaimService.json +251 -58
 - 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 +470 -41
 - package/artifacts/contracts/instance/service/IPoolService.sol/IPoolService.dbg.json +1 -1
 - package/artifacts/contracts/instance/service/IPoolService.sol/IPoolService.json +627 -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 +607 -85
 - package/artifacts/contracts/instance/service/PolicyServiceManager.sol/PolicyServiceManager.dbg.json +1 -1
 - package/artifacts/contracts/instance/service/PolicyServiceManager.sol/PolicyServiceManager.json +71 -19
 - package/artifacts/contracts/instance/service/PoolService.sol/PoolService.dbg.json +1 -1
 - package/artifacts/contracts/instance/service/PoolService.sol/PoolService.json +777 -55
 - package/artifacts/contracts/instance/service/PoolServiceManager.sol/PoolServiceManager.dbg.json +1 -1
 - package/artifacts/contracts/instance/service/PoolServiceManager.sol/PoolServiceManager.json +72 -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 +209 -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/ClaimId.sol/ClaimIdLib.json +83 -4
 - 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/PayoutId.sol/PayoutIdLib.json +116 -7
 - 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 +17 -4
 - 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/Distribution.sol +6 -2
 - package/contracts/components/IComponent.sol +9 -1
 - package/contracts/components/IPoolComponent.sol +6 -44
 - package/contracts/components/Pool.sol +50 -126
 - package/contracts/components/Product.sol +141 -59
 - package/contracts/instance/AccessManagerUpgradeableInitializeable.sol +13 -0
 - package/contracts/instance/BundleManager.sol +9 -8
 - package/contracts/instance/Cloneable.sol +7 -2
 - package/contracts/instance/IInstance.sol +37 -27
 - package/contracts/instance/IInstanceService.sol +18 -9
 - package/contracts/instance/Instance.sol +117 -98
 - package/contracts/instance/InstanceAccessManager.sol +388 -158
 - package/contracts/instance/InstanceReader.sol +36 -12
 - package/contracts/instance/InstanceService.sol +193 -204
 - 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 +23 -6
 - 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/IPolicy.sol +11 -6
 - package/contracts/instance/module/ISetup.sol +3 -16
 - package/contracts/instance/service/ApplicationService.sol +25 -19
 - package/contracts/instance/service/BundleService.sol +224 -80
 - package/contracts/instance/service/ClaimService.sol +114 -26
 - package/contracts/instance/service/DistributionService.sol +58 -77
 - package/contracts/instance/service/IApplicationService.sol +3 -7
 - package/contracts/instance/service/IBundleService.sol +72 -25
 - package/contracts/instance/service/IClaimService.sol +46 -15
 - package/contracts/instance/service/IDistributionService.sol +1 -0
 - package/contracts/instance/service/IPolicyService.sol +72 -5
 - package/contracts/instance/service/IPoolService.sol +85 -3
 - package/contracts/instance/service/PolicyService.sol +320 -143
 - package/contracts/instance/service/PoolService.sol +245 -18
 - package/contracts/instance/service/ProductService.sol +31 -54
 - 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 +70 -0
 - package/contracts/types/Blocknumber.sol +1 -0
 - package/contracts/types/ClaimId.sol +25 -2
 - package/contracts/types/Fee.sol +13 -5
 - package/contracts/types/NftId.sol +8 -0
 - package/contracts/types/ObjectType.sol +6 -5
 - package/contracts/types/PayoutId.sol +33 -5
 - package/contracts/types/RoleId.sol +6 -4
 - package/contracts/types/StateId.sol +7 -2
 - package/contracts/types/Timestamp.sol +6 -0
 - package/contracts/types/UFixed.sol +1 -0
 - package/contracts/types/Version.sol +1 -0
 - package/package.json +1 -1
 
| 
         @@ -3,20 +3,22 @@ pragma solidity ^0.8.20; 
     | 
|
| 
       3 
3 
     | 
    
         | 
| 
       4 
4 
     | 
    
         
             
            import {AccessManagedUpgradeable} from "@openzeppelin/contracts-upgradeable/access/manager/AccessManagedUpgradeable.sol";
         
     | 
| 
       5 
5 
     | 
    
         | 
| 
       6 
     | 
    
         
            -
            import {Key32 
     | 
| 
      
 6 
     | 
    
         
            +
            import {Key32} from "../types/Key32.sol";
         
     | 
| 
       7 
7 
     | 
    
         
             
            import {NftId} from "../types/NftId.sol";
         
     | 
| 
       8 
8 
     | 
    
         
             
            import {ClaimId} from "../types/ClaimId.sol";
         
     | 
| 
       9 
     | 
    
         
            -
            import { 
     | 
| 
       10 
     | 
    
         
            -
            import { 
     | 
| 
       11 
     | 
    
         
            -
            import { 
     | 
| 
       12 
     | 
    
         
            -
            import { 
     | 
| 
       13 
     | 
    
         
            -
            import { 
     | 
| 
       14 
     | 
    
         
            -
            import { 
     | 
| 
       15 
     | 
    
         
            -
            import { 
     | 
| 
       16 
     | 
    
         
            -
             
     | 
| 
       17 
     | 
    
         
            -
             
     | 
| 
      
 9 
     | 
    
         
            +
            import {DistributorType} from "../types/DistributorType.sol";
         
     | 
| 
      
 10 
     | 
    
         
            +
            import {PayoutId} from "../types/PayoutId.sol";
         
     | 
| 
      
 11 
     | 
    
         
            +
            import {ObjectType, BUNDLE, DISTRIBUTION, INSTANCE, POLICY, POOL, PRODUCT, DISTRIBUTOR} from "../types/ObjectType.sol";
         
     | 
| 
      
 12 
     | 
    
         
            +
            import {ReferralId} from "../types/Referral.sol";
         
     | 
| 
      
 13 
     | 
    
         
            +
            import {RiskId} from "../types/RiskId.sol";
         
     | 
| 
      
 14 
     | 
    
         
            +
            import {INSTANCE_OWNER_ROLE} from "../types/RoleId.sol";
         
     | 
| 
      
 15 
     | 
    
         
            +
            import {StateId} from "../types/StateId.sol";
         
     | 
| 
      
 16 
     | 
    
         
            +
            import {VersionPart, VersionPartLib} from "../types/Version.sol";
         
     | 
| 
      
 17 
     | 
    
         
            +
             
     | 
| 
       18 
18 
     | 
    
         
             
            import {Registerable} from "../shared/Registerable.sol";
         
     | 
| 
       19 
19 
     | 
    
         | 
| 
      
 20 
     | 
    
         
            +
            import {IRegistry} from "../registry/IRegistry.sol";
         
     | 
| 
      
 21 
     | 
    
         
            +
             
     | 
| 
       20 
22 
     | 
    
         
             
            import {IInstance} from "./IInstance.sol";
         
     | 
| 
       21 
23 
     | 
    
         
             
            import {InstanceReader} from "./InstanceReader.sol";
         
     | 
| 
       22 
24 
     | 
    
         
             
            import {InstanceAccessManager} from "./InstanceAccessManager.sol";
         
     | 
| 
         @@ -24,18 +26,13 @@ import {BundleManager} from "./BundleManager.sol"; 
     | 
|
| 
       24 
26 
     | 
    
         | 
| 
       25 
27 
     | 
    
         
             
            import {KeyValueStore} from "./base/KeyValueStore.sol";
         
     | 
| 
       26 
28 
     | 
    
         | 
| 
       27 
     | 
    
         
            -
            import {IAccess} from "./module/IAccess.sol";
         
     | 
| 
       28 
29 
     | 
    
         
             
            import {IBundle} from "./module/IBundle.sol";
         
     | 
| 
      
 30 
     | 
    
         
            +
            import {IComponents} from "./module/IComponents.sol";
         
     | 
| 
       29 
31 
     | 
    
         
             
            import {IDistribution} from "./module/IDistribution.sol";
         
     | 
| 
       30 
32 
     | 
    
         
             
            import {IPolicy} from "./module/IPolicy.sol";
         
     | 
| 
       31 
33 
     | 
    
         
             
            import {IRisk} from "./module/IRisk.sol";
         
     | 
| 
       32 
34 
     | 
    
         
             
            import {ISetup} from "./module/ISetup.sol";
         
     | 
| 
       33 
35 
     | 
    
         | 
| 
       34 
     | 
    
         
            -
            import {IDistributionService} from "./service/IDistributionService.sol";
         
     | 
| 
       35 
     | 
    
         
            -
            import {IPoolService} from "./service/IPoolService.sol";
         
     | 
| 
       36 
     | 
    
         
            -
            import {IProductService} from "./service/IProductService.sol";
         
     | 
| 
       37 
     | 
    
         
            -
            import {IPolicyService} from "./service/IPolicyService.sol";
         
     | 
| 
       38 
     | 
    
         
            -
            import {IBundleService} from "./service/IBundleService.sol";
         
     | 
| 
       39 
36 
     | 
    
         
             
            import {VersionPart, VersionPartLib} from "../types/Version.sol";
         
     | 
| 
       40 
37 
     | 
    
         | 
| 
       41 
38 
     | 
    
         
             
            contract Instance is
         
     | 
| 
         @@ -59,13 +56,23 @@ contract Instance is 
     | 
|
| 
       59 
56 
     | 
    
         
             
                InstanceReader internal _instanceReader;
         
     | 
| 
       60 
57 
     | 
    
         
             
                BundleManager internal _bundleManager;
         
     | 
| 
       61 
58 
     | 
    
         | 
| 
       62 
     | 
    
         
            -
                 
     | 
| 
      
 59 
     | 
    
         
            +
                modifier onlyChainNft() {
         
     | 
| 
      
 60 
     | 
    
         
            +
                    if(msg.sender != getRegistry().getChainNftAddress()) {
         
     | 
| 
      
 61 
     | 
    
         
            +
                        revert();
         
     | 
| 
      
 62 
     | 
    
         
            +
                    }
         
     | 
| 
      
 63 
     | 
    
         
            +
                    _;
         
     | 
| 
      
 64 
     | 
    
         
            +
                }
         
     | 
| 
      
 65 
     | 
    
         
            +
             
     | 
| 
      
 66 
     | 
    
         
            +
                function initialize(address authority, address registryAddress, address initialOwner) 
         
     | 
| 
       63 
67 
     | 
    
         
             
                    public 
         
     | 
| 
       64 
68 
     | 
    
         
             
                    initializer()
         
     | 
| 
       65 
69 
     | 
    
         
             
                {
         
     | 
| 
       66 
     | 
    
         
            -
                    __AccessManaged_init( 
     | 
| 
      
 70 
     | 
    
         
            +
                    __AccessManaged_init(authority);
         
     | 
| 
       67 
71 
     | 
    
         | 
| 
       68 
     | 
    
         
            -
                     
     | 
| 
      
 72 
     | 
    
         
            +
                    IRegistry registry = IRegistry(registryAddress);
         
     | 
| 
      
 73 
     | 
    
         
            +
                    initializeRegisterable(registryAddress, registry.getNftId(), INSTANCE(), true, initialOwner, "");
         
     | 
| 
      
 74 
     | 
    
         
            +
                    initializeLifecycle();
         
     | 
| 
      
 75 
     | 
    
         
            +
             
     | 
| 
       69 
76 
     | 
    
         
             
                    registerInterface(type(IInstance).interfaceId);    
         
     | 
| 
       70 
77 
     | 
    
         
             
                }
         
     | 
| 
       71 
78 
     | 
    
         | 
| 
         @@ -96,12 +103,12 @@ contract Instance is 
     | 
|
| 
       96 
103 
     | 
    
         
             
                }
         
     | 
| 
       97 
104 
     | 
    
         | 
| 
       98 
105 
     | 
    
         
             
                //--- PoolSetup ------------------------------------------------------//
         
     | 
| 
       99 
     | 
    
         
            -
                function createPoolSetup(NftId poolNftId,  
     | 
| 
       100 
     | 
    
         
            -
                    create(_toNftKey32(poolNftId, POOL()), abi.encode( 
     | 
| 
      
 106 
     | 
    
         
            +
                function createPoolSetup(NftId poolNftId, IComponents.ComponentInfo memory info) external restricted() {
         
     | 
| 
      
 107 
     | 
    
         
            +
                    create(_toNftKey32(poolNftId, POOL()), abi.encode(info));
         
     | 
| 
       101 
108 
     | 
    
         
             
                }
         
     | 
| 
       102 
109 
     | 
    
         | 
| 
       103 
     | 
    
         
            -
                function updatePoolSetup(NftId poolNftId,  
     | 
| 
       104 
     | 
    
         
            -
                    update(_toNftKey32(poolNftId, POOL()), abi.encode( 
     | 
| 
      
 110 
     | 
    
         
            +
                function updatePoolSetup(NftId poolNftId, IComponents.ComponentInfo memory info, StateId newState) external restricted() {
         
     | 
| 
      
 111 
     | 
    
         
            +
                    update(_toNftKey32(poolNftId, POOL()), abi.encode(info), newState);
         
     | 
| 
       105 
112 
     | 
    
         
             
                }
         
     | 
| 
       106 
113 
     | 
    
         | 
| 
       107 
114 
     | 
    
         
             
                function updatePoolSetupState(NftId poolNftId, StateId newState) external restricted() {
         
     | 
| 
         @@ -109,55 +116,55 @@ contract Instance is 
     | 
|
| 
       109 
116 
     | 
    
         
             
                }
         
     | 
| 
       110 
117 
     | 
    
         | 
| 
       111 
118 
     | 
    
         
             
                //--- DistributorType -------------------------------------------------------//
         
     | 
| 
       112 
     | 
    
         
            -
                function createDistributorType( 
     | 
| 
       113 
     | 
    
         
            -
                    create( 
     | 
| 
      
 119 
     | 
    
         
            +
                function createDistributorType(DistributorType distributorType, IDistribution.DistributorTypeInfo memory info) external restricted() {
         
     | 
| 
      
 120 
     | 
    
         
            +
                    create(distributorType.toKey32(), abi.encode(info));
         
     | 
| 
       114 
121 
     | 
    
         
             
                }
         
     | 
| 
       115 
122 
     | 
    
         | 
| 
       116 
     | 
    
         
            -
                function updateDistributorType( 
     | 
| 
       117 
     | 
    
         
            -
                    update( 
     | 
| 
      
 123 
     | 
    
         
            +
                function updateDistributorType(DistributorType distributorType, IDistribution.DistributorTypeInfo memory info, StateId newState) external restricted() {
         
     | 
| 
      
 124 
     | 
    
         
            +
                    update(distributorType.toKey32(), abi.encode(info), newState);
         
     | 
| 
       118 
125 
     | 
    
         
             
                }
         
     | 
| 
       119 
126 
     | 
    
         | 
| 
       120 
     | 
    
         
            -
                function updateDistributorTypeState( 
     | 
| 
       121 
     | 
    
         
            -
                    updateState( 
     | 
| 
      
 127 
     | 
    
         
            +
                function updateDistributorTypeState(DistributorType distributorType, StateId newState) external restricted() {
         
     | 
| 
      
 128 
     | 
    
         
            +
                    updateState(distributorType.toKey32(), newState);
         
     | 
| 
       122 
129 
     | 
    
         
             
                }
         
     | 
| 
       123 
130 
     | 
    
         | 
| 
       124 
131 
     | 
    
         
             
                //--- Distributor -------------------------------------------------------//
         
     | 
| 
       125 
     | 
    
         
            -
                function createDistributor(NftId  
     | 
| 
       126 
     | 
    
         
            -
                    create( 
     | 
| 
      
 132 
     | 
    
         
            +
                function createDistributor(NftId distributorNftId, IDistribution.DistributorInfo memory info) external restricted() {
         
     | 
| 
      
 133 
     | 
    
         
            +
                    create(_toNftKey32(distributorNftId, DISTRIBUTOR()), abi.encode(info));
         
     | 
| 
       127 
134 
     | 
    
         
             
                }
         
     | 
| 
       128 
135 
     | 
    
         | 
| 
       129 
     | 
    
         
            -
                function updateDistributor(NftId  
     | 
| 
       130 
     | 
    
         
            -
                    update( 
     | 
| 
      
 136 
     | 
    
         
            +
                function updateDistributor(NftId distributorNftId, IDistribution.DistributorInfo memory info, StateId newState) external restricted() {
         
     | 
| 
      
 137 
     | 
    
         
            +
                    update(_toNftKey32(distributorNftId, DISTRIBUTOR()), abi.encode(info), newState);
         
     | 
| 
       131 
138 
     | 
    
         
             
                }
         
     | 
| 
       132 
139 
     | 
    
         | 
| 
       133 
     | 
    
         
            -
                function updateDistributorState(NftId  
     | 
| 
       134 
     | 
    
         
            -
                    updateState( 
     | 
| 
      
 140 
     | 
    
         
            +
                function updateDistributorState(NftId distributorNftId, StateId newState) external restricted() {
         
     | 
| 
      
 141 
     | 
    
         
            +
                    updateState(_toNftKey32(distributorNftId, DISTRIBUTOR()), newState);
         
     | 
| 
       135 
142 
     | 
    
         
             
                }
         
     | 
| 
       136 
143 
     | 
    
         | 
| 
       137 
144 
     | 
    
         
             
                //--- Referral ----------------------------------------------------------//
         
     | 
| 
       138 
     | 
    
         
            -
                function createReferral( 
     | 
| 
       139 
     | 
    
         
            -
                    create( 
     | 
| 
      
 145 
     | 
    
         
            +
                function createReferral(ReferralId referralId, IDistribution.ReferralInfo memory referralInfo) external restricted() {
         
     | 
| 
      
 146 
     | 
    
         
            +
                    create(referralId.toKey32(), abi.encode(referralInfo));
         
     | 
| 
       140 
147 
     | 
    
         
             
                }
         
     | 
| 
       141 
148 
     | 
    
         | 
| 
       142 
     | 
    
         
            -
                function updateReferral( 
     | 
| 
       143 
     | 
    
         
            -
                    update( 
     | 
| 
      
 149 
     | 
    
         
            +
                function updateReferral(ReferralId referralId, IDistribution.ReferralInfo memory referralInfo, StateId newState) external restricted() {
         
     | 
| 
      
 150 
     | 
    
         
            +
                    update(referralId.toKey32(), abi.encode(referralInfo), newState);
         
     | 
| 
       144 
151 
     | 
    
         
             
                }
         
     | 
| 
       145 
152 
     | 
    
         | 
| 
       146 
     | 
    
         
            -
                function updateReferralState( 
     | 
| 
       147 
     | 
    
         
            -
                    updateState( 
     | 
| 
      
 153 
     | 
    
         
            +
                function updateReferralState(ReferralId referralId, StateId newState) external restricted() {
         
     | 
| 
      
 154 
     | 
    
         
            +
                    updateState(referralId.toKey32(), newState);
         
     | 
| 
       148 
155 
     | 
    
         
             
                }
         
     | 
| 
       149 
156 
     | 
    
         | 
| 
       150 
157 
     | 
    
         
             
                //--- Bundle ------------------------------------------------------------//
         
     | 
| 
       151 
158 
     | 
    
         
             
                function createBundle(NftId bundleNftId, IBundle.BundleInfo memory bundle) external restricted() {
         
     | 
| 
       152 
     | 
    
         
            -
                    create( 
     | 
| 
      
 159 
     | 
    
         
            +
                    create(_toNftKey32(bundleNftId, BUNDLE()), abi.encode(bundle));
         
     | 
| 
       153 
160 
     | 
    
         
             
                }
         
     | 
| 
       154 
161 
     | 
    
         | 
| 
       155 
162 
     | 
    
         
             
                function updateBundle(NftId bundleNftId, IBundle.BundleInfo memory bundle, StateId newState) external restricted() {
         
     | 
| 
       156 
     | 
    
         
            -
                    update( 
     | 
| 
      
 163 
     | 
    
         
            +
                    update(_toNftKey32(bundleNftId, BUNDLE()), abi.encode(bundle), newState);
         
     | 
| 
       157 
164 
     | 
    
         
             
                }
         
     | 
| 
       158 
165 
     | 
    
         | 
| 
       159 
166 
     | 
    
         
             
                function updateBundleState(NftId bundleNftId, StateId newState) external restricted() {
         
     | 
| 
       160 
     | 
    
         
            -
                    updateState( 
     | 
| 
      
 167 
     | 
    
         
            +
                    updateState(_toNftKey32(bundleNftId, BUNDLE()), newState);
         
     | 
| 
       161 
168 
     | 
    
         
             
                }
         
     | 
| 
       162 
169 
     | 
    
         | 
| 
       163 
170 
     | 
    
         
             
                //--- Risk --------------------------------------------------------------//
         
     | 
| 
         @@ -175,117 +182,129 @@ contract Instance is 
     | 
|
| 
       175 
182 
     | 
    
         | 
| 
       176 
183 
     | 
    
         
             
                //--- Application (Policy) ----------------------------------------------//
         
     | 
| 
       177 
184 
     | 
    
         
             
                function createApplication(NftId applicationNftId, IPolicy.PolicyInfo memory policy) external restricted() {
         
     | 
| 
       178 
     | 
    
         
            -
                    create( 
     | 
| 
      
 185 
     | 
    
         
            +
                    create(_toNftKey32(applicationNftId, POLICY()), abi.encode(policy));
         
     | 
| 
       179 
186 
     | 
    
         
             
                }
         
     | 
| 
       180 
187 
     | 
    
         | 
| 
       181 
188 
     | 
    
         
             
                function updateApplication(NftId applicationNftId, IPolicy.PolicyInfo memory policy, StateId newState) external restricted() {
         
     | 
| 
       182 
     | 
    
         
            -
                    update( 
     | 
| 
      
 189 
     | 
    
         
            +
                    update(_toNftKey32(applicationNftId, POLICY()), abi.encode(policy), newState);
         
     | 
| 
       183 
190 
     | 
    
         
             
                }
         
     | 
| 
       184 
191 
     | 
    
         | 
| 
       185 
192 
     | 
    
         
             
                function updateApplicationState(NftId applicationNftId, StateId newState) external restricted() {
         
     | 
| 
       186 
     | 
    
         
            -
                    updateState( 
     | 
| 
      
 193 
     | 
    
         
            +
                    updateState(_toNftKey32(applicationNftId, POLICY()), newState);
         
     | 
| 
       187 
194 
     | 
    
         
             
                }
         
     | 
| 
       188 
195 
     | 
    
         | 
| 
       189 
196 
     | 
    
         
             
                //--- Policy ------------------------------------------------------------//
         
     | 
| 
       190 
197 
     | 
    
         
             
                function updatePolicy(NftId policyNftId, IPolicy.PolicyInfo memory policy, StateId newState) external restricted() {
         
     | 
| 
       191 
     | 
    
         
            -
                    update( 
     | 
| 
      
 198 
     | 
    
         
            +
                    update(_toNftKey32(policyNftId, POLICY()), abi.encode(policy), newState);
         
     | 
| 
       192 
199 
     | 
    
         
             
                }
         
     | 
| 
       193 
200 
     | 
    
         | 
| 
       194 
201 
     | 
    
         
             
                function updatePolicyState(NftId policyNftId, StateId newState) external restricted() {
         
     | 
| 
       195 
     | 
    
         
            -
                    updateState( 
     | 
| 
      
 202 
     | 
    
         
            +
                    updateState(_toNftKey32(policyNftId, POLICY()), newState);
         
     | 
| 
       196 
203 
     | 
    
         
             
                }
         
     | 
| 
       197 
204 
     | 
    
         | 
| 
       198 
205 
     | 
    
         
             
                //--- Claim -------------------------------------------------------------//
         
     | 
| 
       199 
206 
     | 
    
         
             
                function createClaim(NftId policyNftId, ClaimId claimId, IPolicy.ClaimInfo memory claim) external restricted() {
         
     | 
| 
       200 
     | 
    
         
            -
                    create( 
     | 
| 
      
 207 
     | 
    
         
            +
                    create(_toClaimKey32(policyNftId, claimId), abi.encode(claim));
         
     | 
| 
       201 
208 
     | 
    
         
             
                }
         
     | 
| 
       202 
209 
     | 
    
         | 
| 
       203 
210 
     | 
    
         
             
                function updateClaim(NftId policyNftId, ClaimId claimId, IPolicy.ClaimInfo memory claim, StateId newState) external restricted() {
         
     | 
| 
       204 
     | 
    
         
            -
                    update( 
     | 
| 
      
 211 
     | 
    
         
            +
                    update(_toClaimKey32(policyNftId, claimId), abi.encode(claim), newState);
         
     | 
| 
       205 
212 
     | 
    
         
             
                }
         
     | 
| 
       206 
213 
     | 
    
         | 
| 
       207 
214 
     | 
    
         
             
                function updateClaimState(NftId policyNftId, ClaimId claimId, StateId newState) external restricted() {
         
     | 
| 
       208 
     | 
    
         
            -
                    updateState( 
     | 
| 
      
 215 
     | 
    
         
            +
                    updateState(_toClaimKey32(policyNftId, claimId), newState);
         
     | 
| 
       209 
216 
     | 
    
         
             
                }
         
     | 
| 
       210 
217 
     | 
    
         | 
| 
       211 
218 
     | 
    
         
             
                //--- Payout ------------------------------------------------------------//
         
     | 
| 
       212 
     | 
    
         
            -
                function createPayout(NftId policyNftId,  
     | 
| 
       213 
     | 
    
         
            -
                    create( 
     | 
| 
      
 219 
     | 
    
         
            +
                function createPayout(NftId policyNftId, PayoutId payoutId, IPolicy.PayoutInfo memory payout) external restricted() {
         
     | 
| 
      
 220 
     | 
    
         
            +
                    create(_toPayoutKey32(policyNftId, payoutId), abi.encode(payout));
         
     | 
| 
       214 
221 
     | 
    
         
             
                }
         
     | 
| 
       215 
222 
     | 
    
         | 
| 
       216 
     | 
    
         
            -
                function updatePayout(NftId policyNftId,  
     | 
| 
       217 
     | 
    
         
            -
                    update( 
     | 
| 
      
 223 
     | 
    
         
            +
                function updatePayout(NftId policyNftId, PayoutId payoutId, IPolicy.PayoutInfo memory payout, StateId newState) external restricted() {
         
     | 
| 
      
 224 
     | 
    
         
            +
                    update(_toPayoutKey32(policyNftId, payoutId), abi.encode(payout), newState);
         
     | 
| 
       218 
225 
     | 
    
         
             
                }
         
     | 
| 
       219 
226 
     | 
    
         | 
| 
       220 
     | 
    
         
            -
                function updatePayoutState(NftId policyNftId, StateId newState) external restricted() {
         
     | 
| 
       221 
     | 
    
         
            -
                    updateState( 
     | 
| 
      
 227 
     | 
    
         
            +
                function updatePayoutState(NftId policyNftId, PayoutId payoutId, StateId newState) external restricted() {
         
     | 
| 
      
 228 
     | 
    
         
            +
                    updateState(_toPayoutKey32(policyNftId, payoutId), newState);
         
     | 
| 
       222 
229 
     | 
    
         
             
                }
         
     | 
| 
       223 
230 
     | 
    
         | 
| 
       224 
     | 
    
         
            -
                //---  
     | 
| 
       225 
     | 
    
         
            -
                function  
     | 
| 
       226 
     | 
    
         
            -
                     
     | 
| 
      
 231 
     | 
    
         
            +
                //--- ITransferInterceptor ------------------------------------------------------------//
         
     | 
| 
      
 232 
     | 
    
         
            +
                function nftMint(address to, uint256 tokenId) external onlyChainNft {
         
     | 
| 
      
 233 
     | 
    
         
            +
                    assert(_accessManager.roleMembers(INSTANCE_OWNER_ROLE()) == 0);// temp
         
     | 
| 
      
 234 
     | 
    
         
            +
                    assert(_accessManager.grantRole(INSTANCE_OWNER_ROLE(), to) == true);
         
     | 
| 
       227 
235 
     | 
    
         
             
                }
         
     | 
| 
       228 
236 
     | 
    
         | 
| 
       229 
     | 
    
         
            -
                function  
     | 
| 
       230 
     | 
    
         
            -
                     
     | 
| 
      
 237 
     | 
    
         
            +
                function nftTransferFrom(address from, address to, uint256 tokenId) external onlyChainNft {
         
     | 
| 
      
 238 
     | 
    
         
            +
                    assert(_accessManager.revokeRole(INSTANCE_OWNER_ROLE(), from) == true);
         
     | 
| 
      
 239 
     | 
    
         
            +
                    assert(_accessManager.grantRole(INSTANCE_OWNER_ROLE(), to) == true);
         
     | 
| 
       231 
240 
     | 
    
         
             
                }
         
     | 
| 
       232 
241 
     | 
    
         | 
| 
       233 
     | 
    
         
            -
                 
     | 
| 
       234 
     | 
    
         
            -
                    return policyNftId.toKey32(POLICY());
         
     | 
| 
       235 
     | 
    
         
            -
                }
         
     | 
| 
      
 242 
     | 
    
         
            +
                //--- initial setup functions -------------------------------------------//
         
     | 
| 
       236 
243 
     | 
    
         | 
| 
       237 
     | 
    
         
            -
                function  
     | 
| 
       238 
     | 
    
         
            -
                     
     | 
| 
       239 
     | 
    
         
            -
             
     | 
| 
      
 244 
     | 
    
         
            +
                function setInstanceAccessManager(InstanceAccessManager accessManager) external restricted {
         
     | 
| 
      
 245 
     | 
    
         
            +
                    if(address(_accessManager) != address(0)) {
         
     | 
| 
      
 246 
     | 
    
         
            +
                        revert ErrorInstanceInstanceAccessManagerAlreadySet(address(_accessManager));
         
     | 
| 
      
 247 
     | 
    
         
            +
                    }
         
     | 
| 
       240 
248 
     | 
    
         | 
| 
       241 
     | 
    
         
            -
             
     | 
| 
       242 
     | 
    
         
            -
             
     | 
| 
       243 
     | 
    
         
            -
             
     | 
| 
      
 249 
     | 
    
         
            +
                    if(accessManager.authority() != authority()) {
         
     | 
| 
      
 250 
     | 
    
         
            +
                        revert ErrorInstanceInstanceAccessManagerAuthorityMismatch(authority());
         
     | 
| 
      
 251 
     | 
    
         
            +
                    }
         
     | 
| 
       244 
252 
     | 
    
         | 
| 
       245 
     | 
    
         
            -
             
     | 
| 
       246 
     | 
    
         
            -
                    return distNftId.toKey32(DISTRIBUTOR());
         
     | 
| 
       247 
     | 
    
         
            -
                }
         
     | 
| 
       248 
     | 
    
         
            -
                
         
     | 
| 
       249 
     | 
    
         
            -
                function getDistributionService() external view returns (IDistributionService) {
         
     | 
| 
       250 
     | 
    
         
            -
                    return IDistributionService(getRegistry().getServiceAddress(DISTRIBUTION(), VersionPart.wrap(3)));
         
     | 
| 
      
 253 
     | 
    
         
            +
                    _accessManager = accessManager;      
         
     | 
| 
       251 
254 
     | 
    
         
             
                }
         
     | 
| 
       252 
255 
     | 
    
         | 
| 
       253 
     | 
    
         
            -
                function  
     | 
| 
       254 
     | 
    
         
            -
                     
     | 
| 
      
 256 
     | 
    
         
            +
                function setBundleManager(BundleManager bundleManager) external restricted() {
         
     | 
| 
      
 257 
     | 
    
         
            +
                    if(address(_bundleManager) != address(0)) {
         
     | 
| 
      
 258 
     | 
    
         
            +
                        revert ErrorInstanceBundleManagerAlreadySet(address(_bundleManager));
         
     | 
| 
      
 259 
     | 
    
         
            +
                    }
         
     | 
| 
      
 260 
     | 
    
         
            +
             
     | 
| 
      
 261 
     | 
    
         
            +
                    if(bundleManager.getInstance() != Instance(this)) {
         
     | 
| 
      
 262 
     | 
    
         
            +
                        revert ErrorInstanceBundleManagerInstanceMismatch(address(this));
         
     | 
| 
      
 263 
     | 
    
         
            +
                    }
         
     | 
| 
      
 264 
     | 
    
         
            +
             
     | 
| 
      
 265 
     | 
    
         
            +
                    if(bundleManager.authority() != authority()) {
         
     | 
| 
      
 266 
     | 
    
         
            +
                        revert ErrorInstanceBundleManagerAuthorityMismatch(authority());
         
     | 
| 
      
 267 
     | 
    
         
            +
                    }
         
     | 
| 
      
 268 
     | 
    
         
            +
             
     | 
| 
      
 269 
     | 
    
         
            +
                    _bundleManager = bundleManager;
         
     | 
| 
       255 
270 
     | 
    
         
             
                }
         
     | 
| 
       256 
271 
     | 
    
         | 
| 
       257 
     | 
    
         
            -
                function  
     | 
| 
       258 
     | 
    
         
            -
                     
     | 
| 
      
 272 
     | 
    
         
            +
                function setInstanceReader(InstanceReader instanceReader) external restricted() {
         
     | 
| 
      
 273 
     | 
    
         
            +
                    if(instanceReader.getInstance() != Instance(this)) {
         
     | 
| 
      
 274 
     | 
    
         
            +
                        revert ErrorInstanceInstanceReaderInstanceMismatch(address(this));
         
     | 
| 
      
 275 
     | 
    
         
            +
                    }
         
     | 
| 
      
 276 
     | 
    
         
            +
             
     | 
| 
      
 277 
     | 
    
         
            +
                    _instanceReader = instanceReader;
         
     | 
| 
       259 
278 
     | 
    
         
             
                }
         
     | 
| 
       260 
279 
     | 
    
         | 
| 
       261 
     | 
    
         
            -
                 
     | 
| 
       262 
     | 
    
         
            -
             
     | 
| 
      
 280 
     | 
    
         
            +
                //--- external view functions -------------------------------------------//
         
     | 
| 
      
 281 
     | 
    
         
            +
             
     | 
| 
      
 282 
     | 
    
         
            +
                function getInstanceReader() external view returns (InstanceReader) {
         
     | 
| 
      
 283 
     | 
    
         
            +
                    return _instanceReader;
         
     | 
| 
       263 
284 
     | 
    
         
             
                }
         
     | 
| 
       264 
285 
     | 
    
         | 
| 
       265 
     | 
    
         
            -
                function  
     | 
| 
       266 
     | 
    
         
            -
                    return  
     | 
| 
      
 286 
     | 
    
         
            +
                function getBundleManager() external view returns (BundleManager) {
         
     | 
| 
      
 287 
     | 
    
         
            +
                    return _bundleManager;
         
     | 
| 
       267 
288 
     | 
    
         
             
                }
         
     | 
| 
       268 
289 
     | 
    
         | 
| 
       269 
     | 
    
         
            -
                function  
     | 
| 
       270 
     | 
    
         
            -
                     
     | 
| 
       271 
     | 
    
         
            -
                    _instanceReader = instanceReader;
         
     | 
| 
      
 290 
     | 
    
         
            +
                function getInstanceAccessManager() external view returns (InstanceAccessManager) {
         
     | 
| 
      
 291 
     | 
    
         
            +
                    return _accessManager;
         
     | 
| 
       272 
292 
     | 
    
         
             
                }
         
     | 
| 
       273 
293 
     | 
    
         | 
| 
       274 
294 
     | 
    
         
             
                function getMajorVersion() external pure returns (VersionPart majorVersion) {
         
     | 
| 
       275 
295 
     | 
    
         
             
                    return VersionPartLib.toVersionPart(GIF_MAJOR_VERSION);
         
     | 
| 
       276 
296 
     | 
    
         
             
                }
         
     | 
| 
       277 
297 
     | 
    
         | 
| 
       278 
     | 
    
         
            -
                 
     | 
| 
       279 
     | 
    
         
            -
             
     | 
| 
      
 298 
     | 
    
         
            +
                //--- internal view/pure functions --------------------------------------//
         
     | 
| 
      
 299 
     | 
    
         
            +
                function _toNftKey32(NftId nftId, ObjectType objectType) private pure returns (Key32) {
         
     | 
| 
      
 300 
     | 
    
         
            +
                    return nftId.toKey32(objectType);
         
     | 
| 
       280 
301 
     | 
    
         
             
                }
         
     | 
| 
       281 
     | 
    
         
            -
             
     | 
| 
       282 
     | 
    
         
            -
                function  
     | 
| 
       283 
     | 
    
         
            -
                     
     | 
| 
       284 
     | 
    
         
            -
                    require(bundleManager.getInstance() == Instance(this), "BundleManager instance mismatch");
         
     | 
| 
       285 
     | 
    
         
            -
                    _bundleManager = bundleManager;
         
     | 
| 
      
 302 
     | 
    
         
            +
             
     | 
| 
      
 303 
     | 
    
         
            +
                function _toClaimKey32(NftId policyNftId, ClaimId claimId) private pure returns (Key32) {
         
     | 
| 
      
 304 
     | 
    
         
            +
                    return claimId.toKey32(policyNftId);
         
     | 
| 
       286 
305 
     | 
    
         
             
                }
         
     | 
| 
       287 
306 
     | 
    
         | 
| 
       288 
     | 
    
         
            -
                function  
     | 
| 
       289 
     | 
    
         
            -
                    return  
     | 
| 
      
 307 
     | 
    
         
            +
                function _toPayoutKey32(NftId policyNftId, PayoutId payoutId) private pure returns (Key32) {
         
     | 
| 
      
 308 
     | 
    
         
            +
                    return payoutId.toKey32(policyNftId);
         
     | 
| 
       290 
309 
     | 
    
         
             
                }
         
     | 
| 
       291 
310 
     | 
    
         
             
            }
         
     |