@etherisc/gif-next 0.0.2-790d44b-698 → 0.0.2-7acbd99-227
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 +40 -25
- package/artifacts/contracts/components/BaseComponent.sol/BaseComponent.dbg.json +1 -1
- package/artifacts/contracts/components/BaseComponent.sol/BaseComponent.json +80 -41
- package/artifacts/contracts/components/Distribution.sol/Distribution.dbg.json +1 -1
- package/artifacts/contracts/components/Distribution.sol/Distribution.json +101 -61
- package/artifacts/contracts/components/IBaseComponent.sol/IBaseComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IBaseComponent.sol/IBaseComponent.json +43 -40
- package/artifacts/contracts/components/IDistributionComponent.sol/IDistributionComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IDistributionComponent.sol/IDistributionComponent.json +55 -52
- package/artifacts/contracts/components/IPoolComponent.sol/IPoolComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IPoolComponent.sol/IPoolComponent.json +100 -113
- package/artifacts/contracts/components/IProductComponent.sol/IProductComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IProductComponent.sol/IProductComponent.json +50 -47
- package/artifacts/contracts/components/Pool.sol/Pool.dbg.json +1 -1
- package/artifacts/contracts/components/Pool.sol/Pool.json +150 -126
- package/artifacts/contracts/components/Product.sol/Product.dbg.json +1 -1
- package/artifacts/contracts/components/Product.sol/Product.json +110 -52
- 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/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/SimpleStateMachine.sol/SimpleStateMachine.dbg.json +1 -1
- 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 +196 -72
- 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 +281 -155
- package/artifacts/contracts/instance/base/ComponentServiceBase.sol/ComponentServiceBase.dbg.json +1 -1
- package/artifacts/contracts/instance/base/ComponentServiceBase.sol/ComponentServiceBase.json +61 -32
- package/artifacts/contracts/instance/base/IInstanceBase.sol/IInstanceBase.dbg.json +1 -1
- package/artifacts/contracts/instance/base/IInstanceBase.sol/IInstanceBase.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 +43 -40
- package/artifacts/contracts/instance/base/InstanceBase.sol/InstanceBase.dbg.json +1 -1
- package/artifacts/contracts/instance/base/InstanceBase.sol/InstanceBase.json +64 -48
- package/artifacts/contracts/instance/base/KeyValueStore.sol/KeyValueStore.dbg.json +1 -1
- package/artifacts/contracts/instance/base/Lifecycle.sol/Lifecycle.dbg.json +1 -1
- 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 +57 -41
- package/artifacts/contracts/instance/module/access/Access.sol/AccessModule.dbg.json +1 -1
- package/artifacts/contracts/instance/module/access/IAccess.sol/IAccess.dbg.json +1 -1
- package/artifacts/contracts/instance/module/access/IAccess.sol/IAccessModule.dbg.json +1 -1
- 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/PolicyModule.sol/PolicyModule.dbg.json +1 -1
- 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/IPoolModule.sol/IPoolModule.json +29 -9
- package/artifacts/contracts/instance/module/pool/PoolModule.sol/PoolModule.dbg.json +1 -1
- package/artifacts/contracts/instance/module/pool/PoolModule.sol/PoolModule.json +28 -8
- 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/ITreasury.sol/ITreasuryModule.json +138 -11
- 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/module/treasury/TreasuryModule.sol/TreasuryModule.json +138 -11
- package/artifacts/contracts/instance/service/ComponentOwnerService.sol/ComponentOwnerService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/ComponentOwnerService.sol/ComponentOwnerService.json +164 -69
- package/artifacts/contracts/instance/service/DistributionService.sol/DistributionService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/DistributionService.sol/DistributionService.json +86 -44
- package/artifacts/contracts/instance/service/IComponentOwnerService.sol/IComponentOwnerService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IComponentOwnerService.sol/IComponentOwnerService.json +43 -59
- package/artifacts/contracts/instance/service/IDistributionService.sol/IDistributionService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IDistributionService.sol/IDistributionService.json +43 -40
- package/artifacts/contracts/instance/service/IPoolService.sol/IPoolService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IPoolService.sol/IPoolService.json +43 -40
- package/artifacts/contracts/instance/service/IProductService.sol/IProductService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IProductService.sol/IProductService.json +43 -40
- package/artifacts/contracts/instance/service/PoolService.sol/PoolService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/PoolService.sol/PoolService.json +88 -46
- package/artifacts/contracts/instance/service/ProductService.sol/ProductService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/ProductService.sol/ProductService.json +110 -68
- package/artifacts/contracts/registry/ChainNft.sol/ChainNft.dbg.json +1 -1
- package/artifacts/contracts/registry/ChainNft.sol/ChainNft.json +141 -12
- package/artifacts/contracts/registry/IChainNft.sol/IChainNft.dbg.json +1 -1
- package/artifacts/contracts/registry/IChainNft.sol/IChainNft.json +5 -0
- package/artifacts/contracts/registry/IRegistry.sol/IRegistry.dbg.json +1 -1
- package/artifacts/contracts/registry/IRegistry.sol/IRegistry.json +293 -40
- package/artifacts/contracts/registry/IRegistryLinked.sol/IRegistryLinked.dbg.json +1 -1
- package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.dbg.json +4 -0
- package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.json +668 -0
- package/artifacts/contracts/registry/ITransferInterceptor.sol/ITransferInterceptor.dbg.json +4 -0
- package/artifacts/contracts/registry/ITransferInterceptor.sol/ITransferInterceptor.json +34 -0
- package/artifacts/contracts/registry/Registry.sol/Registry.dbg.json +1 -1
- package/artifacts/contracts/registry/Registry.sol/Registry.json +390 -292
- package/artifacts/contracts/registry/Registry.sol/RegistryCreationCode.dbg.json +4 -0
- package/artifacts/contracts/registry/Registry.sol/RegistryCreationCode.json +150 -0
- package/artifacts/contracts/registry/RegistryInstaller.sol/RegistryInstaller.dbg.json +4 -0
- package/artifacts/contracts/registry/RegistryInstaller.sol/RegistryInstaller.json +344 -0
- package/artifacts/contracts/registry/RegistryService.sol/RegistryService.dbg.json +4 -0
- package/artifacts/contracts/registry/RegistryService.sol/RegistryService.json +861 -0
- 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/IOwnable.sol/IOwnable.dbg.json +1 -1
- package/artifacts/contracts/shared/IRegisterable.sol/IRegisterable.dbg.json +1 -1
- package/artifacts/contracts/shared/IRegisterable.sol/IRegisterable.json +43 -40
- package/artifacts/contracts/shared/IVersionable.sol/IVersionable.dbg.json +1 -1
- package/artifacts/contracts/shared/ProxyManager.sol/ProxyManager.dbg.json +4 -0
- package/artifacts/contracts/shared/ProxyManager.sol/ProxyManager.json +310 -0
- package/artifacts/contracts/shared/Registerable.sol/Registerable.dbg.json +1 -1
- package/artifacts/contracts/shared/Registerable.sol/Registerable.json +76 -37
- package/artifacts/contracts/shared/UpgradableProxyWithAdmin.sol/UpgradableProxyWithAdmin.dbg.json +4 -0
- package/artifacts/contracts/shared/{Proxy.sol/ProxyWithProxyAdminGetter.json → UpgradableProxyWithAdmin.sol/UpgradableProxyWithAdmin.json} +4 -4
- 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 +101 -61
- package/artifacts/contracts/test/TestFee.sol/TestFee.dbg.json +1 -1
- package/artifacts/contracts/test/TestPool.sol/TestPool.dbg.json +1 -1
- package/artifacts/contracts/test/TestPool.sol/TestPool.json +150 -126
- package/artifacts/contracts/test/TestProduct.sol/TestProduct.dbg.json +1 -1
- package/artifacts/contracts/test/TestProduct.sol/TestProduct.json +115 -58
- package/artifacts/contracts/test/TestRegisterable.sol/TestRegisterable.dbg.json +1 -1
- package/artifacts/contracts/test/TestRegisterable.sol/TestRegisterable.json +93 -39
- package/artifacts/contracts/test/TestRoleId.sol/TestRoleId.dbg.json +1 -1
- package/artifacts/contracts/test/TestService.sol/TestService.dbg.json +1 -1
- package/artifacts/contracts/test/TestService.sol/TestService.json +80 -51
- package/artifacts/contracts/test/TestToken.sol/TestUsdc.dbg.json +1 -1
- package/artifacts/contracts/test/TestVersion.sol/TestVersion.dbg.json +1 -1
- package/artifacts/contracts/test/TestVersion.sol/TestVersion.json +2 -2
- package/artifacts/contracts/test/TestVersionable.sol/TestVersionable.dbg.json +1 -1
- package/artifacts/contracts/test/TestVersionable.sol/TestVersionable.json +2 -2
- package/artifacts/contracts/test/Usdc.sol/USDC.dbg.json +1 -1
- package/artifacts/contracts/types/AddressSet.sol/LibAddressSet.dbg.json +1 -1
- package/artifacts/contracts/types/Blocknumber.sol/BlocknumberLib.dbg.json +1 -1
- package/artifacts/contracts/types/ChainId.sol/ChainIdLib.dbg.json +1 -1
- package/artifacts/contracts/types/Fee.sol/FeeLib.dbg.json +1 -1
- package/artifacts/contracts/types/Key32.sol/Key32Lib.dbg.json +1 -1
- package/artifacts/contracts/types/NftId.sol/NftIdLib.dbg.json +1 -1
- package/artifacts/contracts/types/NftIdSet.sol/LibNftIdSet.dbg.json +1 -1
- package/artifacts/contracts/types/ObjectType.sol/ObjectTypeLib.dbg.json +1 -1
- package/artifacts/contracts/types/ReferralId.sol/ReferralIdLib.dbg.json +1 -1
- package/artifacts/contracts/types/RiskId.sol/RiskIdLib.dbg.json +1 -1
- package/artifacts/contracts/types/RoleId.sol/RoleIdLib.dbg.json +1 -1
- package/artifacts/contracts/types/StateId.sol/StateIdLib.dbg.json +1 -1
- package/artifacts/contracts/types/Timestamp.sol/TimestampLib.dbg.json +1 -1
- package/artifacts/contracts/types/UFixed.sol/UFixedMathLib.dbg.json +1 -1
- package/artifacts/contracts/types/Version.sol/VersionLib.dbg.json +1 -1
- package/artifacts/contracts/types/Version.sol/VersionLib.json +2 -2
- package/artifacts/contracts/types/Version.sol/VersionPartLib.dbg.json +1 -1
- package/artifacts/contracts/types/Version.sol/VersionPartLib.json +2 -2
- package/contracts/components/BaseComponent.sol +12 -27
- package/contracts/components/Distribution.sol +29 -6
- package/contracts/components/IBaseComponent.sol +2 -2
- package/contracts/components/IPoolComponent.sol +2 -8
- package/contracts/components/IProductComponent.sol +2 -1
- package/contracts/components/Pool.sol +84 -73
- package/contracts/components/Product.sol +85 -13
- package/contracts/instance/IInstance.sol +4 -3
- package/contracts/instance/Instance.sol +14 -3
- package/contracts/instance/base/ComponentServiceBase.sol +13 -6
- package/contracts/instance/base/IInstanceBase.sol +3 -2
- package/contracts/instance/base/InstanceBase.sol +6 -8
- package/contracts/instance/base/ServiceBase.sol +19 -13
- package/contracts/instance/module/component/ComponentModule.sol +5 -4
- package/contracts/instance/module/component/IComponent.sol +2 -2
- package/contracts/instance/module/pool/IPoolModule.sol +4 -3
- package/contracts/instance/module/pool/PoolModule.sol +12 -7
- package/contracts/instance/module/treasury/ITreasury.sol +7 -5
- package/contracts/instance/module/treasury/TokenHandler.sol +2 -2
- package/contracts/instance/module/treasury/TreasuryModule.sol +21 -28
- package/contracts/instance/service/ComponentOwnerService.sol +181 -66
- package/contracts/instance/service/DistributionService.sol +6 -11
- package/contracts/instance/service/IComponentOwnerService.sol +0 -2
- package/contracts/instance/service/PoolService.sol +19 -19
- package/contracts/instance/service/ProductService.sol +20 -20
- package/contracts/registry/ChainNft.sol +43 -15
- package/contracts/registry/IChainNft.sol +3 -2
- package/contracts/registry/IRegistry.sol +44 -28
- package/contracts/registry/IRegistryService.sol +29 -0
- package/contracts/registry/ITransferInterceptor.sol +6 -0
- package/contracts/registry/Registry.sol +368 -328
- package/contracts/registry/RegistryInstaller.sol +100 -0
- package/contracts/registry/RegistryService.sol +383 -0
- package/contracts/shared/ERC165.sol +1 -1
- package/contracts/shared/IRegisterable.sol +7 -9
- package/contracts/shared/IVersionable.sol +15 -13
- package/contracts/shared/ProxyManager.sol +115 -0
- package/contracts/shared/Registerable.sol +74 -43
- package/contracts/shared/UpgradableProxyWithAdmin.sol +16 -0
- package/contracts/shared/Versionable.sol +46 -40
- package/contracts/test/TestDistribution.sol +3 -2
- package/contracts/test/TestPool.sol +4 -2
- package/contracts/test/TestProduct.sol +4 -2
- package/contracts/test/TestRegisterable.sol +5 -6
- package/contracts/test/TestService.sol +5 -11
- package/contracts/types/Version.sol +1 -0
- package/package.json +1 -1
- package/artifacts/contracts/shared/Proxy.sol/ProxyDeployer.dbg.json +0 -4
- package/artifacts/contracts/shared/Proxy.sol/ProxyDeployer.json +0 -248
- package/artifacts/contracts/shared/Proxy.sol/ProxyWithProxyAdminGetter.dbg.json +0 -4
- package/contracts/experiment/statemachine/README.md +0 -112
- package/contracts/shared/Proxy.sol +0 -94
@@ -1,21 +1,39 @@
|
|
1
1
|
// SPDX-License-Identifier: Apache-2.0
|
2
|
-
pragma solidity ^0.8.
|
2
|
+
pragma solidity ^0.8.20;
|
3
|
+
|
4
|
+
import {Initializable} from "@openzeppelin5/contracts/proxy/utils/Initializable.sol";
|
3
5
|
|
4
6
|
import {NftId, zeroNftId} from "../types/NftId.sol";
|
5
7
|
import {ObjectType} from "../types/ObjectType.sol";
|
6
8
|
|
7
9
|
import {IRegistry} from "../registry/IRegistry.sol";
|
8
10
|
import {IRegisterable} from "./IRegisterable.sol";
|
11
|
+
import {Versionable} from "./Versionable.sol";
|
9
12
|
|
10
13
|
import {ERC165} from "./ERC165.sol";
|
11
14
|
|
12
15
|
abstract contract Registerable is
|
13
16
|
ERC165,
|
14
|
-
IRegisterable
|
17
|
+
IRegisterable,
|
18
|
+
Initializable
|
15
19
|
{
|
16
|
-
|
17
|
-
|
18
|
-
|
20
|
+
// keccak256(abi.encode(uint256(keccak256("gif-next.contracts.shared.Registerable.sol")) - 1)) & ~bytes32(uint256(0xff));
|
21
|
+
bytes32 public constant REGISTERABLE_LOCATION_V1 = 0x6548007c3f4340f82f348c576c0ff69f4f529cadd5ad41f96aae61abceeaa300;
|
22
|
+
|
23
|
+
struct RegisterableStorage {
|
24
|
+
IRegistry _registry;
|
25
|
+
NftId _parentNftId;
|
26
|
+
address _initialOwner;
|
27
|
+
ObjectType _objectType;
|
28
|
+
bool _isInterceptor;
|
29
|
+
bytes _data;
|
30
|
+
}
|
31
|
+
|
32
|
+
function _getRegisterableStorage() private pure returns (RegisterableStorage storage $) {
|
33
|
+
assembly {
|
34
|
+
$.slot := REGISTERABLE_LOCATION_V1
|
35
|
+
}
|
36
|
+
}
|
19
37
|
|
20
38
|
modifier onlyOwner() virtual {
|
21
39
|
require(
|
@@ -25,62 +43,75 @@ abstract contract Registerable is
|
|
25
43
|
_;
|
26
44
|
}
|
27
45
|
|
28
|
-
|
46
|
+
function _initializeRegisterable(
|
29
47
|
address registryAddress,
|
30
|
-
NftId parentNftId
|
48
|
+
NftId parentNftId,
|
49
|
+
ObjectType objectType,
|
50
|
+
bool isInterceptor,
|
51
|
+
address initialOwner,
|
52
|
+
bytes memory data
|
31
53
|
)
|
32
|
-
|
54
|
+
internal
|
55
|
+
//onlyInitializing//TODO uncomment when "fully" upgradeable
|
56
|
+
virtual
|
33
57
|
{
|
34
58
|
require(
|
35
|
-
|
59
|
+
registryAddress != address(0),
|
36
60
|
"ERROR:RGB-010:REGISTRY_ZERO"
|
37
61
|
);
|
38
62
|
|
39
|
-
|
40
|
-
|
41
|
-
_registry.supportsInterface(type(IRegistry).interfaceId),
|
42
|
-
"ERROR:RGB-011:NOT_REGISTRY"
|
43
|
-
);
|
63
|
+
// TODO check parentNftId -> registry.isRegistered(parentNftId)
|
64
|
+
// TODO check object-parent type pair -> registry.isValidTypeCombo() or something...verify with registry that setup will be able to register...
|
44
65
|
|
45
|
-
|
66
|
+
IRegistry registry = IRegistry(registryAddress);
|
46
67
|
require(
|
47
|
-
|
48
|
-
"ERROR:RGB-
|
68
|
+
registry.supportsInterface(type(IRegistry).interfaceId),
|
69
|
+
"ERROR:RGB-011:NOT_REGISTRY"
|
49
70
|
);
|
50
71
|
|
51
|
-
|
72
|
+
RegisterableStorage storage $ = _getRegisterableStorage();
|
73
|
+
$._registry = registry;
|
74
|
+
$._parentNftId = parentNftId;
|
75
|
+
$._objectType = objectType;
|
76
|
+
$._isInterceptor = isInterceptor;
|
77
|
+
$._initialOwner = initialOwner;// not msg.sender because called in proxy constructor where msg.sender is proxy deployer
|
78
|
+
$._data = data;
|
52
79
|
|
53
|
-
|
54
|
-
_registerInterface(type(IRegisterable).interfaceId);
|
80
|
+
_registerInterface(type(Registerable).interfaceId);
|
55
81
|
}
|
56
82
|
|
57
|
-
// from
|
58
|
-
function
|
59
|
-
return _registry.
|
83
|
+
// from IOwnable
|
84
|
+
function getOwner() public view virtual returns (address) {
|
85
|
+
return _getRegisterableStorage()._registry.ownerOf(address(this));
|
60
86
|
}
|
61
87
|
|
62
|
-
|
63
|
-
|
88
|
+
// from IRegisterable
|
89
|
+
function getRegistry() public view virtual returns (IRegistry registry) {
|
90
|
+
return _getRegisterableStorage()._registry;
|
64
91
|
}
|
65
92
|
|
66
|
-
function
|
67
|
-
|
68
|
-
if(nftId == zeroNftId()) {
|
69
|
-
return _initialOwner;
|
70
|
-
}
|
71
|
-
|
72
|
-
return _registry.getOwner(nftId);
|
73
|
-
}
|
74
|
-
|
75
|
-
function getNftId() public view override returns (NftId nftId) {
|
76
|
-
return _registry.getNftId(address(this));
|
93
|
+
function getNftId() public view virtual returns (NftId nftId) {
|
94
|
+
return _getRegisterableStorage()._registry.getNftId(address(this));
|
77
95
|
}
|
78
96
|
|
79
|
-
function
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
97
|
+
function getInitialInfo()
|
98
|
+
public
|
99
|
+
view
|
100
|
+
virtual
|
101
|
+
returns (IRegistry.ObjectInfo memory, bytes memory data)
|
102
|
+
{
|
103
|
+
RegisterableStorage storage $ = _getRegisterableStorage();
|
104
|
+
return (
|
105
|
+
IRegistry.ObjectInfo(
|
106
|
+
zeroNftId(),
|
107
|
+
$._parentNftId,
|
108
|
+
$._objectType,
|
109
|
+
$._isInterceptor,
|
110
|
+
address(this),
|
111
|
+
$._initialOwner,
|
112
|
+
$._data
|
113
|
+
),
|
114
|
+
bytes("")
|
115
|
+
);
|
85
116
|
}
|
86
|
-
}
|
117
|
+
}
|
@@ -0,0 +1,16 @@
|
|
1
|
+
// SPDX-License-Identifier: Apache-2.0
|
2
|
+
pragma solidity ^0.8.20;
|
3
|
+
|
4
|
+
import {ProxyAdmin} from "@openzeppelin5/contracts/proxy/transparent/ProxyAdmin.sol";
|
5
|
+
import {TransparentUpgradeableProxy, ITransparentUpgradeableProxy} from "@openzeppelin5/contracts/proxy/transparent/TransparentUpgradeableProxy.sol";
|
6
|
+
|
7
|
+
import {IVersionable} from "./IVersionable.sol";
|
8
|
+
|
9
|
+
contract UpgradableProxyWithAdmin is TransparentUpgradeableProxy {
|
10
|
+
|
11
|
+
constructor(address implementation, address initialProxyAdminOwner, bytes memory data)
|
12
|
+
TransparentUpgradeableProxy(implementation, initialProxyAdminOwner, data)
|
13
|
+
{}
|
14
|
+
|
15
|
+
function getProxyAdmin() external returns (ProxyAdmin) { return ProxyAdmin(_proxyAdmin()); }
|
16
|
+
}
|
@@ -15,6 +15,10 @@ abstract contract Versionable is
|
|
15
15
|
Initializable,
|
16
16
|
IVersionable
|
17
17
|
{
|
18
|
+
// keccak256(abi.encode(uint256(keccak256("gif-next.contracts.shared.Versionable.sol")) - 1)) & ~bytes32(uint256(0xff))
|
19
|
+
bytes32 private constant VERSIONABLE_LOCATION_V1 = 0x4f61291a8ac3d020d0a7d919a76b8592aa88385744dee3f8b4f3873b969ed900;
|
20
|
+
|
21
|
+
|
18
22
|
/// @custom:storage-location erc7201:gif-next.contracts.shared.Versionable.sol
|
19
23
|
struct VersionableStorage {
|
20
24
|
mapping(Version version => VersionInfo info) _versionHistory;
|
@@ -22,30 +26,24 @@ abstract contract Versionable is
|
|
22
26
|
Version _v1;
|
23
27
|
}
|
24
28
|
|
25
|
-
// keccak256(abi.encode(uint256(keccak256("gif-next.contracts.shared.Versionable.sol")) - 1)) & ~bytes32(uint256(0xff))
|
26
|
-
bytes32 private constant VersionableStorageLocation = 0x4f61291a8ac3d020d0a7d919a76b8592aa88385744dee3f8b4f3873b969ed900;
|
27
|
-
|
28
|
-
function _getVersionableStorage() private pure returns (VersionableStorage storage $) {
|
29
|
-
assembly {
|
30
|
-
$.slot := VersionableStorageLocation
|
31
|
-
}
|
32
|
-
}
|
33
29
|
|
34
30
|
constructor() {
|
35
31
|
_disableInitializers();
|
36
32
|
}
|
37
|
-
|
33
|
+
// TODO write test where new version of private _updateVersionHistory is added and used...
|
38
34
|
function initialize(
|
39
35
|
address implementation,
|
40
|
-
address activatedBy,
|
36
|
+
address activatedBy,
|
41
37
|
bytes memory data
|
42
38
|
)
|
43
39
|
public
|
44
40
|
initializer
|
45
41
|
{
|
46
42
|
_updateVersionHistory(implementation, activatedBy);
|
47
|
-
_initialize(data);
|
43
|
+
_initialize(activatedBy, data);
|
48
44
|
}
|
45
|
+
|
46
|
+
// TODO activatedBy MUST ALWAYS be an owner?
|
49
47
|
function upgrade(
|
50
48
|
address implementation,
|
51
49
|
address activatedBy,
|
@@ -57,13 +55,42 @@ abstract contract Versionable is
|
|
57
55
|
_updateVersionHistory(implementation, activatedBy);
|
58
56
|
_upgrade(data);
|
59
57
|
}
|
58
|
+
|
59
|
+
function isInitialized(Version _version) public override view returns(bool) {
|
60
|
+
return _getVersionableStorage()._versionHistory[_version].activatedIn.toInt() > 0;
|
61
|
+
}
|
62
|
+
|
63
|
+
function getVersion() public pure virtual returns(Version);
|
64
|
+
|
65
|
+
function getVersionCount() public view override returns(uint256) {
|
66
|
+
return _getVersionableStorage()._versions.length;
|
67
|
+
}
|
68
|
+
|
69
|
+
function getVersion(uint256 idx) public view override returns(Version) {
|
70
|
+
return _getVersionableStorage()._versions[idx];
|
71
|
+
}
|
72
|
+
|
73
|
+
function getVersionInfo(Version _version) public override view returns(VersionInfo memory) {
|
74
|
+
return _getVersionableStorage()._versionHistory[_version];
|
75
|
+
}
|
76
|
+
|
77
|
+
function getInitializedVersion() public view returns(uint64) {
|
78
|
+
return _getInitializedVersion();
|
79
|
+
}
|
80
|
+
|
81
|
+
|
82
|
+
|
60
83
|
// IMPORTANT each version must implement this function
|
61
84
|
// each implementation MUST use onlyInitialising modifier
|
62
|
-
|
85
|
+
// each implementation MUST call intializers of all base contracts...
|
86
|
+
function _initialize(address owner, bytes memory data)
|
63
87
|
internal
|
64
88
|
onlyInitializing
|
65
89
|
virtual
|
66
|
-
{
|
90
|
+
{
|
91
|
+
revert();
|
92
|
+
}
|
93
|
+
|
67
94
|
|
68
95
|
// IMPORTANT each version except version "1" must implement this function
|
69
96
|
// each implementation MUST use onlyInitialising modifier
|
@@ -75,6 +102,12 @@ abstract contract Versionable is
|
|
75
102
|
revert();
|
76
103
|
}
|
77
104
|
|
105
|
+
function _getVersionableStorage() private pure returns (VersionableStorage storage $) {
|
106
|
+
assembly {
|
107
|
+
$.slot := VERSIONABLE_LOCATION_V1
|
108
|
+
}
|
109
|
+
}
|
110
|
+
|
78
111
|
// can only be called once per contract
|
79
112
|
// needs to be called inside the proxy upgrade tx
|
80
113
|
// TODO run reinitializer(version().toUint64()) modifier after "version()" is checked,
|
@@ -111,31 +144,4 @@ abstract contract Versionable is
|
|
111
144
|
|
112
145
|
emit LogVersionableInitialized(thisVersion, implementation, activatedBy);
|
113
146
|
}
|
114
|
-
|
115
|
-
// TODO previous version(s) can not be active -> check that _version is the latest one
|
116
|
-
function isInitialized(Version _version) public override view returns(bool) {
|
117
|
-
return _getVersionableStorage()._versionHistory[_version].activatedIn.toInt() > 0;
|
118
|
-
}
|
119
|
-
|
120
|
-
|
121
|
-
function getVersion() public pure virtual returns(Version);
|
122
|
-
|
123
|
-
|
124
|
-
function getVersionCount() external view override returns(uint256) {
|
125
|
-
return _getVersionableStorage()._versions.length;
|
126
|
-
}
|
127
|
-
|
128
|
-
function getVersion(uint256 idx) external view override returns(Version) {
|
129
|
-
return _getVersionableStorage()._versions[idx];
|
130
|
-
}
|
131
|
-
|
132
|
-
|
133
|
-
function getVersionInfo(Version _version) external override view returns(VersionInfo memory) {
|
134
|
-
return _getVersionableStorage()._versionHistory[_version];
|
135
|
-
}
|
136
|
-
|
137
|
-
function getInitializedVersion() external view returns(uint64)
|
138
|
-
{
|
139
|
-
return _getInitializedVersion();
|
140
|
-
}
|
141
147
|
}
|
@@ -13,9 +13,10 @@ contract TestDistribution is Distribution {
|
|
13
13
|
NftId instanceNftid,
|
14
14
|
address token,
|
15
15
|
bool isVerifying,
|
16
|
-
Fee memory distributionFee
|
16
|
+
Fee memory distributionFee,
|
17
|
+
address initialOwner
|
17
18
|
)
|
18
|
-
Distribution(registry, instanceNftid, token, isVerifying, distributionFee)
|
19
|
+
Distribution(registry, instanceNftid, token, isVerifying, distributionFee, initialOwner)
|
19
20
|
// solhint-disable-next-line no-empty-blocks
|
20
21
|
{}
|
21
22
|
}
|
@@ -13,13 +13,15 @@ contract TestPool is Pool {
|
|
13
13
|
address registry,
|
14
14
|
NftId instanceNftid,
|
15
15
|
address token,
|
16
|
+
bool isInterceptor,
|
16
17
|
bool isVerifying,
|
17
18
|
UFixed collateralizationLevel,
|
18
19
|
Fee memory poolFee,
|
19
20
|
Fee memory stakingFee,
|
20
|
-
Fee memory performanceFee
|
21
|
+
Fee memory performanceFee,
|
22
|
+
address initialOwner
|
21
23
|
)
|
22
|
-
Pool(registry, instanceNftid, token, isVerifying, collateralizationLevel, poolFee, stakingFee, performanceFee)
|
24
|
+
Pool(registry, instanceNftid, token, isInterceptor, isVerifying, collateralizationLevel, poolFee, stakingFee, performanceFee, initialOwner)
|
23
25
|
// solhint-disable-next-line no-empty-blocks
|
24
26
|
{}
|
25
27
|
}
|
@@ -19,12 +19,14 @@ contract TestProduct is Product {
|
|
19
19
|
address registry,
|
20
20
|
NftId instanceNftid,
|
21
21
|
address token,
|
22
|
+
bool isInterceptor,
|
22
23
|
address pool,
|
23
24
|
address distribution,
|
24
25
|
Fee memory productFee,
|
25
|
-
Fee memory processingFee
|
26
|
+
Fee memory processingFee,
|
27
|
+
address initialOwner
|
26
28
|
)
|
27
|
-
Product(registry, instanceNftid, token, pool, distribution, productFee, processingFee)
|
29
|
+
Product(registry, instanceNftid, token, isInterceptor, pool, distribution, productFee, processingFee, initialOwner)
|
28
30
|
// solhint-disable-next-line no-empty-blocks
|
29
31
|
{
|
30
32
|
}
|
@@ -8,12 +8,11 @@ import {Registerable} from "../../contracts/shared/Registerable.sol";
|
|
8
8
|
|
9
9
|
contract TestRegisterable is Registerable {
|
10
10
|
|
11
|
-
constructor(address registry, NftId registryNftId)
|
12
|
-
Registerable(registry, registryNftId)
|
11
|
+
constructor(address registry, NftId registryNftId, ObjectType objectType, bool isInterceptor, address initialOwner)
|
12
|
+
//Registerable(registry, registryNftId)
|
13
13
|
// solhint-disable-next-line no-empty-blocks
|
14
|
-
{
|
15
|
-
|
16
|
-
|
17
|
-
return TOKEN();
|
14
|
+
{
|
15
|
+
bytes memory data = "";
|
16
|
+
_initializeRegisterable(registry, registryNftId, objectType, isInterceptor, initialOwner, data);
|
18
17
|
}
|
19
18
|
}
|
@@ -8,25 +8,19 @@ import {ServiceBase} from "../../contracts/instance/base/ServiceBase.sol";
|
|
8
8
|
import {IVersionable} from "../../contracts/shared/IVersionable.sol";
|
9
9
|
import {Versionable} from "../../contracts/shared/Versionable.sol";
|
10
10
|
|
11
|
+
//import {IService} from "../../contracts/instance/base/IService.sol";
|
12
|
+
|
11
13
|
contract TestService is ServiceBase {
|
12
14
|
|
13
15
|
string public constant NAME = "TestService";
|
14
16
|
|
15
|
-
constructor(address registry, NftId registryNftId)
|
16
|
-
ServiceBase(registry, registryNftId)
|
17
|
+
constructor(address registry, NftId registryNftId, address initialOwner)
|
17
18
|
// solhint-disable-next-line no-empty-blocks
|
18
|
-
{}
|
19
|
-
|
20
|
-
function getVersion()
|
21
|
-
public
|
22
|
-
pure
|
23
|
-
virtual override (IVersionable, Versionable)
|
24
|
-
returns(Version)
|
25
19
|
{
|
26
|
-
|
20
|
+
_initializeServiceBase(registry, registryNftId, initialOwner);
|
27
21
|
}
|
28
22
|
|
29
|
-
function getName()
|
23
|
+
function getName() public pure override returns(string memory name) {
|
30
24
|
return NAME;
|
31
25
|
}
|
32
26
|
}
|
package/package.json
CHANGED