@etherisc/gif-next 0.0.2-f2b0fa2-473 → 0.0.2-f4f92b3-338
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +67 -1
- package/artifacts/contracts/components/Component.sol/Component.dbg.json +4 -0
- package/artifacts/contracts/components/Component.sol/Component.json +656 -0
- package/artifacts/contracts/components/Distribution.sol/Distribution.dbg.json +1 -1
- package/artifacts/contracts/components/Distribution.sol/Distribution.json +329 -90
- package/artifacts/contracts/components/IComponent.sol/IComponent.dbg.json +4 -0
- package/artifacts/contracts/{shared/RegisterableUpgradable.sol/RegisterableUpgradable.json → components/IComponent.sol/IComponent.json} +171 -158
- package/artifacts/contracts/components/IDistributionComponent.sol/IDistributionComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IDistributionComponent.sol/IDistributionComponent.json +496 -0
- package/artifacts/contracts/components/IPoolComponent.sol/IPoolComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IPoolComponent.sol/IPoolComponent.json +568 -2
- package/artifacts/contracts/components/IProductComponent.sol/IProductComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IProductComponent.sol/IProductComponent.json +596 -5
- package/artifacts/contracts/components/Pool.sol/Pool.dbg.json +1 -1
- package/artifacts/contracts/components/Pool.sol/Pool.json +360 -118
- package/artifacts/contracts/components/Product.sol/Product.dbg.json +1 -1
- package/artifacts/contracts/components/Product.sol/Product.json +342 -147
- package/artifacts/contracts/experiment/cloning/Cloner.sol/Cloner.dbg.json +1 -1
- package/artifacts/contracts/experiment/cloning/Cloner.sol/Mock1.dbg.json +1 -1
- package/artifacts/contracts/experiment/cloning/Cloner.sol/Mock2.dbg.json +1 -1
- 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/BundleManager.sol/BundleManager.dbg.json +4 -0
- package/artifacts/contracts/instance/BundleManager.sol/BundleManager.json +764 -0
- package/artifacts/contracts/instance/Cloneable.sol/Cloneable.dbg.json +4 -0
- package/artifacts/contracts/instance/{AccessManagedSimple.sol/AccessManagedSimple.json → Cloneable.sol/Cloneable.json} +86 -2
- package/artifacts/contracts/instance/IInstance.sol/IInstance.dbg.json +1 -1
- package/artifacts/contracts/instance/IInstance.sol/IInstance.json +1657 -28
- package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.dbg.json +1 -1
- package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.json +162 -18
- package/artifacts/contracts/instance/Instance.sol/Instance.dbg.json +1 -1
- package/artifacts/contracts/instance/Instance.sol/Instance.json +232 -632
- package/artifacts/contracts/instance/InstanceAccessManager.sol/InstanceAccessManager.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceAccessManager.sol/InstanceAccessManager.json +231 -114
- package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.json +182 -58
- package/artifacts/contracts/instance/InstanceService.sol/InstanceService.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceService.sol/InstanceService.json +328 -67
- package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.json +72 -23
- package/artifacts/contracts/instance/ObjectManager.sol/ObjectManager.dbg.json +4 -0
- package/artifacts/contracts/instance/ObjectManager.sol/ObjectManager.json +261 -0
- package/artifacts/contracts/instance/base/ComponentService.sol/ComponentService.dbg.json +4 -0
- package/artifacts/contracts/instance/base/{ComponentServiceBase.sol/ComponentServiceBase.json → ComponentService.sol/ComponentService.json} +138 -16
- package/artifacts/contracts/instance/base/IKeyValueStore.sol/IKeyValueStore.dbg.json +1 -1
- package/artifacts/contracts/instance/base/ILifecycle.sol/ILifecycle.dbg.json +1 -1
- package/artifacts/contracts/instance/base/KeyValueStore.sol/KeyValueStore.dbg.json +1 -1
- package/artifacts/contracts/instance/base/KeyValueStore.sol/KeyValueStore.json +2 -2
- package/artifacts/contracts/instance/base/Lifecycle.sol/Lifecycle.dbg.json +1 -1
- package/artifacts/contracts/instance/base/Lifecycle.sol/Lifecycle.json +2 -2
- package/artifacts/contracts/instance/module/IAccess.sol/IAccess.dbg.json +1 -1
- package/artifacts/contracts/instance/module/IAccess.sol/IAccess.json +59 -16
- package/artifacts/contracts/instance/module/IBundle.sol/IBundle.dbg.json +1 -1
- package/artifacts/contracts/instance/module/IDistribution.sol/IDistribution.dbg.json +1 -1
- package/artifacts/contracts/instance/module/IPolicy.sol/IPolicy.dbg.json +1 -1
- package/artifacts/contracts/instance/module/IRisk.sol/IRisk.dbg.json +1 -1
- package/artifacts/contracts/instance/module/ISetup.sol/ISetup.dbg.json +1 -1
- package/artifacts/contracts/instance/module/ITreasury.sol/ITreasury.dbg.json +1 -1
- package/artifacts/contracts/instance/service/BundleService.sol/BundleService.dbg.json +4 -0
- package/artifacts/contracts/instance/service/BundleService.sol/BundleService.json +1102 -0
- package/artifacts/contracts/instance/service/BundleServiceManager.sol/BundleServiceManager.dbg.json +4 -0
- package/artifacts/contracts/instance/service/BundleServiceManager.sol/BundleServiceManager.json +449 -0
- package/artifacts/contracts/instance/service/DistributionService.sol/DistributionService.dbg.json +4 -0
- package/artifacts/contracts/instance/service/DistributionService.sol/DistributionService.json +772 -0
- package/artifacts/contracts/instance/service/DistributionServiceManager.sol/DistributionServiceManager.dbg.json +4 -0
- package/artifacts/contracts/instance/service/DistributionServiceManager.sol/DistributionServiceManager.json +437 -0
- package/artifacts/contracts/instance/service/IBundleService.sol/IBundleService.dbg.json +4 -0
- package/artifacts/contracts/instance/service/{IComponentOwnerService.sol/IComponentOwnerService.json → IBundleService.sol/IBundleService.json} +295 -46
- package/artifacts/contracts/instance/service/IDistributionService.sol/IDistributionService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IDistributionService.sol/IDistributionService.json +13 -18
- package/artifacts/contracts/instance/service/IPolicyService.sol/IPolicyService.dbg.json +4 -0
- package/artifacts/contracts/instance/service/IPolicyService.sol/IPolicyService.json +766 -0
- package/artifacts/contracts/instance/service/IPoolService.sol/IPoolService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IPoolService.sol/IPoolService.json +15 -82
- package/artifacts/contracts/instance/service/IProductService.sol/IProductService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IProductService.sol/IProductService.json +25 -245
- package/artifacts/contracts/instance/service/PolicyService.sol/PolicyService.dbg.json +4 -0
- package/artifacts/contracts/instance/service/PolicyService.sol/PolicyService.json +1227 -0
- package/artifacts/contracts/instance/service/PolicyServiceManager.sol/PolicyServiceManager.dbg.json +4 -0
- package/artifacts/contracts/instance/service/PolicyServiceManager.sol/PolicyServiceManager.json +505 -0
- package/artifacts/contracts/instance/service/PoolService.sol/PoolService.dbg.json +4 -0
- package/artifacts/contracts/instance/service/PoolService.sol/PoolService.json +806 -0
- package/artifacts/contracts/instance/service/PoolServiceManager.sol/PoolServiceManager.dbg.json +4 -0
- package/artifacts/contracts/instance/service/PoolServiceManager.sol/PoolServiceManager.json +437 -0
- package/artifacts/contracts/instance/service/ProductService.sol/ProductService.dbg.json +4 -0
- package/artifacts/contracts/instance/service/ProductService.sol/ProductService.json +856 -0
- package/artifacts/contracts/instance/service/ProductServiceManager.sol/ProductServiceManager.dbg.json +4 -0
- package/artifacts/contracts/instance/service/ProductServiceManager.sol/ProductServiceManager.json +437 -0
- package/artifacts/contracts/registry/ChainNft.sol/ChainNft.dbg.json +1 -1
- package/artifacts/contracts/registry/ChainNft.sol/ChainNft.json +2 -2
- package/artifacts/contracts/registry/IRegistry.sol/IRegistry.dbg.json +1 -1
- package/artifacts/contracts/registry/IRegistry.sol/IRegistry.json +339 -59
- package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.dbg.json +1 -1
- package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.json +220 -111
- package/artifacts/contracts/registry/ITransferInterceptor.sol/ITransferInterceptor.dbg.json +1 -1
- package/artifacts/contracts/registry/Registry.sol/Registry.dbg.json +1 -1
- package/artifacts/contracts/registry/Registry.sol/Registry.json +301 -188
- package/artifacts/contracts/registry/RegistryAccessManager.sol/RegistryAccessManager.dbg.json +4 -0
- package/artifacts/contracts/registry/RegistryAccessManager.sol/RegistryAccessManager.json +285 -0
- package/artifacts/contracts/registry/RegistryService.sol/RegistryService.dbg.json +1 -1
- package/artifacts/contracts/registry/RegistryService.sol/RegistryService.json +69 -130
- package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.dbg.json +1 -1
- package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.json +51 -91
- package/artifacts/contracts/registry/ReleaseManager.sol/ReleaseManager.dbg.json +4 -0
- package/artifacts/contracts/registry/ReleaseManager.sol/ReleaseManager.json +547 -0
- package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.dbg.json +4 -0
- package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.json +394 -0
- package/artifacts/contracts/shared/ContractDeployerLib.sol/ContractDeployerLib.dbg.json +1 -1
- package/artifacts/contracts/shared/ERC165.sol/ERC165.dbg.json +1 -1
- package/artifacts/contracts/shared/ERC165.sol/ERC165.json +2 -2
- package/artifacts/contracts/shared/INftOwnable.sol/INftOwnable.dbg.json +1 -1
- package/artifacts/contracts/shared/IRegisterable.sol/IRegisterable.dbg.json +1 -1
- package/artifacts/contracts/shared/IRegisterable.sol/IRegisterable.json +0 -5
- package/artifacts/contracts/shared/IService.sol/IService.dbg.json +1 -1
- package/artifacts/contracts/shared/IService.sol/IService.json +13 -18
- package/artifacts/contracts/shared/IVersionable.sol/IVersionable.dbg.json +1 -1
- package/artifacts/contracts/shared/NftOwnable.sol/NftOwnable.dbg.json +1 -1
- package/artifacts/contracts/shared/NftOwnable.sol/NftOwnable.json +19 -6
- package/artifacts/contracts/shared/ProxyManager.sol/ProxyManager.dbg.json +1 -1
- package/artifacts/contracts/shared/ProxyManager.sol/ProxyManager.json +19 -6
- package/artifacts/contracts/shared/Registerable.sol/Registerable.dbg.json +1 -1
- package/artifacts/contracts/shared/Registerable.sol/Registerable.json +19 -11
- package/artifacts/contracts/shared/Service.sol/Service.dbg.json +1 -1
- package/artifacts/contracts/shared/Service.sol/Service.json +26 -18
- package/artifacts/contracts/shared/TokenHandler.sol/TokenHandler.dbg.json +1 -1
- package/artifacts/contracts/shared/UpgradableProxyWithAdmin.sol/UpgradableProxyWithAdmin.dbg.json +1 -1
- package/artifacts/contracts/shared/UpgradableProxyWithAdmin.sol/UpgradableProxyWithAdmin.json +2 -2
- package/artifacts/contracts/shared/Versionable.sol/Versionable.dbg.json +1 -1
- package/artifacts/contracts/test/TestFee.sol/TestFee.dbg.json +1 -1
- package/artifacts/contracts/test/TestRegisterable.sol/TestRegisterable.dbg.json +1 -1
- package/artifacts/contracts/test/TestRegisterable.sol/TestRegisterable.json +19 -11
- 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 +44 -36
- package/artifacts/contracts/test/TestToken.sol/TestUsdc.dbg.json +1 -1
- package/artifacts/contracts/test/TestVersion.sol/TestVersion.dbg.json +1 -1
- package/artifacts/contracts/test/TestVersion.sol/TestVersion.json +2 -2
- package/artifacts/contracts/test/TestVersionable.sol/TestVersionable.dbg.json +1 -1
- package/artifacts/contracts/test/TestVersionable.sol/TestVersionable.json +2 -2
- package/artifacts/contracts/test/Usdc.sol/USDC.dbg.json +1 -1
- package/artifacts/contracts/types/AddressSet.sol/LibAddressSet.dbg.json +1 -1
- package/artifacts/contracts/types/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 +1 -1
- package/artifacts/contracts/types/Fee.sol/FeeLib.dbg.json +1 -1
- package/artifacts/contracts/types/Key32.sol/Key32Lib.dbg.json +1 -1
- package/artifacts/contracts/types/NftId.sol/NftIdLib.dbg.json +1 -1
- package/artifacts/contracts/types/NftIdSet.sol/LibNftIdSet.dbg.json +1 -1
- package/artifacts/contracts/types/NftIdSet.sol/LibNftIdSet.json +26 -3
- package/artifacts/contracts/types/NumberId.sol/NumberIdLib.dbg.json +1 -1
- package/artifacts/contracts/types/ObjectType.sol/ObjectTypeLib.dbg.json +1 -1
- package/artifacts/contracts/types/Referral.sol/ReferralLib.dbg.json +1 -1
- package/artifacts/contracts/types/RiskId.sol/RiskIdLib.dbg.json +1 -1
- 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/StateId.sol/StateIdLib.json +2 -2
- package/artifacts/contracts/types/Timestamp.sol/TimestampLib.dbg.json +1 -1
- package/artifacts/contracts/types/UFixed.sol/MathLib.dbg.json +1 -1
- package/artifacts/contracts/types/UFixed.sol/UFixedLib.dbg.json +1 -1
- package/artifacts/contracts/types/Version.sol/VersionLib.dbg.json +1 -1
- package/artifacts/contracts/types/Version.sol/VersionLib.json +2 -2
- package/artifacts/contracts/types/Version.sol/VersionPartLib.dbg.json +1 -1
- package/artifacts/contracts/types/Version.sol/VersionPartLib.json +22 -3
- package/contracts/components/Component.sol +222 -0
- package/contracts/components/Distribution.sol +33 -55
- package/contracts/components/IComponent.sol +43 -0
- package/contracts/components/IDistributionComponent.sol +5 -1
- package/contracts/components/IPoolComponent.sol +11 -3
- package/contracts/components/IProductComponent.sol +7 -3
- package/contracts/components/Pool.sol +65 -83
- package/contracts/components/Product.sol +70 -109
- package/contracts/instance/BundleManager.sol +125 -0
- package/contracts/instance/Cloneable.sol +46 -0
- package/contracts/instance/IInstance.sol +54 -10
- package/contracts/instance/IInstanceService.sol +24 -1
- package/contracts/instance/Instance.sol +76 -243
- package/contracts/instance/InstanceAccessManager.sol +88 -78
- package/contracts/instance/InstanceReader.sol +34 -21
- package/contracts/instance/InstanceService.sol +311 -51
- package/contracts/instance/InstanceServiceManager.sol +10 -12
- package/contracts/instance/ObjectManager.sol +84 -0
- package/contracts/instance/base/ComponentService.sol +134 -0
- package/contracts/instance/module/IAccess.sol +27 -17
- package/contracts/instance/module/IBundle.sol +1 -0
- package/contracts/instance/module/ISetup.sol +3 -0
- package/contracts/instance/service/BundleService.sol +293 -0
- package/contracts/instance/service/BundleServiceManager.sol +51 -0
- package/contracts/instance/service/DistributionService.sol +106 -0
- package/contracts/instance/service/DistributionServiceManager.sol +51 -0
- package/contracts/instance/service/IBundleService.sol +44 -0
- package/contracts/instance/service/IPolicyService.sol +94 -0
- package/contracts/instance/service/IPoolService.sol +6 -23
- package/contracts/instance/service/IProductService.sol +6 -73
- package/contracts/instance/service/PolicyService.sol +538 -0
- package/contracts/instance/service/PolicyServiceManager.sol +54 -0
- package/contracts/instance/service/PoolService.sol +109 -0
- package/contracts/instance/service/PoolServiceManager.sol +51 -0
- package/contracts/instance/service/ProductService.sol +232 -0
- package/contracts/instance/service/ProductServiceManager.sol +54 -0
- package/contracts/registry/ChainNft.sol +1 -1
- package/contracts/registry/IRegistry.sol +47 -6
- package/contracts/registry/IRegistryService.sol +44 -14
- package/contracts/registry/Registry.sol +243 -214
- package/contracts/registry/RegistryAccessManager.sol +216 -0
- package/contracts/registry/RegistryService.sol +81 -258
- package/contracts/registry/RegistryServiceManager.sol +20 -22
- package/contracts/registry/ReleaseManager.sol +332 -0
- package/contracts/registry/TokenRegistry.sol +112 -0
- package/contracts/shared/ERC165.sol +6 -2
- package/contracts/shared/IRegisterable.sol +1 -3
- package/contracts/shared/IService.sol +2 -1
- package/contracts/shared/NftOwnable.sol +7 -4
- package/contracts/shared/ProxyManager.sol +1 -1
- package/contracts/shared/Registerable.sol +11 -14
- package/contracts/shared/Service.sol +14 -8
- package/contracts/test/TestService.sol +3 -2
- package/contracts/types/NftIdSet.sol +26 -24
- package/contracts/types/RoleId.sol +14 -6
- package/contracts/types/StateId.sol +4 -0
- package/contracts/types/Version.sol +4 -1
- package/package.json +1 -1
- package/artifacts/contracts/components/BaseComponent.sol/BaseComponent.dbg.json +0 -4
- package/artifacts/contracts/components/BaseComponent.sol/BaseComponent.json +0 -314
- package/artifacts/contracts/components/IBaseComponent.sol/IBaseComponent.dbg.json +0 -4
- package/artifacts/contracts/components/IBaseComponent.sol/IBaseComponent.json +0 -267
- package/artifacts/contracts/instance/AccessManagedSimple.sol/AccessManagedSimple.dbg.json +0 -4
- package/artifacts/contracts/instance/AccessManagerSimple.sol/AccessManagerSimple.dbg.json +0 -4
- package/artifacts/contracts/instance/AccessManagerSimple.sol/AccessManagerSimple.json +0 -1119
- package/artifacts/contracts/instance/IAccessManagerSimple.sol/IAccessManagerSimple.dbg.json +0 -4
- package/artifacts/contracts/instance/IAccessManagerSimple.sol/IAccessManagerSimple.json +0 -1082
- package/artifacts/contracts/instance/base/ComponentServiceBase.sol/ComponentServiceBase.dbg.json +0 -4
- package/artifacts/contracts/instance/base/IInstanceBase.sol/IInstanceBase.dbg.json +0 -4
- package/artifacts/contracts/instance/base/IInstanceBase.sol/IInstanceBase.json +0 -113
- package/artifacts/contracts/instance/service/ComponentOwnerService.sol/ComponentOwnerService.dbg.json +0 -4
- package/artifacts/contracts/instance/service/ComponentOwnerService.sol/ComponentOwnerService.json +0 -827
- package/artifacts/contracts/instance/service/IComponentOwnerService.sol/IComponentOwnerService.dbg.json +0 -4
- package/artifacts/contracts/shared/RegisterableUpgradable.sol/RegisterableUpgradable.dbg.json +0 -4
- package/contracts/components/BaseComponent.sol +0 -86
- package/contracts/components/IBaseComponent.sol +0 -24
- package/contracts/instance/AccessManagedSimple.sol +0 -114
- package/contracts/instance/AccessManagerSimple.sol +0 -682
- package/contracts/instance/IAccessManagerSimple.sol +0 -391
- package/contracts/instance/base/ComponentServiceBase.sol +0 -49
- package/contracts/instance/base/IInstanceBase.sol +0 -23
- package/contracts/instance/service/ComponentOwnerService.sol +0 -317
- package/contracts/instance/service/IComponentOwnerService.sol +0 -20
- package/contracts/shared/RegisterableUpgradable.sol +0 -16
@@ -131,8 +131,8 @@
|
|
131
131
|
"type": "function"
|
132
132
|
}
|
133
133
|
],
|
134
|
-
"bytecode": "0x6102a461003a600b82828239805160001a60731461002d57634e487b7160e01b600052600060045260246000fd5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600436106100875760003560e01c806368aebf7b1161006557806368aebf7b14610119578063a42e52e914610127578063bc1b392d14610144578063f37f38f01461014b57600080fd5b8063057182b41461008c578063545ce21c146100bd57806367cb8ec1146100e7575b600080fd5b6100a861009a36600461020b565b67ffffffffffffffff161590565b60405190151581526020015b60405180910390f35b6100ce6100cb36600461020b565b90565b60405167ffffffffffffffff90911681526020016100b4565b6101066100f536600461020b565b60081b68ffffffffffffffff001690565b60405160ff1990911681526020016100b4565b6100ce6100cb36600461023c565b6100a861013536600461020b565b67ffffffffffffffff16151590565b60006100ce565b61015e61015936600461020b565b61016c565b6040519081526020016100b4565b600073__$c8f743efd2b4f0c9300f2558c784479d3e$
|
135
|
-
"deployedBytecode": "0x73000000000000000000000000000000000000000030146080604052600436106100875760003560e01c806368aebf7b1161006557806368aebf7b14610119578063a42e52e914610127578063bc1b392d14610144578063f37f38f01461014b57600080fd5b8063057182b41461008c578063545ce21c146100bd57806367cb8ec1146100e7575b600080fd5b6100a861009a36600461020b565b67ffffffffffffffff161590565b60405190151581526020015b60405180910390f35b6100ce6100cb36600461020b565b90565b60405167ffffffffffffffff90911681526020016100b4565b6101066100f536600461020b565b60081b68ffffffffffffffff001690565b60405160ff1990911681526020016100b4565b6100ce6100cb36600461023c565b6100a861013536600461020b565b67ffffffffffffffff16151590565b60006100ce565b61015e61015936600461020b565b61016c565b6040519081526020016100b4565b600073__$c8f743efd2b4f0c9300f2558c784479d3e$
|
134
|
+
"bytecode": "0x6102a461003a600b82828239805160001a60731461002d57634e487b7160e01b600052600060045260246000fd5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600436106100875760003560e01c806368aebf7b1161006557806368aebf7b14610119578063a42e52e914610127578063bc1b392d14610144578063f37f38f01461014b57600080fd5b8063057182b41461008c578063545ce21c146100bd57806367cb8ec1146100e7575b600080fd5b6100a861009a36600461020b565b67ffffffffffffffff161590565b60405190151581526020015b60405180910390f35b6100ce6100cb36600461020b565b90565b60405167ffffffffffffffff90911681526020016100b4565b6101066100f536600461020b565b60081b68ffffffffffffffff001690565b60405160ff1990911681526020016100b4565b6100ce6100cb36600461023c565b6100a861013536600461020b565b67ffffffffffffffff16151590565b60006100ce565b61015e61015936600461020b565b61016c565b6040519081526020016100b4565b600073__$c8f743efd2b4f0c9300f2558c784479d3e$__63f48016ce6014600885901b68ffffffffffffffff00166040516001600160e01b031960e085901b16815260ff909216600483015260ff19166024820152604401602060405180830381865af41580156101e1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102059190610255565b92915050565b60006020828403121561021d57600080fd5b813567ffffffffffffffff8116811461023557600080fd5b9392505050565b60006020828403121561024e57600080fd5b5035919050565b60006020828403121561026757600080fd5b505191905056fea264697066735822122086d6d5e7cf55dda632b0654978a70cfde39145420c77c3f3aaf908785486b9b564736f6c63430008140033",
|
135
|
+
"deployedBytecode": "0x73000000000000000000000000000000000000000030146080604052600436106100875760003560e01c806368aebf7b1161006557806368aebf7b14610119578063a42e52e914610127578063bc1b392d14610144578063f37f38f01461014b57600080fd5b8063057182b41461008c578063545ce21c146100bd57806367cb8ec1146100e7575b600080fd5b6100a861009a36600461020b565b67ffffffffffffffff161590565b60405190151581526020015b60405180910390f35b6100ce6100cb36600461020b565b90565b60405167ffffffffffffffff90911681526020016100b4565b6101066100f536600461020b565b60081b68ffffffffffffffff001690565b60405160ff1990911681526020016100b4565b6100ce6100cb36600461023c565b6100a861013536600461020b565b67ffffffffffffffff16151590565b60006100ce565b61015e61015936600461020b565b61016c565b6040519081526020016100b4565b600073__$c8f743efd2b4f0c9300f2558c784479d3e$__63f48016ce6014600885901b68ffffffffffffffff00166040516001600160e01b031960e085901b16815260ff909216600483015260ff19166024820152604401602060405180830381865af41580156101e1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102059190610255565b92915050565b60006020828403121561021d57600080fd5b813567ffffffffffffffff8116811461023557600080fd5b9392505050565b60006020828403121561024e57600080fd5b5035919050565b60006020828403121561026757600080fd5b505191905056fea264697066735822122086d6d5e7cf55dda632b0654978a70cfde39145420c77c3f3aaf908785486b9b564736f6c63430008140033",
|
136
136
|
"linkReferences": {
|
137
137
|
"contracts/types/Key32.sol": {
|
138
138
|
"Key32Lib": [
|
@@ -85,8 +85,8 @@
|
|
85
85
|
"type": "function"
|
86
86
|
}
|
87
87
|
],
|
88
|
-
"bytecode": "
|
89
|
-
"deployedBytecode": "
|
88
|
+
"bytecode": "0x61018c61003a600b82828239805160001a60731461002d57634e487b7160e01b600052600060045260246000fd5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600436106100565760003560e01c80632c2f8a671461005b5780636f91962014610083578063ac43d83414610098578063b2466acf146100c9575b600080fd5b61006e610069366004610108565b6100df565b60405190151581526020015b60405180910390f35b61006e61009136600461013b565b60ff161590565b6100ac6100a636600461013b565b60ff1690565b6040516bffffffffffffffffffffffff909116815260200161007a565b61006e6100d736600461013b565b60ff16151590565b600060ff808416908316145b9392505050565b803560ff8116811461010357600080fd5b919050565b6000806040838503121561011b57600080fd5b610124836100f2565b9150610132602084016100f2565b90509250929050565b60006020828403121561014d57600080fd5b6100eb826100f256fea26469706673582212204cd4e6f2bb672e5640aaa5a4af92ef3714ca5bf00495f7a3790a03dec2aaa3fc64736f6c63430008140033",
|
89
|
+
"deployedBytecode": "0x73000000000000000000000000000000000000000030146080604052600436106100565760003560e01c80632c2f8a671461005b5780636f91962014610083578063ac43d83414610098578063b2466acf146100c9575b600080fd5b61006e610069366004610108565b6100df565b60405190151581526020015b60405180910390f35b61006e61009136600461013b565b60ff161590565b6100ac6100a636600461013b565b60ff1690565b6040516bffffffffffffffffffffffff909116815260200161007a565b61006e6100d736600461013b565b60ff16151590565b600060ff808416908316145b9392505050565b803560ff8116811461010357600080fd5b919050565b6000806040838503121561011b57600080fd5b610124836100f2565b9150610132602084016100f2565b90509250929050565b60006020828403121561014d57600080fd5b6100eb826100f256fea26469706673582212204cd4e6f2bb672e5640aaa5a4af92ef3714ca5bf00495f7a3790a03dec2aaa3fc64736f6c63430008140033",
|
90
90
|
"linkReferences": {},
|
91
91
|
"deployedLinkReferences": {}
|
92
92
|
}
|
@@ -170,8 +170,8 @@
|
|
170
170
|
"type": "function"
|
171
171
|
}
|
172
172
|
],
|
173
|
-
"bytecode": "
|
174
|
-
"deployedBytecode": "
|
173
|
+
"bytecode": "0x61039161003a600b82828239805160001a60731461002d57634e487b7160e01b600052600060045260246000fd5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600436106100925760003560e01c80638e4ad86c116100655780638e4ad86c1461012157806394aa449c14610144578063a123b37c14610152578063c9e66e291461017957600080fd5b806304b8f6c5146100975780632efe0113146100b357806349a7111a146100c657806355601007146100fd575b600080fd5b60005b60405162ffffff90911681526020015b60405180910390f35b61009a6100c136600461026e565b610190565b6100d96100d436600461029a565b610231565b6040805160ff948516815292841660208401529216918101919091526060016100aa565b61011361010b36600461029a565b62ffffff1690565b6040519081526020016100aa565b61013261012f3660046102c6565b90565b60405160ff90911681526020016100aa565b61009a61012f3660046102df565b61016061010b36600461029a565b60405167ffffffffffffffff90911681526020016100aa565b61013261018736600461029a565b60101c60ff1690565b6000610100841080156101a4575061010083105b80156101b1575061010082105b61020c5760405162461bcd60e51b815260206004820152602260248201527f4552524f523a5652532d3031303a56455253494f4e5f504152545f544f4f5f42604482015261494760f01b606482015260840160405180910390fd5b8161021f600885901b601087901b61031f565b610229919061031f565b949350505050565b600080808360ff601082901c166102488383610338565b915061ffff600883901c16600061025f8185610338565b92989197509195509350505050565b60008060006060848603121561028357600080fd5b505081359360208301359350604090920135919050565b6000602082840312156102ac57600080fd5b813562ffffff811681146102bf57600080fd5b9392505050565b6000602082840312156102d857600080fd5b5035919050565b6000602082840312156102f157600080fd5b813567ffffffffffffffff811681146102bf57600080fd5b634e487b7160e01b600052601160045260246000fd5b8082018082111561033257610332610309565b92915050565b62ffffff82811682821603908082111561035457610354610309565b509291505056fea264697066735822122096e4b37266f82e0aaf6f30afa90c545c35f82576ca3b67d630233921e58f525b64736f6c63430008140033",
|
174
|
+
"deployedBytecode": "0x73000000000000000000000000000000000000000030146080604052600436106100925760003560e01c80638e4ad86c116100655780638e4ad86c1461012157806394aa449c14610144578063a123b37c14610152578063c9e66e291461017957600080fd5b806304b8f6c5146100975780632efe0113146100b357806349a7111a146100c657806355601007146100fd575b600080fd5b60005b60405162ffffff90911681526020015b60405180910390f35b61009a6100c136600461026e565b610190565b6100d96100d436600461029a565b610231565b6040805160ff948516815292841660208401529216918101919091526060016100aa565b61011361010b36600461029a565b62ffffff1690565b6040519081526020016100aa565b61013261012f3660046102c6565b90565b60405160ff90911681526020016100aa565b61009a61012f3660046102df565b61016061010b36600461029a565b60405167ffffffffffffffff90911681526020016100aa565b61013261018736600461029a565b60101c60ff1690565b6000610100841080156101a4575061010083105b80156101b1575061010082105b61020c5760405162461bcd60e51b815260206004820152602260248201527f4552524f523a5652532d3031303a56455253494f4e5f504152545f544f4f5f42604482015261494760f01b606482015260840160405180910390fd5b8161021f600885901b601087901b61031f565b610229919061031f565b949350505050565b600080808360ff601082901c166102488383610338565b915061ffff600883901c16600061025f8185610338565b92989197509195509350505050565b60008060006060848603121561028357600080fd5b505081359360208301359350604090920135919050565b6000602082840312156102ac57600080fd5b813562ffffff811681146102bf57600080fd5b9392505050565b6000602082840312156102d857600080fd5b5035919050565b6000602082840312156102f157600080fd5b813567ffffffffffffffff811681146102bf57600080fd5b634e487b7160e01b600052601160045260246000fd5b8082018082111561033257610332610309565b92915050565b62ffffff82811682821603908082111561035457610354610309565b509291505056fea264697066735822122096e4b37266f82e0aaf6f30afa90c545c35f82576ca3b67d630233921e58f525b64736f6c63430008140033",
|
175
175
|
"linkReferences": {},
|
176
176
|
"deployedLinkReferences": {}
|
177
177
|
}
|
@@ -7,7 +7,7 @@
|
|
7
7
|
"inputs": [
|
8
8
|
{
|
9
9
|
"internalType": "VersionPart",
|
10
|
-
"name": "
|
10
|
+
"name": "a",
|
11
11
|
"type": "uint8"
|
12
12
|
}
|
13
13
|
],
|
@@ -21,10 +21,29 @@
|
|
21
21
|
],
|
22
22
|
"stateMutability": "pure",
|
23
23
|
"type": "function"
|
24
|
+
},
|
25
|
+
{
|
26
|
+
"inputs": [
|
27
|
+
{
|
28
|
+
"internalType": "uint256",
|
29
|
+
"name": "a",
|
30
|
+
"type": "uint256"
|
31
|
+
}
|
32
|
+
],
|
33
|
+
"name": "toVersionPart",
|
34
|
+
"outputs": [
|
35
|
+
{
|
36
|
+
"internalType": "VersionPart",
|
37
|
+
"name": "",
|
38
|
+
"type": "uint8"
|
39
|
+
}
|
40
|
+
],
|
41
|
+
"stateMutability": "pure",
|
42
|
+
"type": "function"
|
24
43
|
}
|
25
44
|
],
|
26
|
-
"bytecode": "
|
27
|
-
"deployedBytecode": "
|
45
|
+
"bytecode": "0x60fb610039600b82828239805160001a60731461002c57634e487b7160e01b600052600060045260246000fd5b30600052607381538281f3fe7300000000000000000000000000000000000000003014608060405260043610603d5760003560e01c80638e4ad86c146042578063ac43d834146067575b600080fd5b6050604d3660046085565b90565b60405160ff90911681526020015b60405180910390f35b60786072366004609d565b60ff1690565b604051908152602001605e565b600060208284031215609657600080fd5b5035919050565b60006020828403121560ae57600080fd5b813560ff8116811460be57600080fd5b939250505056fea264697066735822122074bb6f75f2cab9692d05e41844bf40283045a9440c662c37a97b2502d38207ed64736f6c63430008140033",
|
46
|
+
"deployedBytecode": "0x7300000000000000000000000000000000000000003014608060405260043610603d5760003560e01c80638e4ad86c146042578063ac43d834146067575b600080fd5b6050604d3660046085565b90565b60405160ff90911681526020015b60405180910390f35b60786072366004609d565b60ff1690565b604051908152602001605e565b600060208284031215609657600080fd5b5035919050565b60006020828403121560ae57600080fd5b813560ff8116811460be57600080fd5b939250505056fea264697066735822122074bb6f75f2cab9692d05e41844bf40283045a9440c662c37a97b2502d38207ed64736f6c63430008140033",
|
28
47
|
"linkReferences": {},
|
29
48
|
"deployedLinkReferences": {}
|
30
49
|
}
|
@@ -0,0 +1,222 @@
|
|
1
|
+
// SPDX-License-Identifier: Apache-2.0
|
2
|
+
pragma solidity ^0.8.20;
|
3
|
+
|
4
|
+
import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
|
5
|
+
import {IERC20Metadata} from "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol";
|
6
|
+
import {AccessManagedUpgradeable} from "@openzeppelin/contracts-upgradeable/access/manager/AccessManagedUpgradeable.sol";
|
7
|
+
|
8
|
+
import {IComponent} from "./IComponent.sol";
|
9
|
+
import {IProductService} from "../instance/service/IProductService.sol";
|
10
|
+
import {IInstanceService} from "../instance/IInstanceService.sol";
|
11
|
+
import {IInstance} from "../instance/IInstance.sol";
|
12
|
+
import {InstanceAccessManager} from "../instance/InstanceAccessManager.sol";
|
13
|
+
import {IRegistry} from "../registry/IRegistry.sol";
|
14
|
+
import {NftId} from "../types/NftId.sol";
|
15
|
+
import {ObjectType, INSTANCE, PRODUCT} from "../types/ObjectType.sol";
|
16
|
+
import {VersionPart} from "../types/Version.sol";
|
17
|
+
import {Registerable} from "../shared/Registerable.sol";
|
18
|
+
import {RoleId, RoleIdLib} from "../types/RoleId.sol";
|
19
|
+
import {IAccess} from "../instance/module/IAccess.sol";
|
20
|
+
|
21
|
+
// TODO discuss to inherit from oz accessmanaged
|
22
|
+
// TODO make contract upgradeable
|
23
|
+
// then add (Distribution|Pool|Product)Upradeable that also intherit from Versionable
|
24
|
+
// same pattern as for Service which is also upgradeable
|
25
|
+
abstract contract Component is
|
26
|
+
Registerable,
|
27
|
+
IComponent,
|
28
|
+
AccessManagedUpgradeable
|
29
|
+
{
|
30
|
+
// keccak256(abi.encode(uint256(keccak256("gif-next.contracts.component.Component.sol")) - 1)) & ~bytes32(uint256(0xff));
|
31
|
+
bytes32 public constant CONTRACT_LOCATION_V1 = 0xffe8d4462baed26a47154f4b8f6db497d2f772496965791d25bd456e342b7f00;
|
32
|
+
|
33
|
+
struct ComponentStorage {
|
34
|
+
IInstance _instance; // instance for this component
|
35
|
+
string _name; // unique (per instance) component name
|
36
|
+
IERC20Metadata _token; // token for this component
|
37
|
+
address _wallet; // wallet for this component (default = component contract itself)
|
38
|
+
IInstanceService _instanceService; // instance service for this component
|
39
|
+
|
40
|
+
NftId _productNftId; // only relevant for components that are linked to a aproduct
|
41
|
+
IProductService _productService; // product service for component, might not be relevant for some component types (eg oracles)
|
42
|
+
}
|
43
|
+
|
44
|
+
|
45
|
+
modifier onlyProductService() {
|
46
|
+
if(msg.sender != address(_getComponentStorage()._productService)) {
|
47
|
+
revert ErrorComponentNotProductService(msg.sender);
|
48
|
+
}
|
49
|
+
_;
|
50
|
+
}
|
51
|
+
|
52
|
+
// TODO discuss replacement with modifier restricted from accessmanaged
|
53
|
+
modifier onlyInstanceRole(uint64 roleIdNum) {
|
54
|
+
RoleId roleId = RoleIdLib.toRoleId(roleIdNum);
|
55
|
+
InstanceAccessManager accessManager = InstanceAccessManager(_getComponentStorage()._instance.authority());
|
56
|
+
if( !accessManager.hasRole(roleId, msg.sender)) {
|
57
|
+
revert ErrorComponentUnauthorized(msg.sender, roleIdNum);
|
58
|
+
}
|
59
|
+
_;
|
60
|
+
}
|
61
|
+
|
62
|
+
// TODO discuss replacement with modifier restricted from accessmanaged
|
63
|
+
modifier isNotLocked() {
|
64
|
+
InstanceAccessManager accessManager = InstanceAccessManager(_getComponentStorage()._instance.authority());
|
65
|
+
if (accessManager.isTargetLocked(address(this))) {
|
66
|
+
revert IAccess.ErrorIAccessTargetLocked(address(this));
|
67
|
+
}
|
68
|
+
_;
|
69
|
+
}
|
70
|
+
|
71
|
+
function _getComponentStorage() private pure returns (ComponentStorage storage $) {
|
72
|
+
assembly {
|
73
|
+
$.slot := CONTRACT_LOCATION_V1
|
74
|
+
}
|
75
|
+
}
|
76
|
+
|
77
|
+
|
78
|
+
function _initializeComponent(
|
79
|
+
address registry,
|
80
|
+
NftId instanceNftId,
|
81
|
+
string memory name,
|
82
|
+
address token,
|
83
|
+
ObjectType componentType,
|
84
|
+
bool isInterceptor,
|
85
|
+
address initialOwner,
|
86
|
+
bytes memory data
|
87
|
+
)
|
88
|
+
internal
|
89
|
+
//onlyInitializing // TODO uncomment when "fully" upgradeable
|
90
|
+
virtual
|
91
|
+
{
|
92
|
+
ComponentStorage storage $ = _getComponentStorage();
|
93
|
+
_initializeRegisterable(registry, instanceNftId, componentType, isInterceptor, initialOwner, data);
|
94
|
+
|
95
|
+
// set unique name of component
|
96
|
+
$._name = name;
|
97
|
+
|
98
|
+
// set and check linked instance
|
99
|
+
IRegistry.ObjectInfo memory instanceInfo = getRegistry().getObjectInfo(instanceNftId);
|
100
|
+
$._instance = IInstance(instanceInfo.objectAddress);
|
101
|
+
if(!$._instance.supportsInterface(type(IInstance).interfaceId)) {
|
102
|
+
revert ErrorComponentNotInstance(instanceNftId, instanceInfo.objectAddress);
|
103
|
+
}
|
104
|
+
|
105
|
+
// set linked services
|
106
|
+
VersionPart gifVersion = $._instance.getMajorVersion();
|
107
|
+
$._instanceService = IInstanceService(getRegistry().getServiceAddress(INSTANCE(), gifVersion));
|
108
|
+
$._productService = IProductService(getRegistry().getServiceAddress(PRODUCT(), gifVersion));
|
109
|
+
|
110
|
+
// set wallet and token
|
111
|
+
$._wallet = address(this);
|
112
|
+
$._token = IERC20Metadata(token);
|
113
|
+
|
114
|
+
_registerInterface(type(IComponent).interfaceId);
|
115
|
+
}
|
116
|
+
|
117
|
+
// TODO discuss replacement with modifier restricted from accessmanaged
|
118
|
+
function lock() external onlyOwner override {
|
119
|
+
_getComponentStorage()._instanceService.setTargetLocked(getName(), true);
|
120
|
+
}
|
121
|
+
|
122
|
+
// TODO discuss replacement with modifier restricted from accessmanaged
|
123
|
+
function unlock() external onlyOwner override {
|
124
|
+
_getComponentStorage()._instanceService.setTargetLocked(getName(), false);
|
125
|
+
}
|
126
|
+
|
127
|
+
// only product service may set product nft id during registration of product setup
|
128
|
+
function setProductNftId(NftId productNftId)
|
129
|
+
external
|
130
|
+
override
|
131
|
+
onlyProductService()
|
132
|
+
{
|
133
|
+
ComponentStorage storage $ = _getComponentStorage();
|
134
|
+
|
135
|
+
if($._productNftId.gtz()) {
|
136
|
+
revert ErrorComponentProductNftAlreadySet();
|
137
|
+
}
|
138
|
+
|
139
|
+
$._productNftId = productNftId;
|
140
|
+
}
|
141
|
+
|
142
|
+
/// @dev Sets the wallet address for the component.
|
143
|
+
/// if the current wallet has tokens, these will be transferred.
|
144
|
+
/// if the new wallet address is externally owned, an approval from the
|
145
|
+
/// owner of the external wallet for the component to move all tokens must exist.
|
146
|
+
function setWallet(address newWallet) external override onlyOwner {
|
147
|
+
ComponentStorage storage $ = _getComponentStorage();
|
148
|
+
|
149
|
+
address currentWallet = $._wallet;
|
150
|
+
uint256 currentBalance = $._token.balanceOf(currentWallet);
|
151
|
+
|
152
|
+
// checks
|
153
|
+
if (newWallet == address(0)) {
|
154
|
+
revert ErrorComponentWalletAddressZero();
|
155
|
+
}
|
156
|
+
if (newWallet == currentWallet) {
|
157
|
+
revert ErrorComponentWalletAddressIsSameAsCurrent(newWallet);
|
158
|
+
}
|
159
|
+
|
160
|
+
if (currentBalance > 0) {
|
161
|
+
if (currentWallet == address(this)) {
|
162
|
+
// move tokens from component smart contract to external wallet
|
163
|
+
} else {
|
164
|
+
// move tokens from external wallet to component smart contract or another external wallet
|
165
|
+
uint256 allowance = $._token.allowance(currentWallet, address(this));
|
166
|
+
if (allowance < currentBalance) {
|
167
|
+
revert ErrorComponentWalletAllowanceTooSmall(currentWallet, newWallet, allowance, currentBalance);
|
168
|
+
}
|
169
|
+
}
|
170
|
+
}
|
171
|
+
|
172
|
+
// effects
|
173
|
+
$._wallet = newWallet;
|
174
|
+
emit LogComponentWalletAddressChanged(newWallet);
|
175
|
+
|
176
|
+
// interactions
|
177
|
+
if (currentBalance > 0) {
|
178
|
+
// transfer tokens from current wallet to new wallet
|
179
|
+
if (currentWallet == address(this)) {
|
180
|
+
// transferFrom requires self allowance too
|
181
|
+
$._token.approve(address(this), currentBalance);
|
182
|
+
}
|
183
|
+
|
184
|
+
SafeERC20.safeTransferFrom($._token, currentWallet, newWallet, currentBalance);
|
185
|
+
emit LogComponentWalletTokensTransferred(currentWallet, newWallet, currentBalance);
|
186
|
+
}
|
187
|
+
}
|
188
|
+
|
189
|
+
function getWallet()
|
190
|
+
public
|
191
|
+
view
|
192
|
+
override
|
193
|
+
returns (address walletAddress)
|
194
|
+
{
|
195
|
+
return _getComponentStorage()._wallet;
|
196
|
+
}
|
197
|
+
|
198
|
+
function getToken() public view override returns (IERC20Metadata token) {
|
199
|
+
return _getComponentStorage()._token;
|
200
|
+
}
|
201
|
+
|
202
|
+
function getInstance() public view override returns (IInstance instance) {
|
203
|
+
return _getComponentStorage()._instance;
|
204
|
+
}
|
205
|
+
|
206
|
+
function getName() public view override returns(string memory name) {
|
207
|
+
return _getComponentStorage()._name;
|
208
|
+
}
|
209
|
+
|
210
|
+
function getProductNftId() public view override returns (NftId productNftId) {
|
211
|
+
return _getComponentStorage()._productNftId;
|
212
|
+
}
|
213
|
+
|
214
|
+
function getInstanceService() public view returns (IInstanceService) {
|
215
|
+
return _getComponentStorage()._instanceService;
|
216
|
+
}
|
217
|
+
|
218
|
+
function getProductService() public view returns (IProductService) {
|
219
|
+
return _getComponentStorage()._productService;
|
220
|
+
}
|
221
|
+
|
222
|
+
}
|
@@ -7,7 +7,7 @@ import {IProductService} from "../instance/service/IProductService.sol";
|
|
7
7
|
import {NftId, zeroNftId, NftIdLib} from "../types/NftId.sol";
|
8
8
|
import {ReferralId} from "../types/Referral.sol";
|
9
9
|
import {Fee, FeeLib} from "../types/Fee.sol";
|
10
|
-
import {
|
10
|
+
import {Component} from "./Component.sol";
|
11
11
|
import {IDistributionComponent} from "./IDistributionComponent.sol";
|
12
12
|
import {IRegistry} from "../registry/IRegistry.sol";
|
13
13
|
import {IRegisterable} from "../shared/IRegisterable.sol";
|
@@ -16,43 +16,37 @@ import {Registerable} from "../shared/Registerable.sol";
|
|
16
16
|
import {TokenHandler} from "../shared/TokenHandler.sol";
|
17
17
|
import {InstanceReader} from "../instance/InstanceReader.sol";
|
18
18
|
|
19
|
-
contract Distribution is
|
20
|
-
|
19
|
+
abstract contract Distribution is
|
20
|
+
Component,
|
21
21
|
IDistributionComponent
|
22
22
|
{
|
23
23
|
using NftIdLib for NftId;
|
24
24
|
|
25
|
-
Fee internal _initialDistributionFee;
|
26
25
|
bool internal _isVerifying;
|
26
|
+
Fee internal _initialDistributionFee;
|
27
27
|
|
28
|
-
|
29
|
-
IProductService private _productService;
|
28
|
+
TokenHandler internal _tokenHandler;
|
30
29
|
|
31
|
-
|
32
|
-
require(
|
33
|
-
msg.sender == address(_productService),
|
34
|
-
"ERROR:POL-002:NOT_PRODUCT_SERVICE");
|
35
|
-
_;
|
36
|
-
}
|
30
|
+
IDistributionService private _distributionService;
|
37
31
|
|
38
|
-
|
32
|
+
function __initialize(
|
39
33
|
address registry,
|
40
34
|
NftId instanceNftId,
|
41
|
-
NftId productNftId,
|
42
35
|
// TODO refactor into tokenNftId
|
36
|
+
string memory name,
|
43
37
|
address token,
|
44
38
|
bool verifying,
|
45
39
|
Fee memory distributionFee,
|
46
|
-
address initialOwner
|
47
|
-
|
48
|
-
|
49
|
-
|
40
|
+
address initialOwner,
|
41
|
+
bytes memory data
|
42
|
+
) internal {
|
43
|
+
_initializeComponent(registry, instanceNftId, name, token, DISTRIBUTION(), true, initialOwner, data);
|
44
|
+
|
50
45
|
_isVerifying = verifying;
|
51
46
|
_initialDistributionFee = distributionFee;
|
52
47
|
|
53
|
-
|
54
|
-
|
55
|
-
// _productService = _instance.getProductService();
|
48
|
+
_tokenHandler = new TokenHandler(token);
|
49
|
+
_distributionService = getInstance().getDistributionService();
|
56
50
|
|
57
51
|
_registerInterface(type(IDistributionComponent).interfaceId);
|
58
52
|
}
|
@@ -123,44 +117,28 @@ contract Distribution is
|
|
123
117
|
}
|
124
118
|
|
125
119
|
function getSetupInfo() public view returns (ISetup.DistributionSetupInfo memory setupInfo) {
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
);
|
134
|
-
}
|
135
|
-
|
136
|
-
InstanceReader reader = _instance.getInstanceReader();
|
137
|
-
return reader.getDistributionSetupInfo(getNftId());
|
120
|
+
InstanceReader reader = getInstance().getInstanceReader();
|
121
|
+
setupInfo = reader.getDistributionSetupInfo(getNftId());
|
122
|
+
|
123
|
+
// fallback to initial setup info (wallet is always != address(0))
|
124
|
+
if(setupInfo.wallet == address(0)) {
|
125
|
+
setupInfo = _getInitialSetupInfo();
|
126
|
+
}
|
138
127
|
}
|
139
128
|
|
129
|
+
function _getInitialSetupInfo() internal view returns (ISetup.DistributionSetupInfo memory setupInfo) {
|
130
|
+
return ISetup.DistributionSetupInfo(
|
131
|
+
zeroNftId(),
|
132
|
+
_tokenHandler,
|
133
|
+
_initialDistributionFee,
|
134
|
+
_isVerifying,
|
135
|
+
address(this)
|
136
|
+
);
|
137
|
+
}
|
138
|
+
|
139
|
+
|
140
140
|
/// @dev returns true iff the component needs to be called when selling/renewing policis
|
141
141
|
function isVerifying() external view returns (bool verifying) {
|
142
142
|
return _isVerifying;
|
143
143
|
}
|
144
|
-
|
145
|
-
// from IRegisterable
|
146
|
-
|
147
|
-
function getInitialInfo()
|
148
|
-
public
|
149
|
-
view
|
150
|
-
override (IRegisterable, Registerable)
|
151
|
-
returns(IRegistry.ObjectInfo memory, bytes memory)
|
152
|
-
{
|
153
|
-
(
|
154
|
-
IRegistry.ObjectInfo memory info,
|
155
|
-
bytes memory data
|
156
|
-
) = super.getInitialInfo();
|
157
|
-
|
158
|
-
return (
|
159
|
-
info,
|
160
|
-
abi.encode(
|
161
|
-
_initialDistributionFee,
|
162
|
-
_isVerifying
|
163
|
-
)
|
164
|
-
);
|
165
|
-
}
|
166
144
|
}
|
@@ -0,0 +1,43 @@
|
|
1
|
+
// SPDX-License-Identifier: Apache-2.0
|
2
|
+
pragma solidity ^0.8.20;
|
3
|
+
|
4
|
+
import {IERC20Metadata} from "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol";
|
5
|
+
|
6
|
+
import {IRegisterable} from "../shared/IRegisterable.sol";
|
7
|
+
import {IInstance} from "../instance/IInstance.sol";
|
8
|
+
import {IInstanceService} from "../instance/IInstanceService.sol";
|
9
|
+
import {IProductService} from "../instance/service/IProductService.sol";
|
10
|
+
import {NftId} from "../types/NftId.sol";
|
11
|
+
|
12
|
+
interface IComponent is IRegisterable {
|
13
|
+
|
14
|
+
error ErrorComponentNotInstance(NftId instanceNftId, address instance);
|
15
|
+
error ErrorComponentProductNftAlreadySet();
|
16
|
+
error ErrorComponentWalletAddressZero();
|
17
|
+
error ErrorComponentWalletAddressIsSameAsCurrent(address newWallet);
|
18
|
+
error ErrorComponentWalletAllowanceTooSmall(address oldWallet, address newWallet, uint256 allowance, uint256 balance);
|
19
|
+
error ErrorComponentUnauthorized(address caller, uint64 requiredRoleIdNum);
|
20
|
+
error ErrorComponentNotProductService(address caller);
|
21
|
+
|
22
|
+
event LogComponentWalletAddressChanged(address newWallet);
|
23
|
+
event LogComponentWalletTokensTransferred(address from, address to, uint256 amount);
|
24
|
+
|
25
|
+
function getName() external view returns (string memory name);
|
26
|
+
|
27
|
+
// TODO remove and replace with accessmanaged target locking mechanism
|
28
|
+
function lock() external;
|
29
|
+
function unlock() external;
|
30
|
+
|
31
|
+
function getToken() external view returns (IERC20Metadata token);
|
32
|
+
|
33
|
+
function setWallet(address walletAddress) external;
|
34
|
+
function getWallet() external view returns (address walletAddress);
|
35
|
+
|
36
|
+
function getInstance() external view returns (IInstance instance);
|
37
|
+
|
38
|
+
function setProductNftId(NftId productNftId) external;
|
39
|
+
function getProductNftId() external view returns (NftId productNftId);
|
40
|
+
|
41
|
+
function getInstanceService() external view returns (IInstanceService);
|
42
|
+
function getProductService() external view returns (IProductService);
|
43
|
+
}
|
@@ -2,10 +2,14 @@
|
|
2
2
|
pragma solidity ^0.8.19;
|
3
3
|
|
4
4
|
import {Fee} from "../types/Fee.sol";
|
5
|
+
import {IComponent} from "./IComponent.sol";
|
6
|
+
import {ISetup} from "../instance/module/ISetup.sol";
|
5
7
|
import {ReferralId} from "../types/Referral.sol";
|
6
8
|
import {NftId} from "../types/NftId.sol";
|
7
9
|
|
8
|
-
interface IDistributionComponent {
|
10
|
+
interface IDistributionComponent is IComponent {
|
11
|
+
|
12
|
+
function getSetupInfo() external view returns (ISetup.DistributionSetupInfo memory setupInfo);
|
9
13
|
|
10
14
|
function setFees(
|
11
15
|
Fee memory distributionFee
|
@@ -1,14 +1,18 @@
|
|
1
1
|
// SPDX-License-Identifier: Apache-2.0
|
2
2
|
pragma solidity ^0.8.20;
|
3
3
|
|
4
|
-
import {NftId} from "../types/NftId.sol";
|
5
4
|
import {Fee} from "../types/Fee.sol";
|
5
|
+
import {IComponent} from "./IComponent.sol";
|
6
|
+
import {ISetup} from "../instance/module/ISetup.sol";
|
7
|
+
import {NftId} from "../types/NftId.sol";
|
6
8
|
import {UFixed} from "../types/UFixed.sol";
|
7
9
|
|
8
|
-
interface IPoolComponent {
|
10
|
+
interface IPoolComponent is IComponent {
|
9
11
|
|
10
12
|
event LogUnderwrittenByPool(NftId policyNftId, uint256 collateralizationAmount, address pool);
|
11
13
|
|
14
|
+
function getSetupInfo() external view returns (ISetup.PoolSetupInfo memory setupInfo);
|
15
|
+
|
12
16
|
function setFees(
|
13
17
|
Fee memory poolFee,
|
14
18
|
Fee memory stakingFee,
|
@@ -43,6 +47,10 @@ interface IPoolComponent {
|
|
43
47
|
uint256 collateralizationAmount
|
44
48
|
) external;
|
45
49
|
|
50
|
+
function lockBundle(NftId bundleNftId) external;
|
51
|
+
|
52
|
+
function unlockBundle(NftId bundleNftId) external;
|
53
|
+
|
46
54
|
/**
|
47
55
|
* @dev returns true iff the policy application data in policyData matches
|
48
56
|
* with the bundle filter criteria encoded in bundleFilter.
|
@@ -55,7 +63,7 @@ interface IPoolComponent {
|
|
55
63
|
view
|
56
64
|
returns (bool isMatching);
|
57
65
|
|
58
|
-
function
|
66
|
+
function isConfirmingApplication() external view returns (bool isConfirmingApplication);
|
59
67
|
|
60
68
|
function getCollateralizationLevel() external view returns (UFixed collateralizationLevel);
|
61
69
|
|
@@ -2,11 +2,15 @@
|
|
2
2
|
pragma solidity ^0.8.20;
|
3
3
|
|
4
4
|
import {Fee} from "../types/Fee.sol";
|
5
|
+
import {IComponent} from "./IComponent.sol";
|
6
|
+
import {ISetup} from "../instance/module/ISetup.sol";
|
5
7
|
import {NftId} from "../types/NftId.sol";
|
6
8
|
import {ReferralId} from "../types/Referral.sol";
|
7
9
|
import {RiskId} from "../types/RiskId.sol";
|
8
10
|
|
9
|
-
interface IProductComponent {
|
11
|
+
interface IProductComponent is IComponent {
|
12
|
+
|
13
|
+
function getSetupInfo() external view returns (ISetup.ProductSetupInfo memory setupInfo);
|
10
14
|
|
11
15
|
function setFees(
|
12
16
|
Fee memory productFee,
|
@@ -18,8 +22,8 @@ interface IProductComponent {
|
|
18
22
|
RiskId riskId,
|
19
23
|
uint256 lifetime,
|
20
24
|
bytes memory applicationData,
|
21
|
-
|
22
|
-
|
25
|
+
NftId bundleNftId,
|
26
|
+
ReferralId referralId
|
23
27
|
) external view returns (uint256 premiumAmount);
|
24
28
|
|
25
29
|
function calculateNetPremium(
|