@etherisc/gif-next 0.0.2-f752d2a-551 → 0.0.2-f79a517-071
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +175 -1
- package/artifacts/contracts/components/BaseComponent.sol/BaseComponent.dbg.json +1 -1
- package/artifacts/contracts/components/BaseComponent.sol/BaseComponent.json +166 -39
- package/artifacts/contracts/components/Distribution.sol/Distribution.dbg.json +4 -0
- package/artifacts/contracts/components/Distribution.sol/Distribution.json +557 -0
- package/artifacts/contracts/components/IBaseComponent.sol/IBaseComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IBaseComponent.sol/IBaseComponent.json +119 -39
- package/artifacts/contracts/components/IDistributionComponent.sol/IDistributionComponent.dbg.json +4 -0
- package/artifacts/contracts/components/IDistributionComponent.sol/IDistributionComponent.json +177 -0
- package/artifacts/contracts/components/IPoolComponent.sol/IPoolComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IPoolComponent.sol/IPoolComponent.json +108 -156
- package/artifacts/contracts/components/IProductComponent.sol/IProductComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IProductComponent.sol/IProductComponent.json +67 -139
- package/artifacts/contracts/components/Pool.sol/Pool.dbg.json +1 -1
- package/artifacts/contracts/components/Pool.sol/Pool.json +417 -88
- package/artifacts/contracts/components/Product.sol/Product.dbg.json +1 -1
- package/artifacts/contracts/components/Product.sol/Product.json +360 -51
- 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/SimpleStateMachine.sol/SimpleStateMachine.dbg.json +1 -1
- 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 +768 -694
- 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 +954 -816
- 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 +51 -1
- package/artifacts/contracts/instance/base/IKeyValueStore.sol/IKeyValueStore.dbg.json +1 -1
- package/artifacts/contracts/instance/base/IKeyValueStore.sol/IKeyValueStore.json +49 -0
- package/artifacts/contracts/instance/base/ILifecycle.sol/ILifecycle.dbg.json +1 -1
- package/artifacts/contracts/instance/base/IService.sol/IService.dbg.json +1 -1
- package/artifacts/contracts/instance/base/IService.sol/IService.json +174 -53
- package/artifacts/contracts/instance/base/InstanceBase.sol/InstanceBase.dbg.json +1 -1
- package/artifacts/contracts/instance/base/InstanceBase.sol/InstanceBase.json +263 -45
- package/artifacts/contracts/instance/base/KeyValueStore.sol/KeyValueStore.dbg.json +1 -1
- package/artifacts/contracts/instance/base/KeyValueStore.sol/KeyValueStore.json +41 -23
- 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/base/ModuleBase.sol/ModuleBase.dbg.json +1 -1
- package/artifacts/contracts/instance/base/ServiceBase.sol/ServiceBase.dbg.json +1 -1
- package/artifacts/contracts/instance/base/ServiceBase.sol/ServiceBase.json +220 -52
- package/artifacts/contracts/instance/module/bundle/BundleModule.sol/BundleModule.dbg.json +1 -1
- package/artifacts/contracts/instance/module/bundle/BundleModule.sol/BundleModule.json +55 -54
- 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 +56 -55
- 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/ICompensation.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/{compensation/ICompensation.sol/ICompensationModule.json → distribution/IDistribution.sol/IDistributionModule.json} +2 -2
- 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 -51
- package/artifacts/contracts/instance/module/policy/PolicyModule.sol/PolicyModule.dbg.json +1 -1
- package/artifacts/contracts/instance/module/policy/PolicyModule.sol/PolicyModule.json +61 -51
- 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 +29 -14
- package/artifacts/contracts/instance/module/pool/PoolModule.sol/PoolModule.dbg.json +1 -1
- package/artifacts/contracts/instance/module/pool/PoolModule.sol/PoolModule.json +28 -13
- 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 +326 -221
- 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 +326 -221
- package/artifacts/contracts/instance/service/ComponentOwnerService.sol/ComponentOwnerService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/ComponentOwnerService.sol/ComponentOwnerService.json +374 -70
- package/artifacts/contracts/instance/service/DistributionService.sol/DistributionService.dbg.json +4 -0
- package/artifacts/contracts/instance/service/DistributionService.sol/DistributionService.json +630 -0
- package/artifacts/contracts/instance/service/IComponentOwnerService.sol/IComponentOwnerService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IComponentOwnerService.sol/IComponentOwnerService.json +176 -74
- package/artifacts/contracts/instance/service/IDistributionService.sol/IDistributionService.dbg.json +4 -0
- package/artifacts/contracts/instance/service/IDistributionService.sol/IDistributionService.json +446 -0
- 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/instance/service/PoolService.sol/PoolService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/PoolService.sol/PoolService.json +335 -53
- package/artifacts/contracts/instance/service/ProductService.sol/ProductService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/ProductService.sol/ProductService.json +468 -73
- 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 +190 -51
- 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 +380 -139
- package/artifacts/contracts/registry/RegistryService.sol/RegistryService.dbg.json +4 -0
- package/artifacts/contracts/registry/RegistryService.sol/RegistryService.json +1245 -0
- package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.dbg.json +4 -0
- package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.json +496 -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/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/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/TestDistribution.sol/TestDistribution.dbg.json +4 -0
- package/artifacts/contracts/test/TestDistribution.sol/TestDistribution.json +557 -0
- 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/TestPool.sol/TestPool.dbg.json +1 -1
- package/artifacts/contracts/test/TestPool.sol/TestPool.json +417 -88
- package/artifacts/contracts/test/TestProduct.sol/TestProduct.dbg.json +1 -1
- package/artifacts/contracts/test/TestProduct.sol/TestProduct.json +407 -56
- 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 +2 -2
- package/artifacts/contracts/test/TestService.sol/TestService.dbg.json +1 -1
- package/artifacts/contracts/test/TestService.sol/TestService.json +267 -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 +89 -25
- 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/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 +2 -2
- 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/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 +1 -1
- package/artifacts/contracts/types/RoleId.sol/RoleIdLib.json +2 -2
- package/artifacts/contracts/types/StateId.sol/StateIdLib.dbg.json +1 -1
- package/artifacts/contracts/types/Timestamp.sol/TimestampLib.dbg.json +1 -1
- 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 +2 -2
- package/contracts/components/BaseComponent.sol +11 -20
- package/contracts/components/Distribution.sol +155 -0
- package/contracts/components/IBaseComponent.sol +1 -1
- package/contracts/components/IDistributionComponent.sol +46 -0
- package/contracts/components/IPoolComponent.sol +15 -8
- package/contracts/components/IProductComponent.sol +26 -8
- package/contracts/components/Pool.sol +99 -27
- package/contracts/components/Product.sol +204 -22
- package/contracts/experiment/cloning/Cloner.sol +47 -0
- package/contracts/instance/IInstance.sol +11 -11
- package/contracts/instance/Instance.sol +28 -13
- package/contracts/instance/base/ComponentServiceBase.sol +13 -6
- package/contracts/instance/base/IInstanceBase.sol +11 -2
- package/contracts/instance/base/IKeyValueStore.sol +4 -3
- package/contracts/instance/base/InstanceBase.sol +19 -10
- package/contracts/instance/base/KeyValueStore.sol +12 -7
- package/contracts/instance/base/Lifecycle.sol +15 -10
- package/contracts/instance/base/ModuleBase.sol +22 -17
- package/contracts/instance/base/ServiceBase.sol +20 -13
- package/contracts/instance/module/bundle/BundleModule.sol +10 -12
- package/contracts/instance/module/bundle/IBundle.sol +6 -11
- package/contracts/instance/module/component/ComponentModule.sol +33 -57
- package/contracts/instance/module/component/IComponent.sol +6 -31
- 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 +13 -10
- package/contracts/instance/module/policy/PolicyModule.sol +35 -20
- package/contracts/instance/module/pool/IPoolModule.sol +4 -4
- package/contracts/instance/module/pool/PoolModule.sol +23 -15
- 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 +31 -50
- package/contracts/instance/module/treasury/TokenHandler.sol +1 -1
- package/contracts/instance/module/treasury/TreasuryModule.sol +70 -91
- package/contracts/instance/service/ComponentOwnerService.sol +238 -93
- package/contracts/instance/service/DistributionService.sol +54 -0
- package/contracts/instance/service/IComponentOwnerService.sol +0 -2
- package/contracts/instance/service/IDistributionService.sol +12 -0
- package/contracts/instance/service/IPoolService.sol +7 -0
- package/contracts/instance/service/IProductService.sol +56 -7
- package/contracts/instance/service/PoolService.sol +49 -23
- package/contracts/instance/service/ProductService.sol +250 -94
- package/contracts/registry/ChainNft.sol +80 -37
- package/contracts/registry/IRegistry.sol +28 -28
- package/contracts/registry/IRegistryService.sol +35 -0
- package/contracts/registry/ITransferInterceptor.sol +6 -0
- package/contracts/registry/Registry.sol +314 -272
- package/contracts/registry/RegistryService.sol +441 -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/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/UpgradableProxyWithAdmin.sol +16 -0
- package/contracts/shared/Versionable.sol +112 -54
- package/contracts/test/TestDistribution.sol +22 -0
- package/contracts/test/TestFee.sol +2 -2
- package/contracts/test/TestPool.sol +7 -2
- package/contracts/test/TestProduct.sol +37 -7
- package/contracts/test/TestRegisterable.sol +5 -6
- package/contracts/test/TestService.sol +5 -11
- package/contracts/types/Fee.sol +10 -5
- 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 +9 -2
- package/contracts/types/UFixed.sol +128 -12
- package/contracts/types/Version.sol +9 -0
- package/package.json +4 -3
- 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/IAccess.json +0 -10
- 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/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/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/types/UFixed.sol/UFixedMathLib.dbg.json +0 -4
- package/contracts/experiment/statemachine/README.md +0 -112
- package/contracts/instance/module/access/Access.sol +0 -149
- package/contracts/instance/module/access/IAccess.sol +0 -53
- package/contracts/instance/module/compensation/CompensationModule.sol +0 -8
- package/contracts/instance/module/compensation/ICompensation.sol +0 -10
- package/contracts/registry/IChainNft.sol +0 -21
- package/contracts/registry/IRegistryLinked.sol +0 -8
- package/contracts/shared/IOwnable.sol +0 -6
@@ -1,7 +1,11 @@
|
|
1
1
|
// SPDX-License-Identifier: Apache-2.0
|
2
|
-
pragma solidity ^0.8.
|
2
|
+
pragma solidity ^0.8.20;
|
3
3
|
|
4
4
|
import {IERC20Metadata} from "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol";
|
5
|
+
import {IDistributionComponent} from "../../../components/IDistributionComponent.sol";
|
6
|
+
import {IPoolComponent} from "../../../components/IPoolComponent.sol";
|
7
|
+
import {IProductComponent} from "../../../components/IProductComponent.sol";
|
8
|
+
import {IComponentOwnerService} from "../../service/IComponentOwnerService.sol";
|
5
9
|
|
6
10
|
import {NftId} from "../../../types/NftId.sol";
|
7
11
|
import {UFixed} from "../../../types/UFixed.sol";
|
@@ -13,73 +17,48 @@ interface ITreasury {
|
|
13
17
|
// TODO add events
|
14
18
|
// TODO add errors
|
15
19
|
|
16
|
-
|
17
|
-
|
18
|
-
NftId distributorNftId;
|
20
|
+
// treasury info is linked to product nft id
|
21
|
+
struct TreasuryInfo {
|
19
22
|
NftId poolNftId;
|
23
|
+
NftId distributionNftId;
|
20
24
|
IERC20Metadata token;
|
21
|
-
|
22
|
-
Fee
|
23
|
-
Fee
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
NftId distributorNftId;
|
28
|
-
address wallet;
|
29
|
-
Fee commissionFee;
|
30
|
-
}
|
31
|
-
|
32
|
-
struct PoolSetup {
|
33
|
-
NftId poolNftId;
|
34
|
-
address wallet;
|
35
|
-
Fee stakingFee;
|
36
|
-
Fee performanceFee;
|
25
|
+
Fee productFee; // product fee on net premium
|
26
|
+
Fee processingFee; // product fee on payout amounts
|
27
|
+
Fee poolFee; // pool fee on net premium
|
28
|
+
Fee stakingFee; // pool fee on staked capital from investor
|
29
|
+
Fee performanceFee; // pool fee on profits from capital investors
|
30
|
+
Fee distributionFee; // default distribution fee (no referral id)
|
37
31
|
}
|
38
32
|
}
|
39
33
|
|
40
34
|
interface ITreasuryModule is ITreasury {
|
41
35
|
|
42
|
-
function
|
36
|
+
function registerProductSetup(
|
43
37
|
NftId productNftId,
|
44
|
-
|
45
|
-
NftId poolNftId,
|
46
|
-
IERC20Metadata token,
|
47
|
-
address wallet,
|
48
|
-
Fee memory policyFee,
|
49
|
-
Fee memory processingFee
|
38
|
+
TreasuryInfo memory info
|
50
39
|
) external;
|
51
40
|
|
52
|
-
function
|
41
|
+
function setTreasuryInfo(
|
53
42
|
NftId productNftId,
|
54
|
-
|
55
|
-
Fee memory processingFee
|
43
|
+
TreasuryInfo memory info
|
56
44
|
) external;
|
57
45
|
|
58
|
-
function
|
59
|
-
NftId
|
60
|
-
|
61
|
-
Fee memory stakingFee,
|
62
|
-
Fee memory performanceFee
|
63
|
-
) external;
|
46
|
+
function hasTreasuryInfo(
|
47
|
+
NftId productNftId
|
48
|
+
) external view returns (bool hasInfo);
|
64
49
|
|
65
|
-
function
|
66
|
-
NftId
|
67
|
-
|
68
|
-
|
69
|
-
|
50
|
+
function getTreasuryInfo(
|
51
|
+
NftId productNftId
|
52
|
+
) external view returns (TreasuryInfo memory info);
|
53
|
+
|
54
|
+
function getProductNftId(
|
55
|
+
NftId componentNftId
|
56
|
+
) external view returns (NftId productNftId);
|
70
57
|
|
71
58
|
function getTokenHandler(
|
72
59
|
NftId componentNftId
|
73
60
|
) external view returns (TokenHandler tokenHandler);
|
74
61
|
|
75
|
-
function getProductSetup(
|
76
|
-
NftId productNftId
|
77
|
-
) external view returns (ProductSetup memory setup);
|
78
|
-
|
79
|
-
function getPoolSetup(
|
80
|
-
NftId poolNftId
|
81
|
-
) external view returns (PoolSetup memory setup);
|
82
|
-
|
83
62
|
function calculateFeeAmount(
|
84
63
|
uint256 amount,
|
85
64
|
Fee memory fee
|
@@ -90,7 +69,7 @@ interface ITreasuryModule is ITreasury {
|
|
90
69
|
uint256 fixedFee
|
91
70
|
) external pure returns (Fee memory fee);
|
92
71
|
|
93
|
-
function getZeroFee() external
|
72
|
+
function getZeroFee() external view returns (Fee memory fee);
|
94
73
|
|
95
74
|
function getUFixed(
|
96
75
|
uint256 a
|
@@ -100,4 +79,6 @@ interface ITreasuryModule is ITreasury {
|
|
100
79
|
uint256 a,
|
101
80
|
int8 exp
|
102
81
|
) external pure returns (UFixed);
|
82
|
+
|
83
|
+
function getComponentOwnerService() external view returns(IComponentOwnerService);
|
103
84
|
}
|
@@ -1,103 +1,82 @@
|
|
1
1
|
// SPDX-License-Identifier: Apache-2.0
|
2
|
-
pragma solidity ^0.8.
|
2
|
+
pragma solidity ^0.8.20;
|
3
3
|
|
4
4
|
import {IERC20Metadata} from "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol";
|
5
|
+
import {IDistributionComponent} from "../../../components/IDistributionComponent.sol";
|
6
|
+
import {IPoolComponent} from "../../../components/IPoolComponent.sol";
|
7
|
+
import {IProductComponent} from "../../../components/IProductComponent.sol";
|
5
8
|
|
6
9
|
import {NftId} from "../../../types/NftId.sol";
|
10
|
+
import {TREASURY} from "../../../types/ObjectType.sol";
|
7
11
|
import {Fee, FeeLib} from "../../../types/Fee.sol";
|
8
|
-
import {UFixed,
|
12
|
+
import {UFixed, UFixedLib} from "../../../types/UFixed.sol";
|
9
13
|
import {TokenHandler} from "./TokenHandler.sol";
|
14
|
+
import {IKeyValueStore} from "../../base/IKeyValueStore.sol";
|
10
15
|
import {ITreasuryModule} from "./ITreasury.sol";
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
) external override // TODO add authz (only component module)
|
28
|
-
{
|
29
|
-
require(address(_tokenHandler[productNftId]) == address(0), "ERROR:TRS-010:TOKEN_HANDLER_ALREADY_REGISTERED");
|
30
|
-
require(address(_tokenHandler[poolNftId]) == address(0), "ERROR:TRS-011:TOKEN_HANDLER_ALREADY_REGISTERED");
|
31
|
-
require(address(_tokenHandler[distributorNftId]) == address(0), "ERROR:TRS-012:TOKEN_HANDLER_ALREADY_REGISTERED");
|
32
|
-
// TODO add additional validations
|
33
|
-
|
34
|
-
// deploy product specific handler contract
|
35
|
-
TokenHandler tokenHandler = new TokenHandler(productNftId, address(token));
|
36
|
-
_tokenHandler[productNftId] = tokenHandler;
|
37
|
-
_tokenHandler[poolNftId] = tokenHandler;
|
38
|
-
_tokenHandler[distributorNftId] = tokenHandler;
|
39
|
-
|
40
|
-
// create product setup
|
41
|
-
_productSetup[productNftId] = ProductSetup(
|
42
|
-
productNftId,
|
43
|
-
distributorNftId,
|
44
|
-
poolNftId,
|
45
|
-
token,
|
46
|
-
wallet,
|
47
|
-
policyFee,
|
48
|
-
processingFee
|
16
|
+
import {ModuleBase} from "../../base/ModuleBase.sol";
|
17
|
+
|
18
|
+
abstract contract TreasuryModule is
|
19
|
+
ModuleBase,
|
20
|
+
ITreasuryModule
|
21
|
+
{
|
22
|
+
// relation of distributor and pool nft map to product nft
|
23
|
+
mapping(NftId componentNftId => NftId productNftId) internal _productNft;
|
24
|
+
// relation of component nft to token hanlder
|
25
|
+
mapping(NftId componentNftId => TokenHandler tokenHandler) internal _tokenHandler;
|
26
|
+
Fee internal _zeroFee;
|
27
|
+
|
28
|
+
modifier onlyComponentOwnerService() virtual {
|
29
|
+
require(
|
30
|
+
msg.sender == address(this.getComponentOwnerService()),
|
31
|
+
"ERROR:CMP-001:NOT_COPONENT_OWNER_SERVICE"
|
49
32
|
);
|
33
|
+
_;
|
34
|
+
}
|
50
35
|
|
51
|
-
|
36
|
+
function _initializeTreasuryModule(IKeyValueStore keyValueStore) internal {
|
37
|
+
//_initializeModuleBase(keyValueStore);
|
38
|
+
_initialize(keyValueStore);
|
39
|
+
_zeroFee = FeeLib.zeroFee();
|
52
40
|
}
|
53
41
|
|
54
|
-
function
|
42
|
+
function registerProductSetup(
|
55
43
|
NftId productNftId,
|
56
|
-
|
57
|
-
|
58
|
-
|
44
|
+
TreasuryInfo memory setup
|
45
|
+
)
|
46
|
+
external
|
47
|
+
onlyComponentOwnerService
|
59
48
|
{
|
60
|
-
|
61
|
-
|
62
|
-
ProductSetup storage setup = _productSetup[productNftId];
|
63
|
-
setup.policyFee = policyFee;
|
64
|
-
setup.processingFee = processingFee;
|
65
|
-
|
66
|
-
// TODO add logging
|
67
|
-
}
|
49
|
+
NftId poolNftId = setup.poolNftId;
|
50
|
+
NftId distributionNftId = setup.distributionNftId;
|
68
51
|
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
Fee memory stakingFee,
|
73
|
-
Fee memory performanceFee
|
74
|
-
) external override // TODO add authz (only component module)
|
75
|
-
{
|
76
|
-
// TODO add validation
|
52
|
+
require(address(_tokenHandler[productNftId]) == address(0), "ERROR:TRS-012:TOKEN_HANDLER_ALREADY_REGISTERED");
|
53
|
+
require(_productNft[poolNftId].eqz(), "ERROR:TRS-013:POOL_ALREADY_LINKED");
|
54
|
+
require(_productNft[distributionNftId].eqz(), "ERROR:TRS-014:COMPENSATION_ALREADY_LINKED");
|
77
55
|
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
);
|
56
|
+
// TODO deploy TokenHandler with separate contract to save space
|
57
|
+
// deploy product specific handler contract
|
58
|
+
_tokenHandler[productNftId] = new TokenHandler(productNftId, address(setup.token));
|
59
|
+
_productNft[distributionNftId] = productNftId;
|
60
|
+
_productNft[poolNftId] = productNftId;
|
84
61
|
|
85
|
-
|
62
|
+
_create(TREASURY(), productNftId, abi.encode(setup));
|
86
63
|
}
|
87
64
|
|
88
|
-
function
|
89
|
-
NftId
|
90
|
-
|
91
|
-
|
92
|
-
|
65
|
+
function setTreasuryInfo(
|
66
|
+
NftId productNftId,
|
67
|
+
TreasuryInfo memory info
|
68
|
+
)
|
69
|
+
external
|
70
|
+
// TODO add authz (only component module)
|
71
|
+
override
|
93
72
|
{
|
94
|
-
|
95
|
-
|
96
|
-
PoolSetup storage setup = _poolSetup[poolNftId];
|
97
|
-
setup.stakingFee = stakingFee;
|
98
|
-
setup.performanceFee = performanceFee;
|
73
|
+
_updateData(TREASURY(), productNftId, abi.encode(info));
|
74
|
+
}
|
99
75
|
|
100
|
-
|
76
|
+
function getProductNftId(
|
77
|
+
NftId componentNftId
|
78
|
+
) external view returns (NftId productNftId) {
|
79
|
+
return _productNft[componentNftId];
|
101
80
|
}
|
102
81
|
|
103
82
|
function getTokenHandler(
|
@@ -106,23 +85,23 @@ abstract contract TreasuryModule is ITreasuryModule {
|
|
106
85
|
return _tokenHandler[componentNftId];
|
107
86
|
}
|
108
87
|
|
109
|
-
function
|
88
|
+
function hasTreasuryInfo(
|
110
89
|
NftId productNftId
|
111
|
-
)
|
112
|
-
return
|
90
|
+
) public view override returns (bool hasInfo) {
|
91
|
+
return _exists(TREASURY(), productNftId);
|
113
92
|
}
|
114
93
|
|
115
|
-
function
|
116
|
-
NftId
|
117
|
-
)
|
118
|
-
return
|
94
|
+
function getTreasuryInfo(
|
95
|
+
NftId productNftId
|
96
|
+
) public view override returns (TreasuryInfo memory info) {
|
97
|
+
return abi.decode(_getData(TREASURY(), productNftId), (TreasuryInfo));
|
119
98
|
}
|
120
99
|
|
121
100
|
function calculateFeeAmount(
|
122
101
|
uint256 amount,
|
123
102
|
Fee memory fee
|
124
103
|
) public pure override returns (uint256 feeAmount, uint256 netAmount) {
|
125
|
-
return FeeLib.calculateFee(
|
104
|
+
return FeeLib.calculateFee(fee, amount);
|
126
105
|
}
|
127
106
|
|
128
107
|
function getFee(
|
@@ -132,14 +111,14 @@ abstract contract TreasuryModule is ITreasuryModule {
|
|
132
111
|
return FeeLib.toFee(fractionalFee, fixedFee);
|
133
112
|
}
|
134
113
|
|
135
|
-
function getZeroFee() external
|
136
|
-
return
|
114
|
+
function getZeroFee() external view override returns (Fee memory fee) {
|
115
|
+
return _zeroFee;
|
137
116
|
}
|
138
117
|
|
139
118
|
function getUFixed(
|
140
119
|
uint256 a
|
141
120
|
) external pure override returns (UFixed) {
|
142
|
-
return
|
121
|
+
return UFixedLib.toUFixed(a);
|
143
122
|
}
|
144
123
|
|
145
124
|
function getUFixed(
|
@@ -147,6 +126,6 @@ abstract contract TreasuryModule is ITreasuryModule {
|
|
147
126
|
int8 exp
|
148
127
|
) external pure returns (UFixed)
|
149
128
|
{
|
150
|
-
return
|
129
|
+
return UFixedLib.toUFixed(a, exp);
|
151
130
|
}
|
152
131
|
}
|