@etherisc/gif-next 0.0.2-e6a90b9 → 0.0.2-e6ad61d-739
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +33 -0
 - package/artifacts/contracts/components/Component.sol/Component.dbg.json +1 -1
 - package/artifacts/contracts/components/Component.sol/Component.json +35 -9
 - package/artifacts/contracts/components/Component.sol/InstanceLinked.dbg.json +1 -1
 - package/artifacts/contracts/components/Component.sol/InstanceLinked.json +2 -2
 - package/artifacts/contracts/components/IPool.sol/IPoolComponent.dbg.json +1 -1
 - package/artifacts/contracts/components/IPool.sol/IPoolComponent.json +84 -8
 - package/artifacts/contracts/components/IProduct.sol/IProductComponent.dbg.json +1 -1
 - package/artifacts/contracts/components/IProduct.sol/IProductComponent.json +34 -152
 - package/artifacts/contracts/components/Pool.sol/Pool.dbg.json +1 -1
 - package/artifacts/contracts/components/Pool.sol/Pool.json +146 -13
 - package/artifacts/contracts/components/Product.sol/Product.dbg.json +1 -1
 - package/artifacts/contracts/components/Product.sol/Product.json +148 -15
 - package/artifacts/contracts/experiment/errors/Require.sol/Require.dbg.json +1 -1
 - package/artifacts/contracts/experiment/errors/Require.sol/Require.json +2 -2
 - package/artifacts/contracts/experiment/errors/Revert.sol/Revert.dbg.json +1 -1
 - package/artifacts/contracts/experiment/errors/Revert.sol/Revert.json +2 -2
 - package/artifacts/contracts/experiment/inheritance/A.sol/A.dbg.json +1 -1
 - package/artifacts/contracts/experiment/inheritance/A.sol/A.json +2 -2
 - package/artifacts/contracts/experiment/inheritance/A.sol/AShared.dbg.json +1 -1
 - package/artifacts/contracts/experiment/inheritance/A.sol/AShared.json +2 -2
 - 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 +4 -0
 - package/artifacts/contracts/experiment/statemachine/Dummy.sol/LifeCycleModule.json +59 -0
 - package/artifacts/contracts/experiment/statemachine/ISM.sol/ISM.dbg.json +4 -0
 - package/artifacts/contracts/experiment/statemachine/ISM.sol/ISM.json +124 -0
 - package/artifacts/contracts/experiment/statemachine/ISM.sol/ISMEE.dbg.json +4 -0
 - package/artifacts/contracts/experiment/statemachine/ISM.sol/ISMEE.json +74 -0
 - package/artifacts/contracts/experiment/statemachine/SM.sol/SM.dbg.json +4 -0
 - package/artifacts/contracts/experiment/statemachine/SM.sol/SM.json +124 -0
 - package/artifacts/contracts/experiment/statemachine/SimpleStateMachine.sol/SimpleStateMachine.dbg.json +4 -0
 - package/artifacts/contracts/experiment/statemachine/SimpleStateMachine.sol/SimpleStateMachine.json +207 -0
 - package/artifacts/contracts/experiment/types/TypeA.sol/TypeALib.dbg.json +1 -1
 - package/artifacts/contracts/experiment/types/TypeA.sol/TypeALib.json +2 -2
 - package/artifacts/contracts/experiment/types/TypeB.sol/TypeBLib.dbg.json +1 -1
 - package/artifacts/contracts/experiment/types/TypeB.sol/TypeBLib.json +2 -2
 - package/artifacts/contracts/instance/IInstance.sol/IInstance.dbg.json +1 -1
 - package/artifacts/contracts/instance/IInstance.sol/IInstance.json +714 -127
 - package/artifacts/contracts/instance/Instance.sol/Instance.dbg.json +1 -1
 - package/artifacts/contracts/instance/Instance.sol/Instance.json +845 -129
 - package/artifacts/contracts/instance/access/Access.sol/AccessModule.dbg.json +1 -1
 - package/artifacts/contracts/instance/access/IAccess.sol/IAccess.dbg.json +1 -1
 - package/artifacts/contracts/instance/access/IAccess.sol/IAccessCheckRole.dbg.json +1 -1
 - package/artifacts/contracts/instance/access/IAccess.sol/IAccessComponentTypeRoles.dbg.json +1 -1
 - package/artifacts/contracts/instance/access/IAccess.sol/IAccessModule.dbg.json +1 -1
 - package/artifacts/contracts/instance/component/ComponentModule.sol/ComponentModule.dbg.json +1 -1
 - package/artifacts/contracts/instance/component/ComponentModule.sol/ComponentModule.json +31 -59
 - package/artifacts/contracts/instance/component/ComponentModule.sol/ComponentOwnerService.dbg.json +1 -1
 - package/artifacts/contracts/instance/component/ComponentModule.sol/ComponentOwnerService.json +103 -6
 - package/artifacts/contracts/instance/component/IComponent.sol/IComponent.dbg.json +1 -1
 - package/artifacts/contracts/instance/component/IComponent.sol/IComponentContract.dbg.json +1 -1
 - package/artifacts/contracts/instance/component/IComponent.sol/IComponentContract.json +34 -8
 - package/artifacts/contracts/instance/component/IComponent.sol/IComponentModule.dbg.json +1 -1
 - package/artifacts/contracts/instance/component/IComponent.sol/IComponentModule.json +31 -59
 - package/artifacts/contracts/instance/component/IComponent.sol/IComponentOwnerService.dbg.json +1 -1
 - package/artifacts/contracts/instance/component/IComponent.sol/IComponentOwnerService.json +50 -3
 - package/artifacts/contracts/instance/component/IComponent.sol/IInstanceLinked.dbg.json +1 -1
 - package/artifacts/contracts/instance/lifecycle/ILifecycle.sol/ILifecycle.dbg.json +4 -0
 - package/artifacts/contracts/instance/lifecycle/ILifecycle.sol/ILifecycle.json +134 -0
 - package/artifacts/contracts/instance/lifecycle/ILifecycle.sol/ILifecycleModule.dbg.json +4 -0
 - package/artifacts/contracts/instance/lifecycle/ILifecycle.sol/ILifecycleModule.json +182 -0
 - package/artifacts/contracts/instance/lifecycle/LifecycleModule.sol/LifecycleModule.dbg.json +4 -0
 - package/artifacts/contracts/instance/lifecycle/LifecycleModule.sol/LifecycleModule.json +221 -0
 - package/artifacts/contracts/instance/policy/IPolicy.sol/IPolicy.dbg.json +1 -1
 - package/artifacts/contracts/instance/policy/IPolicy.sol/IPolicyModule.dbg.json +1 -1
 - package/artifacts/contracts/instance/policy/IPolicy.sol/IPolicyModule.json +44 -21
 - package/artifacts/contracts/instance/policy/PolicyModule.sol/PolicyModule.dbg.json +1 -1
 - package/artifacts/contracts/instance/policy/PolicyModule.sol/PolicyModule.json +44 -21
 - package/artifacts/contracts/instance/pool/IPoolModule.sol/IPool.dbg.json +1 -1
 - package/artifacts/contracts/instance/pool/IPoolModule.sol/IPoolModule.dbg.json +1 -1
 - package/artifacts/contracts/instance/pool/IPoolModule.sol/IPoolModule.json +23 -43
 - package/artifacts/contracts/instance/pool/PoolModule.sol/PoolModule.dbg.json +1 -1
 - package/artifacts/contracts/instance/pool/PoolModule.sol/PoolModule.json +28 -35
 - package/artifacts/contracts/instance/product/IProductService.sol/IProductModule.dbg.json +1 -1
 - package/artifacts/contracts/instance/product/IProductService.sol/IProductService.dbg.json +1 -1
 - package/artifacts/contracts/instance/product/IProductService.sol/IProductService.json +21 -8
 - package/artifacts/contracts/instance/product/ProductService.sol/ProductModule.dbg.json +1 -1
 - package/artifacts/contracts/instance/product/ProductService.sol/ProductService.dbg.json +1 -1
 - package/artifacts/contracts/instance/product/ProductService.sol/ProductService.json +85 -14
 - package/artifacts/contracts/instance/treasury/ITreasury.sol/ITreasury.dbg.json +4 -0
 - package/artifacts/contracts/instance/treasury/ITreasury.sol/ITreasury.json +10 -0
 - package/artifacts/contracts/instance/treasury/ITreasury.sol/ITreasuryModule.dbg.json +4 -0
 - package/artifacts/contracts/instance/treasury/ITreasury.sol/ITreasuryModule.json +490 -0
 - package/artifacts/contracts/instance/treasury/TokenHandler.sol/TokenHandler.dbg.json +4 -0
 - package/artifacts/contracts/instance/treasury/TokenHandler.sol/TokenHandler.json +45 -0
 - package/artifacts/contracts/instance/treasury/TreasuryModule.sol/TreasuryModule.dbg.json +4 -0
 - package/artifacts/contracts/instance/treasury/TreasuryModule.sol/TreasuryModule.json +490 -0
 - package/artifacts/contracts/registry/ChainNft.sol/ChainNft.dbg.json +1 -1
 - package/artifacts/contracts/registry/ChainNft.sol/ChainNft.json +2 -2
 - package/artifacts/contracts/registry/IChainNft.sol/IChainNft.dbg.json +1 -1
 - package/artifacts/contracts/registry/IRegistry.sol/IOwnable.dbg.json +1 -1
 - package/artifacts/contracts/registry/IRegistry.sol/IRegisterable.dbg.json +1 -1
 - package/artifacts/contracts/registry/IRegistry.sol/IRegisterable.json +8 -8
 - package/artifacts/contracts/registry/IRegistry.sol/IRegistry.dbg.json +1 -1
 - package/artifacts/contracts/registry/IRegistry.sol/IRegistry.json +20 -111
 - package/artifacts/contracts/registry/IRegistry.sol/IRegistryLinked.dbg.json +1 -1
 - package/artifacts/contracts/registry/Registry.sol/Registerable.dbg.json +1 -1
 - package/artifacts/contracts/registry/Registry.sol/Registerable.json +9 -9
 - package/artifacts/contracts/registry/Registry.sol/Registry.dbg.json +1 -1
 - package/artifacts/contracts/registry/Registry.sol/Registry.json +66 -115
 - package/artifacts/contracts/registry/Registry.sol/RegistryLinked.dbg.json +1 -1
 - package/artifacts/contracts/registry/Registry.sol/RegistryLinked.json +2 -2
 - package/artifacts/contracts/types/Blocknumber.sol/BlocknumberLib.dbg.json +4 -0
 - package/artifacts/contracts/types/Blocknumber.sol/BlocknumberLib.json +174 -0
 - package/artifacts/contracts/types/ChainId.sol/ChainIdLib.dbg.json +1 -1
 - package/artifacts/contracts/types/ChainId.sol/ChainIdLib.json +2 -2
 - package/artifacts/contracts/types/NftId.sol/NftIdLib.dbg.json +1 -1
 - package/artifacts/contracts/types/NftId.sol/NftIdLib.json +85 -3
 - package/artifacts/contracts/types/ObjectType.sol/ObjectTypeLib.dbg.json +4 -0
 - package/artifacts/contracts/types/ObjectType.sol/ObjectTypeLib.json +92 -0
 - package/artifacts/contracts/types/StateId.sol/StateIdLib.dbg.json +4 -0
 - package/artifacts/contracts/types/StateId.sol/StateIdLib.json +92 -0
 - package/artifacts/contracts/types/Timestamp.sol/TimestampLib.dbg.json +4 -0
 - package/artifacts/contracts/types/Timestamp.sol/TimestampLib.json +174 -0
 - package/artifacts/contracts/types/UFixed.sol/UFixedMathLib.dbg.json +4 -0
 - package/artifacts/contracts/types/UFixed.sol/UFixedMathLib.json +479 -0
 - package/contracts/components/Component.sol +39 -24
 - package/contracts/components/IPool.sol +9 -3
 - package/contracts/components/IProduct.sol +11 -6
 - package/contracts/components/Pool.sol +37 -14
 - package/contracts/components/Product.sol +48 -24
 - package/contracts/experiment/errors/Require.sol +10 -5
 - package/contracts/experiment/errors/Revert.sol +13 -8
 - package/contracts/experiment/inheritance/A.sol +8 -11
 - package/contracts/experiment/inheritance/B.sol +10 -5
 - package/contracts/experiment/inheritance/C.sol +11 -5
 - package/contracts/experiment/inheritance/IA.sol +2 -7
 - package/contracts/experiment/inheritance/IB.sol +3 -2
 - package/contracts/experiment/inheritance/IC.sol +4 -3
 - package/contracts/experiment/statemachine/Dummy.sol +27 -0
 - package/contracts/experiment/statemachine/ISM.sol +25 -0
 - package/contracts/experiment/statemachine/README.md +112 -0
 - package/contracts/experiment/statemachine/SM.sol +57 -0
 - package/contracts/experiment/statemachine/SimpleStateMachine.sol +31 -0
 - package/contracts/experiment/types/TypeA.sol +14 -9
 - package/contracts/experiment/types/TypeB.sol +14 -9
 - package/contracts/instance/IInstance.sol +8 -3
 - package/contracts/instance/Instance.sol +24 -15
 - package/contracts/instance/access/Access.sol +63 -116
 - package/contracts/instance/access/IAccess.sol +28 -48
 - package/contracts/instance/component/ComponentModule.sol +163 -135
 - package/contracts/instance/component/IComponent.sol +41 -61
 - package/contracts/instance/lifecycle/ILifecycle.sol +47 -0
 - package/contracts/instance/lifecycle/LifecycleModule.sol +88 -0
 - package/contracts/instance/policy/IPolicy.sol +19 -35
 - package/contracts/instance/policy/PolicyModule.sol +52 -44
 - package/contracts/instance/pool/IPoolModule.sol +9 -26
 - package/contracts/instance/pool/PoolModule.sol +43 -45
 - package/contracts/instance/product/IProductService.sol +10 -19
 - package/contracts/instance/product/ProductService.sol +86 -55
 - package/contracts/instance/treasury/ITreasury.sol +91 -0
 - package/contracts/instance/treasury/TokenHandler.sol +24 -0
 - package/contracts/instance/treasury/TreasuryModule.sol +168 -0
 - package/contracts/registry/ChainNft.sol +23 -61
 - package/contracts/registry/IChainNft.sol +10 -7
 - package/contracts/registry/IRegistry.sol +40 -41
 - package/contracts/registry/Registry.sol +73 -67
 - package/contracts/types/Blocknumber.sol +118 -0
 - package/contracts/types/ChainId.sol +24 -10
 - package/contracts/types/Fee.sol +32 -0
 - package/contracts/types/NftId.sol +36 -10
 - package/contracts/types/ObjectType.sol +107 -0
 - package/contracts/types/StateId.sol +91 -0
 - package/contracts/types/Timestamp.sol +102 -0
 - package/contracts/types/UFixed.sol +210 -0
 - package/package.json +13 -5
 
