@etherisc/gif-next 0.0.2-9105e58-225 → 0.0.2-917cede-703
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 +78 -100
- package/artifacts/contracts/components/Distribution.sol/Distribution.dbg.json +1 -1
- package/artifacts/contracts/components/Distribution.sol/Distribution.json +139 -194
- package/artifacts/contracts/components/IComponent.sol/IComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IComponent.sol/IComponent.json +156 -64
- package/artifacts/contracts/components/IDistributionComponent.sol/IDistributionComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IDistributionComponent.sol/IDistributionComponent.json +169 -143
- package/artifacts/contracts/components/IPoolComponent.sol/IPoolComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IPoolComponent.sol/IPoolComponent.json +353 -176
- package/artifacts/contracts/components/IProductComponent.sol/IProductComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IProductComponent.sol/IProductComponent.json +162 -138
- package/artifacts/contracts/components/Pool.sol/Pool.dbg.json +1 -1
- package/artifacts/contracts/components/Pool.sol/Pool.json +291 -248
- package/artifacts/contracts/components/Product.sol/Product.dbg.json +1 -1
- package/artifacts/contracts/components/Product.sol/Product.json +83 -173
- 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 +527 -400
- package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.dbg.json +1 -1
- package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.json +166 -181
- package/artifacts/contracts/instance/Instance.sol/Instance.dbg.json +1 -1
- package/artifacts/contracts/instance/Instance.sol/Instance.json +500 -623
- 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 +253 -236
- package/artifacts/contracts/instance/InstanceService.sol/InstanceService.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceService.sol/InstanceService.json +300 -384
- package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.json +246 -84
- 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 +71 -166
- 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 +266 -253
- package/artifacts/contracts/instance/service/ApplicationServiceManager.sol/ApplicationServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/ApplicationServiceManager.sol/ApplicationServiceManager.json +214 -76
- package/artifacts/contracts/instance/service/BundleService.sol/BundleService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/BundleService.sol/BundleService.json +409 -386
- package/artifacts/contracts/instance/service/BundleServiceManager.sol/BundleServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/BundleServiceManager.sol/BundleServiceManager.json +249 -71
- package/artifacts/contracts/instance/service/ClaimService.sol/ClaimService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/ClaimService.sol/ClaimService.json +338 -230
- package/artifacts/contracts/instance/service/ClaimServiceManager.sol/ClaimServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/ClaimServiceManager.sol/ClaimServiceManager.json +225 -63
- package/artifacts/contracts/instance/service/DistributionService.sol/DistributionService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/DistributionService.sol/DistributionService.json +883 -233
- package/artifacts/contracts/instance/service/DistributionServiceManager.sol/DistributionServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/DistributionServiceManager.sol/DistributionServiceManager.json +308 -78
- package/artifacts/contracts/instance/service/IApplicationService.sol/IApplicationService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IApplicationService.sol/IApplicationService.json +196 -181
- package/artifacts/contracts/instance/service/IBundleService.sol/IBundleService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IBundleService.sol/IBundleService.json +233 -296
- package/artifacts/contracts/instance/service/IClaimService.sol/IClaimService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IClaimService.sol/IClaimService.json +231 -177
- package/artifacts/contracts/instance/service/IDistributionService.sol/IDistributionService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IDistributionService.sol/IDistributionService.json +594 -134
- package/artifacts/contracts/instance/service/IPolicyService.sol/IPolicyService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IPolicyService.sol/IPolicyService.json +405 -190
- package/artifacts/contracts/instance/service/IPoolService.sol/IPoolService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IPoolService.sol/IPoolService.json +583 -109
- package/artifacts/contracts/instance/service/IProductService.sol/IProductService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IProductService.sol/IProductService.json +68 -141
- package/artifacts/contracts/instance/service/PolicyService.sol/PolicyService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/PolicyService.sol/PolicyService.json +525 -296
- package/artifacts/contracts/instance/service/PolicyServiceManager.sol/PolicyServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/PolicyServiceManager.sol/PolicyServiceManager.json +228 -86
- package/artifacts/contracts/instance/service/PoolService.sol/PoolService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/PoolService.sol/PoolService.json +734 -206
- package/artifacts/contracts/instance/service/PoolServiceManager.sol/PoolServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/PoolServiceManager.sol/PoolServiceManager.json +234 -68
- package/artifacts/contracts/instance/service/ProductService.sol/ProductService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/ProductService.sol/ProductService.json +107 -222
- package/artifacts/contracts/instance/service/ProductServiceManager.sol/ProductServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/ProductServiceManager.sol/ProductServiceManager.json +191 -73
- 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 -163
- 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 +24 -221
- package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.dbg.json +1 -1
- package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.json +184 -70
- 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 +68 -141
- package/artifacts/contracts/shared/IVersionable.sol/IVersionable.dbg.json +1 -1
- package/artifacts/contracts/shared/IVersionable.sol/IVersionable.json +0 -150
- 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 +169 -53
- package/artifacts/contracts/shared/Registerable.sol/Registerable.dbg.json +1 -1
- package/artifacts/contracts/shared/Registerable.sol/Registerable.json +5 -16
- 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 +82 -161
- 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/shared/Versionable.sol/Versionable.json +0 -150
- 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 +6 -17
- 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 +100 -211
- 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 +6 -188
- 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 +23 -4
- 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 +4 -0
- package/artifacts/contracts/types/Seconds.sol/SecondsLib.json +124 -0
- 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 +38 -7
- 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 +99 -88
- package/contracts/components/Distribution.sol +22 -46
- package/contracts/components/IComponent.sol +40 -19
- package/contracts/components/IDistributionComponent.sol +1 -30
- package/contracts/components/IPoolComponent.sol +73 -47
- package/contracts/components/IProductComponent.sol +3 -2
- package/contracts/components/Pool.sol +178 -130
- package/contracts/components/Product.sol +157 -71
- package/contracts/instance/AccessManagerUpgradeableInitializeable.sol +13 -0
- package/contracts/instance/BundleManager.sol +10 -9
- 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 -191
- 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 +8 -5
- package/contracts/instance/module/IComponents.sol +41 -0
- package/contracts/instance/module/IDistribution.sol +2 -0
- package/contracts/instance/module/IPolicy.sol +37 -7
- package/contracts/instance/module/ISetup.sol +7 -21
- package/contracts/instance/service/ApplicationService.sol +137 -50
- package/contracts/instance/service/BundleService.sol +228 -83
- package/contracts/instance/service/ClaimService.sol +114 -26
- package/contracts/instance/service/DistributionService.sol +225 -71
- package/contracts/instance/service/IApplicationService.sol +9 -13
- package/contracts/instance/service/IBundleService.sol +74 -26
- package/contracts/instance/service/IClaimService.sol +46 -15
- package/contracts/instance/service/IDistributionService.sol +37 -3
- package/contracts/instance/service/IPolicyService.sol +69 -21
- package/contracts/instance/service/IPoolService.sol +85 -3
- package/contracts/instance/service/PolicyService.sol +301 -230
- package/contracts/instance/service/PolicyServiceManager.sol +1 -1
- package/contracts/instance/service/PoolService.sol +245 -18
- package/contracts/instance/service/ProductService.sol +31 -54
- package/contracts/instance/service/ProductServiceManager.sol +1 -1
- 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 +15 -16
- package/contracts/registry/ReleaseManager.sol +26 -33
- package/contracts/registry/TokenRegistry.sol +1 -6
- package/contracts/shared/IService.sol +4 -4
- package/contracts/shared/IVersionable.sol +4 -47
- package/contracts/shared/ProxyManager.sol +89 -22
- package/contracts/shared/Registerable.sol +2 -6
- package/contracts/shared/Service.sol +29 -17
- package/contracts/shared/TokenHandler.sol +11 -5
- package/contracts/shared/Versionable.sol +1 -90
- 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/Referral.sol +4 -0
- package/contracts/types/RoleId.sol +13 -6
- package/contracts/types/Seconds.sol +54 -0
- package/contracts/types/StateId.sol +7 -2
- package/contracts/types/Timestamp.sol +18 -13
- package/contracts/types/UFixed.sol +1 -0
- package/contracts/types/Version.sol +1 -0
- package/package.json +1 -1
- package/artifacts/contracts/experiment/cloning/Cloner.sol/Cloner.dbg.json +0 -4
- package/artifacts/contracts/experiment/cloning/Cloner.sol/Cloner.json +0 -66
- package/artifacts/contracts/experiment/cloning/Cloner.sol/Mock1.dbg.json +0 -4
- package/artifacts/contracts/experiment/cloning/Cloner.sol/Mock1.json +0 -24
- package/artifacts/contracts/experiment/cloning/Cloner.sol/Mock2.dbg.json +0 -4
- package/artifacts/contracts/experiment/cloning/Cloner.sol/Mock2.json +0 -42
- package/artifacts/contracts/experiment/errors/Require.sol/Require.dbg.json +0 -4
- package/artifacts/contracts/experiment/errors/Require.sol/Require.json +0 -105
- package/artifacts/contracts/experiment/errors/Revert.sol/Revert.dbg.json +0 -4
- package/artifacts/contracts/experiment/errors/Revert.sol/Revert.json +0 -105
- package/artifacts/contracts/experiment/inheritance/A.sol/A.dbg.json +0 -4
- package/artifacts/contracts/experiment/inheritance/A.sol/A.json +0 -128
- package/artifacts/contracts/experiment/inheritance/A.sol/AShared.dbg.json +0 -4
- package/artifacts/contracts/experiment/inheritance/A.sol/AShared.json +0 -42
- package/artifacts/contracts/experiment/inheritance/B.sol/B.dbg.json +0 -4
- package/artifacts/contracts/experiment/inheritance/B.sol/B.json +0 -76
- package/artifacts/contracts/experiment/inheritance/C.sol/C.dbg.json +0 -4
- package/artifacts/contracts/experiment/inheritance/C.sol/C.json +0 -89
- package/artifacts/contracts/experiment/inheritance/IA.sol/IA.dbg.json +0 -4
- package/artifacts/contracts/experiment/inheritance/IA.sol/IA.json +0 -128
- package/artifacts/contracts/experiment/inheritance/IA.sol/ISharedA.dbg.json +0 -4
- package/artifacts/contracts/experiment/inheritance/IA.sol/ISharedA.json +0 -37
- package/artifacts/contracts/experiment/inheritance/IB.sol/IB.dbg.json +0 -4
- package/artifacts/contracts/experiment/inheritance/IB.sol/IB.json +0 -50
- package/artifacts/contracts/experiment/inheritance/IC.sol/IC.dbg.json +0 -4
- package/artifacts/contracts/experiment/inheritance/IC.sol/IC.json +0 -63
- package/artifacts/contracts/experiment/statemachine/Dummy.sol/LifeCycleModule.dbg.json +0 -4
- package/artifacts/contracts/experiment/statemachine/Dummy.sol/LifeCycleModule.json +0 -59
- package/artifacts/contracts/experiment/statemachine/ISM.sol/ISM.dbg.json +0 -4
- package/artifacts/contracts/experiment/statemachine/ISM.sol/ISM.json +0 -124
- package/artifacts/contracts/experiment/statemachine/ISM.sol/ISMEE.dbg.json +0 -4
- package/artifacts/contracts/experiment/statemachine/ISM.sol/ISMEE.json +0 -74
- package/artifacts/contracts/experiment/statemachine/SM.sol/SM.dbg.json +0 -4
- package/artifacts/contracts/experiment/statemachine/SM.sol/SM.json +0 -124
- package/artifacts/contracts/experiment/statemachine/SimpleStateMachine.sol/SimpleStateMachine.dbg.json +0 -4
- package/artifacts/contracts/experiment/statemachine/SimpleStateMachine.sol/SimpleStateMachine.json +0 -207
- package/artifacts/contracts/experiment/types/TypeA.sol/TypeALib.dbg.json +0 -4
- package/artifacts/contracts/experiment/types/TypeA.sol/TypeALib.json +0 -10
- package/artifacts/contracts/experiment/types/TypeB.sol/TypeBLib.dbg.json +0 -4
- package/artifacts/contracts/experiment/types/TypeB.sol/TypeBLib.json +0 -10
- package/contracts/experiment/cloning/Cloner.sol +0 -47
- package/contracts/experiment/errors/Require.sol +0 -38
- package/contracts/experiment/errors/Revert.sol +0 -44
- package/contracts/experiment/inheritance/A.sol +0 -53
- package/contracts/experiment/inheritance/B.sol +0 -28
- package/contracts/experiment/inheritance/C.sol +0 -34
- package/contracts/experiment/inheritance/IA.sol +0 -13
- package/contracts/experiment/inheritance/IB.sol +0 -10
- package/contracts/experiment/inheritance/IC.sol +0 -12
- package/contracts/experiment/statemachine/Dummy.sol +0 -27
- package/contracts/experiment/statemachine/ISM.sol +0 -25
- package/contracts/experiment/statemachine/SM.sol +0 -57
- package/contracts/experiment/statemachine/SimpleStateMachine.sol +0 -31
- package/contracts/experiment/types/TypeA.sol +0 -47
- package/contracts/experiment/types/TypeB.sol +0 -29
@@ -1,11 +1,13 @@
|
|
1
1
|
// SPDX-License-Identifier: Apache-2.0
|
2
2
|
pragma solidity ^0.8.20;
|
3
3
|
|
4
|
-
import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
|
5
|
-
import {IERC20Metadata} from "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol";
|
6
4
|
import {AccessManagedUpgradeable} from "@openzeppelin/contracts-upgradeable/access/manager/AccessManagedUpgradeable.sol";
|
5
|
+
import {IAccessManaged} from "@openzeppelin/contracts/access/manager/IAccessManaged.sol";
|
6
|
+
import {IERC20Metadata} from "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol";
|
7
|
+
import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
|
7
8
|
|
8
9
|
import {IComponent} from "./IComponent.sol";
|
10
|
+
import {IComponents} from "../instance/module/IComponents.sol";
|
9
11
|
import {IProductService} from "../instance/service/IProductService.sol";
|
10
12
|
import {IInstanceService} from "../instance/IInstanceService.sol";
|
11
13
|
import {IInstance} from "../instance/IInstance.sol";
|
@@ -29,21 +31,23 @@ abstract contract Component is
|
|
29
31
|
AccessManagedUpgradeable
|
30
32
|
{
|
31
33
|
// keccak256(abi.encode(uint256(keccak256("gif-next.contracts.component.Component.sol")) - 1)) & ~bytes32(uint256(0xff));
|
32
|
-
bytes32 public constant
|
34
|
+
bytes32 public constant COMPONENT_LOCATION_V1 = 0xffe8d4462baed26a47154f4b8f6db497d2f772496965791d25bd456e342b7f00;
|
33
35
|
|
34
36
|
struct ComponentStorage {
|
35
|
-
IInstance _instance; // instance for this component
|
36
|
-
InstanceReader _instanceReader; // instance reader for this component
|
37
37
|
string _name; // unique (per instance) component name
|
38
38
|
IERC20Metadata _token; // token for this component
|
39
|
+
IInstance _instance; // instance for this component
|
39
40
|
address _wallet; // wallet for this component (default = component contract itself)
|
41
|
+
InstanceReader _instanceReader; // instance reader for this component
|
40
42
|
bool _isNftInterceptor; // declares if component is involved in nft transfers
|
41
|
-
IInstanceService _instanceService; // instance service for this component
|
42
|
-
|
43
43
|
NftId _productNftId; // only relevant for components that are linked to a aproduct
|
44
|
-
IProductService _productService; // product service for component, might not be relevant for some component types (eg oracles)
|
45
44
|
}
|
46
45
|
|
46
|
+
function _getComponentStorage() private pure returns (ComponentStorage storage $) {
|
47
|
+
assembly {
|
48
|
+
$.slot := COMPONENT_LOCATION_V1
|
49
|
+
}
|
50
|
+
}
|
47
51
|
|
48
52
|
modifier onlyChainNft() {
|
49
53
|
if(msg.sender != getRegistry().getChainNftAddress()) {
|
@@ -52,20 +56,6 @@ abstract contract Component is
|
|
52
56
|
_;
|
53
57
|
}
|
54
58
|
|
55
|
-
|
56
|
-
modifier onlyProductService() {
|
57
|
-
if(msg.sender != address(_getComponentStorage()._productService)) {
|
58
|
-
revert ErrorComponentNotProductService(msg.sender);
|
59
|
-
}
|
60
|
-
_;
|
61
|
-
}
|
62
|
-
|
63
|
-
function _getComponentStorage() private pure returns (ComponentStorage storage $) {
|
64
|
-
assembly {
|
65
|
-
$.slot := CONTRACT_LOCATION_V1
|
66
|
-
}
|
67
|
-
}
|
68
|
-
|
69
59
|
function initializeComponent(
|
70
60
|
address registry,
|
71
61
|
NftId instanceNftId,
|
@@ -74,78 +64,45 @@ abstract contract Component is
|
|
74
64
|
ObjectType componentType,
|
75
65
|
bool isInterceptor,
|
76
66
|
address initialOwner,
|
77
|
-
bytes memory data
|
67
|
+
bytes memory registryData // writeonly data that will saved in the object info record of the registry
|
78
68
|
)
|
79
69
|
public
|
80
70
|
virtual
|
81
71
|
onlyInitializing()
|
82
72
|
{
|
83
|
-
|
84
|
-
initializeRegisterable(registry, instanceNftId, componentType, isInterceptor, initialOwner, data);
|
85
|
-
|
86
|
-
// set unique name of component
|
87
|
-
$._name = name;
|
88
|
-
$._isNftInterceptor = isInterceptor;
|
73
|
+
initializeRegisterable(registry, instanceNftId, componentType, isInterceptor, initialOwner, registryData);
|
89
74
|
|
90
75
|
// set and check linked instance
|
91
|
-
|
92
|
-
$._instance = IInstance(
|
76
|
+
ComponentStorage storage $ = _getComponentStorage();
|
77
|
+
$._instance = IInstance(
|
78
|
+
getRegistry().getObjectInfo(instanceNftId).objectAddress);
|
79
|
+
|
93
80
|
if(!$._instance.supportsInterface(type(IInstance).interfaceId)) {
|
94
|
-
revert ErrorComponentNotInstance(instanceNftId
|
81
|
+
revert ErrorComponentNotInstance(instanceNftId);
|
95
82
|
}
|
96
83
|
|
97
84
|
// initialize AccessManagedUpgradeable
|
98
85
|
__AccessManaged_init($._instance.authority());
|
99
86
|
|
100
|
-
// set
|
101
|
-
|
102
|
-
$.
|
87
|
+
// set component state
|
88
|
+
$._name = name;
|
89
|
+
$._isNftInterceptor = isInterceptor;
|
103
90
|
$._instanceReader = $._instance.getInstanceReader();
|
104
|
-
$._productService = IProductService(getRegistry().getServiceAddress(PRODUCT(), gifVersion));
|
105
|
-
|
106
|
-
// set wallet and token
|
107
91
|
$._wallet = address(this);
|
108
92
|
$._token = IERC20Metadata(token);
|
109
93
|
|
94
|
+
registerInterface(type(IAccessManaged).interfaceId);
|
110
95
|
registerInterface(type(IComponent).interfaceId);
|
111
96
|
}
|
112
97
|
|
113
|
-
/// @dev callback function for nft transfers. may only be called by chain nft contract.
|
114
|
-
/// default implementation is empty. overriding functions MUST add onlyChainNft modifier
|
115
|
-
function nftTransferFrom(address from, address to, uint256 tokenId)
|
116
|
-
external
|
117
|
-
virtual override
|
118
|
-
onlyChainNft()
|
119
|
-
{ }
|
120
|
-
|
121
|
-
// TODO discuss replacement with modifier restricted from accessmanaged
|
122
98
|
function lock() external onlyOwner override {
|
123
|
-
|
99
|
+
IInstanceService(_getServiceAddress(INSTANCE())).setComponentLocked(true);
|
124
100
|
}
|
125
101
|
|
126
102
|
function unlock() external onlyOwner override {
|
127
|
-
|
103
|
+
IInstanceService(_getServiceAddress(INSTANCE())).setComponentLocked(false);
|
128
104
|
}
|
129
105
|
|
130
|
-
// only product service may set product nft id during registration of product setup
|
131
|
-
function setProductNftId(NftId productNftId)
|
132
|
-
external
|
133
|
-
override
|
134
|
-
onlyProductService()
|
135
|
-
{
|
136
|
-
ComponentStorage storage $ = _getComponentStorage();
|
137
|
-
|
138
|
-
if($._productNftId.gtz()) {
|
139
|
-
revert ErrorComponentProductNftAlreadySet();
|
140
|
-
}
|
141
|
-
|
142
|
-
$._productNftId = productNftId;
|
143
|
-
}
|
144
|
-
|
145
|
-
/// @dev Sets the wallet address for the component.
|
146
|
-
/// if the current wallet has tokens, these will be transferred.
|
147
|
-
/// if the new wallet address is externally owned, an approval from the
|
148
|
-
/// owner of the external wallet for the component to move all tokens must exist.
|
149
106
|
function setWallet(address newWallet)
|
150
107
|
external
|
151
108
|
override
|
@@ -160,8 +117,9 @@ abstract contract Component is
|
|
160
117
|
if (newWallet == address(0)) {
|
161
118
|
revert ErrorComponentWalletAddressZero();
|
162
119
|
}
|
120
|
+
|
163
121
|
if (newWallet == currentWallet) {
|
164
|
-
revert ErrorComponentWalletAddressIsSameAsCurrent(
|
122
|
+
revert ErrorComponentWalletAddressIsSameAsCurrent();
|
165
123
|
}
|
166
124
|
|
167
125
|
if (currentBalance > 0) {
|
@@ -178,7 +136,7 @@ abstract contract Component is
|
|
178
136
|
|
179
137
|
// effects
|
180
138
|
$._wallet = newWallet;
|
181
|
-
emit LogComponentWalletAddressChanged(newWallet);
|
139
|
+
emit LogComponentWalletAddressChanged(currentWallet, newWallet);
|
182
140
|
|
183
141
|
// interactions
|
184
142
|
if (currentBalance > 0) {
|
@@ -193,11 +151,44 @@ abstract contract Component is
|
|
193
151
|
}
|
194
152
|
}
|
195
153
|
|
196
|
-
function
|
197
|
-
|
198
|
-
view
|
154
|
+
function setProductNftId(NftId productNftId)
|
155
|
+
external
|
199
156
|
override
|
200
|
-
|
157
|
+
{
|
158
|
+
ComponentStorage storage $ = _getComponentStorage();
|
159
|
+
|
160
|
+
// verify caller is product service
|
161
|
+
if(msg.sender != _getServiceAddress(PRODUCT())) {
|
162
|
+
revert ErrorComponentNotProductService(msg.sender);
|
163
|
+
}
|
164
|
+
|
165
|
+
// verify component is not yet linked to a product
|
166
|
+
if($._productNftId.gtz()) {
|
167
|
+
revert ErrorComponentProductNftAlreadySet();
|
168
|
+
}
|
169
|
+
|
170
|
+
$._productNftId = productNftId;
|
171
|
+
}
|
172
|
+
|
173
|
+
function nftMint(address to, uint256 tokenId)
|
174
|
+
external
|
175
|
+
virtual
|
176
|
+
onlyChainNft
|
177
|
+
{}
|
178
|
+
|
179
|
+
/// @dev callback function for nft transfers
|
180
|
+
/// may only be called by chain nft contract.
|
181
|
+
/// do not override this function to implement business logic for handling transfers
|
182
|
+
/// override internal function _nftTransferFrom instead
|
183
|
+
function nftTransferFrom(address from, address to, uint256 tokenId)
|
184
|
+
external
|
185
|
+
virtual
|
186
|
+
onlyChainNft
|
187
|
+
{
|
188
|
+
_nftTransferFrom(from, to, tokenId);
|
189
|
+
}
|
190
|
+
|
191
|
+
function getWallet() public view override returns (address walletAddress)
|
201
192
|
{
|
202
193
|
return _getComponentStorage()._wallet;
|
203
194
|
}
|
@@ -214,15 +205,6 @@ abstract contract Component is
|
|
214
205
|
return _getComponentStorage()._instance;
|
215
206
|
}
|
216
207
|
|
217
|
-
function getInstanceReader() public view returns (InstanceReader reader) {
|
218
|
-
return _getComponentStorage()._instanceReader;
|
219
|
-
}
|
220
|
-
|
221
|
-
function getServiceAddress(ObjectType domain) public view returns (address service) {
|
222
|
-
VersionPart majorVersion = getInstance().getMajorVersion();
|
223
|
-
return getRegistry().getServiceAddress(domain, majorVersion);
|
224
|
-
}
|
225
|
-
|
226
208
|
function getName() public view override returns(string memory name) {
|
227
209
|
return _getComponentStorage()._name;
|
228
210
|
}
|
@@ -231,12 +213,41 @@ abstract contract Component is
|
|
231
213
|
return _getComponentStorage()._productNftId;
|
232
214
|
}
|
233
215
|
|
234
|
-
function
|
235
|
-
|
216
|
+
function getComponentInfo() public view returns (IComponents.ComponentInfo memory info) {
|
217
|
+
info = _getInstanceReader().getComponentInfo(getNftId());
|
218
|
+
|
219
|
+
// fallback to initial info (wallet is always != address(0))
|
220
|
+
if(info.wallet == address(0)) {
|
221
|
+
info = _getInitialInfo();
|
222
|
+
}
|
236
223
|
}
|
237
224
|
|
238
|
-
|
239
|
-
|
225
|
+
/// @dev defines initial component specification
|
226
|
+
/// overwrite this function according to your use case
|
227
|
+
function _getInitialInfo()
|
228
|
+
internal
|
229
|
+
view
|
230
|
+
virtual
|
231
|
+
returns (IComponents.ComponentInfo memory info)
|
232
|
+
{ }
|
233
|
+
|
234
|
+
|
235
|
+
/// @dev internal function for nft transfers.
|
236
|
+
/// handling logic that deals with nft transfers need to overwrite this function
|
237
|
+
function _nftTransferFrom(address from, address to, uint256 tokenId)
|
238
|
+
internal
|
239
|
+
virtual
|
240
|
+
{ }
|
241
|
+
|
242
|
+
/// @dev returns reader for linked instance
|
243
|
+
function _getInstanceReader() internal view returns (InstanceReader reader) {
|
244
|
+
return _getComponentStorage()._instanceReader;
|
240
245
|
}
|
241
246
|
|
242
|
-
|
247
|
+
/// @dev returns the service address for the specified domain
|
248
|
+
/// gets address via lookup from registry using the major version form the linked instance
|
249
|
+
function _getServiceAddress(ObjectType domain) internal view returns (address service) {
|
250
|
+
VersionPart majorVersion = _getComponentStorage()._instance.getMajorVersion();
|
251
|
+
return getRegistry().getServiceAddress(domain, majorVersion);
|
252
|
+
}
|
253
|
+
}
|
@@ -8,6 +8,7 @@ import {NftId, zeroNftId, NftIdLib, toNftId} from "../types/NftId.sol";
|
|
8
8
|
import {ReferralId, ReferralStatus, ReferralLib} from "../types/Referral.sol";
|
9
9
|
import {Fee, FeeLib} from "../types/Fee.sol";
|
10
10
|
import {Component} from "./Component.sol";
|
11
|
+
import {IDistribution} from "../instance/module/IDistribution.sol";
|
11
12
|
import {IDistributionComponent} from "./IDistributionComponent.sol";
|
12
13
|
import {IRegistry} from "../registry/IRegistry.sol";
|
13
14
|
import {IRegisterable} from "../shared/IRegisterable.sol";
|
@@ -17,7 +18,7 @@ import {TokenHandler} from "../shared/TokenHandler.sol";
|
|
17
18
|
import {InstanceReader} from "../instance/InstanceReader.sol";
|
18
19
|
import {UFixed} from "../types/UFixed.sol";
|
19
20
|
import {DistributorType} from "../types/DistributorType.sol";
|
20
|
-
import {Timestamp} from "../types/Timestamp.sol";
|
21
|
+
import {Timestamp, TimestampLib} from "../types/Timestamp.sol";
|
21
22
|
import {ITransferInterceptor} from "../registry/ITransferInterceptor.sol";
|
22
23
|
|
23
24
|
|
@@ -29,37 +30,43 @@ abstract contract Distribution is
|
|
29
30
|
bytes32 public constant DISTRIBUTION_STORAGE_LOCATION_V1 = 0xaab7c5ea03d290056d6c060e0833d3ebcbe647f7694616a2ec52738a64b2f900;
|
30
31
|
|
31
32
|
struct DistributionStorage {
|
33
|
+
Fee _minDistributionOwnerFee;
|
32
34
|
Fee _distributionFee;
|
33
35
|
TokenHandler _tokenHandler;
|
34
36
|
IDistributionService _distributionService;
|
35
37
|
mapping(address distributor => NftId distributorNftId) _distributorNftId;
|
36
38
|
}
|
37
39
|
|
40
|
+
error ErrorDistributionAlreadyDistributor(address distributor, NftId distributorNftId);
|
41
|
+
|
38
42
|
function initializeDistribution(
|
39
43
|
address registry,
|
40
44
|
NftId instanceNftId,
|
41
45
|
string memory name,
|
42
46
|
address token,
|
47
|
+
Fee memory minDistributionOwnerFee,
|
43
48
|
Fee memory distributionFee,
|
44
49
|
address initialOwner,
|
45
|
-
bytes memory data
|
50
|
+
bytes memory registryData // writeonly data that will saved in the object info record of the registry
|
46
51
|
)
|
47
52
|
public
|
48
53
|
virtual
|
49
54
|
onlyInitializing()
|
50
55
|
{
|
51
|
-
initializeComponent(registry, instanceNftId, name, token, DISTRIBUTION(), true, initialOwner,
|
56
|
+
initializeComponent(registry, instanceNftId, name, token, DISTRIBUTION(), true, initialOwner, registryData);
|
52
57
|
|
53
58
|
DistributionStorage storage $ = _getDistributionStorage();
|
54
59
|
// TODO add validation
|
60
|
+
$._minDistributionOwnerFee = minDistributionOwnerFee;
|
55
61
|
$._distributionFee = distributionFee;
|
56
62
|
$._tokenHandler = new TokenHandler(token);
|
57
|
-
$._distributionService =
|
63
|
+
$._distributionService = IDistributionService(_getServiceAddress(DISTRIBUTION()));
|
58
64
|
|
59
65
|
registerInterface(type(IDistributionComponent).interfaceId);
|
60
66
|
}
|
61
67
|
|
62
68
|
function setFees(
|
69
|
+
Fee memory minDistributionOwnerFee,
|
63
70
|
Fee memory distributionFee
|
64
71
|
)
|
65
72
|
external
|
@@ -67,7 +74,7 @@ abstract contract Distribution is
|
|
67
74
|
onlyOwner
|
68
75
|
restricted()
|
69
76
|
{
|
70
|
-
_getDistributionStorage()._distributionService.setFees(distributionFee);
|
77
|
+
_getDistributionStorage()._distributionService.setFees(minDistributionOwnerFee, distributionFee);
|
71
78
|
}
|
72
79
|
|
73
80
|
function getDistributionFee() external view returns (Fee memory distributionFee) {
|
@@ -111,7 +118,9 @@ abstract contract Distribution is
|
|
111
118
|
returns(NftId distributorNftId)
|
112
119
|
{
|
113
120
|
DistributionStorage storage $ = _getDistributionStorage();
|
114
|
-
|
121
|
+
if($._distributorNftId[distributor].gtz()) {
|
122
|
+
revert ErrorDistributionAlreadyDistributor(distributor, $._distributorNftId[distributor]);
|
123
|
+
}
|
115
124
|
|
116
125
|
distributorNftId = $._distributionService.createDistributor(
|
117
126
|
distributor,
|
@@ -141,7 +150,7 @@ abstract contract Distribution is
|
|
141
150
|
* @dev lets distributors create referral codes.
|
142
151
|
* referral codes need to be unique
|
143
152
|
*/
|
144
|
-
function
|
153
|
+
function _createReferral(
|
145
154
|
NftId distributorNftId,
|
146
155
|
string memory code,
|
147
156
|
UFixed discountPercentage,
|
@@ -149,8 +158,7 @@ abstract contract Distribution is
|
|
149
158
|
Timestamp expiryAt,
|
150
159
|
bytes memory data
|
151
160
|
)
|
152
|
-
|
153
|
-
// TODO add authz (only active distributor)
|
161
|
+
internal
|
154
162
|
returns (ReferralId referralId)
|
155
163
|
{
|
156
164
|
DistributionStorage storage $ = _getDistributionStorage();
|
@@ -163,22 +171,6 @@ abstract contract Distribution is
|
|
163
171
|
data);
|
164
172
|
}
|
165
173
|
|
166
|
-
function calculateFeeAmount(
|
167
|
-
ReferralId referralId,
|
168
|
-
uint256 netPremiumAmount
|
169
|
-
)
|
170
|
-
external
|
171
|
-
view
|
172
|
-
virtual override
|
173
|
-
returns (uint256 feeAmount)
|
174
|
-
{
|
175
|
-
ISetup.DistributionSetupInfo memory setupInfo = getSetupInfo();
|
176
|
-
Fee memory fee = setupInfo.distributionFee;
|
177
|
-
(feeAmount,) = FeeLib.calculateFee(fee, netPremiumAmount);
|
178
|
-
// TODO: use this?
|
179
|
-
// return _distributionService.calculateFeeAmount(referralId, premiumAmount);
|
180
|
-
}
|
181
|
-
|
182
174
|
function isDistributor(address candidate)
|
183
175
|
public
|
184
176
|
view
|
@@ -206,7 +198,7 @@ abstract contract Distribution is
|
|
206
198
|
)
|
207
199
|
{
|
208
200
|
ReferralId referralId = getReferralId(referralCode);
|
209
|
-
return
|
201
|
+
return _getInstanceReader().getDiscountPercentage(referralId);
|
210
202
|
}
|
211
203
|
|
212
204
|
|
@@ -235,19 +227,6 @@ abstract contract Distribution is
|
|
235
227
|
return 0 * netPremiumAmount;
|
236
228
|
}
|
237
229
|
|
238
|
-
function processSale(
|
239
|
-
ReferralId referralId,
|
240
|
-
uint256 premiumAmount
|
241
|
-
)
|
242
|
-
external
|
243
|
-
onlyOwner
|
244
|
-
restricted()
|
245
|
-
virtual override
|
246
|
-
{
|
247
|
-
DistributionStorage storage $ = _getDistributionStorage();
|
248
|
-
$._distributionService.processSale(referralId, premiumAmount);
|
249
|
-
}
|
250
|
-
|
251
230
|
function processRenewal(
|
252
231
|
ReferralId referralId,
|
253
232
|
uint256 feeAmount
|
@@ -260,11 +239,6 @@ abstract contract Distribution is
|
|
260
239
|
// default is no action
|
261
240
|
}
|
262
241
|
|
263
|
-
function referralIsValid(ReferralId referralId) external view returns (bool isValid) {
|
264
|
-
// default is invalid
|
265
|
-
return false;
|
266
|
-
}
|
267
|
-
|
268
242
|
function getSetupInfo() public view returns (ISetup.DistributionSetupInfo memory setupInfo) {
|
269
243
|
InstanceReader reader = getInstance().getInstanceReader();
|
270
244
|
setupInfo = reader.getDistributionSetupInfo(getNftId());
|
@@ -280,13 +254,15 @@ abstract contract Distribution is
|
|
280
254
|
return ISetup.DistributionSetupInfo(
|
281
255
|
zeroNftId(),
|
282
256
|
$._tokenHandler,
|
257
|
+
$._minDistributionOwnerFee,
|
283
258
|
$._distributionFee,
|
284
|
-
address(this)
|
259
|
+
address(this),
|
260
|
+
0
|
285
261
|
);
|
286
262
|
}
|
287
263
|
|
288
264
|
|
289
|
-
function
|
265
|
+
function _nftTransferFrom(address from, address to, uint256 tokenId) internal virtual override {
|
290
266
|
// keep track of distributor nft owner
|
291
267
|
emit LogDistributorUpdated(to, msg.sender);
|
292
268
|
DistributionStorage storage $ = _getDistributionStorage();
|
@@ -1,8 +1,10 @@
|
|
1
1
|
// SPDX-License-Identifier: Apache-2.0
|
2
2
|
pragma solidity ^0.8.20;
|
3
3
|
|
4
|
+
import {IAccessManaged} from "@openzeppelin/contracts/access/manager/IAccessManaged.sol";
|
4
5
|
import {IERC20Metadata} from "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol";
|
5
6
|
|
7
|
+
import {IComponents} from "../instance/module/IComponents.sol";
|
6
8
|
import {IInstance} from "../instance/IInstance.sol";
|
7
9
|
import {IInstanceService} from "../instance/IInstanceService.sol";
|
8
10
|
import {IProductService} from "../instance/service/IProductService.sol";
|
@@ -11,45 +13,64 @@ import {ITransferInterceptor} from "../registry/ITransferInterceptor.sol";
|
|
11
13
|
import {NftId} from "../types/NftId.sol";
|
12
14
|
import {ObjectType} from "../types/ObjectType.sol";
|
13
15
|
|
16
|
+
/// @dev component base class
|
17
|
+
/// component examples are product, distribution, pool and oracle
|
14
18
|
interface IComponent is
|
15
19
|
IRegisterable,
|
16
|
-
ITransferInterceptor
|
20
|
+
ITransferInterceptor,
|
21
|
+
IAccessManaged
|
17
22
|
{
|
18
|
-
|
19
23
|
error ErrorComponentNotChainNft(address caller);
|
20
24
|
error ErrorComponentNotProductService(address caller);
|
21
|
-
error ErrorComponentNotInstance(NftId instanceNftId
|
25
|
+
error ErrorComponentNotInstance(NftId instanceNftId);
|
22
26
|
error ErrorComponentProductNftAlreadySet();
|
27
|
+
|
23
28
|
error ErrorComponentWalletAddressZero();
|
24
|
-
error ErrorComponentWalletAddressIsSameAsCurrent(
|
29
|
+
error ErrorComponentWalletAddressIsSameAsCurrent();
|
25
30
|
error ErrorComponentWalletAllowanceTooSmall(address oldWallet, address newWallet, uint256 allowance, uint256 balance);
|
26
|
-
error ErrorComponentUnauthorized(address caller, uint64 requiredRoleIdNum);
|
27
31
|
|
28
|
-
event LogComponentWalletAddressChanged(address newWallet);
|
32
|
+
event LogComponentWalletAddressChanged(address oldWallet, address newWallet);
|
29
33
|
event LogComponentWalletTokensTransferred(address from, address to, uint256 amount);
|
30
34
|
|
31
|
-
|
32
|
-
|
33
|
-
// TODO remove and replace with accessmanaged target locking mechanism
|
35
|
+
/// @dev locks component to disable functions that may change state related to this component, the only exception is function "unlock"
|
36
|
+
/// only component owner (nft holder) is authorizes to call this function
|
34
37
|
function lock() external;
|
35
|
-
function unlock() external;
|
36
38
|
|
37
|
-
|
39
|
+
/// @dev unlocks component to (re-)enable functions that may change state related to this component
|
40
|
+
/// only component owner (nft holder) is authorizes to call this function
|
41
|
+
function unlock() external;
|
38
42
|
|
43
|
+
/// @dev sets the wallet address for the component
|
44
|
+
/// if the current wallet has tokens, these will be transferred
|
45
|
+
/// if the new wallet address is externally owned, an approval from the
|
46
|
+
/// owner of the external wallet for the component to move all tokens must exist
|
39
47
|
function setWallet(address walletAddress) external;
|
40
|
-
function getWallet() external view returns (address walletAddress);
|
41
48
|
|
42
|
-
|
49
|
+
/// @dev only product service may set product nft id during registration of product setup
|
50
|
+
function setProductNftId(NftId productNftId) external;
|
51
|
+
|
52
|
+
/// @dev returns the name of this component
|
53
|
+
/// to successfully register the component with an instance the name MUST be unique in the linked instance
|
54
|
+
function getName() external view returns (string memory name);
|
55
|
+
|
56
|
+
/// @dev defines which ERC20 token is used by this component
|
57
|
+
function getToken() external view returns (IERC20Metadata token);
|
43
58
|
|
59
|
+
/// @dev defines the instance to which this component is linked to
|
44
60
|
function getInstance() external view returns (IInstance instance);
|
45
61
|
|
46
|
-
/// @dev
|
47
|
-
///
|
48
|
-
function
|
62
|
+
/// @dev defines the wallet address used to hold the ERC20 tokens related to this component
|
63
|
+
/// the default address is the component token address
|
64
|
+
function getWallet() external view returns (address walletAddress);
|
49
65
|
|
50
|
-
|
66
|
+
/// @dev defines the product to which this component is linked to
|
67
|
+
/// this is only relevant for pool and distribution components
|
51
68
|
function getProductNftId() external view returns (NftId productNftId);
|
52
69
|
|
53
|
-
function
|
54
|
-
|
70
|
+
function isNftInterceptor() external view returns(bool isInterceptor);
|
71
|
+
|
72
|
+
/// @dev returns component infos for this pool
|
73
|
+
/// when registered with an instance the info is obtained from the data stored in the instance
|
74
|
+
/// when not registered the function returns the info from the component contract
|
75
|
+
function getComponentInfo() external view returns (IComponents.ComponentInfo memory info);
|
55
76
|
}
|
@@ -17,6 +17,7 @@ interface IDistributionComponent is IComponent {
|
|
17
17
|
function getSetupInfo() external view returns (ISetup.DistributionSetupInfo memory setupInfo);
|
18
18
|
|
19
19
|
function setFees(
|
20
|
+
Fee memory minDistributionOwnerFee,
|
20
21
|
Fee memory distributionFee
|
21
22
|
) external;
|
22
23
|
|
@@ -44,38 +45,11 @@ interface IDistributionComponent is IComponent {
|
|
44
45
|
bytes memory data
|
45
46
|
) external;
|
46
47
|
|
47
|
-
/**
|
48
|
-
* @dev lets distributors create referral codes.
|
49
|
-
* referral codes need to be unique
|
50
|
-
* distributor is identified via msg.sender.
|
51
|
-
*/
|
52
|
-
function createReferral(
|
53
|
-
NftId distributorNftId,
|
54
|
-
string memory code,
|
55
|
-
UFixed discountPercentage,
|
56
|
-
uint32 maxReferrals,
|
57
|
-
Timestamp expiryAt,
|
58
|
-
bytes memory data
|
59
|
-
) external returns (ReferralId referralId);
|
60
|
-
|
61
|
-
function calculateFeeAmount(
|
62
|
-
ReferralId referralId,
|
63
|
-
uint256 netPremiumAmount
|
64
|
-
) external view returns (uint256 feeAmount);
|
65
|
-
|
66
48
|
function calculateRenewalFeeAmount(
|
67
49
|
ReferralId referralId,
|
68
50
|
uint256 netPremiumAmount
|
69
51
|
) external view returns (uint256 feeAmount);
|
70
52
|
|
71
|
-
/// @dev callback from product service when selling a policy for a specific referralId
|
72
|
-
/// the used referral id and the collected fee are provided as parameters
|
73
|
-
/// the component implementation can then process this information accordingly
|
74
|
-
function processSale(
|
75
|
-
ReferralId referralId,
|
76
|
-
uint256 feeAmount
|
77
|
-
) external;
|
78
|
-
|
79
53
|
/// @dev callback from product service when a policy is renews for a specific referralId
|
80
54
|
function processRenewal(
|
81
55
|
ReferralId referralId,
|
@@ -92,9 +66,6 @@ interface IDistributionComponent is IComponent {
|
|
92
66
|
string memory referralCode
|
93
67
|
) external returns (ReferralId referralId);
|
94
68
|
|
95
|
-
/// @dev returns true iff the referral id is valid
|
96
|
-
function referralIsValid(ReferralId referralId) external view returns (bool isValid);
|
97
|
-
|
98
69
|
/// @dev returns true iff the component needs to be called when selling/renewing policis
|
99
70
|
function isVerifying() external view returns (bool verifying);
|
100
71
|
}
|