@etherisc/gif-next 0.0.2-d086e6d-456 → 0.0.2-d1f0662-893
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +6 -88
- package/artifacts/contracts/components/Component.sol/Component.dbg.json +1 -1
- package/artifacts/contracts/components/Component.sol/Component.json +37 -6
- package/artifacts/contracts/components/Distribution.sol/Distribution.dbg.json +1 -1
- package/artifacts/contracts/components/Distribution.sol/Distribution.json +60 -13
- package/artifacts/contracts/components/IComponent.sol/IComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IComponent.sol/IComponent.json +37 -6
- package/artifacts/contracts/components/IDistributionComponent.sol/IDistributionComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IDistributionComponent.sol/IDistributionComponent.json +44 -13
- package/artifacts/contracts/components/IPoolComponent.sol/IPoolComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IPoolComponent.sol/IPoolComponent.json +55 -24
- package/artifacts/contracts/components/IProductComponent.sol/IProductComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IProductComponent.sol/IProductComponent.json +52 -21
- package/artifacts/contracts/components/Pool.sol/Pool.dbg.json +1 -1
- package/artifacts/contracts/components/Pool.sol/Pool.json +55 -24
- package/artifacts/contracts/components/Product.sol/Product.dbg.json +1 -1
- package/artifacts/contracts/components/Product.sol/Product.json +52 -21
- package/artifacts/contracts/instance/BundleManager.sol/BundleManager.dbg.json +1 -1
- package/artifacts/contracts/instance/BundleManager.sol/BundleManager.json +2 -2
- package/artifacts/contracts/instance/Cloneable.sol/Cloneable.dbg.json +1 -1
- package/artifacts/contracts/instance/IInstance.sol/IInstance.dbg.json +1 -1
- package/artifacts/contracts/instance/IInstance.sol/IInstance.json +309 -2023
- package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.dbg.json +1 -1
- package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.json +21 -62
- package/artifacts/contracts/instance/Instance.sol/Instance.dbg.json +1 -1
- package/artifacts/contracts/instance/Instance.sol/Instance.json +424 -2776
- package/artifacts/contracts/instance/InstanceAccessManager.sol/InstanceAccessManager.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceAccessManager.sol/InstanceAccessManager.json +95 -58
- package/artifacts/contracts/instance/InstanceAuthorizationsLib.sol/InstanceAuthorizationsLib.dbg.json +4 -0
- package/artifacts/contracts/instance/InstanceAuthorizationsLib.sol/InstanceAuthorizationsLib.json +124 -0
- package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.json +331 -51
- package/artifacts/contracts/instance/InstanceService.sol/InstanceService.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceService.sol/InstanceService.json +71 -215
- package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.json +38 -83
- package/artifacts/contracts/instance/InstanceStore.sol/InstanceStore.dbg.json +4 -0
- package/artifacts/contracts/instance/InstanceStore.sol/InstanceStore.json +2788 -0
- package/artifacts/contracts/instance/ObjectManager.sol/ObjectManager.dbg.json +1 -1
- package/artifacts/contracts/instance/ObjectManager.sol/ObjectManager.json +2 -2
- package/artifacts/contracts/instance/base/ComponentService.sol/ComponentService.dbg.json +1 -1
- package/artifacts/contracts/instance/base/ComponentService.sol/ComponentService.json +25 -36
- 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 +8 -8
- package/artifacts/contracts/instance/base/Lifecycle.sol/Lifecycle.dbg.json +1 -1
- package/artifacts/contracts/instance/base/Lifecycle.sol/Lifecycle.json +6 -6
- package/artifacts/contracts/instance/module/IAccess.sol/IAccess.dbg.json +1 -1
- package/artifacts/contracts/instance/module/IAccess.sol/IAccess.json +6 -6
- package/artifacts/contracts/instance/module/IBundle.sol/IBundle.dbg.json +1 -1
- package/artifacts/contracts/instance/module/IComponents.sol/IComponents.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/ApplicationService.sol/ApplicationService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/ApplicationService.sol/ApplicationService.json +106 -246
- package/artifacts/contracts/instance/service/ApplicationServiceManager.sol/ApplicationServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/ApplicationServiceManager.sol/ApplicationServiceManager.json +38 -55
- package/artifacts/contracts/instance/service/BundleService.sol/BundleService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/BundleService.sol/BundleService.json +166 -136
- package/artifacts/contracts/instance/service/BundleServiceManager.sol/BundleServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/BundleServiceManager.sol/BundleServiceManager.json +38 -59
- package/artifacts/contracts/instance/service/ClaimService.sol/ClaimService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/ClaimService.sol/ClaimService.json +623 -91
- package/artifacts/contracts/instance/service/ClaimServiceManager.sol/ClaimServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/ClaimServiceManager.sol/ClaimServiceManager.json +143 -32
- package/artifacts/contracts/instance/service/DistributionService.sol/DistributionService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/DistributionService.sol/DistributionService.json +185 -451
- package/artifacts/contracts/instance/service/DistributionServiceManager.sol/DistributionServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/DistributionServiceManager.sol/DistributionServiceManager.json +82 -107
- package/artifacts/contracts/instance/service/IApplicationService.sol/IApplicationService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IApplicationService.sol/IApplicationService.json +38 -191
- package/artifacts/contracts/instance/service/IBundleService.sol/IBundleService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IBundleService.sol/IBundleService.json +97 -45
- package/artifacts/contracts/instance/service/IClaimService.sol/IClaimService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IClaimService.sol/IClaimService.json +306 -62
- package/artifacts/contracts/instance/service/IDistributionService.sol/IDistributionService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IDistributionService.sol/IDistributionService.json +34 -297
- package/artifacts/contracts/instance/service/IPolicyService.sol/IPolicyService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IPolicyService.sol/IPolicyService.json +124 -103
- package/artifacts/contracts/instance/service/IPoolService.sol/IPoolService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IPoolService.sol/IPoolService.json +269 -60
- package/artifacts/contracts/instance/service/IPricingService.sol/IPricingService.dbg.json +4 -0
- package/artifacts/contracts/instance/service/IPricingService.sol/IPricingService.json +510 -0
- package/artifacts/contracts/instance/service/IProductService.sol/IProductService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IProductService.sol/IProductService.json +5 -37
- package/artifacts/contracts/instance/service/PolicyService.sol/PolicyService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/PolicyService.sol/PolicyService.json +332 -162
- package/artifacts/contracts/instance/service/PolicyServiceManager.sol/PolicyServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/PolicyServiceManager.sol/PolicyServiceManager.json +104 -53
- package/artifacts/contracts/instance/service/PoolService.sol/PoolService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/PoolService.sol/PoolService.json +442 -84
- package/artifacts/contracts/instance/service/PoolServiceManager.sol/PoolServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/PoolServiceManager.sol/PoolServiceManager.json +90 -39
- package/artifacts/contracts/instance/service/PricingService.sol/PricingService.dbg.json +4 -0
- package/artifacts/contracts/instance/service/PricingService.sol/PricingService.json +1004 -0
- package/artifacts/contracts/instance/service/PricingServiceManager.sol/PricingServiceManager.dbg.json +4 -0
- package/artifacts/contracts/instance/service/PricingServiceManager.sol/PricingServiceManager.json +688 -0
- package/artifacts/contracts/instance/service/ProductService.sol/ProductService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/ProductService.sol/ProductService.json +56 -59
- package/artifacts/contracts/instance/service/ProductServiceManager.sol/ProductServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/ProductServiceManager.sol/ProductServiceManager.json +28 -37
- package/artifacts/contracts/registry/ChainNft.sol/ChainNft.dbg.json +1 -1
- package/artifacts/contracts/registry/IRegistry.sol/IRegistry.dbg.json +1 -1
- package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.dbg.json +1 -1
- package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.json +5 -37
- 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 +2 -2
- 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 +22 -49
- package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.dbg.json +1 -1
- package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.json +21 -34
- 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 +10 -23
- package/artifacts/contracts/shared/AccessManagerUpgradeableInitializeable.sol/AccessManagerUpgradeableInitializeable.dbg.json +4 -0
- package/artifacts/contracts/{instance → shared}/AccessManagerUpgradeableInitializeable.sol/AccessManagerUpgradeableInitializeable.json +3 -3
- 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/INftOwnable.sol/INftOwnable.json +0 -13
- package/artifacts/contracts/shared/IPolicyHolder.sol/IPolicyHolder.dbg.json +1 -1
- package/artifacts/contracts/shared/IPolicyHolder.sol/IPolicyHolder.json +69 -9
- package/artifacts/contracts/shared/IRegisterable.sol/IRegisterable.dbg.json +1 -1
- package/artifacts/contracts/shared/IRegisterable.sol/IRegisterable.json +0 -13
- package/artifacts/contracts/shared/IRegistryLinked.sol/IRegistryLinked.dbg.json +1 -1
- package/artifacts/contracts/shared/IRegistryLinked.sol/IRegistryLinked.json +0 -13
- package/artifacts/contracts/shared/IService.sol/IService.dbg.json +1 -1
- package/artifacts/contracts/shared/IService.sol/IService.json +5 -37
- 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 +6 -19
- package/artifacts/contracts/shared/PolicyHolder.sol/PolicyHolder.dbg.json +1 -1
- package/artifacts/contracts/shared/PolicyHolder.sol/PolicyHolder.json +80 -26
- package/artifacts/contracts/shared/ProxyManager.sol/ProxyManager.dbg.json +1 -1
- package/artifacts/contracts/shared/ProxyManager.sol/ProxyManager.json +14 -27
- package/artifacts/contracts/shared/Registerable.sol/Registerable.dbg.json +1 -1
- package/artifacts/contracts/shared/Registerable.sol/Registerable.json +6 -19
- package/artifacts/contracts/shared/RegistryLinked.sol/RegistryLinked.dbg.json +1 -1
- package/artifacts/contracts/shared/RegistryLinked.sol/RegistryLinked.json +2 -15
- package/artifacts/contracts/shared/Service.sol/Service.dbg.json +1 -1
- package/artifacts/contracts/shared/Service.sol/Service.json +11 -38
- package/artifacts/contracts/shared/TokenHandler.sol/TokenHandler.dbg.json +1 -1
- package/artifacts/contracts/shared/TokenHandler.sol/TokenHandler.json +24 -6
- package/artifacts/contracts/shared/UpgradableProxyWithAdmin.sol/UpgradableProxyWithAdmin.dbg.json +1 -1
- 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 +6 -19
- 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 +26 -49
- 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/TestVersionable.sol/TestVersionable.dbg.json +1 -1
- 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 +1 -1
- package/artifacts/contracts/types/Amount.sol/AmountLib.json +124 -4
- 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/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 +42 -18
- package/artifacts/contracts/types/Key32.sol/Key32Lib.dbg.json +1 -1
- package/artifacts/contracts/types/Key32.sol/Key32Lib.json +2 -2
- package/artifacts/contracts/types/NftId.sol/NftIdLib.dbg.json +1 -1
- package/artifacts/contracts/types/NftId.sol/NftIdLib.json +2 -2
- package/artifacts/contracts/types/NftIdSet.sol/LibNftIdSet.dbg.json +1 -1
- package/artifacts/contracts/types/NftIdSet.sol/LibNftIdSet.json +2 -2
- package/artifacts/contracts/types/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 +2 -2
- 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 +1 -1
- 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 +17 -4
- 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/VersionPartLib.dbg.json +1 -1
- package/contracts/components/Component.sol +21 -2
- package/contracts/components/Distribution.sol +11 -6
- package/contracts/components/IComponent.sol +16 -2
- package/contracts/components/IPoolComponent.sol +8 -7
- package/contracts/components/IProductComponent.sol +5 -4
- package/contracts/components/Pool.sol +11 -12
- package/contracts/components/Product.sol +144 -62
- package/contracts/instance/BundleManager.sol +3 -4
- package/contracts/instance/IInstance.sol +32 -53
- package/contracts/instance/IInstanceService.sol +15 -14
- package/contracts/instance/Instance.sol +107 -205
- package/contracts/instance/InstanceAccessManager.sol +44 -25
- package/contracts/instance/InstanceAuthorizationsLib.sol +308 -0
- package/contracts/instance/InstanceReader.sol +84 -7
- package/contracts/instance/InstanceService.sol +102 -289
- package/contracts/instance/InstanceStore.sol +212 -0
- package/contracts/instance/ObjectManager.sol +1 -1
- package/contracts/instance/base/ComponentService.sol +53 -41
- package/contracts/instance/base/KeyValueStore.sol +0 -31
- package/contracts/instance/base/Lifecycle.sol +15 -4
- package/contracts/instance/module/IAccess.sol +2 -2
- package/contracts/instance/module/IComponents.sol +3 -3
- package/contracts/instance/module/IDistribution.sol +3 -2
- package/contracts/instance/module/IPolicy.sol +13 -8
- package/contracts/instance/service/ApplicationService.sol +60 -224
- package/contracts/instance/service/BundleService.sol +73 -122
- package/contracts/instance/service/ClaimService.sol +318 -32
- package/contracts/instance/service/DistributionService.sol +64 -151
- package/contracts/instance/service/IApplicationService.sol +8 -28
- package/contracts/instance/service/IBundleService.sol +34 -9
- package/contracts/instance/service/IClaimService.sol +52 -23
- package/contracts/instance/service/IDistributionService.sol +11 -22
- package/contracts/instance/service/IPolicyService.sol +24 -16
- package/contracts/instance/service/IPoolService.sol +18 -3
- package/contracts/instance/service/IPricingService.sol +37 -0
- package/contracts/instance/service/PolicyService.sol +134 -118
- package/contracts/instance/service/PoolService.sol +124 -64
- package/contracts/instance/service/PricingService.sol +275 -0
- package/contracts/instance/service/PricingServiceManager.sol +51 -0
- package/contracts/instance/service/ProductService.sol +14 -14
- package/contracts/registry/IRegistryService.sol +0 -2
- package/contracts/registry/RegistryService.sol +16 -15
- package/contracts/registry/ReleaseManager.sol +20 -18
- package/contracts/shared/IPolicyHolder.sol +23 -9
- package/contracts/shared/IRegistryLinked.sol +0 -1
- package/contracts/shared/IService.sol +3 -6
- package/contracts/shared/NftOwnable.sol +0 -2
- package/contracts/shared/PolicyHolder.sol +30 -17
- package/contracts/shared/Registerable.sol +10 -9
- package/contracts/shared/RegistryLinked.sol +0 -5
- package/contracts/shared/Service.sol +16 -7
- package/contracts/shared/TokenHandler.sol +4 -2
- package/contracts/test/TestService.sol +1 -1
- package/contracts/types/Amount.sol +49 -0
- package/contracts/types/ClaimId.sol +25 -2
- package/contracts/types/Fee.sol +7 -6
- package/contracts/types/ObjectType.sol +9 -5
- package/contracts/types/PayoutId.sol +33 -5
- package/contracts/types/StateId.sol +6 -2
- package/contracts/types/Timestamp.sol +5 -0
- package/package.json +1 -1
- package/artifacts/contracts/instance/AccessManagerUpgradeableInitializeable.sol/AccessManagerUpgradeableInitializeable.dbg.json +0 -4
- /package/contracts/{instance → shared}/AccessManagerUpgradeableInitializeable.sol +0 -0
@@ -3,19 +3,19 @@ pragma solidity ^0.8.20;
|
|
3
3
|
|
4
4
|
import {AccessManagedUpgradeable} from "@openzeppelin/contracts-upgradeable/access/manager/AccessManagedUpgradeable.sol";
|
5
5
|
|
6
|
-
import {Key32
|
6
|
+
import {Key32} from "../types/Key32.sol";
|
7
7
|
import {NftId} from "../types/NftId.sol";
|
8
|
-
import {
|
9
|
-
import {NumberId} from "../types/NumberId.sol";
|
8
|
+
import {RiskId} from "../types/RiskId.sol";
|
10
9
|
import {ObjectType, BUNDLE, DISTRIBUTION, INSTANCE, POLICY, POOL, ROLE, PRODUCT, TARGET, COMPONENT, DISTRIBUTOR, DISTRIBUTOR_TYPE} from "../types/ObjectType.sol";
|
11
|
-
import {
|
12
|
-
import {RoleId, RoleIdLib, INSTANCE_ROLE, INSTANCE_OWNER_ROLE} from "../types/RoleId.sol";
|
13
|
-
import {StateId, ACTIVE} from "../types/StateId.sol";
|
14
|
-
import {TimestampLib} from "../types/Timestamp.sol";
|
10
|
+
import {RoleId, RoleIdLib, eqRoleId, ADMIN_ROLE, INSTANCE_ROLE, INSTANCE_OWNER_ROLE} from "../types/RoleId.sol";
|
15
11
|
import {VersionPart, VersionPartLib} from "../types/Version.sol";
|
12
|
+
import {ClaimId} from "../types/ClaimId.sol";
|
13
|
+
import {ReferralId} from "../types/Referral.sol";
|
14
|
+
import {PayoutId} from "../types/PayoutId.sol";
|
15
|
+
import {DistributorType} from "../types/DistributorType.sol";
|
16
16
|
|
17
|
-
import {ERC165} from "../shared/ERC165.sol";
|
18
17
|
import {Registerable} from "../shared/Registerable.sol";
|
18
|
+
import {TokenHandler} from "../shared/TokenHandler.sol";
|
19
19
|
|
20
20
|
import {IRegistry} from "../registry/IRegistry.sol";
|
21
21
|
|
@@ -23,10 +23,10 @@ import {IInstance} from "./IInstance.sol";
|
|
23
23
|
import {InstanceReader} from "./InstanceReader.sol";
|
24
24
|
import {InstanceAccessManager} from "./InstanceAccessManager.sol";
|
25
25
|
import {BundleManager} from "./BundleManager.sol";
|
26
|
+
import {InstanceStore} from "./InstanceStore.sol";
|
26
27
|
|
27
28
|
import {KeyValueStore} from "./base/KeyValueStore.sol";
|
28
29
|
|
29
|
-
import {IAccess} from "./module/IAccess.sol";
|
30
30
|
import {IBundle} from "./module/IBundle.sol";
|
31
31
|
import {IComponents} from "./module/IComponents.sol";
|
32
32
|
import {IDistribution} from "./module/IDistribution.sol";
|
@@ -39,29 +39,20 @@ import {IPoolService} from "./service/IPoolService.sol";
|
|
39
39
|
import {IProductService} from "./service/IProductService.sol";
|
40
40
|
import {IPolicyService} from "./service/IPolicyService.sol";
|
41
41
|
import {IBundleService} from "./service/IBundleService.sol";
|
42
|
-
import {TokenHandler} from "../shared/TokenHandler.sol";
|
43
|
-
import {VersionPart, VersionPartLib} from "../types/Version.sol";
|
44
42
|
|
45
43
|
contract Instance is
|
46
44
|
IInstance,
|
47
45
|
AccessManagedUpgradeable,
|
48
|
-
Registerable
|
49
|
-
KeyValueStore
|
46
|
+
Registerable
|
50
47
|
{
|
51
|
-
|
52
48
|
uint256 public constant GIF_MAJOR_VERSION = 3;
|
53
49
|
|
54
|
-
uint64 public constant ADMIN_ROLE = type(uint64).min;
|
55
|
-
uint64 public constant PUBLIC_ROLE = type(uint64).max;
|
56
|
-
uint64 public constant CUSTOM_ROLE_ID_MIN = 10000;
|
57
|
-
|
58
|
-
uint32 public constant EXECUTION_DELAY = 0;
|
59
|
-
|
60
50
|
bool private _initialized;
|
61
51
|
|
62
52
|
InstanceAccessManager internal _accessManager;
|
63
53
|
InstanceReader internal _instanceReader;
|
64
54
|
BundleManager internal _bundleManager;
|
55
|
+
InstanceStore internal _instanceStore;
|
65
56
|
|
66
57
|
modifier onlyChainNft() {
|
67
58
|
if(msg.sender != getRegistry().getChainNftAddress()) {
|
@@ -71,206 +62,149 @@ contract Instance is
|
|
71
62
|
}
|
72
63
|
|
73
64
|
function initialize(address authority, address registryAddress, address initialOwner)
|
74
|
-
|
65
|
+
external
|
75
66
|
initializer()
|
76
67
|
{
|
68
|
+
if(authority == address(0)) {
|
69
|
+
revert ErrorInstanceInstanceAccessManagerZero();
|
70
|
+
}
|
71
|
+
|
77
72
|
__AccessManaged_init(authority);
|
78
73
|
|
79
74
|
IRegistry registry = IRegistry(registryAddress);
|
80
75
|
initializeRegisterable(registryAddress, registry.getNftId(), INSTANCE(), true, initialOwner, "");
|
81
|
-
initializeLifecycle();
|
82
76
|
|
83
77
|
registerInterface(type(IInstance).interfaceId);
|
84
78
|
}
|
85
79
|
|
86
|
-
//---
|
87
|
-
function createProductSetup(NftId productNftId, ISetup.ProductSetupInfo memory setup) external restricted() {
|
88
|
-
create(_toNftKey32(productNftId, PRODUCT()), abi.encode(setup));
|
89
|
-
}
|
90
|
-
|
91
|
-
function updateProductSetup(NftId productNftId, ISetup.ProductSetupInfo memory setup, StateId newState) external restricted() {
|
92
|
-
update(_toNftKey32(productNftId, PRODUCT()), abi.encode(setup), newState);
|
93
|
-
}
|
94
|
-
|
95
|
-
function updateProductSetupState(NftId productNftId, StateId newState) external restricted() {
|
96
|
-
updateState(_toNftKey32(productNftId, PRODUCT()), newState);
|
97
|
-
}
|
98
|
-
|
99
|
-
//--- DistributionSetup ------------------------------------------------------//
|
100
|
-
function createDistributionSetup(NftId distributionNftId, ISetup.DistributionSetupInfo memory setup) external restricted() {
|
101
|
-
create(_toNftKey32(distributionNftId, DISTRIBUTION()), abi.encode(setup));
|
102
|
-
}
|
103
|
-
|
104
|
-
function updateDistributionSetup(NftId distributionNftId, ISetup.DistributionSetupInfo memory setup, StateId newState) external restricted() {
|
105
|
-
update(_toNftKey32(distributionNftId, DISTRIBUTION()), abi.encode(setup), newState);
|
106
|
-
}
|
107
|
-
|
108
|
-
function updateDistributionSetupState(NftId distributionNftId, StateId newState) external restricted() {
|
109
|
-
updateState(_toNftKey32(distributionNftId, DISTRIBUTION()), newState);
|
110
|
-
}
|
111
|
-
|
112
|
-
//--- PoolSetup ------------------------------------------------------//
|
113
|
-
function createPoolSetup(NftId poolNftId, IComponents.ComponentInfo memory info) external restricted() {
|
114
|
-
create(_toNftKey32(poolNftId, POOL()), abi.encode(info));
|
115
|
-
}
|
116
|
-
|
117
|
-
function updatePoolSetup(NftId poolNftId, IComponents.ComponentInfo memory info, StateId newState) external restricted() {
|
118
|
-
update(_toNftKey32(poolNftId, POOL()), abi.encode(info), newState);
|
119
|
-
}
|
120
|
-
|
121
|
-
function updatePoolSetupState(NftId poolNftId, StateId newState) external restricted() {
|
122
|
-
updateState(_toNftKey32(poolNftId, POOL()), newState);
|
123
|
-
}
|
124
|
-
|
125
|
-
//--- DistributorType -------------------------------------------------------//
|
126
|
-
function createDistributorType(Key32 distributorKey, IDistribution.DistributorTypeInfo memory info) external restricted() {
|
127
|
-
create(distributorKey, abi.encode(info));
|
128
|
-
}
|
129
|
-
|
130
|
-
function updateDistributorType(Key32 distributorKey, IDistribution.DistributorTypeInfo memory info, StateId newState) external restricted() {
|
131
|
-
update(distributorKey, abi.encode(info), newState);
|
132
|
-
}
|
133
|
-
|
134
|
-
function updateDistributorTypeState(Key32 distributorKey, StateId newState) external restricted() {
|
135
|
-
updateState(distributorKey, newState);
|
136
|
-
}
|
80
|
+
//--- Roles ------------------------------------------------------------//
|
137
81
|
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
update(toDistributorKey32(nftId), abi.encode(info), newState);
|
145
|
-
}
|
146
|
-
|
147
|
-
function updateDistributorState(NftId nftId, StateId newState) external restricted() {
|
148
|
-
updateState(toDistributorKey32(nftId), newState);
|
149
|
-
}
|
150
|
-
|
151
|
-
//--- Referral ----------------------------------------------------------//
|
152
|
-
function createReferral(Key32 referralKey, IDistribution.ReferralInfo memory referralInfo) external restricted() {
|
153
|
-
create(referralKey, abi.encode(referralInfo));
|
154
|
-
}
|
155
|
-
|
156
|
-
function updateReferral(Key32 referralKey, IDistribution.ReferralInfo memory referralInfo, StateId newState) external restricted() {
|
157
|
-
update(referralKey, abi.encode(referralInfo), newState);
|
158
|
-
}
|
159
|
-
|
160
|
-
function updateReferralState(Key32 referralKey, StateId newState) external restricted() {
|
161
|
-
updateState(referralKey, newState);
|
162
|
-
}
|
163
|
-
|
164
|
-
//--- Bundle ------------------------------------------------------------//
|
165
|
-
function createBundle(NftId bundleNftId, IBundle.BundleInfo memory bundle) external restricted() {
|
166
|
-
create(toBundleKey32(bundleNftId), abi.encode(bundle));
|
167
|
-
}
|
168
|
-
|
169
|
-
function updateBundle(NftId bundleNftId, IBundle.BundleInfo memory bundle, StateId newState) external restricted() {
|
170
|
-
update(toBundleKey32(bundleNftId), abi.encode(bundle), newState);
|
171
|
-
}
|
172
|
-
|
173
|
-
function updateBundleState(NftId bundleNftId, StateId newState) external restricted() {
|
174
|
-
updateState(toBundleKey32(bundleNftId), newState);
|
82
|
+
function createRole(string memory roleName, string memory adminName)
|
83
|
+
external
|
84
|
+
restricted // INSTANCE_OWNER_ROLE
|
85
|
+
returns (RoleId roleId, RoleId admin)
|
86
|
+
{
|
87
|
+
(roleId, admin) = _accessManager.createRole(roleName, adminName);
|
175
88
|
}
|
176
89
|
|
177
|
-
|
178
|
-
|
179
|
-
|
90
|
+
function grantRole(RoleId roleId, address account)
|
91
|
+
external
|
92
|
+
restricted // INSTANCE_OWNER_ROLE
|
93
|
+
{
|
94
|
+
_accessManager.grantRole(roleId, account);
|
180
95
|
}
|
181
96
|
|
182
|
-
function
|
183
|
-
|
97
|
+
function revokeRole(RoleId roleId, address account)
|
98
|
+
external
|
99
|
+
restricted // INSTANCE_OWNER_ROLE
|
100
|
+
{
|
101
|
+
_accessManager.revokeRole(roleId, account);
|
184
102
|
}
|
185
103
|
|
186
|
-
|
187
|
-
updateState(riskId.toKey32(), newState);
|
188
|
-
}
|
104
|
+
//--- Targets ------------------------------------------------------------//
|
189
105
|
|
190
|
-
|
191
|
-
|
192
|
-
|
106
|
+
function createTarget(address target, string memory name)
|
107
|
+
external
|
108
|
+
restricted // INSTANCE_OWNER_ROLE
|
109
|
+
{
|
110
|
+
_accessManager.createTarget(target, name);
|
193
111
|
}
|
194
112
|
|
195
|
-
function
|
196
|
-
|
113
|
+
function setTargetFunctionRole(
|
114
|
+
string memory targetName,
|
115
|
+
bytes4[] calldata selectors,
|
116
|
+
RoleId roleId
|
117
|
+
)
|
118
|
+
external
|
119
|
+
restricted // INSTANCE_OWNER_ROLE
|
120
|
+
{
|
121
|
+
_accessManager.setTargetFunctionRole(targetName, selectors, roleId);
|
197
122
|
}
|
198
123
|
|
199
|
-
function
|
200
|
-
|
124
|
+
function setTargetLocked(address target, bool locked)
|
125
|
+
external
|
126
|
+
restricted // INSTANCE_OWNER_ROLE
|
127
|
+
{
|
128
|
+
_accessManager.setTargetLockedByInstance(target, locked);
|
201
129
|
}
|
202
130
|
|
203
|
-
//---
|
204
|
-
function updatePolicy(NftId policyNftId, IPolicy.PolicyInfo memory policy, StateId newState) external restricted() {
|
205
|
-
update(toPolicyKey32(policyNftId), abi.encode(policy), newState);
|
206
|
-
}
|
131
|
+
//--- ITransferInterceptor ------------------------------------------------------------//
|
207
132
|
|
208
|
-
function
|
209
|
-
|
133
|
+
function nftMint(address to, uint256 tokenId) external onlyChainNft {
|
134
|
+
assert(_accessManager.roleMembers(INSTANCE_OWNER_ROLE()) == 0);// temp
|
135
|
+
assert(_accessManager.grantRole(INSTANCE_OWNER_ROLE(), to) == true);
|
210
136
|
}
|
211
137
|
|
212
|
-
|
213
|
-
|
214
|
-
|
138
|
+
function nftTransferFrom(address from, address to, uint256 tokenId) external onlyChainNft {
|
139
|
+
assert(_accessManager.revokeRole(INSTANCE_OWNER_ROLE(), from) == true);
|
140
|
+
assert(_accessManager.grantRole(INSTANCE_OWNER_ROLE(), to) == true);
|
215
141
|
}
|
216
142
|
|
217
|
-
|
218
|
-
update(toPolicyKey32(policyNftId), abi.encode(claim), newState);
|
219
|
-
}
|
143
|
+
//--- initial setup functions -------------------------------------------//
|
220
144
|
|
221
|
-
function
|
222
|
-
|
145
|
+
function setInstanceAccessManager(InstanceAccessManager accessManager) external restricted {
|
146
|
+
if(address(_accessManager) != address(0)) {
|
147
|
+
revert ErrorInstanceInstanceAccessManagerAlreadySet(address(_accessManager));
|
148
|
+
}
|
149
|
+
if(accessManager.authority() != authority()) {
|
150
|
+
revert ErrorInstanceInstanceAccessManagerAuthorityMismatch(authority());
|
151
|
+
}
|
152
|
+
_accessManager = accessManager;
|
223
153
|
}
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
154
|
+
|
155
|
+
function setBundleManager(BundleManager bundleManager) external restricted() {
|
156
|
+
if(address(_bundleManager) != address(0)) {
|
157
|
+
revert ErrorInstanceBundleManagerAlreadySet(address(_bundleManager));
|
158
|
+
}
|
159
|
+
if(bundleManager.getInstance() != Instance(this)) {
|
160
|
+
revert ErrorInstanceBundleManagerInstanceMismatch(address(this));
|
161
|
+
}
|
162
|
+
if(bundleManager.authority() != authority()) {
|
163
|
+
revert ErrorInstanceBundleManagerAuthorityMismatch(authority());
|
164
|
+
}
|
165
|
+
_bundleManager = bundleManager;
|
228
166
|
}
|
229
167
|
|
230
|
-
function
|
231
|
-
|
232
|
-
|
168
|
+
function setInstanceReader(InstanceReader instanceReader) external restricted() {
|
169
|
+
if(instanceReader.getInstance() != Instance(this)) {
|
170
|
+
revert ErrorInstanceInstanceReaderInstanceMismatch(address(this));
|
171
|
+
}
|
233
172
|
|
234
|
-
|
235
|
-
updateState(toPolicyKey32(policyNftId), newState);
|
173
|
+
_instanceReader = instanceReader;
|
236
174
|
}
|
237
175
|
|
238
|
-
//---
|
239
|
-
function nftMint(address to, uint256 tokenId) external onlyChainNft {
|
240
|
-
assert(_accessManager.roleMembers(INSTANCE_OWNER_ROLE()) == 0);// temp
|
241
|
-
assert(_accessManager.grantRole(INSTANCE_OWNER_ROLE(), to) == true);
|
242
|
-
}
|
176
|
+
//--- external view functions -------------------------------------------//
|
243
177
|
|
244
|
-
function
|
245
|
-
|
246
|
-
assert(_accessManager.grantRole(INSTANCE_OWNER_ROLE(), to) == true);
|
178
|
+
function getInstanceReader() external view returns (InstanceReader) {
|
179
|
+
return _instanceReader;
|
247
180
|
}
|
248
181
|
|
249
|
-
|
250
|
-
|
251
|
-
return nftId.toKey32(objectType);
|
182
|
+
function getBundleManager() external view returns (BundleManager) {
|
183
|
+
return _bundleManager;
|
252
184
|
}
|
253
185
|
|
254
|
-
function
|
255
|
-
return
|
186
|
+
function getInstanceAccessManager() external view returns (InstanceAccessManager) {
|
187
|
+
return _accessManager;
|
256
188
|
}
|
257
189
|
|
258
|
-
function
|
259
|
-
|
190
|
+
function setInstanceStore(InstanceStore instanceStore) external restricted {
|
191
|
+
if(address(_instanceStore) != address(0)) {
|
192
|
+
revert ErrorInstanceInstanceStoreAlreadySet(address(_instanceStore));
|
193
|
+
}
|
194
|
+
if(instanceStore.authority() != authority()) {
|
195
|
+
revert ErrorInstanceInstanceStoreAuthorityMismatch(authority());
|
196
|
+
}
|
197
|
+
_instanceStore = instanceStore;
|
260
198
|
}
|
261
199
|
|
262
|
-
function
|
263
|
-
return
|
200
|
+
function getInstanceStore() external view returns (InstanceStore) {
|
201
|
+
return _instanceStore;
|
264
202
|
}
|
265
203
|
|
266
|
-
function
|
267
|
-
return
|
204
|
+
function getMajorVersion() external pure returns (VersionPart majorVersion) {
|
205
|
+
return VersionPartLib.toVersionPart(GIF_MAJOR_VERSION);
|
268
206
|
}
|
269
207
|
|
270
|
-
function toDistributorKey32(NftId distNftId) public pure returns (Key32) {
|
271
|
-
return distNftId.toKey32(DISTRIBUTOR());
|
272
|
-
}
|
273
|
-
|
274
208
|
function getDistributionService() external view returns (IDistributionService) {
|
275
209
|
return IDistributionService(getRegistry().getServiceAddress(DISTRIBUTION(), VersionPart.wrap(3)));
|
276
210
|
}
|
@@ -291,37 +225,5 @@ contract Instance is
|
|
291
225
|
return IBundleService(getRegistry().getServiceAddress(BUNDLE(), VersionPart.wrap(3)));
|
292
226
|
}
|
293
227
|
|
294
|
-
|
295
|
-
|
296
|
-
_instanceReader = instanceReader;
|
297
|
-
}
|
298
|
-
|
299
|
-
function getMajorVersion() external pure returns (VersionPart majorVersion) {
|
300
|
-
return VersionPartLib.toVersionPart(GIF_MAJOR_VERSION);
|
301
|
-
}
|
302
|
-
|
303
|
-
function getInstanceReader() external view returns (InstanceReader) {
|
304
|
-
return _instanceReader;
|
305
|
-
}
|
306
|
-
|
307
|
-
function setBundleManager(BundleManager bundleManager) external restricted() {
|
308
|
-
require(address(_bundleManager) == address(0), "BundleManager is set");
|
309
|
-
require(bundleManager.getInstance() == Instance(this), "BundleManager instance mismatch");
|
310
|
-
require(bundleManager.authority() == authority(), "BundleManager authority mismatch");
|
311
|
-
_bundleManager = bundleManager;
|
312
|
-
}
|
313
|
-
|
314
|
-
function getBundleManager() external view returns (BundleManager) {
|
315
|
-
return _bundleManager;
|
316
|
-
}
|
317
|
-
|
318
|
-
function setInstanceAccessManager(InstanceAccessManager accessManager) external restricted {
|
319
|
-
require(address(_accessManager) == address(0), "InstanceAccessManager is set");
|
320
|
-
require(accessManager.authority() == authority(), "InstanceAccessManager authority mismatch");
|
321
|
-
_accessManager = accessManager;
|
322
|
-
}
|
323
|
-
|
324
|
-
function getInstanceAccessManager() external view returns (InstanceAccessManager) {
|
325
|
-
return _accessManager;
|
326
|
-
}
|
327
|
-
}
|
228
|
+
//--- internal view/pure functions --------------------------------------//
|
229
|
+
}
|
@@ -9,7 +9,7 @@ import {RoleId, RoleIdLib, ADMIN_ROLE, PUBLIC_ROLE, INSTANCE_SERVICE_ROLE, INSTA
|
|
9
9
|
import {TimestampLib} from "../types/Timestamp.sol";
|
10
10
|
import {NftId} from "../types/NftId.sol";
|
11
11
|
|
12
|
-
import {AccessManagerUpgradeableInitializeable} from "
|
12
|
+
import {AccessManagerUpgradeableInitializeable} from "../shared/AccessManagerUpgradeableInitializeable.sol";
|
13
13
|
|
14
14
|
import {IRegistry} from "../registry/IRegistry.sol";
|
15
15
|
|
@@ -73,7 +73,7 @@ contract InstanceAccessManager is
|
|
73
73
|
_createRole(ADMIN_ROLE(), ADMIN_ROLE_NAME, IAccess.Type.Core);
|
74
74
|
_createRole(PUBLIC_ROLE(), PUBLIC_ROLE_NAME, IAccess.Type.Core);
|
75
75
|
_createRole(INSTANCE_ROLE(), INSTANCE_ROLE_NAME, IAccess.Type.Core);
|
76
|
-
_createRole(INSTANCE_OWNER_ROLE(), INSTANCE_OWNER_ROLE_NAME, IAccess.Type.Gif)
|
76
|
+
_createRole(INSTANCE_OWNER_ROLE(), INSTANCE_OWNER_ROLE_NAME, IAccess.Type.Gif);// TODO should be of core type
|
77
77
|
|
78
78
|
// assume `this` is already a member of ADMIN_ROLE
|
79
79
|
EnumerableSet.add(_roleMembers[ADMIN_ROLE()], address(this));
|
@@ -105,6 +105,7 @@ contract InstanceAccessManager is
|
|
105
105
|
}
|
106
106
|
|
107
107
|
// INSTANCE_OWNER_ROLE
|
108
|
+
// TODO specify how many owners role can have -> many roles MUST have exactly 1 member?
|
108
109
|
function createRole(string memory roleName, string memory adminName)
|
109
110
|
external
|
110
111
|
restricted()
|
@@ -142,6 +143,7 @@ contract InstanceAccessManager is
|
|
142
143
|
_roleInfo[roleId].admin = admin;
|
143
144
|
}
|
144
145
|
|
146
|
+
// TODO core role can be granted only to 1 member
|
145
147
|
function grantRole(RoleId roleId, address member)
|
146
148
|
public
|
147
149
|
restrictedToRoleAdmin(roleId)
|
@@ -226,7 +228,7 @@ contract InstanceAccessManager is
|
|
226
228
|
return _roleIds[idx];
|
227
229
|
}
|
228
230
|
|
229
|
-
// TODO
|
231
|
+
// TODO returns ADMIN_ROLE id for non existent name
|
230
232
|
function getRoleIdForName(string memory name) external view returns (RoleId roleId) {
|
231
233
|
return _roleIdForName[ShortStrings.toShortString(name)];
|
232
234
|
}
|
@@ -250,7 +252,7 @@ contract InstanceAccessManager is
|
|
250
252
|
_createTarget(target, name, IAccess.Type.Core);
|
251
253
|
}
|
252
254
|
// INSTANCE_SERVICE_ROLE
|
253
|
-
//
|
255
|
+
// TODO check for instance mismatch?
|
254
256
|
function createGifTarget(address target, string memory name) external restricted()
|
255
257
|
{
|
256
258
|
if(!_registry.isRegistered(target)) {
|
@@ -268,27 +270,23 @@ contract InstanceAccessManager is
|
|
268
270
|
{
|
269
271
|
_createTarget(target, name, IAccess.Type.Custom);
|
270
272
|
}
|
271
|
-
|
272
|
-
//
|
273
|
-
function
|
273
|
+
|
274
|
+
// TODO instance owner locks component instead of revoking it access to the instance...
|
275
|
+
function setTargetLockedByService(address target, bool locked)
|
274
276
|
external
|
275
|
-
restricted
|
277
|
+
restricted // INSTANCE_SERVICE_ROLE
|
276
278
|
{
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
if (target == address(0)) {
|
281
|
-
revert IAccess.ErrorIAccessTargetDoesNotExist(nameShort);
|
282
|
-
}
|
279
|
+
_setTargetLocked(target, locked);
|
280
|
+
}
|
283
281
|
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
_accessManager.setTargetClosed(target, locked);
|
282
|
+
function setTargetLockedByInstance(address target, bool locked)
|
283
|
+
external
|
284
|
+
restricted // INSTANCE_ROLE
|
285
|
+
{
|
286
|
+
_setTargetLocked(target, locked);
|
290
287
|
}
|
291
288
|
|
289
|
+
|
292
290
|
// allowed combinations of roles and targets:
|
293
291
|
//1) set core role for core target
|
294
292
|
//2) set gif role for gif target
|
@@ -314,7 +312,7 @@ contract InstanceAccessManager is
|
|
314
312
|
|
315
313
|
// not custom target
|
316
314
|
if(_targetInfo[target].ttype == IAccess.Type.Custom) {
|
317
|
-
revert IAccess.ErrorIAccessTargetTypeInvalid(
|
315
|
+
revert IAccess.ErrorIAccessTargetTypeInvalid(target, IAccess.Type.Custom);
|
318
316
|
}
|
319
317
|
|
320
318
|
// not custom role
|
@@ -345,7 +343,7 @@ contract InstanceAccessManager is
|
|
345
343
|
|
346
344
|
// not core target
|
347
345
|
if(_targetInfo[target].ttype == IAccess.Type.Core) {
|
348
|
-
revert IAccess.ErrorIAccessTargetTypeInvalid(
|
346
|
+
revert IAccess.ErrorIAccessTargetTypeInvalid(target, IAccess.Type.Core);
|
349
347
|
}
|
350
348
|
|
351
349
|
// not core role
|
@@ -356,8 +354,13 @@ contract InstanceAccessManager is
|
|
356
354
|
_setTargetFunctionRole(target, nameShort, selectors, roleId);
|
357
355
|
}
|
358
356
|
|
357
|
+
function getTargetAddress(string memory targetName) public view returns(address targetAddress) {
|
358
|
+
ShortString nameShort = ShortStrings.toShortString(targetName);
|
359
|
+
return _targetAddressForName[nameShort];
|
360
|
+
}
|
361
|
+
|
359
362
|
function isTargetLocked(address target) public view returns (bool locked) {
|
360
|
-
return
|
363
|
+
return _targetInfo[target].isLocked;
|
361
364
|
}
|
362
365
|
|
363
366
|
function targetExists(address target) public view returns (bool exists) {
|
@@ -492,6 +495,22 @@ contract InstanceAccessManager is
|
|
492
495
|
}
|
493
496
|
}
|
494
497
|
|
498
|
+
// IMPORTANT: instance access manager MUST be of Core type -> otherwise can be locked forever
|
499
|
+
function _setTargetLocked(address target, bool locked) internal
|
500
|
+
{
|
501
|
+
IAccess.Type targetType = _targetInfo[target].ttype;
|
502
|
+
if(target == address(0) || targetType == IAccess.Type.NotInitialized) {
|
503
|
+
revert IAccess.ErrorIAccessTargetDoesNotExist(target);
|
504
|
+
}
|
505
|
+
|
506
|
+
if(targetType == IAccess.Type.Core) {
|
507
|
+
revert IAccess.ErrorIAccessTargetTypeInvalid(target, targetType);
|
508
|
+
}
|
509
|
+
|
510
|
+
_targetInfo[target].isLocked = locked;
|
511
|
+
_accessManager.setTargetClosed(target, locked);
|
512
|
+
}
|
513
|
+
|
495
514
|
function _setTargetFunctionRole(
|
496
515
|
address target,
|
497
516
|
ShortString name,
|
@@ -501,7 +520,7 @@ contract InstanceAccessManager is
|
|
501
520
|
internal
|
502
521
|
{
|
503
522
|
if (target == address(0)) {
|
504
|
-
revert IAccess.ErrorIAccessTargetDoesNotExist(
|
523
|
+
revert IAccess.ErrorIAccessTargetDoesNotExist(target);
|
505
524
|
}
|
506
525
|
|
507
526
|
if (!roleExists(roleId)) {
|
@@ -519,4 +538,4 @@ contract InstanceAccessManager is
|
|
519
538
|
) public view virtual returns (bool immediate, uint32 delay) {
|
520
539
|
return _accessManager.canCall(caller, target, selector);
|
521
540
|
}
|
522
|
-
}
|
541
|
+
}
|