@etherisc/gif-next 0.0.2-dc7e4cb-141 → 0.0.2-de0a1d3-009
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +58 -11
- package/artifacts/contracts/components/BaseComponent.sol/BaseComponent.dbg.json +1 -1
- package/artifacts/contracts/components/Distribution.sol/Distribution.dbg.json +4 -0
- package/artifacts/contracts/components/Distribution.sol/Distribution.json +405 -0
- package/artifacts/contracts/components/IBaseComponent.sol/IBaseComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IDistributionComponent.sol/IDistributionComponent.dbg.json +4 -0
- package/artifacts/contracts/components/IDistributionComponent.sol/IDistributionComponent.json +340 -0
- package/artifacts/contracts/components/IPoolComponent.sol/IPoolComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IPoolComponent.sol/IPoolComponent.json +131 -0
- package/artifacts/contracts/components/IProductComponent.sol/IProductComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IProductComponent.sol/IProductComponent.json +109 -18
- package/artifacts/contracts/components/Pool.sol/Pool.dbg.json +1 -1
- package/artifacts/contracts/components/Pool.sol/Pool.json +194 -3
- package/artifacts/contracts/components/Product.sol/Product.dbg.json +1 -1
- package/artifacts/contracts/components/Product.sol/Product.json +160 -21
- 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/IInstance.sol/IInstance.dbg.json +1 -1
- package/artifacts/contracts/instance/IInstance.sol/IInstance.json +709 -678
- package/artifacts/contracts/instance/IInstanceLinked.sol/IInstanceLinked.dbg.json +1 -1
- package/artifacts/contracts/instance/Instance.sol/Instance.dbg.json +1 -1
- package/artifacts/contracts/instance/Instance.sol/Instance.json +916 -717
- package/artifacts/contracts/instance/base/ComponentServiceBase.sol/ComponentServiceBase.dbg.json +4 -0
- package/artifacts/contracts/instance/{InstanceBase.sol/InstanceBase.json → base/ComponentServiceBase.sol/ComponentServiceBase.json} +102 -28
- package/artifacts/contracts/instance/base/IInstanceBase.sol/IInstanceBase.dbg.json +4 -0
- package/artifacts/contracts/instance/base/IInstanceBase.sol/IInstanceBase.json +113 -0
- package/artifacts/contracts/instance/base/IKeyValueStore.sol/IKeyValueStore.dbg.json +4 -0
- package/artifacts/contracts/instance/base/IKeyValueStore.sol/IKeyValueStore.json +560 -0
- package/artifacts/contracts/instance/base/ILifecycle.sol/ILifecycle.dbg.json +4 -0
- package/artifacts/contracts/instance/{module/lifecycle/ILifecycle.sol/ILifecycleModule.json → base/ILifecycle.sol/ILifecycle.json} +10 -77
- package/artifacts/contracts/instance/base/IService.sol/IService.dbg.json +4 -0
- package/artifacts/contracts/instance/{service → base}/IService.sol/IService.json +58 -17
- package/artifacts/contracts/instance/base/InstanceBase.sol/InstanceBase.dbg.json +4 -0
- package/artifacts/contracts/instance/base/InstanceBase.sol/InstanceBase.json +463 -0
- package/artifacts/contracts/instance/base/KeyValueStore.sol/KeyValueStore.dbg.json +4 -0
- package/artifacts/contracts/instance/base/KeyValueStore.sol/KeyValueStore.json +710 -0
- package/artifacts/contracts/instance/base/Lifecycle.sol/Lifecycle.dbg.json +4 -0
- package/artifacts/contracts/instance/base/Lifecycle.sol/Lifecycle.json +169 -0
- package/artifacts/contracts/instance/base/ModuleBase.sol/ModuleBase.dbg.json +4 -0
- package/artifacts/contracts/instance/{module/compensation/ICompensation.sol/ICompensation.json → base/ModuleBase.sol/ModuleBase.json} +2 -2
- package/artifacts/contracts/instance/base/ServiceBase.sol/ServiceBase.dbg.json +4 -0
- package/artifacts/contracts/instance/{service → base}/ServiceBase.sol/ServiceBase.json +88 -1
- package/artifacts/contracts/instance/module/access/Access.sol/AccessModule.dbg.json +1 -1
- package/artifacts/contracts/instance/module/access/IAccess.sol/IAccess.dbg.json +1 -1
- package/artifacts/contracts/instance/module/access/IAccess.sol/IAccessModule.dbg.json +1 -1
- package/artifacts/contracts/instance/module/bundle/BundleModule.sol/BundleModule.dbg.json +1 -1
- package/artifacts/contracts/instance/module/bundle/BundleModule.sol/BundleModule.json +71 -50
- package/artifacts/contracts/instance/module/bundle/IBundle.sol/IBundle.dbg.json +1 -1
- package/artifacts/contracts/instance/module/bundle/IBundle.sol/IBundleModule.dbg.json +1 -1
- package/artifacts/contracts/instance/module/bundle/IBundle.sol/IBundleModule.json +71 -50
- package/artifacts/contracts/instance/module/component/ComponentModule.sol/ComponentModule.dbg.json +1 -1
- package/artifacts/contracts/instance/module/component/ComponentModule.sol/ComponentModule.json +22 -93
- package/artifacts/contracts/instance/module/component/IComponent.sol/IComponent.dbg.json +1 -1
- package/artifacts/contracts/instance/module/component/IComponent.sol/IComponentModule.dbg.json +1 -1
- package/artifacts/contracts/instance/module/component/IComponent.sol/IComponentModule.json +22 -93
- package/artifacts/contracts/instance/module/distribution/DistributionModule.sol/DistributionModule.dbg.json +4 -0
- package/artifacts/contracts/instance/module/distribution/DistributionModule.sol/DistributionModule.json +10 -0
- package/artifacts/contracts/instance/module/distribution/IDistribution.sol/IDistribution.dbg.json +4 -0
- package/artifacts/contracts/instance/module/{compensation/ICompensation.sol/ICompensationModule.json → distribution/IDistribution.sol/IDistribution.json} +2 -2
- package/artifacts/contracts/instance/module/distribution/IDistribution.sol/IDistributionModule.dbg.json +4 -0
- package/artifacts/contracts/instance/module/distribution/IDistribution.sol/IDistributionModule.json +10 -0
- package/artifacts/contracts/instance/module/policy/IPolicy.sol/IPolicy.dbg.json +1 -1
- package/artifacts/contracts/instance/module/policy/IPolicy.sol/IPolicyModule.dbg.json +1 -1
- package/artifacts/contracts/instance/module/policy/IPolicy.sol/IPolicyModule.json +61 -38
- package/artifacts/contracts/instance/module/policy/PolicyModule.sol/PolicyModule.dbg.json +1 -1
- package/artifacts/contracts/instance/module/policy/PolicyModule.sol/PolicyModule.json +61 -38
- package/artifacts/contracts/instance/module/pool/IPoolModule.sol/IPool.dbg.json +1 -1
- package/artifacts/contracts/instance/module/pool/IPoolModule.sol/IPoolModule.dbg.json +1 -1
- package/artifacts/contracts/instance/module/pool/IPoolModule.sol/IPoolModule.json +0 -5
- package/artifacts/contracts/instance/module/pool/PoolModule.sol/PoolModule.dbg.json +1 -1
- package/artifacts/contracts/instance/module/pool/PoolModule.sol/PoolModule.json +0 -5
- package/artifacts/contracts/instance/module/risk/IRisk.sol/IRisk.dbg.json +1 -1
- package/artifacts/contracts/instance/module/risk/IRisk.sol/IRiskModule.dbg.json +1 -1
- package/artifacts/contracts/instance/module/risk/IRisk.sol/IRiskModule.json +104 -1
- package/artifacts/contracts/instance/module/risk/RiskModule.sol/RiskModule.dbg.json +1 -1
- package/artifacts/contracts/instance/module/risk/RiskModule.sol/RiskModule.json +126 -5
- package/artifacts/contracts/instance/module/treasury/ITreasury.sol/ITreasury.dbg.json +1 -1
- package/artifacts/contracts/instance/module/treasury/ITreasury.sol/ITreasuryModule.dbg.json +1 -1
- package/artifacts/contracts/instance/module/treasury/ITreasury.sol/ITreasuryModule.json +209 -231
- package/artifacts/contracts/instance/module/treasury/TokenHandler.sol/TokenHandler.dbg.json +1 -1
- package/artifacts/contracts/instance/module/treasury/TokenHandler.sol/TokenHandler.json +2 -2
- package/artifacts/contracts/instance/module/treasury/TreasuryModule.sol/TreasuryModule.dbg.json +1 -1
- package/artifacts/contracts/instance/module/treasury/TreasuryModule.sol/TreasuryModule.json +209 -231
- package/artifacts/contracts/instance/service/ComponentOwnerService.sol/ComponentOwnerService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/ComponentOwnerService.sol/ComponentOwnerService.json +145 -18
- package/artifacts/contracts/instance/service/DistributionService.sol/DistributionService.dbg.json +4 -0
- package/artifacts/contracts/instance/service/DistributionService.sol/DistributionService.json +507 -0
- package/artifacts/contracts/instance/service/IComponentOwnerService.sol/IComponentOwnerService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IComponentOwnerService.sol/IComponentOwnerService.json +57 -16
- package/artifacts/contracts/instance/service/IDistributionService.sol/IDistributionService.dbg.json +4 -0
- package/artifacts/contracts/instance/service/{ComponentServiceBase.sol/ComponentServiceBase.json → IDistributionService.sol/IDistributionService.json} +91 -25
- package/artifacts/contracts/instance/service/IPoolService.sol/IPoolService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IPoolService.sol/IPoolService.json +122 -17
- package/artifacts/contracts/instance/service/IProductService.sol/IProductService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IProductService.sol/IProductService.json +210 -16
- package/artifacts/contracts/instance/service/PoolService.sol/PoolService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/PoolService.sol/PoolService.json +171 -12
- package/artifacts/contracts/instance/service/ProductService.sol/ProductService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/ProductService.sol/ProductService.json +303 -31
- package/artifacts/contracts/registry/ChainNft.sol/ChainNft.dbg.json +1 -1
- package/artifacts/contracts/registry/IChainNft.sol/IChainNft.dbg.json +1 -1
- package/artifacts/contracts/registry/IRegistry.sol/IRegistry.dbg.json +1 -1
- package/artifacts/contracts/registry/IRegistryLinked.sol/IRegistryLinked.dbg.json +1 -1
- package/artifacts/contracts/registry/Registry.sol/Registry.dbg.json +1 -1
- package/artifacts/contracts/registry/Registry.sol/Registry.json +2 -2
- package/artifacts/contracts/registry/RegistryUpgradeable.sol/RegistryUpgradeable.dbg.json +4 -0
- package/artifacts/contracts/registry/RegistryUpgradeable.sol/RegistryUpgradeable.json +724 -0
- package/artifacts/contracts/shared/ERC165.sol/ERC165.dbg.json +1 -1
- package/artifacts/contracts/shared/IOwnable.sol/IOwnable.dbg.json +1 -1
- package/artifacts/contracts/shared/IRegisterable.sol/IRegisterable.dbg.json +1 -1
- package/artifacts/contracts/shared/IVersionable.sol/IVersionable.dbg.json +1 -1
- package/artifacts/contracts/shared/IVersionable.sol/IVersionable.json +53 -12
- package/artifacts/contracts/shared/Proxy.sol/ProxyDeployer.dbg.json +4 -0
- package/artifacts/contracts/shared/Proxy.sol/ProxyDeployer.json +248 -0
- package/artifacts/contracts/shared/Proxy.sol/ProxyWithProxyAdminGetter.dbg.json +4 -0
- package/artifacts/contracts/shared/Proxy.sol/ProxyWithProxyAdminGetter.json +129 -0
- package/artifacts/contracts/shared/Registerable.sol/Registerable.dbg.json +1 -1
- package/artifacts/contracts/shared/Versionable.sol/Versionable.dbg.json +1 -1
- package/artifacts/contracts/shared/Versionable.sol/Versionable.json +87 -0
- package/artifacts/contracts/shared/VersionableUpgradeable.sol/VersionableUpgradeable.dbg.json +4 -0
- package/artifacts/contracts/shared/VersionableUpgradeable.sol/VersionableUpgradeable.json +228 -0
- package/artifacts/contracts/test/TestDistribution.sol/TestDistribution.dbg.json +4 -0
- package/artifacts/contracts/test/TestDistribution.sol/TestDistribution.json +405 -0
- 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/TestPool.sol/TestPool.dbg.json +1 -1
- package/artifacts/contracts/test/TestPool.sol/TestPool.json +194 -3
- package/artifacts/contracts/test/TestProduct.sol/TestProduct.dbg.json +1 -1
- package/artifacts/contracts/test/TestProduct.sol/TestProduct.json +209 -27
- package/artifacts/contracts/test/TestRegisterable.sol/TestRegisterable.dbg.json +1 -1
- package/artifacts/contracts/test/TestRegisterable.sol/TestRegisterable.json +2 -2
- package/artifacts/contracts/test/TestRoleId.sol/TestRoleId.dbg.json +1 -1
- package/artifacts/contracts/test/TestRoleId.sol/TestRoleId.json +38 -4
- package/artifacts/contracts/test/TestService.sol/TestService.dbg.json +1 -1
- package/artifacts/contracts/test/TestService.sol/TestService.json +95 -8
- 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 +95 -8
- 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/Blocknumber.sol/BlocknumberLib.dbg.json +1 -1
- package/artifacts/contracts/types/ChainId.sol/ChainIdLib.dbg.json +1 -1
- package/artifacts/contracts/types/Fee.sol/FeeLib.dbg.json +1 -1
- package/artifacts/contracts/types/Fee.sol/FeeLib.json +50 -11
- package/artifacts/contracts/types/Key32.sol/Key32Lib.dbg.json +4 -0
- package/artifacts/contracts/types/Key32.sol/Key32Lib.json +111 -0
- package/artifacts/contracts/types/NftId.sol/NftIdLib.dbg.json +1 -1
- package/artifacts/contracts/types/NftId.sol/NftIdLib.json +65 -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/ObjectType.sol/ObjectTypeLib.dbg.json +1 -1
- package/artifacts/contracts/types/ObjectType.sol/ObjectTypeLib.json +2 -2
- package/artifacts/contracts/types/ReferralId.sol/ReferralIdLib.dbg.json +4 -0
- package/artifacts/contracts/types/ReferralId.sol/ReferralIdLib.json +99 -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 +4 -0
- package/artifacts/contracts/types/RoleId.sol/RoleIdLib.json +30 -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/UFixed.sol/UFixedMathLib.dbg.json +1 -1
- 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 +2 -2
- package/contracts/components/BaseComponent.sol +7 -2
- package/contracts/components/Distribution.sol +132 -0
- package/contracts/components/IDistributionComponent.sol +47 -0
- package/contracts/components/IPoolComponent.sol +14 -0
- package/contracts/components/IProductComponent.sol +24 -5
- package/contracts/components/Pool.sol +64 -3
- package/contracts/components/Product.sol +123 -13
- package/contracts/instance/IInstance.sol +14 -14
- package/contracts/instance/Instance.sol +20 -12
- package/contracts/instance/{service → base}/ComponentServiceBase.sol +1 -0
- package/contracts/instance/base/IInstanceBase.sol +22 -0
- package/contracts/instance/base/IKeyValueStore.sol +50 -0
- package/contracts/instance/base/ILifecycle.sol +30 -0
- package/contracts/instance/{InstanceBase.sol → base/InstanceBase.sol} +33 -13
- package/contracts/instance/base/KeyValueStore.sol +161 -0
- package/contracts/instance/{module/lifecycle/LifecycleModule.sol → base/Lifecycle.sol} +50 -39
- package/contracts/instance/base/ModuleBase.sol +57 -0
- package/contracts/instance/{service → base}/ServiceBase.sol +0 -2
- package/contracts/instance/module/access/Access.sol +6 -6
- package/contracts/instance/module/bundle/BundleModule.sol +24 -118
- package/contracts/instance/module/bundle/IBundle.sol +9 -9
- package/contracts/instance/module/component/ComponentModule.sol +27 -60
- package/contracts/instance/module/component/IComponent.sol +5 -30
- package/contracts/instance/module/distribution/DistributionModule.sol +17 -0
- package/contracts/instance/module/distribution/IDistribution.sol +10 -0
- package/contracts/instance/module/policy/IPolicy.sol +12 -9
- package/contracts/instance/module/policy/PolicyModule.sol +33 -26
- package/contracts/instance/module/pool/IPoolModule.sol +0 -1
- package/contracts/instance/module/pool/PoolModule.sol +12 -9
- package/contracts/instance/module/risk/IRisk.sol +18 -2
- package/contracts/instance/module/risk/RiskModule.sol +56 -2
- package/contracts/instance/module/treasury/ITreasury.sol +29 -50
- package/contracts/instance/module/treasury/TreasuryModule.sol +71 -85
- package/contracts/instance/service/ComponentOwnerService.sol +30 -44
- package/contracts/instance/service/DistributionService.sol +59 -0
- package/contracts/instance/service/IComponentOwnerService.sol +1 -1
- 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/instance/service/PoolService.sol +31 -5
- package/contracts/instance/service/ProductService.sol +231 -77
- package/contracts/registry/Registry.sol +4 -4
- package/contracts/registry/RegistryUpgradeable.sol +473 -0
- package/contracts/shared/IVersionable.sol +17 -4
- package/contracts/shared/Proxy.sol +94 -0
- package/contracts/shared/Versionable.sol +13 -3
- package/contracts/shared/VersionableUpgradeable.sol +133 -0
- package/contracts/test/TestDistribution.sol +21 -0
- package/contracts/test/TestPool.sol +5 -2
- package/contracts/test/TestProduct.sol +35 -7
- package/contracts/test/TestRoleId.sol +2 -2
- package/contracts/test/TestService.sol +1 -1
- package/contracts/types/Fee.sol +8 -3
- package/contracts/types/Key32.sol +45 -0
- package/contracts/types/NftId.sol +16 -1
- package/contracts/types/ObjectType.sol +24 -8
- package/contracts/types/ReferralId.sol +48 -0
- package/contracts/types/RiskId.sol +43 -0
- package/contracts/types/RoleId.sol +12 -10
- package/contracts/types/StateId.sol +7 -1
- package/contracts/types/Version.sol +8 -0
- package/package.json +1 -1
- package/artifacts/contracts/instance/IServiceLinked.sol/IServiceLinked.dbg.json +0 -4
- package/artifacts/contracts/instance/IServiceLinked.sol/IServiceLinked.json +0 -50
- package/artifacts/contracts/instance/InstanceBase.sol/InstanceBase.dbg.json +0 -4
- 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/ICompensationModule.dbg.json +0 -4
- package/artifacts/contracts/instance/module/lifecycle/ILifecycle.sol/ILifecycle.dbg.json +0 -4
- package/artifacts/contracts/instance/module/lifecycle/ILifecycle.sol/ILifecycle.json +0 -134
- package/artifacts/contracts/instance/module/lifecycle/ILifecycle.sol/ILifecycleModule.dbg.json +0 -4
- package/artifacts/contracts/instance/module/lifecycle/LifecycleModule.sol/LifecycleModule.dbg.json +0 -4
- package/artifacts/contracts/instance/module/lifecycle/LifecycleModule.sol/LifecycleModule.json +0 -221
- package/artifacts/contracts/instance/service/ComponentServiceBase.sol/ComponentServiceBase.dbg.json +0 -4
- package/artifacts/contracts/instance/service/IService.sol/IService.dbg.json +0 -4
- package/artifacts/contracts/instance/service/ServiceBase.sol/ServiceBase.dbg.json +0 -4
- package/contracts/instance/IServiceLinked.sol +0 -12
- package/contracts/instance/module/compensation/CompensationModule.sol +0 -8
- package/contracts/instance/module/compensation/ICompensation.sol +0 -10
- package/contracts/instance/module/lifecycle/ILifecycle.sol +0 -47
- /package/contracts/instance/{service → base}/IService.sol +0 -0
@@ -85,8 +85,8 @@
|
|
85
85
|
"type": "function"
|
86
86
|
}
|
87
87
|
],
|
88
|
-
"bytecode": "
|
89
|
-
"deployedBytecode": "
|
88
|
+
"bytecode": "0x61018c61003a600b82828239805160001a60731461002d57634e487b7160e01b600052600060045260246000fd5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600436106100565760003560e01c80632c2f8a671461005b5780636f91962014610083578063ac43d83414610098578063b2466acf146100c9575b600080fd5b61006e610069366004610108565b6100df565b60405190151581526020015b60405180910390f35b61006e61009136600461013b565b60ff161590565b6100ac6100a636600461013b565b60ff1690565b6040516bffffffffffffffffffffffff909116815260200161007a565b61006e6100d736600461013b565b60ff16151590565b600060ff808416908316145b9392505050565b803560ff8116811461010357600080fd5b919050565b6000806040838503121561011b57600080fd5b610124836100f2565b9150610132602084016100f2565b90509250929050565b60006020828403121561014d57600080fd5b6100eb826100f256fea2646970667358221220cd3ba790b6ede070d3b32f6205741f67fdd82bf17dc91ff99902cd5f2ce0711a64736f6c63430008140033",
|
89
|
+
"deployedBytecode": "0x73000000000000000000000000000000000000000030146080604052600436106100565760003560e01c80632c2f8a671461005b5780636f91962014610083578063ac43d83414610098578063b2466acf146100c9575b600080fd5b61006e610069366004610108565b6100df565b60405190151581526020015b60405180910390f35b61006e61009136600461013b565b60ff161590565b6100ac6100a636600461013b565b60ff1690565b6040516bffffffffffffffffffffffff909116815260200161007a565b61006e6100d736600461013b565b60ff16151590565b600060ff808416908316145b9392505050565b803560ff8116811461010357600080fd5b919050565b6000806040838503121561011b57600080fd5b610124836100f2565b9150610132602084016100f2565b90509250929050565b60006020828403121561014d57600080fd5b6100eb826100f256fea2646970667358221220cd3ba790b6ede070d3b32f6205741f67fdd82bf17dc91ff99902cd5f2ce0711a64736f6c63430008140033",
|
90
90
|
"linkReferences": {},
|
91
91
|
"deployedLinkReferences": {}
|
92
92
|
}
|
@@ -41,6 +41,25 @@
|
|
41
41
|
"stateMutability": "pure",
|
42
42
|
"type": "function"
|
43
43
|
},
|
44
|
+
{
|
45
|
+
"inputs": [
|
46
|
+
{
|
47
|
+
"internalType": "Version",
|
48
|
+
"name": "version",
|
49
|
+
"type": "uint24"
|
50
|
+
}
|
51
|
+
],
|
52
|
+
"name": "toUint64",
|
53
|
+
"outputs": [
|
54
|
+
{
|
55
|
+
"internalType": "uint64",
|
56
|
+
"name": "",
|
57
|
+
"type": "uint64"
|
58
|
+
}
|
59
|
+
],
|
60
|
+
"stateMutability": "pure",
|
61
|
+
"type": "function"
|
62
|
+
},
|
44
63
|
{
|
45
64
|
"inputs": [
|
46
65
|
{
|
@@ -70,6 +89,25 @@
|
|
70
89
|
"stateMutability": "pure",
|
71
90
|
"type": "function"
|
72
91
|
},
|
92
|
+
{
|
93
|
+
"inputs": [
|
94
|
+
{
|
95
|
+
"internalType": "uint64",
|
96
|
+
"name": "versionNumber",
|
97
|
+
"type": "uint64"
|
98
|
+
}
|
99
|
+
],
|
100
|
+
"name": "toVersion",
|
101
|
+
"outputs": [
|
102
|
+
{
|
103
|
+
"internalType": "Version",
|
104
|
+
"name": "",
|
105
|
+
"type": "uint24"
|
106
|
+
}
|
107
|
+
],
|
108
|
+
"stateMutability": "pure",
|
109
|
+
"type": "function"
|
110
|
+
},
|
73
111
|
{
|
74
112
|
"inputs": [
|
75
113
|
{
|
@@ -132,8 +170,8 @@
|
|
132
170
|
"type": "function"
|
133
171
|
}
|
134
172
|
],
|
135
|
-
"bytecode": "
|
136
|
-
"deployedBytecode": "
|
173
|
+
"bytecode": "0x61039161003a600b82828239805160001a60731461002d57634e487b7160e01b600052600060045260246000fd5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600436106100925760003560e01c80638e4ad86c116100655780638e4ad86c1461012157806394aa449c14610144578063a123b37c14610152578063c9e66e291461017957600080fd5b806304b8f6c5146100975780632efe0113146100b357806349a7111a146100c657806355601007146100fd575b600080fd5b60005b60405162ffffff90911681526020015b60405180910390f35b61009a6100c136600461026e565b610190565b6100d96100d436600461029a565b610231565b6040805160ff948516815292841660208401529216918101919091526060016100aa565b61011361010b36600461029a565b62ffffff1690565b6040519081526020016100aa565b61013261012f3660046102c6565b90565b60405160ff90911681526020016100aa565b61009a61012f3660046102df565b61016061010b36600461029a565b60405167ffffffffffffffff90911681526020016100aa565b61013261018736600461029a565b60101c60ff1690565b6000610100841080156101a4575061010083105b80156101b1575061010082105b61020c5760405162461bcd60e51b815260206004820152602260248201527f4552524f523a5652532d3031303a56455253494f4e5f504152545f544f4f5f42604482015261494760f01b606482015260840160405180910390fd5b8161021f600885901b601087901b61031f565b610229919061031f565b949350505050565b600080808360ff601082901c166102488383610338565b915061ffff600883901c16600061025f8185610338565b92989197509195509350505050565b60008060006060848603121561028357600080fd5b505081359360208301359350604090920135919050565b6000602082840312156102ac57600080fd5b813562ffffff811681146102bf57600080fd5b9392505050565b6000602082840312156102d857600080fd5b5035919050565b6000602082840312156102f157600080fd5b813567ffffffffffffffff811681146102bf57600080fd5b634e487b7160e01b600052601160045260246000fd5b8082018082111561033257610332610309565b92915050565b62ffffff82811682821603908082111561035457610354610309565b509291505056fea26469706673582212208f9511a0a2a546b8c04a7a10d6336736c2c01718b45d7da4362c9eb1545731ca64736f6c63430008140033",
|
174
|
+
"deployedBytecode": "0x73000000000000000000000000000000000000000030146080604052600436106100925760003560e01c80638e4ad86c116100655780638e4ad86c1461012157806394aa449c14610144578063a123b37c14610152578063c9e66e291461017957600080fd5b806304b8f6c5146100975780632efe0113146100b357806349a7111a146100c657806355601007146100fd575b600080fd5b60005b60405162ffffff90911681526020015b60405180910390f35b61009a6100c136600461026e565b610190565b6100d96100d436600461029a565b610231565b6040805160ff948516815292841660208401529216918101919091526060016100aa565b61011361010b36600461029a565b62ffffff1690565b6040519081526020016100aa565b61013261012f3660046102c6565b90565b60405160ff90911681526020016100aa565b61009a61012f3660046102df565b61016061010b36600461029a565b60405167ffffffffffffffff90911681526020016100aa565b61013261018736600461029a565b60101c60ff1690565b6000610100841080156101a4575061010083105b80156101b1575061010082105b61020c5760405162461bcd60e51b815260206004820152602260248201527f4552524f523a5652532d3031303a56455253494f4e5f504152545f544f4f5f42604482015261494760f01b606482015260840160405180910390fd5b8161021f600885901b601087901b61031f565b610229919061031f565b949350505050565b600080808360ff601082901c166102488383610338565b915061ffff600883901c16600061025f8185610338565b92989197509195509350505050565b60008060006060848603121561028357600080fd5b505081359360208301359350604090920135919050565b6000602082840312156102ac57600080fd5b813562ffffff811681146102bf57600080fd5b9392505050565b6000602082840312156102d857600080fd5b5035919050565b6000602082840312156102f157600080fd5b813567ffffffffffffffff811681146102bf57600080fd5b634e487b7160e01b600052601160045260246000fd5b8082018082111561033257610332610309565b92915050565b62ffffff82811682821603908082111561035457610354610309565b509291505056fea26469706673582212208f9511a0a2a546b8c04a7a10d6336736c2c01718b45d7da4362c9eb1545731ca64736f6c63430008140033",
|
137
175
|
"linkReferences": {},
|
138
176
|
"deployedLinkReferences": {}
|
139
177
|
}
|
@@ -23,8 +23,8 @@
|
|
23
23
|
"type": "function"
|
24
24
|
}
|
25
25
|
],
|
26
|
-
"bytecode": "
|
27
|
-
"deployedBytecode": "
|
26
|
+
"bytecode": "0x60b9610039600b82828239805160001a60731461002c57634e487b7160e01b600052600060045260246000fd5b30600052607381538281f3fe730000000000000000000000000000000000000000301460806040526004361060335760003560e01c8063ac43d834146038575b600080fd5b60496043366004605b565b60ff1690565b60405190815260200160405180910390f35b600060208284031215606c57600080fd5b813560ff81168114607c57600080fd5b939250505056fea2646970667358221220c9c379b3b5ac83b5051ce617e894b84028046aca89e19f78215b3a3e8442fad464736f6c63430008140033",
|
27
|
+
"deployedBytecode": "0x730000000000000000000000000000000000000000301460806040526004361060335760003560e01c8063ac43d834146038575b600080fd5b60496043366004605b565b60ff1690565b60405190815260200160405180910390f35b600060208284031215606c57600080fd5b813560ff81168114607c57600080fd5b939250505056fea2646970667358221220c9c379b3b5ac83b5051ce617e894b84028046aca89e19f78215b3a3e8442fad464736f6c63430008140033",
|
28
28
|
"linkReferences": {},
|
29
29
|
"deployedLinkReferences": {}
|
30
30
|
}
|
@@ -8,12 +8,12 @@ import {Registerable} from "../shared/Registerable.sol";
|
|
8
8
|
|
9
9
|
import {IRegistry} from "../registry/IRegistry.sol";
|
10
10
|
import {IInstance} from "../instance/IInstance.sol";
|
11
|
-
import {IServiceLinked} from "../instance/IServiceLinked.sol";
|
12
11
|
|
13
12
|
import {IInstance} from "../instance/IInstance.sol";
|
14
13
|
import {IComponent, IComponentModule} from "../instance/module/component/IComponent.sol";
|
15
14
|
import {IComponentOwnerService} from "../instance/service/IComponentOwnerService.sol";
|
16
15
|
import {IBaseComponent} from "./IBaseComponent.sol";
|
16
|
+
import {Fee, FeeLib} from "../types/Fee.sol";
|
17
17
|
import {NftId} from "../types/NftId.sol";
|
18
18
|
|
19
19
|
abstract contract BaseComponent is
|
@@ -26,6 +26,8 @@ abstract contract BaseComponent is
|
|
26
26
|
address internal _wallet;
|
27
27
|
IERC20Metadata internal _token;
|
28
28
|
IInstance internal _instance;
|
29
|
+
bool internal _isRegistered;
|
30
|
+
Fee internal _zeroFee;
|
29
31
|
|
30
32
|
constructor(
|
31
33
|
address registry,
|
@@ -44,6 +46,8 @@ abstract contract BaseComponent is
|
|
44
46
|
_componentOwnerService = _instance.getComponentOwnerService();
|
45
47
|
_wallet = address(this);
|
46
48
|
_token = IERC20Metadata(token);
|
49
|
+
_isRegistered = false;
|
50
|
+
_zeroFee = FeeLib.zeroFee();
|
47
51
|
}
|
48
52
|
|
49
53
|
// from registerable
|
@@ -58,7 +62,8 @@ abstract contract BaseComponent is
|
|
58
62
|
"ERROR:COB:INSTANCE_NOT_REGISTERED"
|
59
63
|
);
|
60
64
|
|
61
|
-
|
65
|
+
_isRegistered = true;
|
66
|
+
return _componentOwnerService.register(this);
|
62
67
|
}
|
63
68
|
|
64
69
|
// from component contract
|
@@ -0,0 +1,132 @@
|
|
1
|
+
// SPDX-License-Identifier: Apache-2.0
|
2
|
+
pragma solidity ^0.8.19;
|
3
|
+
|
4
|
+
import {ObjectType, DISTRIBUTION} from "../types/ObjectType.sol";
|
5
|
+
import {IDistributionService} from "../instance/service/IDistributionService.sol";
|
6
|
+
import {IProductService} from "../instance/service/IProductService.sol";
|
7
|
+
import {NftId} from "../types/NftId.sol";
|
8
|
+
import {ReferralId} from "../types/ReferralId.sol";
|
9
|
+
import {Fee, FeeLib} from "../types/Fee.sol";
|
10
|
+
import {BaseComponent} from "./BaseComponent.sol";
|
11
|
+
import {IDistributionComponent} from "./IDistributionComponent.sol";
|
12
|
+
|
13
|
+
contract Distribution is
|
14
|
+
BaseComponent,
|
15
|
+
IDistributionComponent
|
16
|
+
{
|
17
|
+
|
18
|
+
Fee internal _initialDistributionFee;
|
19
|
+
bool internal _isVerifying;
|
20
|
+
|
21
|
+
IDistributionService private _distributionService;
|
22
|
+
IProductService private _productService;
|
23
|
+
|
24
|
+
modifier onlyProductService() {
|
25
|
+
require(
|
26
|
+
msg.sender == address(_productService),
|
27
|
+
"ERROR:POL-002:NOT_PRODUCT_SERVICE");
|
28
|
+
_;
|
29
|
+
}
|
30
|
+
|
31
|
+
constructor(
|
32
|
+
address registry,
|
33
|
+
NftId instanceNftId,
|
34
|
+
// TODO refactor into tokenNftId
|
35
|
+
address token,
|
36
|
+
bool verifying,
|
37
|
+
Fee memory distributionFee
|
38
|
+
)
|
39
|
+
BaseComponent(registry, instanceNftId, token)
|
40
|
+
{
|
41
|
+
_isVerifying = verifying;
|
42
|
+
_initialDistributionFee = distributionFee;
|
43
|
+
|
44
|
+
_distributionService = _instance.getDistributionService();
|
45
|
+
_productService = _instance.getProductService();
|
46
|
+
}
|
47
|
+
|
48
|
+
|
49
|
+
function setFees(
|
50
|
+
Fee memory distributionFee
|
51
|
+
)
|
52
|
+
external
|
53
|
+
override
|
54
|
+
{
|
55
|
+
_distributionService.setFees(distributionFee);
|
56
|
+
}
|
57
|
+
|
58
|
+
function calculateFeeAmount(
|
59
|
+
ReferralId referralId,
|
60
|
+
uint256 netPremiumAmount
|
61
|
+
)
|
62
|
+
external
|
63
|
+
view
|
64
|
+
virtual override
|
65
|
+
returns (uint256 feeAmount)
|
66
|
+
{
|
67
|
+
Fee memory fee = getDistributionFee();
|
68
|
+
(feeAmount,) = FeeLib.calculateFee(fee, netPremiumAmount);
|
69
|
+
}
|
70
|
+
|
71
|
+
|
72
|
+
function calculateRenewalFeeAmount(
|
73
|
+
ReferralId referralId,
|
74
|
+
uint256 netPremiumAmount
|
75
|
+
)
|
76
|
+
external
|
77
|
+
view
|
78
|
+
virtual override
|
79
|
+
returns (uint256 feeAmount)
|
80
|
+
{
|
81
|
+
// default is no fees
|
82
|
+
return 0 * netPremiumAmount;
|
83
|
+
}
|
84
|
+
|
85
|
+
function processSale(
|
86
|
+
ReferralId referralId,
|
87
|
+
uint256 feeAmount
|
88
|
+
)
|
89
|
+
external
|
90
|
+
onlyProductService
|
91
|
+
virtual override
|
92
|
+
{
|
93
|
+
// default is no action
|
94
|
+
}
|
95
|
+
|
96
|
+
function processRenewal(
|
97
|
+
ReferralId referralId,
|
98
|
+
uint256 feeAmount
|
99
|
+
)
|
100
|
+
external
|
101
|
+
onlyProductService
|
102
|
+
virtual override
|
103
|
+
{
|
104
|
+
// default is no action
|
105
|
+
}
|
106
|
+
|
107
|
+
function referralIsValid(ReferralId referralId) external view returns (bool isValid) {
|
108
|
+
// default is invalid
|
109
|
+
return false;
|
110
|
+
}
|
111
|
+
|
112
|
+
/// @dev default distribution fee, ie when not using any valid referralId
|
113
|
+
function getDistributionFee() public view returns (Fee memory distributionFee) {
|
114
|
+
NftId productNftId = _instance.getProductNftId(getNftId());
|
115
|
+
if (_instance.hasTreasuryInfo(productNftId)) {
|
116
|
+
return _instance.getTreasuryInfo(productNftId).distributionFee;
|
117
|
+
} else {
|
118
|
+
return _initialDistributionFee;
|
119
|
+
}
|
120
|
+
}
|
121
|
+
|
122
|
+
|
123
|
+
/// @dev returns true iff the component needs to be called when selling/renewing policis
|
124
|
+
function isVerifying() external view returns (bool verifying) {
|
125
|
+
return _isVerifying;
|
126
|
+
}
|
127
|
+
|
128
|
+
// from registerable
|
129
|
+
function getType() public pure override returns (ObjectType) {
|
130
|
+
return DISTRIBUTION();
|
131
|
+
}
|
132
|
+
}
|
@@ -0,0 +1,47 @@
|
|
1
|
+
// SPDX-License-Identifier: Apache-2.0
|
2
|
+
pragma solidity ^0.8.19;
|
3
|
+
|
4
|
+
import {Fee} from "../types/Fee.sol";
|
5
|
+
import {ReferralId} from "../types/ReferralId.sol";
|
6
|
+
import {NftId} from "../types/NftId.sol";
|
7
|
+
import {IBaseComponent} from "./IBaseComponent.sol";
|
8
|
+
|
9
|
+
interface IDistributionComponent is IBaseComponent {
|
10
|
+
|
11
|
+
function setFees(
|
12
|
+
Fee memory distributionFee
|
13
|
+
) external;
|
14
|
+
|
15
|
+
function calculateFeeAmount(
|
16
|
+
ReferralId referralId,
|
17
|
+
uint256 netPremiumAmount
|
18
|
+
) external view returns (uint256 feeAmount);
|
19
|
+
|
20
|
+
function calculateRenewalFeeAmount(
|
21
|
+
ReferralId referralId,
|
22
|
+
uint256 netPremiumAmount
|
23
|
+
) external view returns (uint256 feeAmount);
|
24
|
+
|
25
|
+
/// @dev callback from product service when selling a policy for a specific referralId
|
26
|
+
/// the used referral id and the collected fee are provided as parameters
|
27
|
+
/// the component implementation can then process this information accordingly
|
28
|
+
function processSale(
|
29
|
+
ReferralId referralId,
|
30
|
+
uint256 feeAmount
|
31
|
+
) external;
|
32
|
+
|
33
|
+
/// @dev callback from product service when a policy is renews for a specific referralId
|
34
|
+
function processRenewal(
|
35
|
+
ReferralId referralId,
|
36
|
+
uint256 feeAmount
|
37
|
+
) external;
|
38
|
+
|
39
|
+
/// @dev returns true iff the referral id is valid
|
40
|
+
function referralIsValid(ReferralId referralId) external view returns (bool isValid);
|
41
|
+
|
42
|
+
/// @dev default distribution fee, ie when not using any valid referralId
|
43
|
+
function getDistributionFee() external view returns (Fee memory distributionFee);
|
44
|
+
|
45
|
+
/// @dev returns true iff the component needs to be called when selling/renewing policis
|
46
|
+
function isVerifying() external view returns (bool verifying);
|
47
|
+
}
|
@@ -10,15 +10,27 @@ interface IPoolComponent is IBaseComponent {
|
|
10
10
|
|
11
11
|
event LogUnderwrittenByPool(NftId policyNftId, uint256 collateralizationAmount, address pool);
|
12
12
|
|
13
|
+
function setFees(
|
14
|
+
Fee memory poolFee,
|
15
|
+
Fee memory stakingFee,
|
16
|
+
Fee memory performanceFee
|
17
|
+
) external;
|
18
|
+
|
13
19
|
/**
|
14
20
|
* @dev creates a new bundle for this pool.
|
15
21
|
*/
|
16
22
|
function createBundle(
|
23
|
+
Fee memory fee,
|
17
24
|
uint256 initialAmount,
|
18
25
|
uint256 lifetime,
|
19
26
|
bytes memory filter
|
20
27
|
) external returns(NftId bundleNftId);
|
21
28
|
|
29
|
+
function setBundleFee(
|
30
|
+
NftId policyNftId,
|
31
|
+
Fee memory fee
|
32
|
+
) external;
|
33
|
+
|
22
34
|
/**
|
23
35
|
* @dev this is a callback function that is called by the product service when underwriting a policy.
|
24
36
|
* the pool has the option to check the details and object to underwriting by reverting.
|
@@ -48,6 +60,8 @@ interface IPoolComponent is IBaseComponent {
|
|
48
60
|
|
49
61
|
function getCollateralizationLevel() external view returns (UFixed collateralizationLevel);
|
50
62
|
|
63
|
+
function getPoolFee() external view returns (Fee memory poolFee);
|
64
|
+
|
51
65
|
function getStakingFee() external view returns (Fee memory stakingFee);
|
52
66
|
|
53
67
|
function getPerformanceFee()
|
@@ -1,19 +1,38 @@
|
|
1
1
|
// SPDX-License-Identifier: Apache-2.0
|
2
2
|
pragma solidity ^0.8.19;
|
3
3
|
|
4
|
-
import {NftId} from "../types/NftId.sol";
|
5
4
|
import {Fee} from "../types/Fee.sol";
|
5
|
+
import {NftId} from "../types/NftId.sol";
|
6
|
+
import {ReferralId} from "../types/ReferralId.sol";
|
7
|
+
import {RiskId} from "../types/RiskId.sol";
|
8
|
+
|
6
9
|
import {IBaseComponent} from "./IBaseComponent.sol";
|
7
10
|
|
8
11
|
interface IProductComponent is IBaseComponent {
|
9
12
|
function setFees(
|
10
|
-
Fee memory
|
13
|
+
Fee memory productFee,
|
11
14
|
Fee memory processingFee
|
12
15
|
) external;
|
13
16
|
|
14
|
-
function
|
15
|
-
|
16
|
-
|
17
|
+
function calculatePremium(
|
18
|
+
uint256 sumInsuredAmount,
|
19
|
+
RiskId riskId,
|
20
|
+
uint256 lifetime,
|
21
|
+
bytes memory applicationData,
|
22
|
+
ReferralId referralId,
|
23
|
+
NftId bundleNftId
|
24
|
+
) external view returns (uint256 premiumAmount);
|
17
25
|
|
26
|
+
function calculateNetPremium(
|
27
|
+
uint256 sumInsuredAmount,
|
28
|
+
RiskId riskId,
|
29
|
+
uint256 lifetime,
|
30
|
+
bytes memory applicationData
|
31
|
+
) external view returns (uint256 netPremiumAmount);
|
32
|
+
|
33
|
+
function getProductFee() external view returns (Fee memory productFee);
|
18
34
|
function getProcessingFee() external view returns (Fee memory processingFee);
|
35
|
+
|
36
|
+
function getPoolNftId() external view returns (NftId poolNftId);
|
37
|
+
function getDistributionNftId() external view returns (NftId distributionNftId);
|
19
38
|
}
|
@@ -15,6 +15,10 @@ contract Pool is BaseComponent, IPoolComponent {
|
|
15
15
|
bool internal _isVerifying;
|
16
16
|
UFixed internal _collateralizationLevel;
|
17
17
|
|
18
|
+
Fee internal _initialPoolFee;
|
19
|
+
Fee internal _initialStakingFee;
|
20
|
+
Fee internal _initialPerformanceFee;
|
21
|
+
|
18
22
|
// may be used to interact with instance by derived contracts
|
19
23
|
IPoolService internal _poolService;
|
20
24
|
|
@@ -41,19 +45,38 @@ contract Pool is BaseComponent, IPoolComponent {
|
|
41
45
|
// TODO refactor into tokenNftId
|
42
46
|
address token,
|
43
47
|
bool verifying,
|
44
|
-
UFixed collateralizationLevel
|
48
|
+
UFixed collateralizationLevel,
|
49
|
+
Fee memory poolFee,
|
50
|
+
Fee memory stakingFee,
|
51
|
+
Fee memory performanceFee
|
45
52
|
)
|
46
53
|
BaseComponent(registry, instanceNftId, token)
|
47
54
|
{
|
48
55
|
_isVerifying = verifying;
|
49
56
|
// TODO add validation
|
50
57
|
_collateralizationLevel = collateralizationLevel;
|
58
|
+
_initialPoolFee = poolFee;
|
59
|
+
_initialStakingFee = stakingFee;
|
60
|
+
_initialPerformanceFee = performanceFee;
|
51
61
|
|
52
62
|
_poolService = _instance.getPoolService();
|
53
63
|
_productService = _instance.getProductService();
|
54
64
|
}
|
55
65
|
|
66
|
+
function setFees(
|
67
|
+
Fee memory poolFee,
|
68
|
+
Fee memory stakingFee,
|
69
|
+
Fee memory performanceFee
|
70
|
+
)
|
71
|
+
external
|
72
|
+
onlyOwner
|
73
|
+
override
|
74
|
+
{
|
75
|
+
_poolService.setFees(poolFee, stakingFee, performanceFee);
|
76
|
+
}
|
77
|
+
|
56
78
|
function createBundle(
|
79
|
+
Fee memory fee,
|
57
80
|
uint256 initialAmount,
|
58
81
|
uint256 lifetime,
|
59
82
|
bytes memory filter
|
@@ -65,6 +88,7 @@ contract Pool is BaseComponent, IPoolComponent {
|
|
65
88
|
address owner = msg.sender;
|
66
89
|
bundleNftId = _poolService.createBundle(
|
67
90
|
owner,
|
91
|
+
fee,
|
68
92
|
initialAmount,
|
69
93
|
lifetime,
|
70
94
|
filter
|
@@ -73,6 +97,17 @@ contract Pool is BaseComponent, IPoolComponent {
|
|
73
97
|
// TODO add logging
|
74
98
|
}
|
75
99
|
|
100
|
+
function setBundleFee(
|
101
|
+
NftId bundleNftId,
|
102
|
+
Fee memory fee
|
103
|
+
)
|
104
|
+
external
|
105
|
+
override
|
106
|
+
// TODO add onlyBundleOwner
|
107
|
+
{
|
108
|
+
_poolService.setBundleFee(bundleNftId, fee);
|
109
|
+
}
|
110
|
+
|
76
111
|
/**
|
77
112
|
* @dev see {IPool.underwrite}.
|
78
113
|
* Default implementation that only writes a {LogUnderwrittenByPool} entry.
|
@@ -133,6 +168,7 @@ contract Pool is BaseComponent, IPoolComponent {
|
|
133
168
|
|
134
169
|
function _createBundle(
|
135
170
|
address bundleOwner,
|
171
|
+
Fee memory fee,
|
136
172
|
uint256 amount,
|
137
173
|
uint256 lifetime,
|
138
174
|
bytes calldata filter
|
@@ -142,6 +178,7 @@ contract Pool is BaseComponent, IPoolComponent {
|
|
142
178
|
{
|
143
179
|
bundleNftId = _poolService.createBundle(
|
144
180
|
bundleOwner,
|
181
|
+
fee,
|
145
182
|
amount,
|
146
183
|
lifetime,
|
147
184
|
filter
|
@@ -149,13 +186,32 @@ contract Pool is BaseComponent, IPoolComponent {
|
|
149
186
|
}
|
150
187
|
|
151
188
|
// from pool component
|
189
|
+
function getPoolFee()
|
190
|
+
external
|
191
|
+
view
|
192
|
+
override
|
193
|
+
returns (Fee memory poolFee)
|
194
|
+
{
|
195
|
+
NftId productNftId = _instance.getProductNftId(getNftId());
|
196
|
+
if (_instance.hasTreasuryInfo(productNftId)) {
|
197
|
+
return _instance.getTreasuryInfo(productNftId).poolFee;
|
198
|
+
} else {
|
199
|
+
return _initialPoolFee;
|
200
|
+
}
|
201
|
+
}
|
202
|
+
|
152
203
|
function getStakingFee()
|
153
204
|
external
|
154
205
|
view
|
155
206
|
override
|
156
207
|
returns (Fee memory stakingFee)
|
157
208
|
{
|
158
|
-
|
209
|
+
NftId productNftId = _instance.getProductNftId(getNftId());
|
210
|
+
if (_instance.hasTreasuryInfo(productNftId)) {
|
211
|
+
return _instance.getTreasuryInfo(productNftId).stakingFee;
|
212
|
+
} else {
|
213
|
+
return _initialStakingFee;
|
214
|
+
}
|
159
215
|
}
|
160
216
|
|
161
217
|
function getPerformanceFee()
|
@@ -164,7 +220,12 @@ contract Pool is BaseComponent, IPoolComponent {
|
|
164
220
|
override
|
165
221
|
returns (Fee memory performanceFee)
|
166
222
|
{
|
167
|
-
|
223
|
+
NftId productNftId = _instance.getProductNftId(getNftId());
|
224
|
+
if (_instance.hasTreasuryInfo(productNftId)) {
|
225
|
+
return _instance.getTreasuryInfo(productNftId).performanceFee;
|
226
|
+
} else {
|
227
|
+
return _initialPerformanceFee;
|
228
|
+
}
|
168
229
|
}
|
169
230
|
|
170
231
|
// from registerable
|