@etherisc/gif-next 0.0.2-e875d61-189 → 0.0.2-eb13b47-989
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +179 -26
- package/artifacts/contracts/components/BaseComponent.sol/BaseComponent.dbg.json +1 -1
- package/artifacts/contracts/components/BaseComponent.sol/BaseComponent.json +168 -28
- package/artifacts/contracts/components/Distribution.sol/Distribution.dbg.json +4 -0
- package/artifacts/contracts/components/Distribution.sol/Distribution.json +610 -0
- package/artifacts/contracts/components/IBaseComponent.sol/IBaseComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IBaseComponent.sol/IBaseComponent.json +121 -28
- package/artifacts/contracts/components/IDistributionComponent.sol/IDistributionComponent.dbg.json +4 -0
- package/artifacts/contracts/components/IDistributionComponent.sol/IDistributionComponent.json +152 -0
- package/artifacts/contracts/components/IPoolComponent.sol/IPoolComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IPoolComponent.sol/IPoolComponent.json +74 -181
- package/artifacts/contracts/components/IProductComponent.sol/IProductComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IProductComponent.sol/IProductComponent.json +55 -177
- package/artifacts/contracts/components/Pool.sol/Pool.dbg.json +1 -1
- package/artifacts/contracts/components/Pool.sol/Pool.json +389 -70
- package/artifacts/contracts/components/Product.sol/Product.dbg.json +1 -1
- package/artifacts/contracts/components/Product.sol/Product.json +477 -71
- package/artifacts/contracts/experiment/cloning/Cloner.sol/Cloner.dbg.json +4 -0
- package/artifacts/contracts/experiment/cloning/Cloner.sol/Cloner.json +66 -0
- package/artifacts/contracts/experiment/cloning/Cloner.sol/Mock1.dbg.json +4 -0
- package/artifacts/contracts/experiment/cloning/Cloner.sol/Mock1.json +24 -0
- package/artifacts/contracts/experiment/cloning/Cloner.sol/Mock2.dbg.json +4 -0
- package/artifacts/contracts/experiment/cloning/Cloner.sol/Mock2.json +42 -0
- package/artifacts/contracts/experiment/errors/Require.sol/Require.dbg.json +1 -1
- package/artifacts/contracts/experiment/errors/Revert.sol/Revert.dbg.json +1 -1
- package/artifacts/contracts/experiment/inheritance/A.sol/A.dbg.json +1 -1
- package/artifacts/contracts/experiment/inheritance/A.sol/AShared.dbg.json +1 -1
- package/artifacts/contracts/experiment/inheritance/B.sol/B.dbg.json +1 -1
- package/artifacts/contracts/experiment/inheritance/C.sol/C.dbg.json +1 -1
- package/artifacts/contracts/experiment/inheritance/IA.sol/IA.dbg.json +1 -1
- package/artifacts/contracts/experiment/inheritance/IA.sol/ISharedA.dbg.json +1 -1
- package/artifacts/contracts/experiment/inheritance/IB.sol/IB.dbg.json +1 -1
- package/artifacts/contracts/experiment/inheritance/IC.sol/IC.dbg.json +1 -1
- package/artifacts/contracts/experiment/statemachine/Dummy.sol/LifeCycleModule.dbg.json +1 -1
- package/artifacts/contracts/experiment/statemachine/Dummy.sol/LifeCycleModule.json +2 -2
- package/artifacts/contracts/experiment/statemachine/ISM.sol/ISM.dbg.json +1 -1
- package/artifacts/contracts/experiment/statemachine/ISM.sol/ISMEE.dbg.json +1 -1
- package/artifacts/contracts/experiment/statemachine/SM.sol/SM.dbg.json +1 -1
- package/artifacts/contracts/experiment/statemachine/SM.sol/SM.json +2 -2
- package/artifacts/contracts/experiment/statemachine/SimpleStateMachine.sol/SimpleStateMachine.dbg.json +1 -1
- package/artifacts/contracts/experiment/statemachine/SimpleStateMachine.sol/SimpleStateMachine.json +2 -2
- package/artifacts/contracts/experiment/types/TypeA.sol/TypeALib.dbg.json +1 -1
- package/artifacts/contracts/experiment/types/TypeB.sol/TypeBLib.dbg.json +1 -1
- package/artifacts/contracts/instance/AccessManagedSimple.sol/AccessManagedSimple.dbg.json +4 -0
- package/artifacts/contracts/instance/AccessManagedSimple.sol/AccessManagedSimple.json +114 -0
- package/artifacts/contracts/instance/AccessManagerSimple.sol/AccessManagerSimple.dbg.json +4 -0
- package/artifacts/contracts/instance/AccessManagerSimple.sol/AccessManagerSimple.json +1132 -0
- package/artifacts/contracts/instance/IAccessManagerSimple.sol/IAccessManagerSimple.dbg.json +4 -0
- package/artifacts/contracts/instance/IAccessManagerSimple.sol/IAccessManagerSimple.json +1082 -0
- package/artifacts/contracts/instance/IInstance.sol/IInstance.dbg.json +1 -1
- package/artifacts/contracts/instance/IInstance.sol/IInstance.json +140 -1658
- package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.dbg.json +4 -0
- package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.json +480 -0
- package/artifacts/contracts/instance/Instance.sol/Instance.dbg.json +1 -1
- package/artifacts/contracts/instance/Instance.sol/Instance.json +2426 -1125
- package/artifacts/contracts/instance/InstanceAccessManager.sol/InstanceAccessManager.dbg.json +4 -0
- package/artifacts/contracts/instance/InstanceAccessManager.sol/InstanceAccessManager.json +930 -0
- package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.dbg.json +4 -0
- package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.json +1283 -0
- package/artifacts/contracts/instance/InstanceService.sol/InstanceService.dbg.json +4 -0
- package/artifacts/contracts/instance/InstanceService.sol/InstanceService.json +755 -0
- package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.dbg.json +4 -0
- package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.json +432 -0
- package/artifacts/contracts/instance/base/ComponentServiceBase.sol/ComponentServiceBase.dbg.json +1 -1
- package/artifacts/contracts/instance/base/ComponentServiceBase.sol/ComponentServiceBase.json +224 -43
- package/artifacts/contracts/instance/base/IInstanceBase.sol/IInstanceBase.dbg.json +1 -1
- package/artifacts/contracts/instance/base/IInstanceBase.sol/IInstanceBase.json +33 -1
- package/artifacts/contracts/instance/base/IKeyValueStore.sol/IKeyValueStore.dbg.json +1 -1
- package/artifacts/contracts/instance/base/IKeyValueStore.sol/IKeyValueStore.json +27 -158
- 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 +37 -245
- package/artifacts/contracts/instance/base/Lifecycle.sol/Lifecycle.dbg.json +1 -1
- package/artifacts/contracts/instance/base/Lifecycle.sol/Lifecycle.json +4 -4
- package/artifacts/contracts/instance/module/IAccess.sol/IAccess.dbg.json +4 -0
- package/artifacts/contracts/instance/module/IAccess.sol/IAccess.json +211 -0
- package/artifacts/contracts/instance/module/IBundle.sol/IBundle.dbg.json +4 -0
- package/artifacts/contracts/instance/module/{bundle/IBundle.sol → IBundle.sol}/IBundle.json +1 -1
- package/artifacts/contracts/instance/module/IDistribution.sol/IDistribution.dbg.json +4 -0
- package/artifacts/contracts/instance/module/{access/IAccess.sol/IAccess.json → IDistribution.sol/IDistribution.json} +2 -2
- package/artifacts/contracts/instance/module/IPolicy.sol/IPolicy.dbg.json +4 -0
- package/artifacts/contracts/instance/module/{policy/IPolicy.sol → IPolicy.sol}/IPolicy.json +1 -1
- package/artifacts/contracts/instance/module/IRisk.sol/IRisk.dbg.json +4 -0
- package/artifacts/contracts/instance/module/{risk/IRisk.sol → IRisk.sol}/IRisk.json +1 -1
- package/artifacts/contracts/instance/module/ISetup.sol/ISetup.dbg.json +4 -0
- package/artifacts/contracts/instance/{base/ModuleBase.sol/ModuleBase.json → module/ISetup.sol/ISetup.json} +2 -2
- package/artifacts/contracts/instance/module/ITreasury.sol/ITreasury.dbg.json +4 -0
- package/artifacts/contracts/instance/module/{treasury/ITreasury.sol → ITreasury.sol}/ITreasury.json +1 -1
- package/artifacts/contracts/instance/service/ComponentOwnerService.sol/ComponentOwnerService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/ComponentOwnerService.sol/ComponentOwnerService.json +381 -77
- package/artifacts/contracts/instance/service/IComponentOwnerService.sol/IComponentOwnerService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IComponentOwnerService.sol/IComponentOwnerService.json +177 -75
- package/artifacts/contracts/instance/service/IDistributionService.sol/IDistributionService.dbg.json +4 -0
- package/artifacts/contracts/instance/{base/ServiceBase.sol/ServiceBase.json → service/IDistributionService.sol/IDistributionService.json} +204 -58
- package/artifacts/contracts/instance/service/IPoolService.sol/IPoolService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IPoolService.sol/IPoolService.json +235 -50
- package/artifacts/contracts/instance/service/IProductService.sol/IProductService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IProductService.sol/IProductService.json +325 -51
- package/artifacts/contracts/registry/ChainNft.sol/ChainNft.dbg.json +1 -1
- package/artifacts/contracts/registry/ChainNft.sol/ChainNft.json +186 -12
- package/artifacts/contracts/registry/IRegistry.sol/IRegistry.dbg.json +1 -1
- package/artifacts/contracts/registry/IRegistry.sol/IRegistry.json +460 -38
- package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.dbg.json +4 -0
- package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.json +872 -0
- package/artifacts/contracts/registry/ITransferInterceptor.sol/ITransferInterceptor.dbg.json +4 -0
- package/artifacts/contracts/registry/ITransferInterceptor.sol/ITransferInterceptor.json +34 -0
- package/artifacts/contracts/registry/Registry.sol/Registry.dbg.json +1 -1
- package/artifacts/contracts/registry/Registry.sol/Registry.json +563 -124
- package/artifacts/contracts/registry/RegistryService.sol/RegistryService.dbg.json +4 -0
- package/artifacts/contracts/registry/RegistryService.sol/RegistryService.json +1261 -0
- package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.dbg.json +4 -0
- package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.json +508 -0
- package/artifacts/contracts/shared/ContractDeployerLib.sol/ContractDeployerLib.dbg.json +4 -0
- package/artifacts/contracts/shared/ContractDeployerLib.sol/ContractDeployerLib.json +107 -0
- package/artifacts/contracts/shared/ERC165.sol/ERC165.dbg.json +1 -1
- package/artifacts/contracts/shared/ERC165.sol/ERC165.json +2 -2
- package/artifacts/contracts/shared/INftOwnable.sol/INftOwnable.dbg.json +4 -0
- package/artifacts/contracts/shared/INftOwnable.sol/INftOwnable.json +127 -0
- package/artifacts/contracts/shared/IRegisterable.sol/IRegisterable.dbg.json +1 -1
- package/artifacts/contracts/shared/IRegisterable.sol/IRegisterable.json +117 -37
- package/artifacts/contracts/shared/IService.sol/IService.dbg.json +4 -0
- package/artifacts/contracts/{instance/base → shared}/IService.sol/IService.json +175 -54
- package/artifacts/contracts/shared/IVersionable.sol/IVersionable.dbg.json +1 -1
- package/artifacts/contracts/shared/IVersionable.sol/IVersionable.json +55 -14
- package/artifacts/contracts/shared/NftOwnable.sol/NftOwnable.dbg.json +4 -0
- package/artifacts/contracts/shared/NftOwnable.sol/NftOwnable.json +158 -0
- package/artifacts/contracts/shared/ProxyManager.sol/ProxyManager.dbg.json +4 -0
- package/artifacts/contracts/shared/ProxyManager.sol/ProxyManager.json +349 -0
- package/artifacts/contracts/shared/Registerable.sol/Registerable.dbg.json +1 -1
- package/artifacts/contracts/shared/Registerable.sol/Registerable.json +190 -37
- package/artifacts/contracts/shared/RegisterableUpgradable.sol/RegisterableUpgradable.dbg.json +4 -0
- package/artifacts/contracts/{instance/base/InstanceBase.sol/InstanceBase.json → shared/RegisterableUpgradable.sol/RegisterableUpgradable.json} +188 -90
- package/artifacts/contracts/shared/Service.sol/Service.dbg.json +4 -0
- package/artifacts/contracts/shared/Service.sol/Service.json +468 -0
- package/artifacts/contracts/shared/TokenHandler.sol/TokenHandler.dbg.json +4 -0
- package/artifacts/contracts/shared/TokenHandler.sol/TokenHandler.json +96 -0
- package/artifacts/contracts/shared/UpgradableProxyWithAdmin.sol/UpgradableProxyWithAdmin.dbg.json +4 -0
- package/artifacts/contracts/shared/UpgradableProxyWithAdmin.sol/UpgradableProxyWithAdmin.json +129 -0
- package/artifacts/contracts/shared/Versionable.sol/Versionable.dbg.json +1 -1
- package/artifacts/contracts/shared/Versionable.sol/Versionable.json +78 -14
- package/artifacts/contracts/test/TestFee.sol/TestFee.dbg.json +1 -1
- package/artifacts/contracts/test/TestFee.sol/TestFee.json +4 -4
- package/artifacts/contracts/test/TestRegisterable.sol/TestRegisterable.dbg.json +1 -1
- package/artifacts/contracts/test/TestRegisterable.sol/TestRegisterable.json +204 -36
- package/artifacts/contracts/test/TestRoleId.sol/TestRoleId.dbg.json +1 -1
- package/artifacts/contracts/test/TestRoleId.sol/TestRoleId.json +14 -14
- package/artifacts/contracts/test/TestService.sol/TestService.dbg.json +1 -1
- package/artifacts/contracts/test/TestService.sol/TestService.json +283 -62
- package/artifacts/contracts/test/TestToken.sol/TestUsdc.dbg.json +1 -1
- package/artifacts/contracts/test/TestToken.sol/TestUsdc.json +91 -53
- 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 +103 -23
- package/artifacts/contracts/test/Usdc.sol/USDC.dbg.json +1 -1
- package/artifacts/contracts/test/Usdc.sol/USDC.json +91 -53
- package/artifacts/contracts/types/AddressSet.sol/LibAddressSet.dbg.json +1 -1
- package/artifacts/contracts/types/Blocknumber.sol/BlocknumberLib.dbg.json +1 -1
- package/artifacts/contracts/types/ChainId.sol/ChainIdLib.dbg.json +1 -1
- package/artifacts/contracts/types/DistributorType.sol/DistributorTypeLib.dbg.json +4 -0
- package/artifacts/contracts/types/DistributorType.sol/DistributorTypeLib.json +104 -0
- package/artifacts/contracts/types/Fee.sol/FeeLib.dbg.json +1 -1
- package/artifacts/contracts/types/Fee.sol/FeeLib.json +52 -13
- package/artifacts/contracts/types/Key32.sol/Key32Lib.dbg.json +1 -1
- package/artifacts/contracts/types/Key32.sol/Key32Lib.json +31 -17
- package/artifacts/contracts/types/NftId.sol/NftIdLib.dbg.json +1 -1
- package/artifacts/contracts/types/NftId.sol/NftIdLib.json +2 -2
- 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 +4 -0
- package/artifacts/contracts/types/NumberId.sol/NumberIdLib.json +100 -0
- 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/Referral.sol/ReferralLib.dbg.json +4 -0
- package/artifacts/contracts/types/Referral.sol/ReferralLib.json +123 -0
- package/artifacts/contracts/types/RiskId.sol/RiskIdLib.dbg.json +4 -0
- package/artifacts/contracts/types/RiskId.sol/RiskIdLib.json +86 -0
- package/artifacts/contracts/types/RoleId.sol/RoleIdLib.dbg.json +1 -1
- package/artifacts/contracts/types/RoleId.sol/RoleIdLib.json +134 -8
- 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 +15 -2
- package/artifacts/contracts/types/UFixed.sol/MathLib.dbg.json +4 -0
- package/artifacts/contracts/types/UFixed.sol/MathLib.json +10 -0
- package/artifacts/contracts/types/UFixed.sol/UFixedLib.dbg.json +4 -0
- package/artifacts/contracts/types/UFixed.sol/{UFixedMathLib.json → UFixedLib.json} +3 -3
- package/artifacts/contracts/types/Version.sol/VersionLib.dbg.json +1 -1
- package/artifacts/contracts/types/Version.sol/VersionLib.json +40 -2
- package/artifacts/contracts/types/Version.sol/VersionPartLib.dbg.json +1 -1
- package/artifacts/contracts/types/Version.sol/VersionPartLib.json +22 -3
- package/contracts/components/BaseComponent.sol +20 -28
- package/contracts/components/Distribution.sol +166 -0
- package/contracts/components/IBaseComponent.sol +8 -3
- package/contracts/components/IDistributionComponent.sol +43 -0
- package/contracts/components/IPoolComponent.sol +14 -9
- package/contracts/components/IProductComponent.sol +25 -9
- package/contracts/components/Pool.sol +108 -40
- package/contracts/components/Product.sol +209 -46
- package/contracts/experiment/cloning/Cloner.sol +47 -0
- package/contracts/instance/AccessManagedSimple.sol +122 -0
- package/contracts/instance/AccessManagerSimple.sol +692 -0
- package/contracts/instance/IAccessManagerSimple.sol +391 -0
- package/contracts/instance/IInstance.sol +18 -40
- package/contracts/instance/IInstanceService.sol +30 -0
- package/contracts/instance/Instance.sol +427 -56
- package/contracts/instance/InstanceAccessManager.sol +288 -0
- package/contracts/instance/InstanceReader.sol +290 -0
- package/contracts/instance/InstanceService.sol +138 -0
- package/contracts/instance/InstanceServiceManager.sol +56 -0
- package/contracts/instance/base/ComponentServiceBase.sol +15 -8
- package/contracts/instance/base/IInstanceBase.sol +6 -2
- package/contracts/instance/base/IKeyValueStore.sol +13 -14
- package/contracts/instance/base/ILifecycle.sol +3 -3
- package/contracts/instance/base/KeyValueStore.sol +49 -38
- package/contracts/instance/base/Lifecycle.sol +11 -3
- package/contracts/instance/module/IAccess.sol +38 -0
- package/contracts/instance/module/IBundle.sol +19 -0
- package/contracts/instance/module/IDistribution.sol +39 -0
- package/contracts/instance/module/IPolicy.sol +45 -0
- package/contracts/instance/module/IRisk.sol +11 -0
- package/contracts/instance/module/ISetup.sol +43 -0
- package/contracts/instance/module/ITreasury.sol +23 -0
- package/contracts/instance/service/ComponentOwnerService.sol +238 -76
- package/contracts/instance/service/IComponentOwnerService.sol +1 -3
- package/contracts/instance/service/IDistributionService.sol +12 -0
- package/contracts/instance/service/IPoolService.sol +8 -1
- package/contracts/instance/service/IProductService.sol +56 -7
- package/contracts/registry/ChainNft.sol +80 -37
- package/contracts/registry/IRegistry.sol +58 -25
- package/contracts/registry/IRegistryService.sol +35 -0
- package/contracts/registry/ITransferInterceptor.sol +6 -0
- package/contracts/registry/Registry.sol +354 -267
- package/contracts/registry/RegistryService.sol +444 -0
- package/contracts/registry/RegistryServiceManager.sol +64 -0
- package/contracts/shared/ContractDeployerLib.sol +72 -0
- package/contracts/shared/INftOwnable.sol +22 -0
- package/contracts/shared/IRegisterable.sol +8 -15
- package/contracts/{instance/base → shared}/IService.sol +3 -3
- package/contracts/shared/IVersionable.sol +55 -11
- package/contracts/shared/NftOwnable.sol +136 -0
- package/contracts/shared/ProxyManager.sol +94 -0
- package/contracts/shared/Registerable.sol +62 -59
- package/contracts/shared/RegisterableUpgradable.sol +16 -0
- package/contracts/shared/Service.sol +54 -0
- package/contracts/shared/TokenHandler.sol +27 -0
- package/contracts/shared/UpgradableProxyWithAdmin.sol +16 -0
- package/contracts/shared/Versionable.sol +113 -55
- package/contracts/test/TestFee.sol +2 -2
- package/contracts/test/TestRegisterable.sol +5 -6
- package/contracts/test/TestRoleId.sol +1 -1
- package/contracts/test/TestService.sol +5 -13
- package/contracts/types/DistributorType.sol +55 -0
- package/contracts/types/Fee.sol +10 -5
- package/contracts/types/Key32.sol +8 -3
- package/contracts/types/NumberId.sol +52 -0
- package/contracts/types/ObjectType.sol +40 -11
- package/contracts/types/Referral.sol +85 -0
- package/contracts/types/RiskId.sol +43 -0
- package/contracts/types/RoleId.sol +54 -10
- package/contracts/types/StateId.sol +1 -1
- package/contracts/types/Timestamp.sol +7 -3
- package/contracts/types/UFixed.sol +128 -12
- package/contracts/types/Version.sol +13 -1
- package/package.json +4 -3
- package/artifacts/contracts/instance/IInstanceLinked.sol/IInstanceLinked.dbg.json +0 -4
- package/artifacts/contracts/instance/IInstanceLinked.sol/IInstanceLinked.json +0 -24
- package/artifacts/contracts/instance/base/IService.sol/IService.dbg.json +0 -4
- package/artifacts/contracts/instance/base/InstanceBase.sol/InstanceBase.dbg.json +0 -4
- package/artifacts/contracts/instance/base/ModuleBase.sol/ModuleBase.dbg.json +0 -4
- package/artifacts/contracts/instance/base/ServiceBase.sol/ServiceBase.dbg.json +0 -4
- package/artifacts/contracts/instance/module/access/Access.sol/AccessModule.dbg.json +0 -4
- package/artifacts/contracts/instance/module/access/Access.sol/AccessModule.json +0 -333
- package/artifacts/contracts/instance/module/access/IAccess.sol/IAccess.dbg.json +0 -4
- package/artifacts/contracts/instance/module/access/IAccess.sol/IAccessModule.dbg.json +0 -4
- package/artifacts/contracts/instance/module/access/IAccess.sol/IAccessModule.json +0 -333
- package/artifacts/contracts/instance/module/bundle/BundleModule.sol/BundleModule.dbg.json +0 -4
- package/artifacts/contracts/instance/module/bundle/BundleModule.sol/BundleModule.json +0 -265
- package/artifacts/contracts/instance/module/bundle/IBundle.sol/IBundle.dbg.json +0 -4
- package/artifacts/contracts/instance/module/bundle/IBundle.sol/IBundleModule.dbg.json +0 -4
- package/artifacts/contracts/instance/module/bundle/IBundle.sol/IBundleModule.json +0 -265
- package/artifacts/contracts/instance/module/compensation/CompensationModule.sol/CompensationModule.dbg.json +0 -4
- package/artifacts/contracts/instance/module/compensation/CompensationModule.sol/CompensationModule.json +0 -10
- package/artifacts/contracts/instance/module/compensation/ICompensation.sol/ICompensation.dbg.json +0 -4
- package/artifacts/contracts/instance/module/compensation/ICompensation.sol/ICompensation.json +0 -10
- package/artifacts/contracts/instance/module/compensation/ICompensation.sol/ICompensationModule.dbg.json +0 -4
- package/artifacts/contracts/instance/module/compensation/ICompensation.sol/ICompensationModule.json +0 -10
- package/artifacts/contracts/instance/module/component/ComponentModule.sol/ComponentModule.dbg.json +0 -4
- package/artifacts/contracts/instance/module/component/ComponentModule.sol/ComponentModule.json +0 -136
- package/artifacts/contracts/instance/module/component/IComponent.sol/IComponent.dbg.json +0 -4
- package/artifacts/contracts/instance/module/component/IComponent.sol/IComponent.json +0 -10
- package/artifacts/contracts/instance/module/component/IComponent.sol/IComponentModule.dbg.json +0 -4
- package/artifacts/contracts/instance/module/component/IComponent.sol/IComponentModule.json +0 -136
- package/artifacts/contracts/instance/module/policy/IPolicy.sol/IPolicy.dbg.json +0 -4
- package/artifacts/contracts/instance/module/policy/IPolicy.sol/IPolicyModule.dbg.json +0 -4
- package/artifacts/contracts/instance/module/policy/IPolicy.sol/IPolicyModule.json +0 -273
- package/artifacts/contracts/instance/module/policy/PolicyModule.sol/PolicyModule.dbg.json +0 -4
- package/artifacts/contracts/instance/module/policy/PolicyModule.sol/PolicyModule.json +0 -273
- package/artifacts/contracts/instance/module/pool/IPoolModule.sol/IPool.dbg.json +0 -4
- package/artifacts/contracts/instance/module/pool/IPoolModule.sol/IPool.json +0 -10
- package/artifacts/contracts/instance/module/pool/IPoolModule.sol/IPoolModule.dbg.json +0 -4
- package/artifacts/contracts/instance/module/pool/IPoolModule.sol/IPoolModule.json +0 -144
- package/artifacts/contracts/instance/module/pool/PoolModule.sol/PoolModule.dbg.json +0 -4
- package/artifacts/contracts/instance/module/pool/PoolModule.sol/PoolModule.json +0 -144
- package/artifacts/contracts/instance/module/risk/IRisk.sol/IRisk.dbg.json +0 -4
- package/artifacts/contracts/instance/module/risk/IRisk.sol/IRiskModule.dbg.json +0 -4
- package/artifacts/contracts/instance/module/risk/IRisk.sol/IRiskModule.json +0 -10
- package/artifacts/contracts/instance/module/risk/RiskModule.sol/RiskModule.dbg.json +0 -4
- package/artifacts/contracts/instance/module/risk/RiskModule.sol/RiskModule.json +0 -10
- package/artifacts/contracts/instance/module/treasury/ITreasury.sol/ITreasury.dbg.json +0 -4
- package/artifacts/contracts/instance/module/treasury/ITreasury.sol/ITreasuryModule.dbg.json +0 -4
- package/artifacts/contracts/instance/module/treasury/ITreasury.sol/ITreasuryModule.json +0 -531
- package/artifacts/contracts/instance/module/treasury/TokenHandler.sol/TokenHandler.dbg.json +0 -4
- package/artifacts/contracts/instance/module/treasury/TokenHandler.sol/TokenHandler.json +0 -76
- package/artifacts/contracts/instance/module/treasury/TreasuryModule.sol/TreasuryModule.dbg.json +0 -4
- package/artifacts/contracts/instance/module/treasury/TreasuryModule.sol/TreasuryModule.json +0 -531
- package/artifacts/contracts/instance/service/PoolService.sol/PoolService.dbg.json +0 -4
- package/artifacts/contracts/instance/service/PoolService.sol/PoolService.json +0 -471
- package/artifacts/contracts/instance/service/ProductService.sol/ProductService.dbg.json +0 -4
- package/artifacts/contracts/instance/service/ProductService.sol/ProductService.json +0 -673
- package/artifacts/contracts/registry/IChainNft.sol/IChainNft.dbg.json +0 -4
- package/artifacts/contracts/registry/IChainNft.sol/IChainNft.json +0 -452
- package/artifacts/contracts/registry/IRegistryLinked.sol/IRegistryLinked.dbg.json +0 -4
- package/artifacts/contracts/registry/IRegistryLinked.sol/IRegistryLinked.json +0 -24
- package/artifacts/contracts/shared/IOwnable.sol/IOwnable.dbg.json +0 -4
- package/artifacts/contracts/shared/IOwnable.sol/IOwnable.json +0 -24
- package/artifacts/contracts/test/TestPool.sol/TestPool.dbg.json +0 -4
- package/artifacts/contracts/test/TestPool.sol/TestPool.json +0 -455
- package/artifacts/contracts/test/TestProduct.sol/TestProduct.dbg.json +0 -4
- package/artifacts/contracts/test/TestProduct.sol/TestProduct.json +0 -436
- package/artifacts/contracts/types/UFixed.sol/UFixedMathLib.dbg.json +0 -4
- package/contracts/experiment/statemachine/README.md +0 -112
- package/contracts/instance/IInstanceLinked.sol +0 -8
- package/contracts/instance/base/InstanceBase.sol +0 -84
- package/contracts/instance/base/ModuleBase.sol +0 -46
- package/contracts/instance/base/ServiceBase.sol +0 -37
- package/contracts/instance/module/access/Access.sol +0 -149
- package/contracts/instance/module/access/IAccess.sol +0 -53
- package/contracts/instance/module/bundle/BundleModule.sol +0 -135
- package/contracts/instance/module/bundle/IBundle.sol +0 -51
- package/contracts/instance/module/compensation/CompensationModule.sol +0 -17
- package/contracts/instance/module/compensation/ICompensation.sol +0 -10
- package/contracts/instance/module/component/ComponentModule.sol +0 -81
- package/contracts/instance/module/component/IComponent.sol +0 -29
- package/contracts/instance/module/policy/IPolicy.sol +0 -59
- package/contracts/instance/module/policy/PolicyModule.sol +0 -89
- package/contracts/instance/module/pool/IPoolModule.sol +0 -40
- package/contracts/instance/module/pool/PoolModule.sol +0 -90
- package/contracts/instance/module/risk/IRisk.sol +0 -10
- package/contracts/instance/module/risk/RiskModule.sol +0 -17
- package/contracts/instance/module/treasury/ITreasury.sol +0 -96
- package/contracts/instance/module/treasury/TokenHandler.sol +0 -48
- package/contracts/instance/module/treasury/TreasuryModule.sol +0 -171
- package/contracts/instance/service/PoolService.sol +0 -129
- package/contracts/instance/service/ProductService.sol +0 -366
- package/contracts/registry/IChainNft.sol +0 -21
- package/contracts/registry/IRegistryLinked.sol +0 -8
- package/contracts/shared/IOwnable.sol +0 -6
- package/contracts/test/TestPool.sol +0 -24
- package/contracts/test/TestProduct.sol +0 -51
@@ -1,366 +0,0 @@
|
|
1
|
-
// SPDX-License-Identifier: Apache-2.0
|
2
|
-
pragma solidity ^0.8.19;
|
3
|
-
|
4
|
-
import {IRegistry} from "../../registry/IRegistry.sol";
|
5
|
-
import {IPoolComponent} from "../../components/IPoolComponent.sol";
|
6
|
-
import {IInstance} from "../../instance/IInstance.sol";
|
7
|
-
import {IPolicy, IPolicyModule} from "../module/policy/IPolicy.sol";
|
8
|
-
import {IPool} from "../module/pool/IPoolModule.sol";
|
9
|
-
import {IBundle} from "../module/bundle/IBundle.sol";
|
10
|
-
import {IProductService} from "./IProductService.sol";
|
11
|
-
import {ITreasury, ITreasuryModule, TokenHandler} from "../../instance/module/treasury/ITreasury.sol";
|
12
|
-
|
13
|
-
import {IVersionable} from "../../shared/IVersionable.sol";
|
14
|
-
import {Versionable} from "../../shared/Versionable.sol";
|
15
|
-
|
16
|
-
import {Timestamp, zeroTimestamp} from "../../types/Timestamp.sol";
|
17
|
-
import {UFixed, UFixedMathLib} from "../../types/UFixed.sol";
|
18
|
-
import {ObjectType, INSTANCE, PRODUCT, POLICY} from "../../types/ObjectType.sol";
|
19
|
-
import {APPLIED, UNDERWRITTEN, ACTIVE} from "../../types/StateId.sol";
|
20
|
-
import {NftId, NftIdLib} from "../../types/NftId.sol";
|
21
|
-
import {Blocknumber, blockNumber} from "../../types/Blocknumber.sol";
|
22
|
-
import {Fee, FeeLib} from "../../types/Fee.sol";
|
23
|
-
import {Version, VersionLib} from "../../types/Version.sol";
|
24
|
-
|
25
|
-
import {ComponentServiceBase} from "../base/ComponentServiceBase.sol";
|
26
|
-
import {IProductService} from "./IProductService.sol";
|
27
|
-
|
28
|
-
// TODO or name this ProtectionService to have Product be something more generic (loan, savings account, ...)
|
29
|
-
contract ProductService is ComponentServiceBase, IProductService {
|
30
|
-
using NftIdLib for NftId;
|
31
|
-
|
32
|
-
string public constant NAME = "ProductService";
|
33
|
-
|
34
|
-
event LogProductServiceSender(address sender);
|
35
|
-
|
36
|
-
constructor(
|
37
|
-
address registry,
|
38
|
-
NftId registryNftId
|
39
|
-
) ComponentServiceBase(registry, registryNftId) // solhint-disable-next-line no-empty-blocks
|
40
|
-
{
|
41
|
-
_registerInterface(type(IProductService).interfaceId);
|
42
|
-
}
|
43
|
-
|
44
|
-
function getVersion()
|
45
|
-
public
|
46
|
-
pure
|
47
|
-
virtual override (IVersionable, Versionable)
|
48
|
-
returns(Version)
|
49
|
-
{
|
50
|
-
return VersionLib.toVersion(3,0,0);
|
51
|
-
}
|
52
|
-
|
53
|
-
function getName() external pure override returns(string memory name) {
|
54
|
-
return NAME;
|
55
|
-
}
|
56
|
-
|
57
|
-
function setFees(
|
58
|
-
Fee memory policyFee,
|
59
|
-
Fee memory processingFee
|
60
|
-
)
|
61
|
-
external
|
62
|
-
override
|
63
|
-
{
|
64
|
-
(IRegistry.ObjectInfo memory productInfo, IInstance instance) = _getAndVerifyComponentInfoAndInstance(PRODUCT());
|
65
|
-
NftId productNftId = productInfo.nftId;
|
66
|
-
ITreasury.TreasuryInfo memory treasuryInfo = instance.getTreasuryInfo(productNftId);
|
67
|
-
treasuryInfo.policyFee = policyFee;
|
68
|
-
treasuryInfo.processingFee = processingFee;
|
69
|
-
instance.setTreasuryInfo(productNftId, treasuryInfo);
|
70
|
-
}
|
71
|
-
|
72
|
-
function createApplication(
|
73
|
-
address applicationOwner,
|
74
|
-
uint256 sumInsuredAmount,
|
75
|
-
uint256 premiumAmount,
|
76
|
-
uint256 lifetime,
|
77
|
-
NftId bundleNftId
|
78
|
-
) external override returns (NftId policyNftId) {
|
79
|
-
(IRegistry.ObjectInfo memory productInfo, IInstance instance) = _getAndVerifyComponentInfoAndInstance(PRODUCT());
|
80
|
-
NftId productNftId = productInfo.nftId;
|
81
|
-
// TODO add validations (see create bundle in pool service)
|
82
|
-
|
83
|
-
policyNftId = this.getRegistry().registerObjectForInstance(
|
84
|
-
productNftId,
|
85
|
-
POLICY(),
|
86
|
-
applicationOwner,
|
87
|
-
""
|
88
|
-
);
|
89
|
-
|
90
|
-
instance.createPolicyInfo(
|
91
|
-
policyNftId,
|
92
|
-
productNftId,
|
93
|
-
sumInsuredAmount,
|
94
|
-
premiumAmount,
|
95
|
-
lifetime,
|
96
|
-
bundleNftId
|
97
|
-
);
|
98
|
-
|
99
|
-
// TODO add logging
|
100
|
-
}
|
101
|
-
|
102
|
-
function _getAndVerifyUnderwritingSetup(
|
103
|
-
IInstance instance,
|
104
|
-
IPolicy.PolicyInfo memory policyInfo
|
105
|
-
)
|
106
|
-
internal
|
107
|
-
view
|
108
|
-
returns (
|
109
|
-
ITreasury.TreasuryInfo memory treasuryInfo,
|
110
|
-
NftId bundleNftId,
|
111
|
-
IBundle.BundleInfo memory bundleInfo,
|
112
|
-
uint256 collateralAmount
|
113
|
-
)
|
114
|
-
{
|
115
|
-
// check match between policy and bundle (via pool)
|
116
|
-
treasuryInfo = instance.getTreasuryInfo(policyInfo.productNftId);
|
117
|
-
bundleNftId = policyInfo.bundleNftId;
|
118
|
-
bundleInfo = instance.getBundleInfo(bundleNftId);
|
119
|
-
require(bundleInfo.poolNftId == treasuryInfo.poolNftId, "POLICY_BUNDLE_MISMATCH");
|
120
|
-
|
121
|
-
// calculate required collateral
|
122
|
-
NftId poolNftId = treasuryInfo.poolNftId;
|
123
|
-
IPool.PoolInfo memory poolInfo = instance.getPoolInfo(poolNftId);
|
124
|
-
|
125
|
-
// obtain remaining return values
|
126
|
-
collateralAmount = calculateRequiredCollateral(poolInfo.collateralizationLevel, policyInfo.sumInsuredAmount);
|
127
|
-
}
|
128
|
-
|
129
|
-
function _lockCollateralInBundle(
|
130
|
-
IInstance instance,
|
131
|
-
NftId bundleNftId,
|
132
|
-
IBundle.BundleInfo memory bundleInfo,
|
133
|
-
NftId policyNftId,
|
134
|
-
uint256 collateralAmount
|
135
|
-
)
|
136
|
-
internal
|
137
|
-
returns (IBundle.BundleInfo memory)
|
138
|
-
{
|
139
|
-
bundleInfo.lockedAmount += collateralAmount;
|
140
|
-
instance.collateralizePolicy(bundleNftId, policyNftId, collateralAmount);
|
141
|
-
return bundleInfo;
|
142
|
-
}
|
143
|
-
|
144
|
-
function _underwriteByPool(
|
145
|
-
ITreasury.TreasuryInfo memory treasuryInfo,
|
146
|
-
NftId policyNftId,
|
147
|
-
IPolicy.PolicyInfo memory policyInfo,
|
148
|
-
bytes memory bundleFilter,
|
149
|
-
uint256 collateralAmount
|
150
|
-
)
|
151
|
-
internal
|
152
|
-
{
|
153
|
-
address poolAddress = _registry.getObjectInfo(treasuryInfo.poolNftId).objectAddress;
|
154
|
-
IPoolComponent pool = IPoolComponent(poolAddress);
|
155
|
-
pool.underwrite(
|
156
|
-
policyNftId,
|
157
|
-
policyInfo.applicationData,
|
158
|
-
bundleFilter,
|
159
|
-
collateralAmount);
|
160
|
-
}
|
161
|
-
|
162
|
-
|
163
|
-
function underwrite(
|
164
|
-
NftId policyNftId,
|
165
|
-
bool requirePremiumPayment,
|
166
|
-
Timestamp activateAt
|
167
|
-
)
|
168
|
-
external
|
169
|
-
override
|
170
|
-
{
|
171
|
-
// check caller is registered product
|
172
|
-
(
|
173
|
-
IRegistry.ObjectInfo memory productInfo,
|
174
|
-
IInstance instance
|
175
|
-
) = _getAndVerifyComponentInfoAndInstance(PRODUCT());
|
176
|
-
|
177
|
-
// check match between policy and calling product
|
178
|
-
NftId productNftId = productInfo.nftId;
|
179
|
-
IPolicy.PolicyInfo memory policyInfo = instance.getPolicyInfo(policyNftId);
|
180
|
-
require(policyInfo.productNftId == productNftId, "POLICY_PRODUCT_MISMATCH");
|
181
|
-
require(instance.getPolicyState(policyNftId) == APPLIED(), "ERROR:PRS-021:STATE_NOT_APPLIED");
|
182
|
-
|
183
|
-
ITreasury.TreasuryInfo memory treasuryInfo;
|
184
|
-
NftId bundleNftId;
|
185
|
-
IBundle.BundleInfo memory bundleInfo;
|
186
|
-
uint256 collateralAmount;
|
187
|
-
|
188
|
-
(
|
189
|
-
treasuryInfo,
|
190
|
-
bundleNftId,
|
191
|
-
bundleInfo,
|
192
|
-
collateralAmount
|
193
|
-
) = _getAndVerifyUnderwritingSetup(
|
194
|
-
instance,
|
195
|
-
policyInfo
|
196
|
-
);
|
197
|
-
|
198
|
-
// lock bundle collateral
|
199
|
-
bundleInfo = _lockCollateralInBundle(
|
200
|
-
instance,
|
201
|
-
bundleNftId,
|
202
|
-
bundleInfo,
|
203
|
-
policyNftId,
|
204
|
-
collateralAmount);
|
205
|
-
|
206
|
-
// set policy state to underwritten
|
207
|
-
instance.updatePolicyState(policyNftId, UNDERWRITTEN());
|
208
|
-
|
209
|
-
// optional activation of policy
|
210
|
-
if(activateAt > zeroTimestamp()) {
|
211
|
-
policyInfo.activatedAt = activateAt;
|
212
|
-
policyInfo.expiredAt = activateAt.addSeconds(policyInfo.lifetime);
|
213
|
-
|
214
|
-
instance.updatePolicyState(policyNftId, ACTIVE());
|
215
|
-
}
|
216
|
-
|
217
|
-
// optional collection of premium
|
218
|
-
if(requirePremiumPayment) {
|
219
|
-
uint256 netPremiumAmount = _processPremiumByTreasury(
|
220
|
-
instance,
|
221
|
-
productInfo.nftId,
|
222
|
-
treasuryInfo,
|
223
|
-
policyNftId,
|
224
|
-
policyInfo.premiumAmount);
|
225
|
-
|
226
|
-
policyInfo.premiumPaidAmount += policyInfo.premiumAmount;
|
227
|
-
bundleInfo.balanceAmount += netPremiumAmount;
|
228
|
-
}
|
229
|
-
|
230
|
-
instance.setPolicyInfo(policyNftId, policyInfo);
|
231
|
-
instance.setBundleInfo(bundleNftId, bundleInfo);
|
232
|
-
|
233
|
-
// involve pool if necessary
|
234
|
-
{
|
235
|
-
NftId poolNftId = treasuryInfo.poolNftId;
|
236
|
-
IPool.PoolInfo memory poolInfo = instance.getPoolInfo(poolNftId);
|
237
|
-
|
238
|
-
if(poolInfo.isVerifying) {
|
239
|
-
_underwriteByPool(
|
240
|
-
treasuryInfo,
|
241
|
-
policyNftId,
|
242
|
-
policyInfo,
|
243
|
-
bundleInfo.filter,
|
244
|
-
collateralAmount
|
245
|
-
);
|
246
|
-
}
|
247
|
-
}
|
248
|
-
|
249
|
-
// TODO add logging
|
250
|
-
}
|
251
|
-
|
252
|
-
function calculateRequiredCollateral(UFixed collateralizationLevel, uint256 sumInsuredAmount) public pure override returns(uint256 collateralAmount) {
|
253
|
-
UFixed sumInsuredUFixed = UFixedMathLib.toUFixed(sumInsuredAmount);
|
254
|
-
UFixed collateralUFixed = collateralizationLevel * sumInsuredUFixed;
|
255
|
-
return collateralUFixed.toInt();
|
256
|
-
}
|
257
|
-
|
258
|
-
function collectPremium(NftId policyNftId, Timestamp activateAt) external override {
|
259
|
-
// check caller is registered product
|
260
|
-
(IRegistry.ObjectInfo memory productInfo, IInstance instance) = _getAndVerifyComponentInfoAndInstance(PRODUCT());
|
261
|
-
|
262
|
-
// perform actual token transfers
|
263
|
-
IPolicy.PolicyInfo memory policyInfo = instance.getPolicyInfo(policyNftId);
|
264
|
-
ITreasury.TreasuryInfo memory treasuryInfo = instance.getTreasuryInfo(productInfo.nftId);
|
265
|
-
|
266
|
-
uint256 premiumAmount = policyInfo.premiumAmount;
|
267
|
-
_processPremiumByTreasury(instance, productInfo.nftId, treasuryInfo, policyNftId, premiumAmount);
|
268
|
-
|
269
|
-
// policy level book keeping for premium paid
|
270
|
-
policyInfo.premiumPaidAmount += premiumAmount;
|
271
|
-
|
272
|
-
// optional activation of policy
|
273
|
-
if(activateAt > zeroTimestamp()) {
|
274
|
-
require(
|
275
|
-
policyInfo.activatedAt.eqz(),
|
276
|
-
"ERROR:PRS-030:ALREADY_ACTIVATED");
|
277
|
-
|
278
|
-
policyInfo.activatedAt = activateAt;
|
279
|
-
policyInfo.expiredAt = activateAt.addSeconds(policyInfo.lifetime);
|
280
|
-
|
281
|
-
instance.updatePolicyState(policyNftId, ACTIVE());
|
282
|
-
}
|
283
|
-
|
284
|
-
instance.setPolicyInfo(policyNftId, policyInfo);
|
285
|
-
|
286
|
-
// TODO add logging
|
287
|
-
}
|
288
|
-
|
289
|
-
function activate(NftId policyNftId, Timestamp activateAt) external override {
|
290
|
-
// check caller is registered product
|
291
|
-
(, IInstance instance) = _getAndVerifyComponentInfoAndInstance(PRODUCT());
|
292
|
-
|
293
|
-
IPolicy.PolicyInfo memory policyInfo = instance.getPolicyInfo(policyNftId);
|
294
|
-
|
295
|
-
require(
|
296
|
-
policyInfo.activatedAt.eqz(),
|
297
|
-
"ERROR:PRS-020:ALREADY_ACTIVATED");
|
298
|
-
|
299
|
-
policyInfo.activatedAt = activateAt;
|
300
|
-
policyInfo.expiredAt = activateAt.addSeconds(policyInfo.lifetime);
|
301
|
-
|
302
|
-
instance.setPolicyInfo(policyNftId, policyInfo);
|
303
|
-
instance.updatePolicyState(policyNftId, ACTIVE());
|
304
|
-
|
305
|
-
// TODO add logging
|
306
|
-
}
|
307
|
-
|
308
|
-
function close(
|
309
|
-
NftId policyNftId
|
310
|
-
) external override // solhint-disable-next-line no-empty-blocks
|
311
|
-
{
|
312
|
-
|
313
|
-
}
|
314
|
-
|
315
|
-
function _getPoolNftId(
|
316
|
-
IInstance instance,
|
317
|
-
NftId productNftId
|
318
|
-
)
|
319
|
-
internal
|
320
|
-
view
|
321
|
-
returns (NftId poolNftid)
|
322
|
-
{
|
323
|
-
return instance.getTreasuryInfo(productNftId).poolNftId;
|
324
|
-
}
|
325
|
-
|
326
|
-
|
327
|
-
function _processPremiumByTreasury(
|
328
|
-
IInstance instance,
|
329
|
-
NftId productNftId,
|
330
|
-
ITreasury.TreasuryInfo memory treasuryInfo,
|
331
|
-
NftId policyNftId,
|
332
|
-
uint256 premiumAmount
|
333
|
-
)
|
334
|
-
internal
|
335
|
-
returns (uint256 netPremiumAmount)
|
336
|
-
{
|
337
|
-
// process token transfer(s)
|
338
|
-
if(premiumAmount > 0) {
|
339
|
-
TokenHandler tokenHandler = instance.getTokenHandler(productNftId);
|
340
|
-
address policyOwner = _registry.getOwner(policyNftId);
|
341
|
-
address poolWallet = instance.getComponentWallet(treasuryInfo.poolNftId);
|
342
|
-
netPremiumAmount = premiumAmount;
|
343
|
-
Fee memory policyFee = treasuryInfo.policyFee;
|
344
|
-
|
345
|
-
if (FeeLib.feeIsZero(policyFee)) {
|
346
|
-
tokenHandler.transfer(
|
347
|
-
policyOwner,
|
348
|
-
poolWallet,
|
349
|
-
premiumAmount
|
350
|
-
);
|
351
|
-
} else {
|
352
|
-
(uint256 feeAmount, uint256 netAmount) = instance.calculateFeeAmount(
|
353
|
-
premiumAmount,
|
354
|
-
policyFee
|
355
|
-
);
|
356
|
-
|
357
|
-
address productWallet = instance.getComponentWallet(productNftId);
|
358
|
-
tokenHandler.transfer(policyOwner, productWallet, feeAmount);
|
359
|
-
tokenHandler.transfer(policyOwner, poolWallet, netAmount);
|
360
|
-
netPremiumAmount = netAmount;
|
361
|
-
}
|
362
|
-
}
|
363
|
-
|
364
|
-
// TODO add logging
|
365
|
-
}
|
366
|
-
}
|
@@ -1,21 +0,0 @@
|
|
1
|
-
// SPDX-License-Identifier: Apache-2.0
|
2
|
-
pragma solidity ^0.8.19;
|
3
|
-
|
4
|
-
import {IERC721Enumerable} from "@openzeppelin/contracts/token/ERC721/extensions/IERC721Enumerable.sol";
|
5
|
-
|
6
|
-
interface IChainNft is IERC721Enumerable {
|
7
|
-
function mint(
|
8
|
-
address to,
|
9
|
-
string memory uri
|
10
|
-
) external returns (uint256 tokenId);
|
11
|
-
|
12
|
-
function burn(uint256 tokenId) external;
|
13
|
-
|
14
|
-
function setURI(uint256 tokenId, string memory uri) external;
|
15
|
-
|
16
|
-
function exists(uint256 tokenId) external view returns (bool);
|
17
|
-
|
18
|
-
function totalMinted() external view returns (uint256);
|
19
|
-
|
20
|
-
function getRegistryAddress() external view returns (address registry);
|
21
|
-
}
|
@@ -1,24 +0,0 @@
|
|
1
|
-
// SPDX-License-Identifier: Apache-2.0
|
2
|
-
pragma solidity ^0.8.19;
|
3
|
-
|
4
|
-
import {NftId} from "../../contracts/types/NftId.sol";
|
5
|
-
import {UFixed} from "../../contracts/types/UFixed.sol";
|
6
|
-
import {Fee} from "../../contracts/types/Fee.sol";
|
7
|
-
import {Pool} from "../../contracts/components/Pool.sol";
|
8
|
-
|
9
|
-
|
10
|
-
contract TestPool is Pool {
|
11
|
-
|
12
|
-
constructor(
|
13
|
-
address registry,
|
14
|
-
NftId instanceNftid,
|
15
|
-
address token,
|
16
|
-
bool isVerifying,
|
17
|
-
UFixed collateralizationLevel,
|
18
|
-
Fee memory stakingFee,
|
19
|
-
Fee memory performanceFee
|
20
|
-
)
|
21
|
-
Pool(registry, instanceNftid, token, isVerifying, collateralizationLevel, stakingFee, performanceFee)
|
22
|
-
// solhint-disable-next-line no-empty-blocks
|
23
|
-
{}
|
24
|
-
}
|
@@ -1,51 +0,0 @@
|
|
1
|
-
// SPDX-License-Identifier: Apache-2.0
|
2
|
-
pragma solidity ^0.8.19;
|
3
|
-
|
4
|
-
import {Product} from "../../contracts/components/Product.sol";
|
5
|
-
import {NftId, toNftId} from "../../contracts/types/NftId.sol";
|
6
|
-
import {Timestamp, blockTimestamp} from "../../contracts/types/Timestamp.sol";
|
7
|
-
import {Fee} from "../../contracts/types/Fee.sol";
|
8
|
-
|
9
|
-
contract TestProduct is Product {
|
10
|
-
|
11
|
-
event LogTestProductSender(address sender);
|
12
|
-
|
13
|
-
constructor(
|
14
|
-
address registry,
|
15
|
-
NftId instanceNftid,
|
16
|
-
address token,
|
17
|
-
address pool,
|
18
|
-
Fee memory policyFee,
|
19
|
-
Fee memory processingFee
|
20
|
-
)
|
21
|
-
Product(registry, instanceNftid, token, pool, policyFee, processingFee)
|
22
|
-
// solhint-disable-next-line no-empty-blocks
|
23
|
-
{}
|
24
|
-
|
25
|
-
function applyForPolicy(
|
26
|
-
uint256 sumInsuredAmount,
|
27
|
-
uint256 premiumAmount,
|
28
|
-
uint256 lifetime,
|
29
|
-
NftId bundleNftId
|
30
|
-
)
|
31
|
-
external
|
32
|
-
returns(NftId nftId)
|
33
|
-
{
|
34
|
-
nftId = _createApplication(
|
35
|
-
msg.sender, // policy holder
|
36
|
-
sumInsuredAmount,
|
37
|
-
premiumAmount,
|
38
|
-
lifetime,
|
39
|
-
bundleNftId
|
40
|
-
);
|
41
|
-
}
|
42
|
-
|
43
|
-
function underwrite(NftId nftId, bool requirePremiumPayment, Timestamp activateAt) external {
|
44
|
-
emit LogTestProductSender(msg.sender);
|
45
|
-
_underwrite(nftId, requirePremiumPayment, activateAt);
|
46
|
-
}
|
47
|
-
|
48
|
-
function collectPremium(NftId nftId, Timestamp activateAt) external {
|
49
|
-
_collectPremium(nftId, activateAt);
|
50
|
-
}
|
51
|
-
}
|