| 
         @@ -23,20 +23,25 @@ a.toInt() == x.toInt() // -> no error 
     | 
|
| 
       23 
23 
     | 
    
         
             
            type TypeA is uint248;
         
     | 
| 
       24 
24 
     | 
    
         | 
| 
       25 
25 
     | 
    
         
             
            // type bindings
         
     | 
| 
       26 
     | 
    
         
            -
            using {
         
     | 
| 
       27 
     | 
    
         
            -
                eqTypeA as ==,
         
     | 
| 
       28 
     | 
    
         
            -
                neTypeA as !=,
         
     | 
| 
       29 
     | 
    
         
            -
                TypeALib.toInt
         
     | 
| 
       30 
     | 
    
         
            -
            } for TypeA global;
         
     | 
| 
      
 26 
     | 
    
         
            +
            using {eqTypeA as ==, neTypeA as !=, TypeALib.toInt} for TypeA global;
         
     | 
| 
       31 
27 
     | 
    
         | 
| 
       32 
28 
     | 
    
         
             
            // general pure free functions
         
     | 
| 
       33 
     | 
    
         
            -
            function toTypeA(uint256 typeA) pure returns(TypeA) { 
     | 
| 
      
 29 
     | 
    
         
            +
            function toTypeA(uint256 typeA) pure returns (TypeA) {
         
     | 
| 
      
 30 
     | 
    
         
            +
                return TypeA.wrap(uint248(typeA));
         
     | 
| 
      
 31 
     | 
    
         
            +
            }
         
     | 
| 
       34 
32 
     | 
    
         | 
| 
       35 
33 
     | 
    
         
             
            // pure free functions for operators
         
     | 
| 
       36 
     | 
    
         
            -
            function eqTypeA(TypeA a, TypeA b) pure returns(bool isSame) { 
     | 
| 
       37 
     | 
    
         
            -
             
     | 
| 
      
 34 
     | 
    
         
            +
            function eqTypeA(TypeA a, TypeA b) pure returns (bool isSame) {
         
     | 
| 
      
 35 
     | 
    
         
            +
                return TypeA.unwrap(a) == TypeA.unwrap(b);
         
     | 
| 
      
 36 
     | 
    
         
            +
            }
         
     | 
| 
      
 37 
     | 
    
         
            +
             
     | 
| 
      
 38 
     | 
    
         
            +
            function neTypeA(TypeA a, TypeA b) pure returns (bool isDifferent) {
         
     | 
| 
      
 39 
     | 
    
         
            +
                return TypeA.unwrap(a) != TypeA.unwrap(b);
         
     | 
| 
      
 40 
     | 
    
         
            +
            }
         
     | 
| 
       38 
41 
     | 
    
         | 
| 
       39 
42 
     | 
    
         
             
            // library functions that operate on user defined type
         
     | 
| 
       40 
43 
     | 
    
         
             
            library TypeALib {
         
     | 
| 
       41 
     | 
    
         
            -
                function toInt(TypeA typeA) internal pure returns(uint256) { 
     | 
| 
      
 44 
     | 
    
         
            +
                function toInt(TypeA typeA) internal pure returns (uint256) {
         
     | 
| 
      
 45 
     | 
    
         
            +
                    return uint256(TypeA.unwrap(typeA));
         
     | 
| 
      
 46 
     | 
    
         
            +
                }
         
     | 
| 
       42 
47 
     | 
    
         
             
            }
         
     | 
| 
         @@ -5,20 +5,25 @@ pragma solidity ^0.8.19; 
     | 
|
| 
       5 
5 
     | 
    
         
             
            type TypeB is uint248;
         
     | 
| 
       6 
6 
     | 
    
         | 
| 
       7 
7 
     | 
    
         
             
            // type bindings
         
     | 
| 
       8 
     | 
    
         
            -
            using {
         
     | 
| 
       9 
     | 
    
         
            -
                eqTypeB as ==,
         
     | 
| 
       10 
     | 
    
         
            -
                addTypeB as +,
         
     | 
| 
       11 
     | 
    
         
            -
                TypeBLib.toInt
         
     | 
| 
       12 
     | 
    
         
            -
            } for TypeB global;
         
     | 
| 
      
 8 
     | 
    
         
            +
            using {eqTypeB as ==, addTypeB as +, TypeBLib.toInt} for TypeB global;
         
     | 
| 
       13 
9 
     | 
    
         | 
| 
       14 
10 
     | 
    
         
             
            // general pure free functions
         
     | 
| 
       15 
     | 
    
         
            -
            function toTypeB(uint256 x) pure returns(TypeB) { 
     | 
| 
      
 11 
     | 
    
         
            +
            function toTypeB(uint256 x) pure returns (TypeB) {
         
     | 
| 
      
 12 
     | 
    
         
            +
                return TypeB.wrap(uint248(x));
         
     | 
| 
      
 13 
     | 
    
         
            +
            }
         
     | 
| 
       16 
14 
     | 
    
         | 
| 
       17 
15 
     | 
    
         
             
            // pure free functions for operators
         
     | 
| 
       18 
     | 
    
         
            -
            function eqTypeB(TypeB a, TypeB b) pure returns(bool isSame) { 
     | 
| 
       19 
     | 
    
         
            -
             
     | 
| 
      
 16 
     | 
    
         
            +
            function eqTypeB(TypeB a, TypeB b) pure returns (bool isSame) {
         
     | 
| 
      
 17 
     | 
    
         
            +
                return TypeB.unwrap(a) == TypeB.unwrap(b);
         
     | 
| 
      
 18 
     | 
    
         
            +
            }
         
     | 
| 
      
 19 
     | 
    
         
            +
             
     | 
| 
      
 20 
     | 
    
         
            +
            function addTypeB(TypeB a, TypeB b) pure returns (TypeB sum) {
         
     | 
| 
      
 21 
     | 
    
         
            +
                return TypeB.wrap(TypeB.unwrap(a) + TypeB.unwrap(b));
         
     | 
| 
      
 22 
     | 
    
         
            +
            }
         
     | 
| 
       20 
23 
     | 
    
         | 
| 
       21 
24 
     | 
    
         
             
            // library functions that operate on user defined type
         
     | 
| 
       22 
25 
     | 
    
         
             
            library TypeBLib {
         
     | 
| 
       23 
     | 
    
         
            -
                function toInt(TypeB b) internal pure returns(uint256) { 
     | 
| 
      
 26 
     | 
    
         
            +
                function toInt(TypeB b) internal pure returns (uint256) {
         
     | 
| 
      
 27 
     | 
    
         
            +
                    return uint256(TypeB.unwrap(b));
         
     | 
| 
      
 28 
     | 
    
         
            +
                }
         
     | 
| 
       24 
29 
     | 
    
         
             
            }
         
     | 
| 
         @@ -3,18 +3,23 @@ pragma solidity ^0.8.19; 
     | 
|
| 
       3 
3 
     | 
    
         | 
| 
       4 
4 
     | 
    
         
             
            import {IRegisterable} from "../registry/IRegistry.sol";
         
     | 
| 
       5 
5 
     | 
    
         
             
            import {IAccessModule} from "./access/IAccess.sol";
         
     | 
| 
      
 6 
     | 
    
         
            +
            import {ILifecycleModule} from "./lifecycle/ILifecycle.sol";
         
     | 
| 
       6 
7 
     | 
    
         
             
            import {IComponentModule} from "./component/IComponent.sol";
         
     | 
| 
       7 
8 
     | 
    
         
             
            import {IProductModule} from "./product/IProductService.sol";
         
     | 
| 
       8 
9 
     | 
    
         
             
            import {IPolicyModule} from "./policy/IPolicy.sol";
         
     | 
| 
       9 
10 
     | 
    
         
             
            import {IPoolModule} from "./pool/IPoolModule.sol";
         
     | 
| 
      
 11 
     | 
    
         
            +
            import {ITreasuryModule} from "./treasury/ITreasury.sol";
         
     | 
| 
       10 
12 
     | 
    
         | 
| 
       11 
     | 
    
         
            -
             
     | 
| 
      
 13 
     | 
    
         
            +
            // solhint-disable-next-line no-empty-blocks
         
     | 
| 
       12 
14 
     | 
    
         
             
            interface IInstance is
         
     | 
| 
       13 
15 
     | 
    
         
             
                IRegisterable,
         
     | 
| 
       14 
16 
     | 
    
         
             
                IAccessModule,
         
     | 
| 
      
 17 
     | 
    
         
            +
                ILifecycleModule,
         
     | 
| 
       15 
18 
     | 
    
         
             
                IPolicyModule,
         
     | 
| 
       16 
19 
     | 
    
         
             
                IPoolModule,
         
     | 
| 
       17 
20 
     | 
    
         
             
                IComponentModule,
         
     | 
| 
       18 
     | 
    
         
            -
                IProductModule
         
     | 
| 
       19 
     | 
    
         
            -
             
     | 
| 
      
 21 
     | 
    
         
            +
                IProductModule,
         
     | 
| 
      
 22 
     | 
    
         
            +
                ITreasuryModule
         
     | 
| 
      
 23 
     | 
    
         
            +
            {
         
     | 
| 
       20 
24 
     | 
    
         | 
| 
      
 25 
     | 
    
         
            +
            }
         
     | 
| 
         @@ -5,23 +5,28 @@ import {Registerable} from "../registry/Registry.sol"; 
     | 
|
| 
       5 
5 
     | 
    
         
             
            import {IRegistry} from "../registry/IRegistry.sol";
         
     | 
| 
       6 
6 
     | 
    
         | 
| 
       7 
7 
     | 
    
         
             
            import {IAccessModule, AccessModule} from "./access/Access.sol";
         
     | 
| 
      
 8 
     | 
    
         
            +
            import {LifecycleModule} from "./lifecycle/LifecycleModule.sol";
         
     | 
| 
       8 
9 
     | 
    
         
             
            import {ComponentModule} from "./component/ComponentModule.sol";
         
     | 
| 
       9 
10 
     | 
    
         
             
            import {ProductModule} from "./product/ProductService.sol";
         
     | 
| 
       10 
11 
     | 
    
         
             
            import {PolicyModule} from "./policy/PolicyModule.sol";
         
     | 
| 
       11 
12 
     | 
    
         
             
            import {PoolModule} from "./pool/PoolModule.sol";
         
     | 
| 
      
 13 
     | 
    
         
            +
            import {TreasuryModule} from "./treasury/TreasuryModule.sol";
         
     | 
| 
       12 
14 
     | 
    
         | 
| 
       13 
15 
     | 
    
         
             
            import {IInstance} from "./IInstance.sol";
         
     | 
| 
      
 16 
     | 
    
         
            +
            import {ObjectType, INSTANCE} from "../types/ObjectType.sol";
         
     | 
| 
      
 17 
     | 
    
         
            +
            import {NftId, toNftId} from "../types/NftId.sol";
         
     | 
| 
       14 
18 
     | 
    
         | 
| 
       15 
19 
     | 
    
         
             
            contract Instance is
         
     | 
| 
       16 
20 
     | 
    
         
             
                Registerable,
         
     | 
| 
       17 
21 
     | 
    
         
             
                AccessModule,
         
     | 
| 
       18 
     | 
    
         
            -
                 
     | 
| 
       19 
     | 
    
         
            -
                 
     | 
| 
      
 22 
     | 
    
         
            +
                LifecycleModule,
         
     | 
| 
      
 23 
     | 
    
         
            +
                ComponentModule,
         
     | 
| 
      
 24 
     | 
    
         
            +
                PolicyModule,
         
     | 
| 
       20 
25 
     | 
    
         
             
                PoolModule,
         
     | 
| 
       21 
     | 
    
         
            -
                ProductModule, 
     | 
| 
      
 26 
     | 
    
         
            +
                ProductModule,
         
     | 
| 
      
 27 
     | 
    
         
            +
                TreasuryModule,
         
     | 
| 
       22 
28 
     | 
    
         
             
                IInstance
         
     | 
| 
       23 
29 
     | 
    
         
             
            {
         
     | 
| 
       24 
     | 
    
         
            -
             
     | 
| 
       25 
30 
     | 
    
         
             
                constructor(
         
     | 
| 
       26 
31 
     | 
    
         
             
                    address registry,
         
     | 
| 
       27 
32 
     | 
    
         
             
                    address componentOwnerService,
         
     | 
| 
         @@ -33,31 +38,35 @@ contract Instance is 
     | 
|
| 
       33 
38 
     | 
    
         
             
                    PolicyModule(productService)
         
     | 
| 
       34 
39 
     | 
    
         
             
                    ProductModule(productService)
         
     | 
| 
       35 
40 
     | 
    
         
             
                    PoolModule(productService)
         
     | 
| 
       36 
     | 
    
         
            -
                 
     | 
| 
      
 41 
     | 
    
         
            +
                // solhint-disable-next-line no-empty-blocks
         
     | 
| 
      
 42 
     | 
    
         
            +
                {
         
     | 
| 
      
 43 
     | 
    
         
            +
             
     | 
| 
      
 44 
     | 
    
         
            +
                }
         
     | 
| 
       37 
45 
     | 
    
         | 
| 
       38 
46 
     | 
    
         
             
                // from registerable
         
     | 
| 
       39 
     | 
    
         
            -
                function register() external override returns( 
     | 
| 
       40 
     | 
    
         
            -
                    require( 
     | 
| 
      
 47 
     | 
    
         
            +
                function register() external override returns (NftId nftId) {
         
     | 
| 
      
 48 
     | 
    
         
            +
                    require(
         
     | 
| 
      
 49 
     | 
    
         
            +
                        address(_registry) != address(0),
         
     | 
| 
      
 50 
     | 
    
         
            +
                        "ERROR:PRD-001:REGISTRY_ZERO"
         
     | 
| 
      
 51 
     | 
    
         
            +
                    );
         
     | 
| 
       41 
52 
     | 
    
         
             
                    return _registry.register(address(this));
         
     | 
| 
       42 
53 
     | 
    
         
             
                }
         
     | 
| 
       43 
54 
     | 
    
         | 
| 
       44 
55 
     | 
    
         
             
                // from registerable
         
     | 
| 
       45 
     | 
    
         
            -
                function getParentNftId() public  
     | 
| 
      
 56 
     | 
    
         
            +
                function getParentNftId() public pure override returns (NftId) {
         
     | 
| 
       46 
57 
     | 
    
         
             
                    // TODO  add self registry and exchange 0 for_registry.getNftId();
         
     | 
| 
       47 
58 
     | 
    
         
             
                    // define parent tree for all registerables
         
     | 
| 
       48 
     | 
    
         
            -
                    // eg 0 <- chain(mainnet) <- global registry <- chain registry <- instance <- component <- policy/bundle 
     | 
| 
       49 
     | 
    
         
            -
                    return 0;
         
     | 
| 
      
 59 
     | 
    
         
            +
                    // eg 0 <- chain(mainnet) <- global registry <- chain registry <- instance <- component <- policy/bundle
         
     | 
| 
      
 60 
     | 
    
         
            +
                    return toNftId(0);
         
     | 
| 
       50 
61 
     | 
    
         
             
                }
         
     | 
| 
       51 
62 
     | 
    
         | 
| 
       52 
63 
     | 
    
         
             
                // from registerable
         
     | 
| 
       53 
     | 
    
         
            -
                function getType() external  
     | 
| 
       54 
     | 
    
         
            -
                    return  
     | 
| 
      
 64 
     | 
    
         
            +
                function getType() external pure override returns (ObjectType objectType) {
         
     | 
| 
      
 65 
     | 
    
         
            +
                    return INSTANCE();
         
     | 
| 
       55 
66 
     | 
    
         
             
                }
         
     | 
| 
       56 
67 
     | 
    
         | 
| 
       57 
68 
     | 
    
         
             
                // from registerable
         
     | 
| 
       58 
     | 
    
         
            -
                function getData() external  
     | 
| 
      
 69 
     | 
    
         
            +
                function getData() external pure override returns (bytes memory data) {
         
     | 
| 
       59 
70 
     | 
    
         
             
                    return bytes(abi.encode(0));
         
     | 
| 
       60 
71 
     | 
    
         
             
                }
         
     | 
| 
       61 
     | 
    
         
            -
             
     | 
| 
       62 
     | 
    
         
            -
             
     | 
| 
       63 
72 
     | 
    
         
             
            }
         
     | 
| 
         @@ -7,26 +7,24 @@ import "@openzeppelin/contracts/utils/structs/EnumerableSet.sol"; 
     | 
|
| 
       7 
7 
     | 
    
         | 
| 
       8 
8 
     | 
    
         
             
            import {IAccessModule} from "./IAccess.sol";
         
     | 
| 
       9 
9 
     | 
    
         | 
| 
       10 
     | 
    
         
            -
             
     | 
| 
       11 
     | 
    
         
            -
             
     | 
| 
       12 
     | 
    
         
            -
                 
     | 
| 
       13 
     | 
    
         
            -
             
     | 
| 
       14 
     | 
    
         
            -
                string constant public PRODUCT_OWNER = "ProductOwner";
         
     | 
| 
       15 
     | 
    
         
            -
                string constant public ORACLE_OWNER = "OracleOwner";
         
     | 
| 
       16 
     | 
    
         
            -
                string constant public POOL_OWNER = "PoolOwner";
         
     | 
| 
      
 10 
     | 
    
         
            +
            abstract contract AccessModule is IAccessModule {
         
     | 
| 
      
 11 
     | 
    
         
            +
                string public constant PRODUCT_OWNER = "ProductOwner";
         
     | 
| 
      
 12 
     | 
    
         
            +
                string public constant ORACLE_OWNER = "OracleOwner";
         
     | 
| 
      
 13 
     | 
    
         
            +
                string public constant POOL_OWNER = "PoolOwner";
         
     | 
| 
       17 
14 
     | 
    
         | 
| 
       18 
15 
     | 
    
         
             
                using EnumerableSet for EnumerableSet.AddressSet;
         
     | 
| 
       19 
16 
     | 
    
         | 
| 
       20 
17 
     | 
    
         
             
                event LogAccessRoleGranted(bytes32 role, address member, bool isMember);
         
     | 
| 
       21 
18 
     | 
    
         | 
| 
       22 
19 
     | 
    
         
             
                mapping(bytes32 role => RoleInfo info) private _info;
         
     | 
| 
       23 
     | 
    
         
            -
                bytes32 
     | 
| 
      
 20 
     | 
    
         
            +
                bytes32[] private _roles;
         
     | 
| 
       24 
21 
     | 
    
         | 
| 
       25 
22 
     | 
    
         
             
                bytes32 private immutable _productOwnerRole;
         
     | 
| 
       26 
23 
     | 
    
         
             
                bytes32 private immutable _oracleOwnerRole;
         
     | 
| 
       27 
24 
     | 
    
         
             
                bytes32 private immutable _poolOwnerRole;
         
     | 
| 
       28 
25 
     | 
    
         | 
| 
       29 
     | 
    
         
            -
                mapping(bytes32 role => mapping(address member => bool isMember)) 
     | 
| 
      
 26 
     | 
    
         
            +
                mapping(bytes32 role => mapping(address member => bool isMember))
         
     | 
| 
      
 27 
     | 
    
         
            +
                    private _isRoleMember;
         
     | 
| 
       30 
28 
     | 
    
         
             
                mapping(bytes32 role => EnumerableSet.AddressSet) private _roleMembers;
         
     | 
| 
       31 
29 
     | 
    
         | 
| 
       32 
30 
     | 
    
         
             
                modifier onlyOwner() {
         
     | 
| 
         @@ -40,70 +38,54 @@ abstract contract AccessModule is 
     | 
|
| 
       40 
38 
     | 
    
         
             
                    _poolOwnerRole = _createRole(POOL_OWNER);
         
     | 
| 
       41 
39 
     | 
    
         
             
                }
         
     | 
| 
       42 
40 
     | 
    
         | 
| 
       43 
     | 
    
         
            -
                function PRODUCT_OWNER_ROLE() public view override returns(bytes32 role) { 
     | 
| 
       44 
     | 
    
         
            -
             
     | 
| 
       45 
     | 
    
         
            -
                 
     | 
| 
      
 41 
     | 
    
         
            +
                function PRODUCT_OWNER_ROLE() public view override returns (bytes32 role) {
         
     | 
| 
      
 42 
     | 
    
         
            +
                    return _productOwnerRole;
         
     | 
| 
      
 43 
     | 
    
         
            +
                }
         
     | 
| 
      
 44 
     | 
    
         
            +
             
     | 
| 
      
 45 
     | 
    
         
            +
                function ORACLE_OWNER_ROLE() public view override returns (bytes32 role) {
         
     | 
| 
      
 46 
     | 
    
         
            +
                    return _oracleOwnerRole;
         
     | 
| 
      
 47 
     | 
    
         
            +
                }
         
     | 
| 
       46 
48 
     | 
    
         | 
| 
      
 49 
     | 
    
         
            +
                function POOL_OWNER_ROLE() public view override returns (bytes32 role) {
         
     | 
| 
      
 50 
     | 
    
         
            +
                    return _poolOwnerRole;
         
     | 
| 
      
 51 
     | 
    
         
            +
                }
         
     | 
| 
       47 
52 
     | 
    
         | 
| 
       48 
     | 
    
         
            -
                function createRole( 
     | 
| 
       49 
     | 
    
         
            -
                     
     | 
| 
       50 
     | 
    
         
            -
             
     | 
| 
       51 
     | 
    
         
            -
                    onlyOwner
         
     | 
| 
       52 
     | 
    
         
            -
                    returns(bytes32 role)
         
     | 
| 
       53 
     | 
    
         
            -
                {
         
     | 
| 
      
 53 
     | 
    
         
            +
                function createRole(
         
     | 
| 
      
 54 
     | 
    
         
            +
                    string memory roleName
         
     | 
| 
      
 55 
     | 
    
         
            +
                ) external override onlyOwner returns (bytes32 role) {
         
     | 
| 
       54 
56 
     | 
    
         
             
                    return _createRole(roleName);
         
     | 
| 
       55 
57 
     | 
    
         
             
                }
         
     | 
| 
       56 
58 
     | 
    
         | 
| 
       57 
     | 
    
         
            -
                function _createRole( 
     | 
| 
       58 
     | 
    
         
            -
                     
     | 
| 
       59 
     | 
    
         
            -
             
     | 
| 
       60 
     | 
    
         
            -
             
     | 
| 
       61 
     | 
    
         
            -
                    RoleInfo memory info = RoleInfo(
         
     | 
| 
       62 
     | 
    
         
            -
                        0,
         
     | 
| 
       63 
     | 
    
         
            -
                        roleName,
         
     | 
| 
       64 
     | 
    
         
            -
                        true
         
     | 
| 
       65 
     | 
    
         
            -
                    );
         
     | 
| 
      
 59 
     | 
    
         
            +
                function _createRole(
         
     | 
| 
      
 60 
     | 
    
         
            +
                    string memory roleName
         
     | 
| 
      
 61 
     | 
    
         
            +
                ) internal returns (bytes32 role) {
         
     | 
| 
      
 62 
     | 
    
         
            +
                    RoleInfo memory info = RoleInfo(0, roleName, true);
         
     | 
| 
       66 
63 
     | 
    
         | 
| 
       67 
64 
     | 
    
         
             
                    role = _setRoleInfo(info);
         
     | 
| 
       68 
     | 
    
         
            -
             
     | 
| 
       69 
     | 
    
         
            -
                    
         
     | 
| 
       70 
65 
     | 
    
         
             
                }
         
     | 
| 
       71 
66 
     | 
    
         | 
| 
       72 
67 
     | 
    
         
             
                // TODO move to module
         
     | 
| 
       73 
     | 
    
         
            -
                function disableRole(bytes32 role) 
         
     | 
| 
       74 
     | 
    
         
            -
                    external
         
     | 
| 
       75 
     | 
    
         
            -
                    override
         
     | 
| 
       76 
     | 
    
         
            -
                    onlyOwner
         
     | 
| 
       77 
     | 
    
         
            -
                {
         
     | 
| 
      
 68 
     | 
    
         
            +
                function disableRole(bytes32 role) external override onlyOwner {
         
     | 
| 
       78 
69 
     | 
    
         
             
                    RoleInfo memory info = _info[role];
         
     | 
| 
       79 
70 
     | 
    
         
             
                    require(info.id == role, "ERROR:AOS-001:ROLE_DOES_NOT_EXIST");
         
     | 
| 
       80 
71 
     | 
    
         | 
| 
       81 
72 
     | 
    
         
             
                    info.isActive = false;
         
     | 
| 
       82 
73 
     | 
    
         
             
                    _setRoleInfo(info);
         
     | 
| 
       83 
     | 
    
         
            -
             
     | 
| 
       84 
     | 
    
         
            -
                    
         
     | 
| 
       85 
     | 
    
         
            -
                }   
         
     | 
| 
      
 74 
     | 
    
         
            +
                }
         
     | 
| 
       86 
75 
     | 
    
         | 
| 
       87 
76 
     | 
    
         
             
                // TODO move to module
         
     | 
| 
       88 
     | 
    
         
            -
                function enableRole(bytes32 role) 
         
     | 
| 
       89 
     | 
    
         
            -
                    external
         
     | 
| 
       90 
     | 
    
         
            -
                    override       
         
     | 
| 
       91 
     | 
    
         
            -
                    onlyOwner
         
     | 
| 
       92 
     | 
    
         
            -
                {
         
     | 
| 
      
 77 
     | 
    
         
            +
                function enableRole(bytes32 role) external override onlyOwner {
         
     | 
| 
       93 
78 
     | 
    
         
             
                    RoleInfo memory info = _info[role];
         
     | 
| 
       94 
79 
     | 
    
         
             
                    require(info.id == role, "ERROR:AOS-002:ROLE_DOES_NOT_EXIST");
         
     | 
| 
       95 
80 
     | 
    
         | 
| 
       96 
81 
     | 
    
         
             
                    info.isActive = true;
         
     | 
| 
       97 
82 
     | 
    
         
             
                    _setRoleInfo(info);
         
     | 
| 
      
 83 
     | 
    
         
            +
                }
         
     | 
| 
       98 
84 
     | 
    
         | 
| 
       99 
     | 
    
         
            -
             
     | 
| 
       100 
     | 
    
         
            -
             
     | 
| 
       101 
     | 
    
         
            -
             
     | 
| 
       102 
     | 
    
         
            -
                 
     | 
| 
       103 
     | 
    
         
            -
                    external
         
     | 
| 
       104 
     | 
    
         
            -
                    override     
         
     | 
| 
       105 
     | 
    
         
            -
                    onlyOwner
         
     | 
| 
       106 
     | 
    
         
            -
                {
         
     | 
| 
      
 85 
     | 
    
         
            +
                function grantRole(
         
     | 
| 
      
 86 
     | 
    
         
            +
                    bytes32 role,
         
     | 
| 
      
 87 
     | 
    
         
            +
                    address member
         
     | 
| 
      
 88 
     | 
    
         
            +
                ) external override onlyOwner {
         
     | 
| 
       107 
89 
     | 
    
         
             
                    require(_info[role].id == role, "ERROR:ACM-010:ROLE_NOT_EXISTING");
         
     | 
| 
       108 
90 
     | 
    
         
             
                    require(_info[role].isActive, "ERROR:ACM-011:ROLE_NOT_ACTIVE");
         
     | 
| 
       109 
91 
     | 
    
         | 
| 
         @@ -113,106 +95,71 @@ abstract contract AccessModule is 
     | 
|
| 
       113 
95 
     | 
    
         
             
                    emit LogAccessRoleGranted(role, member, _isRoleMember[role][member]);
         
     | 
| 
       114 
96 
     | 
    
         
             
                }
         
     | 
| 
       115 
97 
     | 
    
         | 
| 
       116 
     | 
    
         
            -
             
     | 
| 
       117 
     | 
    
         
            -
             
     | 
| 
       118 
     | 
    
         
            -
                     
     | 
| 
       119 
     | 
    
         
            -
             
     | 
| 
       120 
     | 
    
         
            -
                    onlyOwner
         
     | 
| 
       121 
     | 
    
         
            -
                {
         
     | 
| 
      
 98 
     | 
    
         
            +
                function revokeRole(
         
     | 
| 
      
 99 
     | 
    
         
            +
                    bytes32 role,
         
     | 
| 
      
 100 
     | 
    
         
            +
                    address member
         
     | 
| 
      
 101 
     | 
    
         
            +
                ) external override onlyOwner {
         
     | 
| 
       122 
102 
     | 
    
         
             
                    require(_info[role].id == role, "ERROR:ACM-020:ROLE_NOT_EXISTING");
         
     | 
| 
       123 
103 
     | 
    
         | 
| 
       124 
104 
     | 
    
         
             
                    _isRoleMember[role][member] = false;
         
     | 
| 
       125 
105 
     | 
    
         
             
                    _roleMembers[role].remove(member);
         
     | 
| 
       126 
     | 
    
         
            -
             
     | 
| 
       127 
     | 
    
         
            -
                    
         
     | 
| 
       128 
106 
     | 
    
         
             
                }
         
     | 
| 
       129 
107 
     | 
    
         | 
| 
       130 
     | 
    
         
            -
             
     | 
| 
       131 
     | 
    
         
            -
             
     | 
| 
       132 
     | 
    
         
            -
                     
     | 
| 
       133 
     | 
    
         
            -
             
     | 
| 
       134 
     | 
    
         
            -
                    override
         
     | 
| 
       135 
     | 
    
         
            -
                    returns(bool)
         
     | 
| 
       136 
     | 
    
         
            -
                {
         
     | 
| 
      
 108 
     | 
    
         
            +
                function hasRole(
         
     | 
| 
      
 109 
     | 
    
         
            +
                    bytes32 role,
         
     | 
| 
      
 110 
     | 
    
         
            +
                    address member
         
     | 
| 
      
 111 
     | 
    
         
            +
                ) external view override returns (bool) {
         
     | 
| 
       137 
112 
     | 
    
         
             
                    return _isRoleMember[role][member];
         
     | 
| 
       138 
113 
     | 
    
         
             
                }
         
     | 
| 
       139 
114 
     | 
    
         | 
| 
       140 
     | 
    
         
            -
             
     | 
| 
       141 
     | 
    
         
            -
             
     | 
| 
       142 
     | 
    
         
            -
             
     | 
| 
       143 
     | 
    
         
            -
                    override
         
     | 
| 
       144 
     | 
    
         
            -
                    view
         
     | 
| 
       145 
     | 
    
         
            -
                    returns(RoleInfo memory info)
         
     | 
| 
       146 
     | 
    
         
            -
                {
         
     | 
| 
      
 115 
     | 
    
         
            +
                function getRoleInfo(
         
     | 
| 
      
 116 
     | 
    
         
            +
                    bytes32 role
         
     | 
| 
      
 117 
     | 
    
         
            +
                ) external view override returns (RoleInfo memory info) {
         
     | 
| 
       147 
118 
     | 
    
         
             
                    return _info[role];
         
     | 
| 
       148 
119 
     | 
    
         
             
                }
         
     | 
| 
       149 
120 
     | 
    
         | 
| 
       150 
     | 
    
         
            -
             
     | 
| 
       151 
     | 
    
         
            -
             
     | 
| 
       152 
     | 
    
         
            -
             
     | 
| 
       153 
     | 
    
         
            -
                    override
         
     | 
| 
       154 
     | 
    
         
            -
                    view
         
     | 
| 
       155 
     | 
    
         
            -
                    returns(bytes32 role)
         
     | 
| 
       156 
     | 
    
         
            -
                {
         
     | 
| 
      
 121 
     | 
    
         
            +
                function getRole(
         
     | 
| 
      
 122 
     | 
    
         
            +
                    uint256 idx
         
     | 
| 
      
 123 
     | 
    
         
            +
                ) external view override returns (bytes32 role) {
         
     | 
| 
       157 
124 
     | 
    
         
             
                    return _roles[idx];
         
     | 
| 
       158 
125 
     | 
    
         
             
                }
         
     | 
| 
       159 
126 
     | 
    
         | 
| 
       160 
     | 
    
         
            -
             
     | 
| 
       161 
     | 
    
         
            -
                function getRoleCount()
         
     | 
| 
       162 
     | 
    
         
            -
                    external
         
     | 
| 
       163 
     | 
    
         
            -
                    override
         
     | 
| 
       164 
     | 
    
         
            -
                    view
         
     | 
| 
       165 
     | 
    
         
            -
                    returns(uint256 roles)
         
     | 
| 
       166 
     | 
    
         
            -
                {
         
     | 
| 
      
 127 
     | 
    
         
            +
                function getRoleCount() external view override returns (uint256 roles) {
         
     | 
| 
       167 
128 
     | 
    
         
             
                    return _roles.length;
         
     | 
| 
       168 
     | 
    
         
            -
                } 
     | 
| 
       169 
     | 
    
         
            -
             
     | 
| 
       170 
     | 
    
         
            -
                function getRoleMemberCount( 
     | 
| 
       171 
     | 
    
         
            -
                     
     | 
| 
       172 
     | 
    
         
            -
             
     | 
| 
       173 
     | 
    
         
            -
                    view
         
     | 
| 
       174 
     | 
    
         
            -
                    returns(uint256 roleMembers)
         
     | 
| 
       175 
     | 
    
         
            -
                {
         
     | 
| 
      
 129 
     | 
    
         
            +
                }
         
     | 
| 
      
 130 
     | 
    
         
            +
             
     | 
| 
      
 131 
     | 
    
         
            +
                function getRoleMemberCount(
         
     | 
| 
      
 132 
     | 
    
         
            +
                    bytes32 role
         
     | 
| 
      
 133 
     | 
    
         
            +
                ) public view override returns (uint256 roleMembers) {
         
     | 
| 
       176 
134 
     | 
    
         
             
                    return _roleMembers[role].length();
         
     | 
| 
       177 
135 
     | 
    
         
             
                }
         
     | 
| 
       178 
136 
     | 
    
         | 
| 
       179 
     | 
    
         
            -
                function getRoleMember( 
     | 
| 
       180 
     | 
    
         
            -
                     
     | 
| 
       181 
     | 
    
         
            -
                     
     | 
| 
       182 
     | 
    
         
            -
             
     | 
| 
       183 
     | 
    
         
            -
                    returns(address roleMembers)
         
     | 
| 
       184 
     | 
    
         
            -
                {
         
     | 
| 
      
 137 
     | 
    
         
            +
                function getRoleMember(
         
     | 
| 
      
 138 
     | 
    
         
            +
                    bytes32 role,
         
     | 
| 
      
 139 
     | 
    
         
            +
                    uint256 idx
         
     | 
| 
      
 140 
     | 
    
         
            +
                ) public view override returns (address roleMembers) {
         
     | 
| 
       185 
141 
     | 
    
         
             
                    return _roleMembers[role].at(idx);
         
     | 
| 
       186 
142 
     | 
    
         
             
                }
         
     | 
| 
       187 
143 
     | 
    
         | 
| 
       188 
     | 
    
         
            -
                function getRoleForName( 
     | 
| 
       189 
     | 
    
         
            -
                     
     | 
| 
       190 
     | 
    
         
            -
             
     | 
| 
       191 
     | 
    
         
            -
                    pure
         
     | 
| 
       192 
     | 
    
         
            -
                    returns(bytes32 role)
         
     | 
| 
       193 
     | 
    
         
            -
                {
         
     | 
| 
      
 144 
     | 
    
         
            +
                function getRoleForName(
         
     | 
| 
      
 145 
     | 
    
         
            +
                    string memory roleName
         
     | 
| 
      
 146 
     | 
    
         
            +
                ) public pure override returns (bytes32 role) {
         
     | 
| 
       194 
147 
     | 
    
         
             
                    return keccak256(abi.encode(roleName));
         
     | 
| 
       195 
148 
     | 
    
         
             
                }
         
     | 
| 
       196 
149 
     | 
    
         | 
| 
       197 
     | 
    
         
            -
             
     | 
| 
       198 
     | 
    
         
            -
             
     | 
| 
       199 
     | 
    
         
            -
             
     | 
| 
       200 
     | 
    
         
            -
                    returns(bytes32 role)
         
     | 
| 
       201 
     | 
    
         
            -
                {
         
     | 
| 
      
 150 
     | 
    
         
            +
                function _setRoleInfo(
         
     | 
| 
      
 151 
     | 
    
         
            +
                    RoleInfo memory info
         
     | 
| 
      
 152 
     | 
    
         
            +
                ) internal returns (bytes32 role) {
         
     | 
| 
       202 
153 
     | 
    
         
             
                    role = info.id;
         
     | 
| 
       203 
154 
     | 
    
         | 
| 
       204 
     | 
    
         
            -
                    if(role == bytes32(0)) {
         
     | 
| 
      
 155 
     | 
    
         
            +
                    if (role == bytes32(0)) {
         
     | 
| 
       205 
156 
     | 
    
         
             
                        role = getRoleForName(info.name);
         
     | 
| 
       206 
157 
     | 
    
         
             
                        // TODO check that this is a new role id
         
     | 
| 
       207 
158 
     | 
    
         | 
| 
       208 
159 
     | 
    
         
             
                        info.id = role;
         
     | 
| 
       209 
160 
     | 
    
         
             
                        _roles.push(role);
         
     | 
| 
       210 
     | 
    
         
            -
             
     | 
| 
       211 
     | 
    
         
            -
                        
         
     | 
| 
       212 
161 
     | 
    
         
             
                    }
         
     | 
| 
       213 
162 
     | 
    
         | 
| 
       214 
163 
     | 
    
         
             
                    _info[role] = info;
         
     | 
| 
       215 
     | 
    
         
            -
             
     | 
| 
       216 
     | 
    
         
            -
                    
         
     | 
| 
       217 
164 
     | 
    
         
             
                }
         
     | 
| 
       218 
165 
     | 
    
         
             
            }
         
     | 
| 
         @@ -4,7 +4,6 @@ pragma solidity ^0.8.19; 
     | 
|
| 
       4 
4 
     | 
    
         
             
            import {IOwnable, IRegistryLinked} from "../../registry/IRegistry.sol";
         
     | 
| 
       5 
5 
     | 
    
         | 
| 
       6 
6 
     | 
    
         
             
            interface IAccess {
         
     | 
| 
       7 
     | 
    
         
            -
             
     | 
| 
       8 
7 
     | 
    
         
             
                struct RoleInfo {
         
     | 
| 
       9 
8 
     | 
    
         
             
                    bytes32 id;
         
     | 
| 
       10 
9 
     | 
    
         
             
                    string name;
         
     | 
| 
         @@ -13,71 +12,52 @@ interface IAccess { 
     | 
|
| 
       13 
12 
     | 
    
         
             
            }
         
     | 
| 
       14 
13 
     | 
    
         | 
| 
       15 
14 
     | 
    
         
             
            interface IAccessCheckRole {
         
     | 
| 
       16 
     | 
    
         
            -
             
     | 
| 
       17 
     | 
    
         
            -
                function hasRole(bytes32 role, address member)
         
     | 
| 
       18 
     | 
    
         
            -
                    external
         
     | 
| 
       19 
     | 
    
         
            -
                    view
         
     | 
| 
       20 
     | 
    
         
            -
                    returns(bool);
         
     | 
| 
      
 15 
     | 
    
         
            +
                function hasRole(bytes32 role, address member) external view returns (bool);
         
     | 
| 
       21 
16 
     | 
    
         
             
            }
         
     | 
| 
       22 
17 
     | 
    
         | 
| 
       23 
18 
     | 
    
         
             
            interface IAccessComponentTypeRoles {
         
     | 
| 
       24 
     | 
    
         
            -
                function PRODUCT_OWNER_ROLE() external view returns(bytes32 role);
         
     | 
| 
       25 
     | 
    
         
            -
                function ORACLE_OWNER_ROLE() external view returns(bytes32 role);
         
     | 
| 
       26 
     | 
    
         
            -
                function POOL_OWNER_ROLE() external view returns(bytes32 role);
         
     | 
| 
       27 
     | 
    
         
            -
            }
         
     | 
| 
      
 19 
     | 
    
         
            +
                function PRODUCT_OWNER_ROLE() external view returns (bytes32 role);
         
     | 
| 
       28 
20 
     | 
    
         | 
| 
      
 21 
     | 
    
         
            +
                function ORACLE_OWNER_ROLE() external view returns (bytes32 role);
         
     | 
| 
       29 
22 
     | 
    
         | 
| 
       30 
     | 
    
         
            -
             
     | 
| 
      
 23 
     | 
    
         
            +
                function POOL_OWNER_ROLE() external view returns (bytes32 role);
         
     | 
| 
      
 24 
     | 
    
         
            +
            }
         
     | 
| 
      
 25 
     | 
    
         
            +
             
     | 
| 
      
 26 
     | 
    
         
            +
            interface IAccessModule is
         
     | 
| 
       31 
27 
     | 
    
         
             
                IOwnable,
         
     | 
| 
       32 
28 
     | 
    
         
             
                IRegistryLinked,
         
     | 
| 
       33 
29 
     | 
    
         
             
                IAccess,
         
     | 
| 
       34 
30 
     | 
    
         
             
                IAccessComponentTypeRoles,
         
     | 
| 
       35 
31 
     | 
    
         
             
                IAccessCheckRole
         
     | 
| 
       36 
32 
     | 
    
         
             
            {
         
     | 
| 
      
 33 
     | 
    
         
            +
                function createRole(string memory roleName) external returns (bytes32 role);
         
     | 
| 
       37 
34 
     | 
    
         | 
| 
       38 
     | 
    
         
            -
                function  
     | 
| 
       39 
     | 
    
         
            -
                    external
         
     | 
| 
       40 
     | 
    
         
            -
                    returns(bytes32 role);
         
     | 
| 
       41 
     | 
    
         
            -
             
     | 
| 
       42 
     | 
    
         
            -
                function enableRole(bytes32 role)
         
     | 
| 
       43 
     | 
    
         
            -
                    external;       
         
     | 
| 
      
 35 
     | 
    
         
            +
                function enableRole(bytes32 role) external;
         
     | 
| 
       44 
36 
     | 
    
         | 
| 
       45 
     | 
    
         
            -
                function disableRole(bytes32 role)
         
     | 
| 
       46 
     | 
    
         
            -
                    external;       
         
     | 
| 
      
 37 
     | 
    
         
            +
                function disableRole(bytes32 role) external;
         
     | 
| 
       47 
38 
     | 
    
         | 
| 
       48 
     | 
    
         
            -
                function grantRole(bytes32 role, address member)
         
     | 
| 
       49 
     | 
    
         
            -
                    external;       
         
     | 
| 
      
 39 
     | 
    
         
            +
                function grantRole(bytes32 role, address member) external;
         
     | 
| 
       50 
40 
     | 
    
         | 
| 
       51 
     | 
    
         
            -
                function revokeRole(bytes32 role, address member)
         
     | 
| 
       52 
     | 
    
         
            -
                    external;       
         
     | 
| 
      
 41 
     | 
    
         
            +
                function revokeRole(bytes32 role, address member) external;
         
     | 
| 
       53 
42 
     | 
    
         | 
| 
       54 
     | 
    
         
            -
                function getRole(uint256 idx)
         
     | 
| 
       55 
     | 
    
         
            -
                    external
         
     | 
| 
       56 
     | 
    
         
            -
                    view
         
     | 
| 
       57 
     | 
    
         
            -
                    returns(bytes32 role);
         
     | 
| 
      
 43 
     | 
    
         
            +
                function getRole(uint256 idx) external view returns (bytes32 role);
         
     | 
| 
       58 
44 
     | 
    
         | 
| 
       59 
     | 
    
         
            -
                function getRoleInfo( 
     | 
| 
       60 
     | 
    
         
            -
                     
     | 
| 
       61 
     | 
    
         
            -
             
     | 
| 
       62 
     | 
    
         
            -
                    returns(RoleInfo memory info);
         
     | 
| 
      
 45 
     | 
    
         
            +
                function getRoleInfo(
         
     | 
| 
      
 46 
     | 
    
         
            +
                    bytes32 role
         
     | 
| 
      
 47 
     | 
    
         
            +
                ) external view returns (RoleInfo memory info);
         
     | 
| 
       63 
48 
     | 
    
         | 
| 
       64 
     | 
    
         
            -
                function getRoleForName( 
     | 
| 
       65 
     | 
    
         
            -
                     
     | 
| 
       66 
     | 
    
         
            -
             
     | 
| 
       67 
     | 
    
         
            -
                    returns(bytes32 role);
         
     | 
| 
      
 49 
     | 
    
         
            +
                function getRoleForName(
         
     | 
| 
      
 50 
     | 
    
         
            +
                    string memory roleName
         
     | 
| 
      
 51 
     | 
    
         
            +
                ) external pure returns (bytes32 role);
         
     | 
| 
       68 
52 
     | 
    
         | 
| 
       69 
     | 
    
         
            -
                function getRoleCount()
         
     | 
| 
       70 
     | 
    
         
            -
                    external
         
     | 
| 
       71 
     | 
    
         
            -
                    view
         
     | 
| 
       72 
     | 
    
         
            -
                    returns(uint256 roles);
         
     | 
| 
      
 53 
     | 
    
         
            +
                function getRoleCount() external view returns (uint256 roles);
         
     | 
| 
       73 
54 
     | 
    
         | 
| 
       74 
     | 
    
         
            -
                function getRoleMemberCount( 
     | 
| 
       75 
     | 
    
         
            -
                     
     | 
| 
       76 
     | 
    
         
            -
             
     | 
| 
       77 
     | 
    
         
            -
                    returns(uint256 roleMembers);
         
     | 
| 
      
 55 
     | 
    
         
            +
                function getRoleMemberCount(
         
     | 
| 
      
 56 
     | 
    
         
            +
                    bytes32 role
         
     | 
| 
      
 57 
     | 
    
         
            +
                ) external view returns (uint256 roleMembers);
         
     | 
| 
       78 
58 
     | 
    
         | 
| 
       79 
     | 
    
         
            -
                function getRoleMember( 
     | 
| 
       80 
     | 
    
         
            -
                     
     | 
| 
       81 
     | 
    
         
            -
                     
     | 
| 
       82 
     | 
    
         
            -
             
     | 
| 
       83 
     | 
    
         
            -
            }
         
     | 
| 
      
 59 
     | 
    
         
            +
                function getRoleMember(
         
     | 
| 
      
 60 
     | 
    
         
            +
                    bytes32 role,
         
     | 
| 
      
 61 
     | 
    
         
            +
                    uint256 idx
         
     | 
| 
      
 62 
     | 
    
         
            +
                ) external view returns (address roleMembers);
         
     | 
| 
      
 63 
     | 
    
         
            +
            }
         
     |