@etherisc/gif-next 0.0.2-e37834a-021 → 0.0.2-e46206a-486
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +104 -1
- package/artifacts/contracts/components/BaseComponent.sol/BaseComponent.dbg.json +1 -1
- package/artifacts/contracts/components/BaseComponent.sol/BaseComponent.json +90 -2
- package/artifacts/contracts/components/Distribution.sol/Distribution.dbg.json +1 -1
- package/artifacts/contracts/components/Distribution.sol/Distribution.json +118 -6
- package/artifacts/contracts/components/IBaseComponent.sol/IBaseComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IBaseComponent.sol/IBaseComponent.json +80 -3
- package/artifacts/contracts/components/IDistributionComponent.sol/IDistributionComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IPoolComponent.sol/IPoolComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IProductComponent.sol/IProductComponent.dbg.json +1 -1
- package/artifacts/contracts/components/Pool.sol/Pool.dbg.json +1 -1
- package/artifacts/contracts/components/Pool.sol/Pool.json +120 -6
- package/artifacts/contracts/components/Product.sol/Product.dbg.json +1 -1
- package/artifacts/contracts/components/Product.sol/Product.json +118 -6
- package/artifacts/contracts/experiment/cloning/Cloner.sol/Cloner.dbg.json +4 -0
- package/artifacts/contracts/experiment/cloning/Cloner.sol/Cloner.json +66 -0
- package/artifacts/contracts/experiment/cloning/Cloner.sol/Mock1.dbg.json +4 -0
- package/artifacts/contracts/experiment/cloning/Cloner.sol/Mock1.json +24 -0
- package/artifacts/contracts/experiment/cloning/Cloner.sol/Mock2.dbg.json +4 -0
- package/artifacts/contracts/experiment/cloning/Cloner.sol/Mock2.json +42 -0
- package/artifacts/contracts/experiment/errors/Require.sol/Require.dbg.json +1 -1
- package/artifacts/contracts/experiment/errors/Revert.sol/Revert.dbg.json +1 -1
- package/artifacts/contracts/experiment/inheritance/A.sol/A.dbg.json +1 -1
- package/artifacts/contracts/experiment/inheritance/A.sol/AShared.dbg.json +1 -1
- package/artifacts/contracts/experiment/inheritance/B.sol/B.dbg.json +1 -1
- package/artifacts/contracts/experiment/inheritance/C.sol/C.dbg.json +1 -1
- package/artifacts/contracts/experiment/inheritance/IA.sol/IA.dbg.json +1 -1
- package/artifacts/contracts/experiment/inheritance/IA.sol/ISharedA.dbg.json +1 -1
- package/artifacts/contracts/experiment/inheritance/IB.sol/IB.dbg.json +1 -1
- package/artifacts/contracts/experiment/inheritance/IC.sol/IC.dbg.json +1 -1
- package/artifacts/contracts/experiment/statemachine/Dummy.sol/LifeCycleModule.dbg.json +1 -1
- package/artifacts/contracts/experiment/statemachine/Dummy.sol/LifeCycleModule.json +2 -2
- package/artifacts/contracts/experiment/statemachine/ISM.sol/ISM.dbg.json +1 -1
- package/artifacts/contracts/experiment/statemachine/ISM.sol/ISMEE.dbg.json +1 -1
- package/artifacts/contracts/experiment/statemachine/SM.sol/SM.dbg.json +1 -1
- package/artifacts/contracts/experiment/statemachine/SM.sol/SM.json +2 -2
- package/artifacts/contracts/experiment/statemachine/SimpleStateMachine.sol/SimpleStateMachine.dbg.json +1 -1
- package/artifacts/contracts/experiment/statemachine/SimpleStateMachine.sol/SimpleStateMachine.json +2 -2
- package/artifacts/contracts/experiment/types/TypeA.sol/TypeALib.dbg.json +1 -1
- package/artifacts/contracts/experiment/types/TypeB.sol/TypeBLib.dbg.json +1 -1
- package/artifacts/contracts/instance/IInstance.sol/IInstance.dbg.json +1 -1
- package/artifacts/contracts/instance/IInstance.sol/IInstance.json +54 -286
- package/artifacts/contracts/instance/IInstanceLinked.sol/IInstanceLinked.dbg.json +1 -1
- package/artifacts/contracts/instance/Instance.sol/Instance.dbg.json +1 -1
- package/artifacts/contracts/instance/Instance.sol/Instance.json +171 -396
- package/artifacts/contracts/instance/base/ComponentServiceBase.sol/ComponentServiceBase.dbg.json +1 -1
- package/artifacts/contracts/instance/base/ComponentServiceBase.sol/ComponentServiceBase.json +90 -2
- package/artifacts/contracts/instance/base/IInstanceBase.sol/IInstanceBase.dbg.json +1 -1
- 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/IService.sol/IService.dbg.json +1 -1
- package/artifacts/contracts/instance/base/IService.sol/IService.json +80 -3
- package/artifacts/contracts/instance/base/InstanceBase.sol/InstanceBase.dbg.json +1 -1
- package/artifacts/contracts/instance/base/InstanceBase.sol/InstanceBase.json +90 -2
- package/artifacts/contracts/instance/base/KeyValueStore.sol/KeyValueStore.dbg.json +1 -1
- package/artifacts/contracts/instance/base/KeyValueStore.sol/KeyValueStore.json +22 -14
- package/artifacts/contracts/instance/base/Lifecycle.sol/Lifecycle.dbg.json +1 -1
- package/artifacts/contracts/instance/base/Lifecycle.sol/Lifecycle.json +2 -2
- package/artifacts/contracts/instance/base/ModuleBase.sol/ModuleBase.dbg.json +1 -1
- package/artifacts/contracts/instance/base/ServiceBase.sol/ServiceBase.dbg.json +1 -1
- package/artifacts/contracts/instance/base/ServiceBase.sol/ServiceBase.json +90 -2
- package/artifacts/contracts/instance/module/bundle/BundleModule.sol/BundleModule.dbg.json +1 -1
- package/artifacts/contracts/instance/module/bundle/IBundle.sol/IBundle.dbg.json +1 -1
- package/artifacts/contracts/instance/module/bundle/IBundle.sol/IBundleModule.dbg.json +1 -1
- package/artifacts/contracts/instance/module/component/ComponentModule.sol/ComponentModule.dbg.json +1 -1
- package/artifacts/contracts/instance/module/component/IComponent.sol/IComponent.dbg.json +1 -1
- package/artifacts/contracts/instance/module/component/IComponent.sol/IComponentModule.dbg.json +1 -1
- package/artifacts/contracts/instance/module/distribution/DistributionModule.sol/DistributionModule.dbg.json +1 -1
- package/artifacts/contracts/instance/module/distribution/DistributionModule.sol/DistributionModule.json +2 -2
- package/artifacts/contracts/instance/module/distribution/IDistribution.sol/IDistribution.dbg.json +1 -1
- package/artifacts/contracts/instance/module/distribution/IDistribution.sol/IDistributionModule.dbg.json +1 -1
- package/artifacts/contracts/instance/module/policy/IPolicy.sol/IPolicy.dbg.json +1 -1
- package/artifacts/contracts/instance/module/policy/IPolicy.sol/IPolicyModule.dbg.json +1 -1
- package/artifacts/contracts/instance/module/policy/IPolicy.sol/IPolicyModule.json +0 -13
- package/artifacts/contracts/instance/module/policy/PolicyModule.sol/PolicyModule.dbg.json +1 -1
- package/artifacts/contracts/instance/module/policy/PolicyModule.sol/PolicyModule.json +0 -13
- package/artifacts/contracts/instance/module/pool/IPoolModule.sol/IPool.dbg.json +1 -1
- package/artifacts/contracts/instance/module/pool/IPoolModule.sol/IPoolModule.dbg.json +1 -1
- package/artifacts/contracts/instance/module/pool/PoolModule.sol/PoolModule.dbg.json +1 -1
- package/artifacts/contracts/instance/module/risk/IRisk.sol/IRisk.dbg.json +1 -1
- package/artifacts/contracts/instance/module/risk/IRisk.sol/IRiskModule.dbg.json +1 -1
- package/artifacts/contracts/instance/module/risk/RiskModule.sol/RiskModule.dbg.json +1 -1
- package/artifacts/contracts/instance/module/risk/RiskModule.sol/RiskModule.json +2 -2
- package/artifacts/contracts/instance/module/treasury/ITreasury.sol/ITreasury.dbg.json +1 -1
- package/artifacts/contracts/instance/module/treasury/ITreasury.sol/ITreasuryModule.dbg.json +1 -1
- package/artifacts/contracts/instance/module/treasury/TokenHandler.sol/TokenHandler.dbg.json +1 -1
- package/artifacts/contracts/instance/module/treasury/TokenHandler.sol/TokenHandler.json +2 -2
- package/artifacts/contracts/instance/module/treasury/TreasuryModule.sol/TreasuryModule.dbg.json +1 -1
- package/artifacts/contracts/instance/service/ComponentOwnerService.sol/ComponentOwnerService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/ComponentOwnerService.sol/ComponentOwnerService.json +194 -41
- package/artifacts/contracts/instance/service/DistributionService.sol/DistributionService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/DistributionService.sol/DistributionService.json +136 -16
- package/artifacts/contracts/instance/service/IComponentOwnerService.sol/IComponentOwnerService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IComponentOwnerService.sol/IComponentOwnerService.json +81 -4
- package/artifacts/contracts/instance/service/IDistributionService.sol/IDistributionService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IDistributionService.sol/IDistributionService.json +80 -3
- package/artifacts/contracts/instance/service/IPoolService.sol/IPoolService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IPoolService.sol/IPoolService.json +80 -3
- package/artifacts/contracts/instance/service/IProductService.sol/IProductService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IProductService.sol/IProductService.json +80 -3
- package/artifacts/contracts/instance/service/PoolService.sol/PoolService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/PoolService.sol/PoolService.json +138 -18
- package/artifacts/contracts/instance/service/ProductService.sol/ProductService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/ProductService.sol/ProductService.json +154 -42
- package/artifacts/contracts/registry/ChainNft.sol/ChainNft.dbg.json +1 -1
- package/artifacts/contracts/registry/ChainNft.sol/ChainNft.json +47 -2
- package/artifacts/contracts/registry/IRegistry.sol/IRegistry.dbg.json +1 -1
- package/artifacts/contracts/registry/IRegistry.sol/IRegistry.json +42 -156
- package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.dbg.json +1 -1
- package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.json +214 -10
- 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 +62 -184
- package/artifacts/contracts/registry/RegistryService.sol/RegistryService.dbg.json +1 -1
- package/artifacts/contracts/registry/RegistryService.sol/RegistryService.json +410 -34
- package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.dbg.json +1 -1
- package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.json +86 -42
- package/artifacts/contracts/shared/ContractDeployerLib.sol/ContractDeployerLib.dbg.json +1 -1
- package/artifacts/contracts/shared/ERC165.sol/ERC165.dbg.json +1 -1
- package/artifacts/contracts/shared/ERC165.sol/ERC165.json +2 -2
- package/artifacts/contracts/shared/INftOwnable.sol/INftOwnable.dbg.json +4 -0
- package/artifacts/contracts/shared/INftOwnable.sol/INftOwnable.json +127 -0
- package/artifacts/contracts/shared/IRegisterable.sol/IRegisterable.dbg.json +1 -1
- package/artifacts/contracts/shared/IRegisterable.sol/IRegisterable.json +80 -3
- 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 +32 -6
- package/artifacts/contracts/shared/ProxyManager.sol/ProxyManager.dbg.json +1 -1
- package/artifacts/contracts/shared/ProxyManager.sol/ProxyManager.json +21 -16
- package/artifacts/contracts/shared/Registerable.sol/Registerable.dbg.json +1 -1
- package/artifacts/contracts/shared/Registerable.sol/Registerable.json +120 -6
- 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/TestDistribution.sol/TestDistribution.dbg.json +1 -1
- package/artifacts/contracts/test/TestDistribution.sol/TestDistribution.json +118 -6
- package/artifacts/contracts/test/TestFee.sol/TestFee.dbg.json +1 -1
- package/artifacts/contracts/test/TestFee.sol/TestFee.json +4 -4
- package/artifacts/contracts/test/TestPool.sol/TestPool.dbg.json +1 -1
- package/artifacts/contracts/test/TestPool.sol/TestPool.json +120 -6
- package/artifacts/contracts/test/TestProduct.sol/TestProduct.dbg.json +1 -1
- package/artifacts/contracts/test/TestProduct.sol/TestProduct.json +120 -8
- package/artifacts/contracts/test/TestRegisterable.sol/TestRegisterable.dbg.json +1 -1
- package/artifacts/contracts/test/TestRegisterable.sol/TestRegisterable.json +120 -6
- package/artifacts/contracts/test/TestRoleId.sol/TestRoleId.dbg.json +1 -1
- package/artifacts/contracts/test/TestRoleId.sol/TestRoleId.json +14 -14
- package/artifacts/contracts/test/TestService.sol/TestService.dbg.json +1 -1
- package/artifacts/contracts/test/TestService.sol/TestService.json +142 -14
- package/artifacts/contracts/test/TestToken.sol/TestUsdc.dbg.json +1 -1
- package/artifacts/contracts/test/TestToken.sol/TestUsdc.json +91 -53
- package/artifacts/contracts/test/TestVersion.sol/TestVersion.dbg.json +1 -1
- package/artifacts/contracts/test/TestVersionable.sol/TestVersionable.dbg.json +1 -1
- package/artifacts/contracts/test/TestVersionable.sol/TestVersionable.json +18 -2
- package/artifacts/contracts/test/Usdc.sol/USDC.dbg.json +1 -1
- package/artifacts/contracts/test/Usdc.sol/USDC.json +91 -53
- package/artifacts/contracts/types/AddressSet.sol/LibAddressSet.dbg.json +1 -1
- package/artifacts/contracts/types/Blocknumber.sol/BlocknumberLib.dbg.json +1 -1
- package/artifacts/contracts/types/ChainId.sol/ChainIdLib.dbg.json +1 -1
- package/artifacts/contracts/types/DistributorType.sol/DistributorTypeLib.dbg.json +4 -0
- package/artifacts/contracts/types/DistributorType.sol/DistributorTypeLib.json +104 -0
- package/artifacts/contracts/types/Fee.sol/FeeLib.dbg.json +1 -1
- package/artifacts/contracts/types/Fee.sol/FeeLib.json +4 -4
- package/artifacts/contracts/types/Key32.sol/Key32Lib.dbg.json +1 -1
- package/artifacts/contracts/types/Key32.sol/Key32Lib.json +31 -17
- 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 +4 -0
- package/artifacts/contracts/types/NumberId.sol/NumberIdLib.json +100 -0
- 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/Referral.sol/ReferralLib.dbg.json +4 -0
- package/artifacts/contracts/types/Referral.sol/ReferralLib.json +123 -0
- 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 +134 -8
- 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 +15 -2
- package/artifacts/contracts/types/UFixed.sol/MathLib.dbg.json +4 -0
- package/artifacts/contracts/types/UFixed.sol/MathLib.json +10 -0
- package/artifacts/contracts/types/UFixed.sol/UFixedLib.dbg.json +4 -0
- package/artifacts/contracts/types/UFixed.sol/{UFixedMathLib.json → UFixedLib.json} +3 -3
- package/artifacts/contracts/types/Version.sol/VersionLib.dbg.json +1 -1
- package/artifacts/contracts/types/Version.sol/VersionPartLib.dbg.json +1 -1
- package/contracts/components/BaseComponent.sol +1 -1
- package/contracts/components/Distribution.sol +1 -1
- package/contracts/components/IBaseComponent.sol +1 -1
- package/contracts/components/IDistributionComponent.sol +1 -1
- package/contracts/components/IProductComponent.sol +1 -1
- package/contracts/components/Product.sol +2 -2
- package/contracts/experiment/cloning/Cloner.sol +47 -0
- package/contracts/instance/IInstance.sol +4 -6
- package/contracts/instance/Instance.sol +4 -6
- package/contracts/instance/base/KeyValueStore.sol +3 -2
- package/contracts/instance/base/ModuleBase.sol +1 -1
- package/contracts/instance/base/ServiceBase.sol +1 -0
- package/contracts/instance/module/bundle/BundleModule.sol +2 -2
- package/contracts/instance/module/component/ComponentModule.sol +1 -1
- package/contracts/instance/module/component/IComponent.sol +1 -1
- package/contracts/instance/module/policy/IPolicy.sol +2 -2
- package/contracts/instance/module/policy/PolicyModule.sol +2 -2
- package/contracts/instance/module/treasury/ITreasury.sol +1 -1
- package/contracts/instance/module/treasury/TokenHandler.sol +1 -1
- package/contracts/instance/module/treasury/TreasuryModule.sol +4 -4
- package/contracts/instance/service/ComponentOwnerService.sol +73 -30
- package/contracts/instance/service/IProductService.sol +1 -1
- package/contracts/instance/service/ProductService.sol +3 -3
- package/contracts/registry/ChainNft.sol +40 -25
- package/contracts/registry/IRegistry.sol +9 -25
- package/contracts/registry/IRegistryService.sol +9 -3
- package/contracts/registry/Registry.sol +90 -157
- package/contracts/registry/RegistryService.sol +167 -101
- package/contracts/registry/RegistryServiceManager.sol +22 -10
- package/contracts/shared/ERC165.sol +1 -1
- package/contracts/shared/INftOwnable.sol +22 -0
- package/contracts/shared/IRegisterable.sol +3 -8
- package/contracts/shared/NftOwnable.sol +83 -34
- package/contracts/shared/ProxyManager.sol +3 -12
- package/contracts/shared/Registerable.sol +14 -42
- package/contracts/shared/UpgradableProxyWithAdmin.sol +2 -2
- package/contracts/shared/Versionable.sol +3 -3
- package/contracts/test/TestFee.sol +2 -2
- package/contracts/test/TestProduct.sol +2 -2
- package/contracts/test/TestRoleId.sol +1 -1
- package/contracts/types/DistributorType.sol +55 -0
- package/contracts/types/Fee.sol +3 -3
- package/contracts/types/Key32.sol +8 -3
- package/contracts/types/NumberId.sol +52 -0
- package/contracts/types/ObjectType.sol +35 -14
- package/contracts/types/Referral.sol +85 -0
- package/contracts/types/RoleId.sol +53 -9
- package/contracts/types/StateId.sol +1 -1
- package/contracts/types/Timestamp.sol +7 -3
- package/contracts/types/UFixed.sol +128 -12
- package/package.json +4 -3
- package/artifacts/contracts/instance/module/access/Access.sol/AccessModule.dbg.json +0 -4
- package/artifacts/contracts/instance/module/access/Access.sol/AccessModule.json +0 -333
- package/artifacts/contracts/instance/module/access/IAccess.sol/IAccess.dbg.json +0 -4
- package/artifacts/contracts/instance/module/access/IAccess.sol/IAccess.json +0 -10
- package/artifacts/contracts/instance/module/access/IAccess.sol/IAccessModule.dbg.json +0 -4
- package/artifacts/contracts/instance/module/access/IAccess.sol/IAccessModule.json +0 -333
- package/artifacts/contracts/registry/IChainNft.sol/IChainNft.dbg.json +0 -4
- package/artifacts/contracts/registry/IChainNft.sol/IChainNft.json +0 -457
- package/artifacts/contracts/shared/IOwnable.sol/IOwnable.dbg.json +0 -4
- package/artifacts/contracts/shared/IOwnable.sol/IOwnable.json +0 -24
- package/artifacts/contracts/types/ReferralId.sol/ReferralIdLib.dbg.json +0 -4
- package/artifacts/contracts/types/ReferralId.sol/ReferralIdLib.json +0 -99
- package/artifacts/contracts/types/UFixed.sol/UFixedMathLib.dbg.json +0 -4
- package/contracts/instance/module/access/Access.sol +0 -149
- package/contracts/instance/module/access/IAccess.sol +0 -53
- package/contracts/registry/IChainNft.sol +0 -22
- package/contracts/shared/IOwnable.sol +0 -6
- package/contracts/types/ReferralId.sol +0 -48
@@ -1,149 +0,0 @@
|
|
1
|
-
// SPDX-License-Identifier: Apache-2.0
|
2
|
-
pragma solidity ^0.8.19;
|
3
|
-
|
4
|
-
// role admin handling of oz doesn't fit nft ownability
|
5
|
-
// import {AccessControlEnumerable} from "@openzeppelin/contracts/access/AccessControlEnumerable.sol";
|
6
|
-
import "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";
|
7
|
-
|
8
|
-
import {RoleId, RoleIdLib} from "../../../types/RoleId.sol";
|
9
|
-
import {DISTRIBUTION_OWNER_ROLE, ORACLE_OWNER_ROLE, POOL_OWNER_ROLE, PRODUCT_OWNER_ROLE} from "../../../types/RoleId.sol";
|
10
|
-
import {DISTRIBUTION_OWNER_ROLE_NAME, ORACLE_OWNER_ROLE_NAME, POOL_OWNER_ROLE_NAME, PRODUCT_OWNER_ROLE_NAME} from "../../../types/RoleId.sol";
|
11
|
-
import {IAccessModule} from "./IAccess.sol";
|
12
|
-
|
13
|
-
abstract contract AccessModule is IAccessModule {
|
14
|
-
|
15
|
-
using EnumerableSet for EnumerableSet.AddressSet;
|
16
|
-
|
17
|
-
mapping(RoleId role => RoleInfo info) private _info;
|
18
|
-
RoleId[] private _roles;
|
19
|
-
|
20
|
-
mapping(RoleId role => mapping(address member => bool isMember))
|
21
|
-
private _isRoleMember;
|
22
|
-
mapping(RoleId role => EnumerableSet.AddressSet members) private _roleMembers;
|
23
|
-
|
24
|
-
modifier onlyAccessOwner() {
|
25
|
-
require(
|
26
|
-
msg.sender == this.getOwner(),
|
27
|
-
"ERROR:ACS-001:NOT_OWNER");
|
28
|
-
_;
|
29
|
-
}
|
30
|
-
|
31
|
-
modifier onlyExistingRole(RoleId role) {
|
32
|
-
require(
|
33
|
-
_info[role].id == role,
|
34
|
-
"ERROR:ACS-002:ROLE_NOT_EXISTING");
|
35
|
-
_;
|
36
|
-
}
|
37
|
-
|
38
|
-
constructor() {
|
39
|
-
_createRole(DISTRIBUTION_OWNER_ROLE(), DISTRIBUTION_OWNER_ROLE_NAME());
|
40
|
-
_createRole(ORACLE_OWNER_ROLE(), ORACLE_OWNER_ROLE_NAME());
|
41
|
-
_createRole(POOL_OWNER_ROLE(), POOL_OWNER_ROLE_NAME());
|
42
|
-
_createRole(PRODUCT_OWNER_ROLE(), PRODUCT_OWNER_ROLE_NAME());
|
43
|
-
}
|
44
|
-
|
45
|
-
function createRole(
|
46
|
-
string memory roleName
|
47
|
-
) public override onlyAccessOwner returns (RoleId role) {
|
48
|
-
role = RoleIdLib.toRoleId(roleName);
|
49
|
-
require(
|
50
|
-
!roleExists(role),
|
51
|
-
"ERROR:ACS-010:ROLE_ALREADY_EXISTS");
|
52
|
-
|
53
|
-
_createRole(role, roleName);
|
54
|
-
}
|
55
|
-
|
56
|
-
function setRoleState(RoleId role, bool active) external override onlyExistingRole(role) onlyAccessOwner {
|
57
|
-
RoleInfo memory info = _info[role];
|
58
|
-
info.isActive = active;
|
59
|
-
_setRoleInfo(info);
|
60
|
-
|
61
|
-
emit LogAccessRoleStateSet(role, active);
|
62
|
-
}
|
63
|
-
|
64
|
-
function grantRole(
|
65
|
-
RoleId role,
|
66
|
-
address member
|
67
|
-
) external override onlyExistingRole(role) onlyAccessOwner {
|
68
|
-
require(_info[role].isActive, "ERROR:ACS-040:ROLE_NOT_ACTIVE");
|
69
|
-
|
70
|
-
_isRoleMember[role][member] = true;
|
71
|
-
_roleMembers[role].add(member);
|
72
|
-
|
73
|
-
emit LogAccessRoleGranted(role, member, _isRoleMember[role][member]);
|
74
|
-
}
|
75
|
-
|
76
|
-
function revokeRole(
|
77
|
-
RoleId role,
|
78
|
-
address member
|
79
|
-
) external override onlyExistingRole(role) onlyAccessOwner {
|
80
|
-
delete _isRoleMember[role][member];
|
81
|
-
_roleMembers[role].remove(member);
|
82
|
-
|
83
|
-
emit LogAccessRoleGranted(role, member, false);
|
84
|
-
}
|
85
|
-
|
86
|
-
function roleExists(RoleId role) public view virtual override returns (bool) {
|
87
|
-
return _info[role].id == role;
|
88
|
-
}
|
89
|
-
|
90
|
-
function hasRole(
|
91
|
-
RoleId role,
|
92
|
-
address member
|
93
|
-
) public view virtual override returns (bool) {
|
94
|
-
return _isRoleMember[role][member];
|
95
|
-
}
|
96
|
-
|
97
|
-
function getRoleId(string memory roleName) external pure override returns (RoleId role) {
|
98
|
-
return RoleIdLib.toRoleId(roleName);
|
99
|
-
}
|
100
|
-
|
101
|
-
function getRoleInfo(
|
102
|
-
RoleId role
|
103
|
-
) external view override returns (RoleInfo memory info) {
|
104
|
-
return _info[role];
|
105
|
-
}
|
106
|
-
|
107
|
-
function getRole(
|
108
|
-
uint256 idx
|
109
|
-
) external view override returns (RoleId role) {
|
110
|
-
return _roles[idx];
|
111
|
-
}
|
112
|
-
|
113
|
-
function getRoleCount() external view override returns (uint256 roles) {
|
114
|
-
return _roles.length;
|
115
|
-
}
|
116
|
-
|
117
|
-
function getRoleMemberCount(
|
118
|
-
RoleId role
|
119
|
-
) public view override returns (uint256 roleMembers) {
|
120
|
-
return _roleMembers[role].length();
|
121
|
-
}
|
122
|
-
|
123
|
-
function getRoleMember(
|
124
|
-
RoleId role,
|
125
|
-
uint256 idx
|
126
|
-
) public view override returns (address roleMembers) {
|
127
|
-
return _roleMembers[role].at(idx);
|
128
|
-
}
|
129
|
-
|
130
|
-
function _createRole(
|
131
|
-
RoleId role,
|
132
|
-
string memory roleName
|
133
|
-
) internal {
|
134
|
-
RoleInfo memory info = RoleInfo(role, roleName, true);
|
135
|
-
_setRoleInfo(info);
|
136
|
-
|
137
|
-
emit LogAccessRoleCreated(role, roleName);
|
138
|
-
}
|
139
|
-
|
140
|
-
function _setRoleInfo(
|
141
|
-
RoleInfo memory info
|
142
|
-
) internal {
|
143
|
-
RoleId role = info.id;
|
144
|
-
_info[role] = info;
|
145
|
-
if(!roleExists(role)) {
|
146
|
-
_roles.push(role);
|
147
|
-
}
|
148
|
-
}
|
149
|
-
}
|
@@ -1,53 +0,0 @@
|
|
1
|
-
// SPDX-License-Identifier: Apache-2.0
|
2
|
-
pragma solidity ^0.8.19;
|
3
|
-
|
4
|
-
import {RoleId} from "../../../types/RoleId.sol";
|
5
|
-
|
6
|
-
interface IAccess {
|
7
|
-
struct RoleInfo {
|
8
|
-
RoleId id;
|
9
|
-
string name;
|
10
|
-
bool isActive;
|
11
|
-
}
|
12
|
-
}
|
13
|
-
|
14
|
-
interface IAccessModule is
|
15
|
-
IAccess
|
16
|
-
{
|
17
|
-
event LogAccessRoleCreated(RoleId role, string roleName);
|
18
|
-
event LogAccessRoleStateSet(RoleId role, bool active);
|
19
|
-
event LogAccessRoleGranted(RoleId role, address member, bool isMember);
|
20
|
-
|
21
|
-
function createRole(string memory roleName) external returns (RoleId role);
|
22
|
-
|
23
|
-
function setRoleState(RoleId role, bool active) external;
|
24
|
-
|
25
|
-
function grantRole(RoleId role, address member) external;
|
26
|
-
|
27
|
-
function revokeRole(RoleId role, address member) external;
|
28
|
-
|
29
|
-
function roleExists(RoleId role) external view returns (bool);
|
30
|
-
|
31
|
-
function hasRole(RoleId role, address member) external view returns (bool);
|
32
|
-
|
33
|
-
function getRoleCount() external view returns (uint256 roles);
|
34
|
-
|
35
|
-
function getRole(uint256 idx) external view returns (RoleId role);
|
36
|
-
|
37
|
-
function getRoleId(string memory roleName) external pure returns (RoleId role);
|
38
|
-
|
39
|
-
function getRoleInfo(
|
40
|
-
RoleId role
|
41
|
-
) external view returns (RoleInfo memory info);
|
42
|
-
|
43
|
-
function getRoleMemberCount(
|
44
|
-
RoleId role
|
45
|
-
) external view returns (uint256 roleMembers);
|
46
|
-
|
47
|
-
function getRoleMember(
|
48
|
-
RoleId role,
|
49
|
-
uint256 idx
|
50
|
-
) external view returns (address roleMember);
|
51
|
-
|
52
|
-
function getOwner() external view returns (address owner);
|
53
|
-
}
|
@@ -1,22 +0,0 @@
|
|
1
|
-
// SPDX-License-Identifier: Apache-2.0
|
2
|
-
pragma solidity ^0.8.20;
|
3
|
-
|
4
|
-
import {IERC721Enumerable} from "@openzeppelin5/contracts/token/ERC721/extensions/IERC721Enumerable.sol";
|
5
|
-
|
6
|
-
interface IChainNft is IERC721Enumerable {
|
7
|
-
function mint(
|
8
|
-
address to,
|
9
|
-
address interceptor,
|
10
|
-
string memory uri
|
11
|
-
) external returns (uint256 tokenId);
|
12
|
-
|
13
|
-
function burn(uint256 tokenId) external;
|
14
|
-
|
15
|
-
function setURI(uint256 tokenId, string memory uri) external;
|
16
|
-
|
17
|
-
function exists(uint256 tokenId) external view returns (bool);
|
18
|
-
|
19
|
-
function totalMinted() external view returns (uint256);
|
20
|
-
|
21
|
-
function getRegistryAddress() external view returns (address registry);
|
22
|
-
}
|
@@ -1,48 +0,0 @@
|
|
1
|
-
// SPDX-License-Identifier: Apache-2.0
|
2
|
-
pragma solidity ^0.8.19;
|
3
|
-
|
4
|
-
import {Key32, KeyId, Key32Lib} from "./Key32.sol";
|
5
|
-
import {REFERRAL} from "./ObjectType.sol";
|
6
|
-
|
7
|
-
type ReferralId is bytes8;
|
8
|
-
|
9
|
-
// type bindings
|
10
|
-
using {
|
11
|
-
eqReferralId as ==,
|
12
|
-
neReferralId as !=,
|
13
|
-
ReferralIdLib.toKey32
|
14
|
-
} for ReferralId global;
|
15
|
-
|
16
|
-
// general pure free functions
|
17
|
-
|
18
|
-
// @dev Returns true iff risk ids a and b are identical
|
19
|
-
function eqReferralId(ReferralId a, ReferralId b) pure returns (bool isSame) {
|
20
|
-
return ReferralId.unwrap(a) == ReferralId.unwrap(b);
|
21
|
-
}
|
22
|
-
|
23
|
-
// @dev Returns true iff risk ids a and b are different
|
24
|
-
function neReferralId(ReferralId a, ReferralId b) pure returns (bool isDifferent) {
|
25
|
-
return ReferralId.unwrap(a) != ReferralId.unwrap(b);
|
26
|
-
}
|
27
|
-
|
28
|
-
library ReferralIdLib {
|
29
|
-
|
30
|
-
function zeroReferralId() public pure returns (ReferralId) {
|
31
|
-
return ReferralId.wrap(bytes8(0));
|
32
|
-
}
|
33
|
-
|
34
|
-
// @dev Converts a role string into a role id.
|
35
|
-
function toReferralId(string memory referral) public pure returns (ReferralId) {
|
36
|
-
return ReferralId.wrap(bytes8(keccak256(abi.encode(referral))));
|
37
|
-
}
|
38
|
-
|
39
|
-
/// @dev Returns the key32 value for the specified id
|
40
|
-
function toKey32(ReferralId id) public pure returns (Key32 key) {
|
41
|
-
return Key32Lib.toKey32(REFERRAL(), toKeyId(id));
|
42
|
-
}
|
43
|
-
|
44
|
-
/// @dev Returns the key id value for the specified id
|
45
|
-
function toKeyId(ReferralId id) public pure returns (KeyId keyId) {
|
46
|
-
return KeyId.wrap(bytes31(ReferralId.unwrap(id)));
|
47
|
-
}
|
48
|
-
}
|