@etherisc/gif-next 0.0.2-f29e479-370 → 0.0.2-f2df3e2-873
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +6 -83
- package/artifacts/contracts/components/Component.sol/Component.dbg.json +1 -1
- package/artifacts/contracts/components/Component.sol/Component.json +78 -89
- package/artifacts/contracts/components/Distribution.sol/Distribution.dbg.json +1 -1
- package/artifacts/contracts/components/Distribution.sol/Distribution.json +139 -140
- package/artifacts/contracts/components/IComponent.sol/IComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IComponent.sol/IComponent.json +156 -64
- package/artifacts/contracts/components/IDistributionComponent.sol/IDistributionComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IDistributionComponent.sol/IDistributionComponent.json +181 -112
- package/artifacts/contracts/components/IPoolComponent.sol/IPoolComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IPoolComponent.sol/IPoolComponent.json +353 -176
- package/artifacts/contracts/components/IProductComponent.sol/IProductComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IProductComponent.sol/IProductComponent.json +162 -138
- package/artifacts/contracts/components/Pool.sol/Pool.dbg.json +1 -1
- package/artifacts/contracts/components/Pool.sol/Pool.json +299 -245
- package/artifacts/contracts/components/Product.sol/Product.dbg.json +1 -1
- package/artifacts/contracts/components/Product.sol/Product.json +83 -162
- package/artifacts/contracts/instance/AccessManagerUpgradeableInitializeable.sol/AccessManagerUpgradeableInitializeable.dbg.json +4 -0
- package/artifacts/contracts/instance/AccessManagerUpgradeableInitializeable.sol/AccessManagerUpgradeableInitializeable.json +1206 -0
- package/artifacts/contracts/instance/BundleManager.sol/BundleManager.dbg.json +1 -1
- package/artifacts/contracts/instance/BundleManager.sol/BundleManager.json +64 -50
- package/artifacts/contracts/instance/Cloneable.sol/Cloneable.dbg.json +1 -1
- package/artifacts/contracts/instance/Cloneable.sol/Cloneable.json +5 -0
- package/artifacts/contracts/instance/IInstance.sol/IInstance.dbg.json +1 -1
- package/artifacts/contracts/instance/IInstance.sol/IInstance.json +527 -400
- package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.dbg.json +1 -1
- package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.json +175 -51
- package/artifacts/contracts/instance/Instance.sol/Instance.dbg.json +1 -1
- package/artifacts/contracts/instance/Instance.sol/Instance.json +500 -612
- package/artifacts/contracts/instance/InstanceAccessManager.sol/InstanceAccessManager.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceAccessManager.sol/InstanceAccessManager.json +472 -126
- package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.json +253 -236
- package/artifacts/contracts/instance/InstanceService.sol/InstanceService.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceService.sol/InstanceService.json +305 -211
- package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.json +71 -23
- package/artifacts/contracts/instance/ObjectManager.sol/ObjectManager.dbg.json +1 -1
- package/artifacts/contracts/instance/ObjectManager.sol/ObjectManager.json +8 -13
- package/artifacts/contracts/instance/base/ComponentService.sol/ComponentService.dbg.json +1 -1
- package/artifacts/contracts/instance/base/ComponentService.sol/ComponentService.json +86 -31
- package/artifacts/contracts/instance/base/IKeyValueStore.sol/IKeyValueStore.dbg.json +1 -1
- package/artifacts/contracts/instance/base/ILifecycle.sol/ILifecycle.dbg.json +1 -1
- package/artifacts/contracts/instance/base/KeyValueStore.sol/KeyValueStore.dbg.json +1 -1
- package/artifacts/contracts/instance/base/KeyValueStore.sol/KeyValueStore.json +40 -10
- package/artifacts/contracts/instance/base/Lifecycle.sol/Lifecycle.dbg.json +1 -1
- package/artifacts/contracts/instance/base/Lifecycle.sol/Lifecycle.json +36 -11
- package/artifacts/contracts/instance/module/IAccess.sol/IAccess.dbg.json +1 -1
- package/artifacts/contracts/instance/module/IAccess.sol/IAccess.json +56 -73
- package/artifacts/contracts/instance/module/IBundle.sol/IBundle.dbg.json +1 -1
- package/artifacts/contracts/instance/module/IComponents.sol/IComponents.dbg.json +4 -0
- package/artifacts/contracts/instance/module/IComponents.sol/IComponents.json +10 -0
- package/artifacts/contracts/instance/module/IDistribution.sol/IDistribution.dbg.json +1 -1
- package/artifacts/contracts/instance/module/IPolicy.sol/IPolicy.dbg.json +1 -1
- package/artifacts/contracts/instance/module/IRisk.sol/IRisk.dbg.json +1 -1
- package/artifacts/contracts/instance/module/ISetup.sol/ISetup.dbg.json +1 -1
- package/artifacts/contracts/instance/module/ITreasury.sol/ITreasury.dbg.json +1 -1
- package/artifacts/contracts/instance/service/ApplicationService.sol/ApplicationService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/ApplicationService.sol/ApplicationService.json +291 -100
- package/artifacts/contracts/instance/service/ApplicationServiceManager.sol/ApplicationServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/ApplicationServiceManager.sol/ApplicationServiceManager.json +46 -22
- package/artifacts/contracts/instance/service/BundleService.sol/BundleService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/BundleService.sol/BundleService.json +422 -252
- package/artifacts/contracts/instance/service/BundleServiceManager.sol/BundleServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/BundleServiceManager.sol/BundleServiceManager.json +78 -14
- package/artifacts/contracts/instance/service/ClaimService.sol/ClaimService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/ClaimService.sol/ClaimService.json +373 -87
- package/artifacts/contracts/instance/service/ClaimServiceManager.sol/ClaimServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/ClaimServiceManager.sol/ClaimServiceManager.json +55 -7
- package/artifacts/contracts/instance/service/DistributionService.sol/DistributionService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/DistributionService.sol/DistributionService.json +579 -123
- package/artifacts/contracts/instance/service/DistributionServiceManager.sol/DistributionServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/DistributionServiceManager.sol/DistributionServiceManager.json +71 -47
- package/artifacts/contracts/instance/service/IApplicationService.sol/IApplicationService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IApplicationService.sol/IApplicationService.json +200 -46
- package/artifacts/contracts/instance/service/IBundleService.sol/IBundleService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IBundleService.sol/IBundleService.json +241 -188
- package/artifacts/contracts/instance/service/IClaimService.sol/IClaimService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IClaimService.sol/IClaimService.json +251 -58
- package/artifacts/contracts/instance/service/IDistributionService.sol/IDistributionService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IDistributionService.sol/IDistributionService.json +444 -25
- package/artifacts/contracts/instance/service/IPolicyService.sol/IPolicyService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IPolicyService.sol/IPolicyService.json +430 -76
- package/artifacts/contracts/instance/service/IPoolService.sol/IPoolService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IPoolService.sol/IPoolService.json +511 -14
- package/artifacts/contracts/instance/service/IProductService.sol/IProductService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IProductService.sol/IProductService.json +80 -14
- package/artifacts/contracts/instance/service/PolicyService.sol/PolicyService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/PolicyService.sol/PolicyService.json +544 -153
- package/artifacts/contracts/instance/service/PolicyServiceManager.sol/PolicyServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/PolicyServiceManager.sol/PolicyServiceManager.json +51 -27
- package/artifacts/contracts/instance/service/PoolService.sol/PoolService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/PoolService.sol/PoolService.json +562 -52
- package/artifacts/contracts/instance/service/PoolServiceManager.sol/PoolServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/PoolServiceManager.sol/PoolServiceManager.json +24 -12
- package/artifacts/contracts/instance/service/ProductService.sol/ProductService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/ProductService.sol/ProductService.json +115 -52
- package/artifacts/contracts/instance/service/ProductServiceManager.sol/ProductServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/ProductServiceManager.sol/ProductServiceManager.json +16 -12
- package/artifacts/contracts/registry/ChainNft.sol/ChainNft.dbg.json +1 -1
- package/artifacts/contracts/registry/ChainNft.sol/ChainNft.json +15 -2
- package/artifacts/contracts/registry/IRegistry.sol/IRegistry.dbg.json +1 -1
- package/artifacts/contracts/registry/IRegistry.sol/IRegistry.json +19 -0
- package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.dbg.json +1 -1
- package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.json +0 -24
- package/artifacts/contracts/registry/ITransferInterceptor.sol/ITransferInterceptor.dbg.json +1 -1
- package/artifacts/contracts/registry/ITransferInterceptor.sol/ITransferInterceptor.json +18 -0
- package/artifacts/contracts/registry/Registry.sol/Registry.dbg.json +1 -1
- package/artifacts/contracts/registry/Registry.sol/Registry.json +31 -12
- package/artifacts/contracts/registry/RegistryAccessManager.sol/RegistryAccessManager.dbg.json +1 -1
- package/artifacts/contracts/registry/RegistryAccessManager.sol/RegistryAccessManager.json +2 -2
- package/artifacts/contracts/registry/RegistryService.sol/RegistryService.dbg.json +1 -1
- package/artifacts/contracts/registry/RegistryService.sol/RegistryService.json +18 -37
- package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.dbg.json +1 -1
- package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.json +7 -7
- package/artifacts/contracts/registry/ReleaseManager.sol/ReleaseManager.dbg.json +1 -1
- package/artifacts/contracts/registry/ReleaseManager.sol/ReleaseManager.json +23 -11
- package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.dbg.json +1 -1
- package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.json +2 -2
- package/artifacts/contracts/shared/ContractDeployerLib.sol/ContractDeployerLib.dbg.json +1 -1
- package/artifacts/contracts/shared/ERC165.sol/ERC165.dbg.json +1 -1
- package/artifacts/contracts/shared/INftOwnable.sol/INftOwnable.dbg.json +1 -1
- package/artifacts/contracts/shared/IPolicyHolder.sol/IPolicyHolder.dbg.json +1 -1
- package/artifacts/contracts/shared/IRegisterable.sol/IRegisterable.dbg.json +1 -1
- package/artifacts/contracts/shared/IRegistryLinked.sol/IRegistryLinked.dbg.json +1 -1
- package/artifacts/contracts/shared/IService.sol/IService.dbg.json +1 -1
- package/artifacts/contracts/shared/IService.sol/IService.json +80 -14
- 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 +2 -2
- package/artifacts/contracts/shared/PolicyHolder.sol/PolicyHolder.dbg.json +1 -1
- package/artifacts/contracts/shared/PolicyHolder.sol/PolicyHolder.json +2 -2
- package/artifacts/contracts/shared/ProxyManager.sol/ProxyManager.dbg.json +1 -1
- package/artifacts/contracts/shared/ProxyManager.sol/ProxyManager.json +2 -2
- package/artifacts/contracts/shared/Registerable.sol/Registerable.dbg.json +1 -1
- package/artifacts/contracts/shared/Registerable.sol/Registerable.json +3 -3
- package/artifacts/contracts/shared/RegistryLinked.sol/RegistryLinked.dbg.json +1 -1
- package/artifacts/contracts/shared/RegistryLinked.sol/RegistryLinked.json +2 -2
- package/artifacts/contracts/shared/Service.sol/Service.dbg.json +1 -1
- package/artifacts/contracts/shared/Service.sol/Service.json +87 -16
- package/artifacts/contracts/shared/TokenHandler.sol/TokenHandler.dbg.json +1 -1
- package/artifacts/contracts/shared/TokenHandler.sol/TokenHandler.json +2 -2
- package/artifacts/contracts/shared/UpgradableProxyWithAdmin.sol/UpgradableProxyWithAdmin.dbg.json +1 -1
- package/artifacts/contracts/shared/UpgradableProxyWithAdmin.sol/UpgradableProxyWithAdmin.json +2 -2
- package/artifacts/contracts/shared/Versionable.sol/Versionable.dbg.json +1 -1
- package/artifacts/contracts/test/TestFee.sol/TestFee.dbg.json +1 -1
- package/artifacts/contracts/test/TestFee.sol/TestFee.json +2 -2
- package/artifacts/contracts/test/TestRegisterable.sol/TestRegisterable.dbg.json +1 -1
- package/artifacts/contracts/test/TestRegisterable.sol/TestRegisterable.json +3 -3
- package/artifacts/contracts/test/TestRoleId.sol/TestRoleId.dbg.json +1 -1
- package/artifacts/contracts/test/TestRoleId.sol/TestRoleId.json +6 -6
- package/artifacts/contracts/test/TestService.sol/TestService.dbg.json +1 -1
- package/artifacts/contracts/test/TestService.sol/TestService.json +102 -27
- 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/Amount.sol/AmountLib.dbg.json +4 -0
- package/artifacts/contracts/types/Amount.sol/AmountLib.json +185 -0
- package/artifacts/contracts/types/Blocknumber.sol/BlocknumberLib.dbg.json +1 -1
- package/artifacts/contracts/types/Blocknumber.sol/BlocknumberLib.json +2 -2
- package/artifacts/contracts/types/ChainId.sol/ChainIdLib.dbg.json +1 -1
- package/artifacts/contracts/types/ClaimId.sol/ClaimIdLib.dbg.json +1 -1
- package/artifacts/contracts/types/ClaimId.sol/ClaimIdLib.json +83 -4
- package/artifacts/contracts/types/DistributorType.sol/DistributorTypeLib.dbg.json +1 -1
- package/artifacts/contracts/types/DistributorType.sol/DistributorTypeLib.json +2 -2
- package/artifacts/contracts/types/Fee.sol/FeeLib.dbg.json +1 -1
- package/artifacts/contracts/types/Fee.sol/FeeLib.json +40 -9
- package/artifacts/contracts/types/Key32.sol/Key32Lib.dbg.json +1 -1
- package/artifacts/contracts/types/Key32.sol/Key32Lib.json +2 -2
- package/artifacts/contracts/types/NftId.sol/NftIdLib.dbg.json +1 -1
- package/artifacts/contracts/types/NftId.sol/NftIdLib.json +17 -4
- package/artifacts/contracts/types/NftIdSet.sol/LibNftIdSet.dbg.json +1 -1
- package/artifacts/contracts/types/NftIdSet.sol/LibNftIdSet.json +2 -2
- package/artifacts/contracts/types/NumberId.sol/NumberIdLib.dbg.json +1 -1
- package/artifacts/contracts/types/ObjectType.sol/ObjectTypeLib.dbg.json +1 -1
- package/artifacts/contracts/types/ObjectType.sol/ObjectTypeLib.json +2 -2
- package/artifacts/contracts/types/PayoutId.sol/PayoutIdLib.dbg.json +1 -1
- package/artifacts/contracts/types/PayoutId.sol/PayoutIdLib.json +116 -7
- package/artifacts/contracts/types/Referral.sol/ReferralLib.dbg.json +1 -1
- package/artifacts/contracts/types/Referral.sol/ReferralLib.json +23 -4
- package/artifacts/contracts/types/RiskId.sol/RiskIdLib.dbg.json +1 -1
- package/artifacts/contracts/types/RiskId.sol/RiskIdLib.json +2 -2
- package/artifacts/contracts/types/RoleId.sol/RoleIdLib.dbg.json +1 -1
- package/artifacts/contracts/types/RoleId.sol/RoleIdLib.json +2 -2
- package/artifacts/contracts/types/Seconds.sol/SecondsLib.dbg.json +4 -0
- package/artifacts/contracts/types/Seconds.sol/SecondsLib.json +124 -0
- package/artifacts/contracts/types/StateId.sol/StateIdLib.dbg.json +1 -1
- package/artifacts/contracts/types/StateId.sol/StateIdLib.json +2 -2
- package/artifacts/contracts/types/Timestamp.sol/TimestampLib.dbg.json +1 -1
- package/artifacts/contracts/types/Timestamp.sol/TimestampLib.json +38 -7
- package/artifacts/contracts/types/UFixed.sol/MathLib.dbg.json +1 -1
- package/artifacts/contracts/types/UFixed.sol/MathLib.json +2 -2
- package/artifacts/contracts/types/UFixed.sol/UFixedLib.dbg.json +1 -1
- package/artifacts/contracts/types/UFixed.sol/UFixedLib.json +2 -2
- package/artifacts/contracts/types/Version.sol/VersionLib.dbg.json +1 -1
- package/artifacts/contracts/types/Version.sol/VersionLib.json +2 -2
- package/artifacts/contracts/types/Version.sol/VersionPartLib.dbg.json +1 -1
- package/artifacts/contracts/types/Version.sol/VersionPartLib.json +2 -2
- package/contracts/components/Component.sol +99 -87
- package/contracts/components/Distribution.sol +18 -21
- package/contracts/components/IComponent.sol +40 -18
- package/contracts/components/IDistributionComponent.sol +1 -22
- package/contracts/components/IPoolComponent.sol +73 -47
- package/contracts/components/IProductComponent.sol +3 -2
- package/contracts/components/Pool.sol +178 -130
- package/contracts/components/Product.sol +157 -71
- package/contracts/instance/AccessManagerUpgradeableInitializeable.sol +13 -0
- package/contracts/instance/BundleManager.sol +10 -9
- package/contracts/instance/Cloneable.sol +7 -2
- package/contracts/instance/IInstance.sol +37 -27
- package/contracts/instance/IInstanceService.sol +18 -9
- package/contracts/instance/Instance.sol +117 -98
- package/contracts/instance/InstanceAccessManager.sol +388 -158
- package/contracts/instance/InstanceReader.sol +36 -12
- package/contracts/instance/InstanceService.sol +193 -191
- package/contracts/instance/ObjectManager.sol +6 -8
- package/contracts/instance/base/ComponentService.sol +17 -30
- package/contracts/instance/base/KeyValueStore.sol +13 -5
- package/contracts/instance/base/Lifecycle.sol +23 -6
- package/contracts/instance/module/IAccess.sol +21 -14
- package/contracts/instance/module/IBundle.sol +8 -5
- package/contracts/instance/module/IComponents.sol +41 -0
- package/contracts/instance/module/IDistribution.sol +2 -1
- package/contracts/instance/module/IPolicy.sol +37 -7
- package/contracts/instance/module/ISetup.sol +7 -22
- package/contracts/instance/service/ApplicationService.sol +137 -50
- package/contracts/instance/service/BundleService.sol +221 -83
- package/contracts/instance/service/ClaimService.sol +114 -26
- package/contracts/instance/service/DistributionService.sol +174 -118
- package/contracts/instance/service/IApplicationService.sol +9 -13
- package/contracts/instance/service/IBundleService.sol +68 -26
- package/contracts/instance/service/IClaimService.sol +46 -15
- package/contracts/instance/service/IDistributionService.sol +20 -4
- package/contracts/instance/service/IPolicyService.sol +69 -21
- package/contracts/instance/service/IPoolService.sol +82 -3
- package/contracts/instance/service/PolicyService.sol +297 -232
- package/contracts/instance/service/PoolService.sol +214 -20
- package/contracts/instance/service/ProductService.sol +31 -54
- package/contracts/registry/ChainNft.sol +8 -0
- package/contracts/registry/IRegistry.sol +2 -0
- package/contracts/registry/IRegistryService.sol +4 -3
- package/contracts/registry/ITransferInterceptor.sol +1 -0
- package/contracts/registry/Registry.sol +23 -20
- package/contracts/registry/RegistryService.sol +15 -16
- package/contracts/registry/ReleaseManager.sol +20 -18
- package/contracts/shared/IService.sol +4 -6
- package/contracts/shared/Registerable.sol +2 -2
- package/contracts/shared/Service.sol +21 -7
- package/contracts/shared/TokenHandler.sol +11 -5
- package/contracts/test/TestService.sol +1 -1
- package/contracts/types/Amount.sol +65 -0
- package/contracts/types/Blocknumber.sol +1 -0
- package/contracts/types/ClaimId.sol +25 -2
- package/contracts/types/Fee.sol +13 -5
- package/contracts/types/NftId.sol +8 -0
- package/contracts/types/ObjectType.sol +6 -5
- package/contracts/types/PayoutId.sol +33 -5
- package/contracts/types/Referral.sol +4 -0
- package/contracts/types/RoleId.sol +13 -6
- package/contracts/types/Seconds.sol +54 -0
- package/contracts/types/StateId.sol +7 -2
- package/contracts/types/Timestamp.sol +18 -13
- package/contracts/types/UFixed.sol +1 -0
- package/contracts/types/Version.sol +1 -0
- package/package.json +1 -1
@@ -472,8 +472,8 @@
|
|
472
472
|
"type": "function"
|
473
473
|
}
|
474
474
|
],
|
475
|
-
"bytecode": "
|
476
|
-
"deployedBytecode": "
|
475
|
+
"bytecode": "0x610a2a61003a600b82828239805160001a60731461002d57634e487b7160e01b600052600060045260246000fd5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600436106101625760003560e01c80637a858b97116100cd578063bc1b392d11610086578063bc1b392d146102c7578063bdbb4630146102ce578063c8a4ac9c146102d5578063cc8b7b73146102e8578063ea6515c4146102fb578063eb646d711461030e57600080fd5b80637a858b971461025f57806389fa8ed71461027257806393aa872514610287578063a391c15b1461028e578063b4773329146102a1578063b67d77c5146102b457600080fd5b8063313ce5671161011f578063313ce567146101f957806332148d731461020057806344aa68361461021357806345ebb61e14610226578063753b14a514610239578063771602f71461024c57600080fd5b8063059f8b161461016757806308c76ec414610182578063118fc88c146101955780631488c845146101b85780631a12cd47146101cb57806321e5749b146101e6575b600080fd5b61016f610316565b6040519081526020015b60405180910390f35b61016f610190366004610797565b610325565b6101a86101a33660046107cd565b6103ad565b6040519015158152602001610179565b61016f6101c63660046107ef565b6103ba565b6101d3601281565b60405160009190910b8152602001610179565b6101a86101f43660046107cd565b61049c565b601261016f565b6101a861020e3660046107cd565b6104a6565b61016f61022136600461081a565b6104b0565b61016f61023436600461081a565b6104bd565b6101a861024736600461081a565b6104d5565b61016f61025a3660046107cd565b6104de565b6101a861026d36600461081a565b6104ea565b60025b60405160ff9091168152602001610179565b6000610275565b61016f61029c3660046107cd565b6104f4565b6101a86102af3660046107cd565b610500565b61016f6102c23660046107cd565b61050b565b600061016f565b6001610275565b61016f6102e33660046107cd565b610517565b61016f6102f63660046107cd565b610523565b6101a86103093660046107cd565b61052f565b61016f61053a565b6103226012600a61092d565b81565b600060011960ff8316016103745761036d60026103446012600a61092d565b61034e919061094f565b6103589085610971565b60016103666012600a61092d565b6000610552565b90506103a7565b60ff821661038e5761036d8360016103666012600a61092d565b61036d8360016103a06012600a61092d565b6001610552565b92915050565b60008282115b9392505050565b6000806103c8836012610984565b60000b121561041e5760405162461bcd60e51b815260206004820152601f60248201527f4552524f523a464d2d3031303a4558504f4e454e545f544f4f5f534d414c4c0060448201526064015b60405180910390fd5b604061042b836012610984565b60000b131561047c5760405162461bcd60e51b815260206004820152601f60248201527f4552524f523a464d2d3031313a4558504f4e454e545f544f4f5f4c41524745006044820152606401610415565b610487826012610984565b61049290600a6109a5565b6103b390846109b4565b60008282106103b3565b60008183146103b3565b60006103a7826002610325565b60006104cb6012600a61092d565b6103a790836109b4565b600081156103a7565b60006103b383836105af565b60008115156103a7565b60006103b383836105bb565b6000828211156103b3565b60006103b3838361061f565b60006103b3838361067b565b60006103b38383610690565b6000828210156103b3565b60026105486012600a61092d565b610322919061094f565b6000806105608686866106ae565b90506001836002811115610576576105766109cb565b14801561059357506000848061058e5761058e610939565b868809115b156105a6576105a3600182610971565b90505b95945050505050565b60006103b38284610971565b600080821161060c5760405162461bcd60e51b815260206004820152601a60248201527f4552524f523a55464d2d3032303a44495649534f525f5a45524f0000000000006044820152606401610415565b6103b383670de0b6b3a7640000846106ae565b6000828211156106715760405162461bcd60e51b815260206004820152601d60248201527f4552524f523a55464d2d3031303a4e454741544956455f524553554c540000006044820152606401610415565b6103b382846109e1565b60006103b38383670de0b6b3a76400006106ae565b6000828210156106a45761036d838361061f565b6103b3828461061f565b60008080600019858709858702925082811083820303915050806000036106e8578382816106de576106de610939565b04925050506103b3565b80841161072f5760405162461bcd60e51b81526020600482015260156024820152744d6174683a206d756c446976206f766572666c6f7760581b6044820152606401610415565b600084868809600260036001881981018916988990049182028318808302840302808302840302808302840302808302840302808302840302918202909203026000889003889004909101858311909403939093029303949094049190911702949350505050565b600080604083850312156107aa57600080fd5b82359150602083013560ff811681146107c257600080fd5b809150509250929050565b600080604083850312156107e057600080fd5b50508035926020909101359150565b6000806040838503121561080257600080fd5b8235915060208301358060000b81146107c257600080fd5b60006020828403121561082c57600080fd5b5035919050565b634e487b7160e01b600052601160045260246000fd5b600181815b8085111561088457816000190482111561086a5761086a610833565b8085161561087757918102915b93841c939080029061084e565b509250929050565b60008261089b575060016103a7565b816108a8575060006103a7565b81600181146108be57600281146108c8576108e4565b60019150506103a7565b60ff8411156108d9576108d9610833565b50506001821b6103a7565b5060208310610133831016604e8410600b8410161715610907575081810a6103a7565b6109118383610849565b806000190482111561092557610925610833565b029392505050565b60006103b3838361088c565b634e487b7160e01b600052601260045260246000fd5b60008261096c57634e487b7160e01b600052601260045260246000fd5b500490565b808201808211156103a7576103a7610833565b600081810b9083900b01607f8113607f19821217156103a7576103a7610833565b60006103b360ff84168361088c565b80820281158282048414176103a7576103a7610833565b634e487b7160e01b600052602160045260246000fd5b818103818111156103a7576103a761083356fea2646970667358221220bf133d0c138c18bc61ded1b407424a979556fd8b0354b7c8f51b313c2d08fa2264736f6c63430008140033",
|
476
|
+
"deployedBytecode": "0x73000000000000000000000000000000000000000030146080604052600436106101625760003560e01c80637a858b97116100cd578063bc1b392d11610086578063bc1b392d146102c7578063bdbb4630146102ce578063c8a4ac9c146102d5578063cc8b7b73146102e8578063ea6515c4146102fb578063eb646d711461030e57600080fd5b80637a858b971461025f57806389fa8ed71461027257806393aa872514610287578063a391c15b1461028e578063b4773329146102a1578063b67d77c5146102b457600080fd5b8063313ce5671161011f578063313ce567146101f957806332148d731461020057806344aa68361461021357806345ebb61e14610226578063753b14a514610239578063771602f71461024c57600080fd5b8063059f8b161461016757806308c76ec414610182578063118fc88c146101955780631488c845146101b85780631a12cd47146101cb57806321e5749b146101e6575b600080fd5b61016f610316565b6040519081526020015b60405180910390f35b61016f610190366004610797565b610325565b6101a86101a33660046107cd565b6103ad565b6040519015158152602001610179565b61016f6101c63660046107ef565b6103ba565b6101d3601281565b60405160009190910b8152602001610179565b6101a86101f43660046107cd565b61049c565b601261016f565b6101a861020e3660046107cd565b6104a6565b61016f61022136600461081a565b6104b0565b61016f61023436600461081a565b6104bd565b6101a861024736600461081a565b6104d5565b61016f61025a3660046107cd565b6104de565b6101a861026d36600461081a565b6104ea565b60025b60405160ff9091168152602001610179565b6000610275565b61016f61029c3660046107cd565b6104f4565b6101a86102af3660046107cd565b610500565b61016f6102c23660046107cd565b61050b565b600061016f565b6001610275565b61016f6102e33660046107cd565b610517565b61016f6102f63660046107cd565b610523565b6101a86103093660046107cd565b61052f565b61016f61053a565b6103226012600a61092d565b81565b600060011960ff8316016103745761036d60026103446012600a61092d565b61034e919061094f565b6103589085610971565b60016103666012600a61092d565b6000610552565b90506103a7565b60ff821661038e5761036d8360016103666012600a61092d565b61036d8360016103a06012600a61092d565b6001610552565b92915050565b60008282115b9392505050565b6000806103c8836012610984565b60000b121561041e5760405162461bcd60e51b815260206004820152601f60248201527f4552524f523a464d2d3031303a4558504f4e454e545f544f4f5f534d414c4c0060448201526064015b60405180910390fd5b604061042b836012610984565b60000b131561047c5760405162461bcd60e51b815260206004820152601f60248201527f4552524f523a464d2d3031313a4558504f4e454e545f544f4f5f4c41524745006044820152606401610415565b610487826012610984565b61049290600a6109a5565b6103b390846109b4565b60008282106103b3565b60008183146103b3565b60006103a7826002610325565b60006104cb6012600a61092d565b6103a790836109b4565b600081156103a7565b60006103b383836105af565b60008115156103a7565b60006103b383836105bb565b6000828211156103b3565b60006103b3838361061f565b60006103b3838361067b565b60006103b38383610690565b6000828210156103b3565b60026105486012600a61092d565b610322919061094f565b6000806105608686866106ae565b90506001836002811115610576576105766109cb565b14801561059357506000848061058e5761058e610939565b868809115b156105a6576105a3600182610971565b90505b95945050505050565b60006103b38284610971565b600080821161060c5760405162461bcd60e51b815260206004820152601a60248201527f4552524f523a55464d2d3032303a44495649534f525f5a45524f0000000000006044820152606401610415565b6103b383670de0b6b3a7640000846106ae565b6000828211156106715760405162461bcd60e51b815260206004820152601d60248201527f4552524f523a55464d2d3031303a4e454741544956455f524553554c540000006044820152606401610415565b6103b382846109e1565b60006103b38383670de0b6b3a76400006106ae565b6000828210156106a45761036d838361061f565b6103b3828461061f565b60008080600019858709858702925082811083820303915050806000036106e8578382816106de576106de610939565b04925050506103b3565b80841161072f5760405162461bcd60e51b81526020600482015260156024820152744d6174683a206d756c446976206f766572666c6f7760581b6044820152606401610415565b600084868809600260036001881981018916988990049182028318808302840302808302840302808302840302808302840302808302840302918202909203026000889003889004909101858311909403939093029303949094049190911702949350505050565b600080604083850312156107aa57600080fd5b82359150602083013560ff811681146107c257600080fd5b809150509250929050565b600080604083850312156107e057600080fd5b50508035926020909101359150565b6000806040838503121561080257600080fd5b8235915060208301358060000b81146107c257600080fd5b60006020828403121561082c57600080fd5b5035919050565b634e487b7160e01b600052601160045260246000fd5b600181815b8085111561088457816000190482111561086a5761086a610833565b8085161561087757918102915b93841c939080029061084e565b509250929050565b60008261089b575060016103a7565b816108a8575060006103a7565b81600181146108be57600281146108c8576108e4565b60019150506103a7565b60ff8411156108d9576108d9610833565b50506001821b6103a7565b5060208310610133831016604e8410600b8410161715610907575081810a6103a7565b6109118383610849565b806000190482111561092557610925610833565b029392505050565b60006103b3838361088c565b634e487b7160e01b600052601260045260246000fd5b60008261096c57634e487b7160e01b600052601260045260246000fd5b500490565b808201808211156103a7576103a7610833565b600081810b9083900b01607f8113607f19821217156103a7576103a7610833565b60006103b360ff84168361088c565b80820281158282048414176103a7576103a7610833565b634e487b7160e01b600052602160045260246000fd5b818103818111156103a7576103a761083356fea2646970667358221220bf133d0c138c18bc61ded1b407424a979556fd8b0354b7c8f51b313c2d08fa2264736f6c63430008140033",
|
477
477
|
"linkReferences": {},
|
478
478
|
"deployedLinkReferences": {}
|
479
479
|
}
|
@@ -170,8 +170,8 @@
|
|
170
170
|
"type": "function"
|
171
171
|
}
|
172
172
|
],
|
173
|
-
"bytecode": "
|
174
|
-
"deployedBytecode": "
|
173
|
+
"bytecode": "0x61039161003a600b82828239805160001a60731461002d57634e487b7160e01b600052600060045260246000fd5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600436106100925760003560e01c80638e4ad86c116100655780638e4ad86c1461012157806394aa449c14610144578063a123b37c14610152578063c9e66e291461017957600080fd5b806304b8f6c5146100975780632efe0113146100b357806349a7111a146100c657806355601007146100fd575b600080fd5b60005b60405162ffffff90911681526020015b60405180910390f35b61009a6100c136600461026e565b610190565b6100d96100d436600461029a565b610231565b6040805160ff948516815292841660208401529216918101919091526060016100aa565b61011361010b36600461029a565b62ffffff1690565b6040519081526020016100aa565b61013261012f3660046102c6565b90565b60405160ff90911681526020016100aa565b61009a61012f3660046102df565b61016061010b36600461029a565b60405167ffffffffffffffff90911681526020016100aa565b61013261018736600461029a565b60101c60ff1690565b6000610100841080156101a4575061010083105b80156101b1575061010082105b61020c5760405162461bcd60e51b815260206004820152602260248201527f4552524f523a5652532d3031303a56455253494f4e5f504152545f544f4f5f42604482015261494760f01b606482015260840160405180910390fd5b8161021f600885901b601087901b61031f565b610229919061031f565b949350505050565b600080808360ff601082901c166102488383610338565b915061ffff600883901c16600061025f8185610338565b92989197509195509350505050565b60008060006060848603121561028357600080fd5b505081359360208301359350604090920135919050565b6000602082840312156102ac57600080fd5b813562ffffff811681146102bf57600080fd5b9392505050565b6000602082840312156102d857600080fd5b5035919050565b6000602082840312156102f157600080fd5b813567ffffffffffffffff811681146102bf57600080fd5b634e487b7160e01b600052601160045260246000fd5b8082018082111561033257610332610309565b92915050565b62ffffff82811682821603908082111561035457610354610309565b509291505056fea2646970667358221220801f2c14b03a7330f0c0f9dce2a4a4bea8603a2ffbea5bb26b7564e07c0d257564736f6c63430008140033",
|
174
|
+
"deployedBytecode": "0x73000000000000000000000000000000000000000030146080604052600436106100925760003560e01c80638e4ad86c116100655780638e4ad86c1461012157806394aa449c14610144578063a123b37c14610152578063c9e66e291461017957600080fd5b806304b8f6c5146100975780632efe0113146100b357806349a7111a146100c657806355601007146100fd575b600080fd5b60005b60405162ffffff90911681526020015b60405180910390f35b61009a6100c136600461026e565b610190565b6100d96100d436600461029a565b610231565b6040805160ff948516815292841660208401529216918101919091526060016100aa565b61011361010b36600461029a565b62ffffff1690565b6040519081526020016100aa565b61013261012f3660046102c6565b90565b60405160ff90911681526020016100aa565b61009a61012f3660046102df565b61016061010b36600461029a565b60405167ffffffffffffffff90911681526020016100aa565b61013261018736600461029a565b60101c60ff1690565b6000610100841080156101a4575061010083105b80156101b1575061010082105b61020c5760405162461bcd60e51b815260206004820152602260248201527f4552524f523a5652532d3031303a56455253494f4e5f504152545f544f4f5f42604482015261494760f01b606482015260840160405180910390fd5b8161021f600885901b601087901b61031f565b610229919061031f565b949350505050565b600080808360ff601082901c166102488383610338565b915061ffff600883901c16600061025f8185610338565b92989197509195509350505050565b60008060006060848603121561028357600080fd5b505081359360208301359350604090920135919050565b6000602082840312156102ac57600080fd5b813562ffffff811681146102bf57600080fd5b9392505050565b6000602082840312156102d857600080fd5b5035919050565b6000602082840312156102f157600080fd5b813567ffffffffffffffff811681146102bf57600080fd5b634e487b7160e01b600052601160045260246000fd5b8082018082111561033257610332610309565b92915050565b62ffffff82811682821603908082111561035457610354610309565b509291505056fea2646970667358221220801f2c14b03a7330f0c0f9dce2a4a4bea8603a2ffbea5bb26b7564e07c0d257564736f6c63430008140033",
|
175
175
|
"linkReferences": {},
|
176
176
|
"deployedLinkReferences": {}
|
177
177
|
}
|
@@ -42,8 +42,8 @@
|
|
42
42
|
"type": "function"
|
43
43
|
}
|
44
44
|
],
|
45
|
-
"bytecode": "
|
46
|
-
"deployedBytecode": "
|
45
|
+
"bytecode": "0x60fb610039600b82828239805160001a60731461002c57634e487b7160e01b600052600060045260246000fd5b30600052607381538281f3fe7300000000000000000000000000000000000000003014608060405260043610603d5760003560e01c80638e4ad86c146042578063ac43d834146067575b600080fd5b6050604d3660046085565b90565b60405160ff90911681526020015b60405180910390f35b60786072366004609d565b60ff1690565b604051908152602001605e565b600060208284031215609657600080fd5b5035919050565b60006020828403121560ae57600080fd5b813560ff8116811460be57600080fd5b939250505056fea2646970667358221220cdee50fe6c9714f8463d3a3d707ceac1b02f5c17b070c998ecfbac805f95cace64736f6c63430008140033",
|
46
|
+
"deployedBytecode": "0x7300000000000000000000000000000000000000003014608060405260043610603d5760003560e01c80638e4ad86c146042578063ac43d834146067575b600080fd5b6050604d3660046085565b90565b60405160ff90911681526020015b60405180910390f35b60786072366004609d565b60ff1690565b604051908152602001605e565b600060208284031215609657600080fd5b5035919050565b60006020828403121560ae57600080fd5b813560ff8116811460be57600080fd5b939250505056fea2646970667358221220cdee50fe6c9714f8463d3a3d707ceac1b02f5c17b070c998ecfbac805f95cace64736f6c63430008140033",
|
47
47
|
"linkReferences": {},
|
48
48
|
"deployedLinkReferences": {}
|
49
49
|
}
|
@@ -1,11 +1,13 @@
|
|
1
1
|
// SPDX-License-Identifier: Apache-2.0
|
2
2
|
pragma solidity ^0.8.20;
|
3
3
|
|
4
|
-
import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
|
5
|
-
import {IERC20Metadata} from "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol";
|
6
4
|
import {AccessManagedUpgradeable} from "@openzeppelin/contracts-upgradeable/access/manager/AccessManagedUpgradeable.sol";
|
5
|
+
import {IAccessManaged} from "@openzeppelin/contracts/access/manager/IAccessManaged.sol";
|
6
|
+
import {IERC20Metadata} from "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol";
|
7
|
+
import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
|
7
8
|
|
8
9
|
import {IComponent} from "./IComponent.sol";
|
10
|
+
import {IComponents} from "../instance/module/IComponents.sol";
|
9
11
|
import {IProductService} from "../instance/service/IProductService.sol";
|
10
12
|
import {IInstanceService} from "../instance/IInstanceService.sol";
|
11
13
|
import {IInstance} from "../instance/IInstance.sol";
|
@@ -29,21 +31,23 @@ abstract contract Component is
|
|
29
31
|
AccessManagedUpgradeable
|
30
32
|
{
|
31
33
|
// keccak256(abi.encode(uint256(keccak256("gif-next.contracts.component.Component.sol")) - 1)) & ~bytes32(uint256(0xff));
|
32
|
-
bytes32 public constant
|
34
|
+
bytes32 public constant COMPONENT_LOCATION_V1 = 0xffe8d4462baed26a47154f4b8f6db497d2f772496965791d25bd456e342b7f00;
|
33
35
|
|
34
36
|
struct ComponentStorage {
|
35
|
-
IInstance _instance; // instance for this component
|
36
|
-
InstanceReader _instanceReader; // instance reader for this component
|
37
37
|
string _name; // unique (per instance) component name
|
38
38
|
IERC20Metadata _token; // token for this component
|
39
|
+
IInstance _instance; // instance for this component
|
39
40
|
address _wallet; // wallet for this component (default = component contract itself)
|
41
|
+
InstanceReader _instanceReader; // instance reader for this component
|
40
42
|
bool _isNftInterceptor; // declares if component is involved in nft transfers
|
41
|
-
IInstanceService _instanceService; // instance service for this component
|
42
|
-
|
43
43
|
NftId _productNftId; // only relevant for components that are linked to a aproduct
|
44
|
-
IProductService _productService; // product service for component, might not be relevant for some component types (eg oracles)
|
45
44
|
}
|
46
45
|
|
46
|
+
function _getComponentStorage() private pure returns (ComponentStorage storage $) {
|
47
|
+
assembly {
|
48
|
+
$.slot := COMPONENT_LOCATION_V1
|
49
|
+
}
|
50
|
+
}
|
47
51
|
|
48
52
|
modifier onlyChainNft() {
|
49
53
|
if(msg.sender != getRegistry().getChainNftAddress()) {
|
@@ -52,20 +56,6 @@ abstract contract Component is
|
|
52
56
|
_;
|
53
57
|
}
|
54
58
|
|
55
|
-
|
56
|
-
modifier onlyProductService() {
|
57
|
-
if(msg.sender != address(_getComponentStorage()._productService)) {
|
58
|
-
revert ErrorComponentNotProductService(msg.sender);
|
59
|
-
}
|
60
|
-
_;
|
61
|
-
}
|
62
|
-
|
63
|
-
function _getComponentStorage() private pure returns (ComponentStorage storage $) {
|
64
|
-
assembly {
|
65
|
-
$.slot := CONTRACT_LOCATION_V1
|
66
|
-
}
|
67
|
-
}
|
68
|
-
|
69
59
|
function initializeComponent(
|
70
60
|
address registry,
|
71
61
|
NftId instanceNftId,
|
@@ -74,77 +64,45 @@ abstract contract Component is
|
|
74
64
|
ObjectType componentType,
|
75
65
|
bool isInterceptor,
|
76
66
|
address initialOwner,
|
77
|
-
bytes memory data
|
67
|
+
bytes memory registryData // writeonly data that will saved in the object info record of the registry
|
78
68
|
)
|
79
69
|
public
|
80
70
|
virtual
|
81
71
|
onlyInitializing()
|
82
72
|
{
|
83
|
-
|
84
|
-
initializeRegisterable(registry, instanceNftId, componentType, isInterceptor, initialOwner, data);
|
85
|
-
|
86
|
-
// set unique name of component
|
87
|
-
$._name = name;
|
88
|
-
$._isNftInterceptor = isInterceptor;
|
73
|
+
initializeRegisterable(registry, instanceNftId, componentType, isInterceptor, initialOwner, registryData);
|
89
74
|
|
90
75
|
// set and check linked instance
|
91
|
-
|
92
|
-
$._instance = IInstance(
|
76
|
+
ComponentStorage storage $ = _getComponentStorage();
|
77
|
+
$._instance = IInstance(
|
78
|
+
getRegistry().getObjectInfo(instanceNftId).objectAddress);
|
79
|
+
|
93
80
|
if(!$._instance.supportsInterface(type(IInstance).interfaceId)) {
|
94
|
-
revert ErrorComponentNotInstance(instanceNftId
|
81
|
+
revert ErrorComponentNotInstance(instanceNftId);
|
95
82
|
}
|
96
83
|
|
97
84
|
// initialize AccessManagedUpgradeable
|
98
85
|
__AccessManaged_init($._instance.authority());
|
99
86
|
|
100
|
-
// set
|
101
|
-
|
102
|
-
$.
|
87
|
+
// set component state
|
88
|
+
$._name = name;
|
89
|
+
$._isNftInterceptor = isInterceptor;
|
103
90
|
$._instanceReader = $._instance.getInstanceReader();
|
104
|
-
$._productService = IProductService(getRegistry().getServiceAddress(PRODUCT(), gifVersion));
|
105
|
-
|
106
|
-
// set wallet and token
|
107
91
|
$._wallet = address(this);
|
108
92
|
$._token = IERC20Metadata(token);
|
109
93
|
|
94
|
+
registerInterface(type(IAccessManaged).interfaceId);
|
110
95
|
registerInterface(type(IComponent).interfaceId);
|
111
96
|
}
|
112
97
|
|
113
|
-
/// @dev callback function for nft transfers. may only be called by chain nft contract.
|
114
|
-
/// default implementation is empty. overriding functions MUST add onlyChainNft modifier
|
115
|
-
function nftTransferFrom(address from, address to, uint256 tokenId)
|
116
|
-
external
|
117
|
-
virtual override
|
118
|
-
onlyChainNft()
|
119
|
-
{ }
|
120
|
-
|
121
98
|
function lock() external onlyOwner override {
|
122
|
-
|
99
|
+
IInstanceService(_getServiceAddress(INSTANCE())).setComponentLocked(true);
|
123
100
|
}
|
124
101
|
|
125
102
|
function unlock() external onlyOwner override {
|
126
|
-
|
103
|
+
IInstanceService(_getServiceAddress(INSTANCE())).setComponentLocked(false);
|
127
104
|
}
|
128
105
|
|
129
|
-
// only product service may set product nft id during registration of product setup
|
130
|
-
function setProductNftId(NftId productNftId)
|
131
|
-
external
|
132
|
-
override
|
133
|
-
onlyProductService()
|
134
|
-
{
|
135
|
-
ComponentStorage storage $ = _getComponentStorage();
|
136
|
-
|
137
|
-
if($._productNftId.gtz()) {
|
138
|
-
revert ErrorComponentProductNftAlreadySet();
|
139
|
-
}
|
140
|
-
|
141
|
-
$._productNftId = productNftId;
|
142
|
-
}
|
143
|
-
|
144
|
-
/// @dev Sets the wallet address for the component.
|
145
|
-
/// if the current wallet has tokens, these will be transferred.
|
146
|
-
/// if the new wallet address is externally owned, an approval from the
|
147
|
-
/// owner of the external wallet for the component to move all tokens must exist.
|
148
106
|
function setWallet(address newWallet)
|
149
107
|
external
|
150
108
|
override
|
@@ -159,8 +117,9 @@ abstract contract Component is
|
|
159
117
|
if (newWallet == address(0)) {
|
160
118
|
revert ErrorComponentWalletAddressZero();
|
161
119
|
}
|
120
|
+
|
162
121
|
if (newWallet == currentWallet) {
|
163
|
-
revert ErrorComponentWalletAddressIsSameAsCurrent(
|
122
|
+
revert ErrorComponentWalletAddressIsSameAsCurrent();
|
164
123
|
}
|
165
124
|
|
166
125
|
if (currentBalance > 0) {
|
@@ -177,7 +136,7 @@ abstract contract Component is
|
|
177
136
|
|
178
137
|
// effects
|
179
138
|
$._wallet = newWallet;
|
180
|
-
emit LogComponentWalletAddressChanged(newWallet);
|
139
|
+
emit LogComponentWalletAddressChanged(currentWallet, newWallet);
|
181
140
|
|
182
141
|
// interactions
|
183
142
|
if (currentBalance > 0) {
|
@@ -192,11 +151,44 @@ abstract contract Component is
|
|
192
151
|
}
|
193
152
|
}
|
194
153
|
|
195
|
-
function
|
196
|
-
|
197
|
-
view
|
154
|
+
function setProductNftId(NftId productNftId)
|
155
|
+
external
|
198
156
|
override
|
199
|
-
|
157
|
+
{
|
158
|
+
ComponentStorage storage $ = _getComponentStorage();
|
159
|
+
|
160
|
+
// verify caller is product service
|
161
|
+
if(msg.sender != _getServiceAddress(PRODUCT())) {
|
162
|
+
revert ErrorComponentNotProductService(msg.sender);
|
163
|
+
}
|
164
|
+
|
165
|
+
// verify component is not yet linked to a product
|
166
|
+
if($._productNftId.gtz()) {
|
167
|
+
revert ErrorComponentProductNftAlreadySet();
|
168
|
+
}
|
169
|
+
|
170
|
+
$._productNftId = productNftId;
|
171
|
+
}
|
172
|
+
|
173
|
+
function nftMint(address to, uint256 tokenId)
|
174
|
+
external
|
175
|
+
virtual
|
176
|
+
onlyChainNft
|
177
|
+
{}
|
178
|
+
|
179
|
+
/// @dev callback function for nft transfers
|
180
|
+
/// may only be called by chain nft contract.
|
181
|
+
/// do not override this function to implement business logic for handling transfers
|
182
|
+
/// override internal function _nftTransferFrom instead
|
183
|
+
function nftTransferFrom(address from, address to, uint256 tokenId)
|
184
|
+
external
|
185
|
+
virtual
|
186
|
+
onlyChainNft
|
187
|
+
{
|
188
|
+
_nftTransferFrom(from, to, tokenId);
|
189
|
+
}
|
190
|
+
|
191
|
+
function getWallet() public view override returns (address walletAddress)
|
200
192
|
{
|
201
193
|
return _getComponentStorage()._wallet;
|
202
194
|
}
|
@@ -213,15 +205,6 @@ abstract contract Component is
|
|
213
205
|
return _getComponentStorage()._instance;
|
214
206
|
}
|
215
207
|
|
216
|
-
function getInstanceReader() public view returns (InstanceReader reader) {
|
217
|
-
return _getComponentStorage()._instanceReader;
|
218
|
-
}
|
219
|
-
|
220
|
-
function getServiceAddress(ObjectType domain) public view returns (address service) {
|
221
|
-
VersionPart majorVersion = getInstance().getMajorVersion();
|
222
|
-
return getRegistry().getServiceAddress(domain, majorVersion);
|
223
|
-
}
|
224
|
-
|
225
208
|
function getName() public view override returns(string memory name) {
|
226
209
|
return _getComponentStorage()._name;
|
227
210
|
}
|
@@ -230,12 +213,41 @@ abstract contract Component is
|
|
230
213
|
return _getComponentStorage()._productNftId;
|
231
214
|
}
|
232
215
|
|
233
|
-
function
|
234
|
-
|
216
|
+
function getComponentInfo() public view returns (IComponents.ComponentInfo memory info) {
|
217
|
+
info = _getInstanceReader().getComponentInfo(getNftId());
|
218
|
+
|
219
|
+
// fallback to initial info (wallet is always != address(0))
|
220
|
+
if(info.wallet == address(0)) {
|
221
|
+
info = _getInitialInfo();
|
222
|
+
}
|
235
223
|
}
|
236
224
|
|
237
|
-
|
238
|
-
|
225
|
+
/// @dev defines initial component specification
|
226
|
+
/// overwrite this function according to your use case
|
227
|
+
function _getInitialInfo()
|
228
|
+
internal
|
229
|
+
view
|
230
|
+
virtual
|
231
|
+
returns (IComponents.ComponentInfo memory info)
|
232
|
+
{ }
|
233
|
+
|
234
|
+
|
235
|
+
/// @dev internal function for nft transfers.
|
236
|
+
/// handling logic that deals with nft transfers need to overwrite this function
|
237
|
+
function _nftTransferFrom(address from, address to, uint256 tokenId)
|
238
|
+
internal
|
239
|
+
virtual
|
240
|
+
{ }
|
241
|
+
|
242
|
+
/// @dev returns reader for linked instance
|
243
|
+
function _getInstanceReader() internal view returns (InstanceReader reader) {
|
244
|
+
return _getComponentStorage()._instanceReader;
|
239
245
|
}
|
240
246
|
|
241
|
-
|
247
|
+
/// @dev returns the service address for the specified domain
|
248
|
+
/// gets address via lookup from registry using the major version form the linked instance
|
249
|
+
function _getServiceAddress(ObjectType domain) internal view returns (address service) {
|
250
|
+
VersionPart majorVersion = _getComponentStorage()._instance.getMajorVersion();
|
251
|
+
return getRegistry().getServiceAddress(domain, majorVersion);
|
252
|
+
}
|
253
|
+
}
|
@@ -30,37 +30,43 @@ abstract contract Distribution is
|
|
30
30
|
bytes32 public constant DISTRIBUTION_STORAGE_LOCATION_V1 = 0xaab7c5ea03d290056d6c060e0833d3ebcbe647f7694616a2ec52738a64b2f900;
|
31
31
|
|
32
32
|
struct DistributionStorage {
|
33
|
+
Fee _minDistributionOwnerFee;
|
33
34
|
Fee _distributionFee;
|
34
35
|
TokenHandler _tokenHandler;
|
35
36
|
IDistributionService _distributionService;
|
36
37
|
mapping(address distributor => NftId distributorNftId) _distributorNftId;
|
37
38
|
}
|
38
39
|
|
40
|
+
error ErrorDistributionAlreadyDistributor(address distributor, NftId distributorNftId);
|
41
|
+
|
39
42
|
function initializeDistribution(
|
40
43
|
address registry,
|
41
44
|
NftId instanceNftId,
|
42
45
|
string memory name,
|
43
46
|
address token,
|
47
|
+
Fee memory minDistributionOwnerFee,
|
44
48
|
Fee memory distributionFee,
|
45
49
|
address initialOwner,
|
46
|
-
bytes memory data
|
50
|
+
bytes memory registryData // writeonly data that will saved in the object info record of the registry
|
47
51
|
)
|
48
52
|
public
|
49
53
|
virtual
|
50
54
|
onlyInitializing()
|
51
55
|
{
|
52
|
-
initializeComponent(registry, instanceNftId, name, token, DISTRIBUTION(), true, initialOwner,
|
56
|
+
initializeComponent(registry, instanceNftId, name, token, DISTRIBUTION(), true, initialOwner, registryData);
|
53
57
|
|
54
58
|
DistributionStorage storage $ = _getDistributionStorage();
|
55
59
|
// TODO add validation
|
60
|
+
$._minDistributionOwnerFee = minDistributionOwnerFee;
|
56
61
|
$._distributionFee = distributionFee;
|
57
62
|
$._tokenHandler = new TokenHandler(token);
|
58
|
-
$._distributionService =
|
63
|
+
$._distributionService = IDistributionService(_getServiceAddress(DISTRIBUTION()));
|
59
64
|
|
60
65
|
registerInterface(type(IDistributionComponent).interfaceId);
|
61
66
|
}
|
62
67
|
|
63
68
|
function setFees(
|
69
|
+
Fee memory minDistributionOwnerFee,
|
64
70
|
Fee memory distributionFee
|
65
71
|
)
|
66
72
|
external
|
@@ -68,7 +74,7 @@ abstract contract Distribution is
|
|
68
74
|
onlyOwner
|
69
75
|
restricted()
|
70
76
|
{
|
71
|
-
_getDistributionStorage()._distributionService.setFees(distributionFee);
|
77
|
+
_getDistributionStorage()._distributionService.setFees(minDistributionOwnerFee, distributionFee);
|
72
78
|
}
|
73
79
|
|
74
80
|
function getDistributionFee() external view returns (Fee memory distributionFee) {
|
@@ -112,7 +118,9 @@ abstract contract Distribution is
|
|
112
118
|
returns(NftId distributorNftId)
|
113
119
|
{
|
114
120
|
DistributionStorage storage $ = _getDistributionStorage();
|
115
|
-
|
121
|
+
if($._distributorNftId[distributor].gtz()) {
|
122
|
+
revert ErrorDistributionAlreadyDistributor(distributor, $._distributorNftId[distributor]);
|
123
|
+
}
|
116
124
|
|
117
125
|
distributorNftId = $._distributionService.createDistributor(
|
118
126
|
distributor,
|
@@ -190,7 +198,7 @@ abstract contract Distribution is
|
|
190
198
|
)
|
191
199
|
{
|
192
200
|
ReferralId referralId = getReferralId(referralCode);
|
193
|
-
return
|
201
|
+
return _getInstanceReader().getDiscountPercentage(referralId);
|
194
202
|
}
|
195
203
|
|
196
204
|
|
@@ -219,19 +227,6 @@ abstract contract Distribution is
|
|
219
227
|
return 0 * netPremiumAmount;
|
220
228
|
}
|
221
229
|
|
222
|
-
function processSale(
|
223
|
-
ReferralId referralId,
|
224
|
-
uint256 premiumAmount
|
225
|
-
)
|
226
|
-
external
|
227
|
-
onlyOwner
|
228
|
-
restricted()
|
229
|
-
virtual override
|
230
|
-
{
|
231
|
-
DistributionStorage storage $ = _getDistributionStorage();
|
232
|
-
$._distributionService.processSale(referralId, premiumAmount);
|
233
|
-
}
|
234
|
-
|
235
230
|
function processRenewal(
|
236
231
|
ReferralId referralId,
|
237
232
|
uint256 feeAmount
|
@@ -259,13 +254,15 @@ abstract contract Distribution is
|
|
259
254
|
return ISetup.DistributionSetupInfo(
|
260
255
|
zeroNftId(),
|
261
256
|
$._tokenHandler,
|
257
|
+
$._minDistributionOwnerFee,
|
262
258
|
$._distributionFee,
|
263
|
-
address(this)
|
259
|
+
address(this),
|
260
|
+
0
|
264
261
|
);
|
265
262
|
}
|
266
263
|
|
267
264
|
|
268
|
-
function
|
265
|
+
function _nftTransferFrom(address from, address to, uint256 tokenId) internal virtual override {
|
269
266
|
// keep track of distributor nft owner
|
270
267
|
emit LogDistributorUpdated(to, msg.sender);
|
271
268
|
DistributionStorage storage $ = _getDistributionStorage();
|
@@ -1,8 +1,10 @@
|
|
1
1
|
// SPDX-License-Identifier: Apache-2.0
|
2
2
|
pragma solidity ^0.8.20;
|
3
3
|
|
4
|
+
import {IAccessManaged} from "@openzeppelin/contracts/access/manager/IAccessManaged.sol";
|
4
5
|
import {IERC20Metadata} from "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol";
|
5
6
|
|
7
|
+
import {IComponents} from "../instance/module/IComponents.sol";
|
6
8
|
import {IInstance} from "../instance/IInstance.sol";
|
7
9
|
import {IInstanceService} from "../instance/IInstanceService.sol";
|
8
10
|
import {IProductService} from "../instance/service/IProductService.sol";
|
@@ -11,44 +13,64 @@ import {ITransferInterceptor} from "../registry/ITransferInterceptor.sol";
|
|
11
13
|
import {NftId} from "../types/NftId.sol";
|
12
14
|
import {ObjectType} from "../types/ObjectType.sol";
|
13
15
|
|
16
|
+
/// @dev component base class
|
17
|
+
/// component examples are product, distribution, pool and oracle
|
14
18
|
interface IComponent is
|
15
19
|
IRegisterable,
|
16
|
-
ITransferInterceptor
|
20
|
+
ITransferInterceptor,
|
21
|
+
IAccessManaged
|
17
22
|
{
|
18
|
-
|
19
23
|
error ErrorComponentNotChainNft(address caller);
|
20
24
|
error ErrorComponentNotProductService(address caller);
|
21
|
-
error ErrorComponentNotInstance(NftId instanceNftId
|
25
|
+
error ErrorComponentNotInstance(NftId instanceNftId);
|
22
26
|
error ErrorComponentProductNftAlreadySet();
|
27
|
+
|
23
28
|
error ErrorComponentWalletAddressZero();
|
24
|
-
error ErrorComponentWalletAddressIsSameAsCurrent(
|
29
|
+
error ErrorComponentWalletAddressIsSameAsCurrent();
|
25
30
|
error ErrorComponentWalletAllowanceTooSmall(address oldWallet, address newWallet, uint256 allowance, uint256 balance);
|
26
|
-
error ErrorComponentUnauthorized(address caller, uint64 requiredRoleIdNum);
|
27
31
|
|
28
|
-
event LogComponentWalletAddressChanged(address newWallet);
|
32
|
+
event LogComponentWalletAddressChanged(address oldWallet, address newWallet);
|
29
33
|
event LogComponentWalletTokensTransferred(address from, address to, uint256 amount);
|
30
34
|
|
31
|
-
|
32
|
-
|
35
|
+
/// @dev locks component to disable functions that may change state related to this component, the only exception is function "unlock"
|
36
|
+
/// only component owner (nft holder) is authorizes to call this function
|
33
37
|
function lock() external;
|
34
|
-
function unlock() external;
|
35
38
|
|
36
|
-
|
39
|
+
/// @dev unlocks component to (re-)enable functions that may change state related to this component
|
40
|
+
/// only component owner (nft holder) is authorizes to call this function
|
41
|
+
function unlock() external;
|
37
42
|
|
43
|
+
/// @dev sets the wallet address for the component
|
44
|
+
/// if the current wallet has tokens, these will be transferred
|
45
|
+
/// if the new wallet address is externally owned, an approval from the
|
46
|
+
/// owner of the external wallet for the component to move all tokens must exist
|
38
47
|
function setWallet(address walletAddress) external;
|
39
|
-
function getWallet() external view returns (address walletAddress);
|
40
48
|
|
41
|
-
|
49
|
+
/// @dev only product service may set product nft id during registration of product setup
|
50
|
+
function setProductNftId(NftId productNftId) external;
|
51
|
+
|
52
|
+
/// @dev returns the name of this component
|
53
|
+
/// to successfully register the component with an instance the name MUST be unique in the linked instance
|
54
|
+
function getName() external view returns (string memory name);
|
55
|
+
|
56
|
+
/// @dev defines which ERC20 token is used by this component
|
57
|
+
function getToken() external view returns (IERC20Metadata token);
|
42
58
|
|
59
|
+
/// @dev defines the instance to which this component is linked to
|
43
60
|
function getInstance() external view returns (IInstance instance);
|
44
61
|
|
45
|
-
/// @dev
|
46
|
-
///
|
47
|
-
function
|
62
|
+
/// @dev defines the wallet address used to hold the ERC20 tokens related to this component
|
63
|
+
/// the default address is the component token address
|
64
|
+
function getWallet() external view returns (address walletAddress);
|
48
65
|
|
49
|
-
|
66
|
+
/// @dev defines the product to which this component is linked to
|
67
|
+
/// this is only relevant for pool and distribution components
|
50
68
|
function getProductNftId() external view returns (NftId productNftId);
|
51
69
|
|
52
|
-
function
|
53
|
-
|
70
|
+
function isNftInterceptor() external view returns(bool isInterceptor);
|
71
|
+
|
72
|
+
/// @dev returns component infos for this pool
|
73
|
+
/// when registered with an instance the info is obtained from the data stored in the instance
|
74
|
+
/// when not registered the function returns the info from the component contract
|
75
|
+
function getComponentInfo() external view returns (IComponents.ComponentInfo memory info);
|
54
76
|
}
|
@@ -17,6 +17,7 @@ interface IDistributionComponent is IComponent {
|
|
17
17
|
function getSetupInfo() external view returns (ISetup.DistributionSetupInfo memory setupInfo);
|
18
18
|
|
19
19
|
function setFees(
|
20
|
+
Fee memory minDistributionOwnerFee,
|
20
21
|
Fee memory distributionFee
|
21
22
|
) external;
|
22
23
|
|
@@ -44,33 +45,11 @@ interface IDistributionComponent is IComponent {
|
|
44
45
|
bytes memory data
|
45
46
|
) external;
|
46
47
|
|
47
|
-
/**
|
48
|
-
* @dev lets distributors create referral codes.
|
49
|
-
* referral codes need to be unique
|
50
|
-
* distributor is identified via msg.sender.
|
51
|
-
*/
|
52
|
-
function createReferral(
|
53
|
-
NftId distributorNftId,
|
54
|
-
string memory code,
|
55
|
-
UFixed discountPercentage,
|
56
|
-
uint32 maxReferrals,
|
57
|
-
Timestamp expiryAt,
|
58
|
-
bytes memory data
|
59
|
-
) external returns (ReferralId referralId);
|
60
|
-
|
61
48
|
function calculateRenewalFeeAmount(
|
62
49
|
ReferralId referralId,
|
63
50
|
uint256 netPremiumAmount
|
64
51
|
) external view returns (uint256 feeAmount);
|
65
52
|
|
66
|
-
/// @dev callback from product service when selling a policy for a specific referralId
|
67
|
-
/// the used referral id and the collected fee are provided as parameters
|
68
|
-
/// the component implementation can then process this information accordingly
|
69
|
-
function processSale(
|
70
|
-
ReferralId referralId,
|
71
|
-
uint256 feeAmount
|
72
|
-
) external;
|
73
|
-
|
74
53
|
/// @dev callback from product service when a policy is renews for a specific referralId
|
75
54
|
function processRenewal(
|
76
55
|
ReferralId referralId,
|