@etherisc/gif-next 0.0.2-de0a1d3-009 → 0.0.2-e37834a-021
Sign up to get free protection for your applications and to get access to all the features.
- 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 +0 -163
- package/artifacts/contracts/components/IPoolComponent.sol/IPoolComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IPoolComponent.sol/IPoolComponent.json +6 -185
- package/artifacts/contracts/components/IProductComponent.sol/IProductComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IProductComponent.sol/IProductComponent.json +0 -163
- 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 +198 -74
- 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 +285 -178
- package/artifacts/contracts/instance/base/ComponentServiceBase.sol/ComponentServiceBase.dbg.json +1 -1
- package/artifacts/contracts/instance/base/ComponentServiceBase.sol/ComponentServiceBase.json +59 -53
- 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 +45 -42
- package/artifacts/contracts/instance/base/InstanceBase.sol/InstanceBase.dbg.json +1 -1
- package/artifacts/contracts/instance/base/InstanceBase.sol/InstanceBase.json +62 -69
- 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 +55 -62
- 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 +165 -93
- package/artifacts/contracts/instance/service/DistributionService.sol/DistributionService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/DistributionService.sol/DistributionService.json +87 -68
- package/artifacts/contracts/instance/service/IComponentOwnerService.sol/IComponentOwnerService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IComponentOwnerService.sol/IComponentOwnerService.json +45 -61
- package/artifacts/contracts/instance/service/IDistributionService.sol/IDistributionService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IDistributionService.sol/IDistributionService.json +45 -42
- package/artifacts/contracts/instance/service/IPoolService.sol/IPoolService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IPoolService.sol/IPoolService.json +45 -42
- package/artifacts/contracts/instance/service/IProductService.sol/IProductService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IProductService.sol/IProductService.json +45 -42
- package/artifacts/contracts/instance/service/PoolService.sol/PoolService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/PoolService.sol/PoolService.json +89 -70
- package/artifacts/contracts/instance/service/ProductService.sol/ProductService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/ProductService.sol/ProductService.json +117 -98
- 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/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 +483 -120
- package/artifacts/contracts/registry/RegistryService.sol/RegistryService.dbg.json +4 -0
- package/artifacts/contracts/registry/RegistryService.sol/RegistryService.json +885 -0
- package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.dbg.json +4 -0
- package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.json +460 -0
- package/artifacts/contracts/shared/ContractDeployerLib.sol/ContractDeployerLib.dbg.json +4 -0
- package/artifacts/contracts/shared/ContractDeployerLib.sol/ContractDeployerLib.json +107 -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/IVersionable.sol/IVersionable.json +2 -2
- package/artifacts/contracts/shared/NftOwnable.sol/NftOwnable.dbg.json +4 -0
- package/artifacts/contracts/shared/NftOwnable.sol/NftOwnable.json +132 -0
- package/artifacts/contracts/shared/ProxyManager.sol/ProxyManager.dbg.json +4 -0
- package/artifacts/contracts/shared/ProxyManager.sol/ProxyManager.json +344 -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/shared/Versionable.sol/Versionable.json +4 -27
- 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 +81 -75
- 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 +15 -38
- 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/IDistributionComponent.sol +1 -2
- package/contracts/components/IPoolComponent.sol +3 -10
- package/contracts/components/IProductComponent.sol +2 -3
- 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 +25 -24
- 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 +382 -273
- package/contracts/registry/RegistryService.sol +375 -0
- package/contracts/registry/RegistryServiceManager.sol +52 -0
- package/contracts/shared/ContractDeployerLib.sol +72 -0
- package/contracts/shared/ERC165.sol +1 -1
- package/contracts/shared/IRegisterable.sol +7 -9
- package/contracts/shared/IVersionable.sol +40 -9
- package/contracts/shared/NftOwnable.sol +87 -0
- package/contracts/shared/ProxyManager.sol +103 -0
- package/contracts/shared/Registerable.sol +74 -43
- package/contracts/shared/UpgradableProxyWithAdmin.sol +16 -0
- package/contracts/shared/Versionable.sol +108 -60
- 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/registry/IRegistryLinked.sol/IRegistryLinked.dbg.json +0 -4
- package/artifacts/contracts/registry/IRegistryLinked.sol/IRegistryLinked.json +0 -24
- package/artifacts/contracts/registry/RegistryUpgradeable.sol/RegistryUpgradeable.dbg.json +0 -4
- package/artifacts/contracts/registry/RegistryUpgradeable.sol/RegistryUpgradeable.json +0 -724
- 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/artifacts/contracts/shared/VersionableUpgradeable.sol/VersionableUpgradeable.dbg.json +0 -4
- package/artifacts/contracts/shared/VersionableUpgradeable.sol/VersionableUpgradeable.json +0 -228
- package/contracts/experiment/statemachine/README.md +0 -112
- package/contracts/registry/IRegistryLinked.sol +0 -8
- package/contracts/registry/RegistryUpgradeable.sol +0 -473
- package/contracts/shared/Proxy.sol +0 -94
- package/contracts/shared/VersionableUpgradeable.sol +0 -133
@@ -0,0 +1,87 @@
|
|
1
|
+
// SPDX-License-Identifier: Apache-2.0
|
2
|
+
pragma solidity ^0.8.20;
|
3
|
+
|
4
|
+
import {IOwnable} from "./IOwnable.sol";
|
5
|
+
import {IRegistry} from "../registry/IRegistry.sol";
|
6
|
+
import {NftId, zeroNftId} from "../types/NftId.sol";
|
7
|
+
|
8
|
+
contract NftOwnable is
|
9
|
+
IOwnable
|
10
|
+
{
|
11
|
+
error ErrorNftOwnableUnauthorized(address account);
|
12
|
+
|
13
|
+
error ErrorAlreadyInitialized(address registry, NftId nftId);
|
14
|
+
error ErrorRegistryAlreadyInitialized(address registry);
|
15
|
+
error ErrorRegistryNotInitialized();
|
16
|
+
error ErrorRegistryAddressZero();
|
17
|
+
error ErrorContractNotRegistered(address contractAddress);
|
18
|
+
|
19
|
+
IRegistry internal _registry;
|
20
|
+
NftId private _nftId;
|
21
|
+
address private _initialOwner;
|
22
|
+
|
23
|
+
modifier onlyOwner() {
|
24
|
+
address owner = getOwner();
|
25
|
+
|
26
|
+
// owner == address(0) is eg uninitialized upgradable contract
|
27
|
+
if (owner != address(0) && msg.sender != owner) {
|
28
|
+
revert ErrorNftOwnableUnauthorized(msg.sender);
|
29
|
+
}
|
30
|
+
_;
|
31
|
+
}
|
32
|
+
|
33
|
+
constructor() {
|
34
|
+
_initialOwner = msg.sender;
|
35
|
+
}
|
36
|
+
|
37
|
+
// function only needed during bootstrapping on a new chain
|
38
|
+
function linkToRegistry(
|
39
|
+
address registryAddress,
|
40
|
+
address contractAddress
|
41
|
+
)
|
42
|
+
internal
|
43
|
+
onlyOwner()
|
44
|
+
returns (NftId)
|
45
|
+
{
|
46
|
+
if (_nftId.gtz()) {
|
47
|
+
revert ErrorAlreadyInitialized(address(_registry), _nftId);
|
48
|
+
}
|
49
|
+
|
50
|
+
if (address(_registry) != address(0)) {
|
51
|
+
revert ErrorRegistryAlreadyInitialized(address(_registry));
|
52
|
+
}
|
53
|
+
|
54
|
+
if (registryAddress == address(0)) {
|
55
|
+
revert ErrorRegistryAddressZero();
|
56
|
+
}
|
57
|
+
|
58
|
+
_registry = IRegistry(registryAddress);
|
59
|
+
|
60
|
+
if (!_registry.isRegistered(contractAddress)) {
|
61
|
+
revert ErrorContractNotRegistered(contractAddress);
|
62
|
+
}
|
63
|
+
|
64
|
+
_nftId = _registry.getNftId(contractAddress);
|
65
|
+
|
66
|
+
return _nftId;
|
67
|
+
}
|
68
|
+
|
69
|
+
|
70
|
+
function getRegistry() external view returns (IRegistry) {
|
71
|
+
return _registry;
|
72
|
+
}
|
73
|
+
|
74
|
+
|
75
|
+
function getNftId() external view returns (NftId) {
|
76
|
+
return _nftId;
|
77
|
+
}
|
78
|
+
|
79
|
+
|
80
|
+
function getOwner() public view returns (address) {
|
81
|
+
if (_nftId.gtz()) {
|
82
|
+
return _registry.ownerOf(_nftId);
|
83
|
+
}
|
84
|
+
|
85
|
+
return _initialOwner;
|
86
|
+
}
|
87
|
+
}
|
@@ -0,0 +1,103 @@
|
|
1
|
+
// SPDX-License-Identifier: Apache-2.0
|
2
|
+
pragma solidity ^0.8.20;
|
3
|
+
|
4
|
+
import {Ownable} from "@openzeppelin5/contracts/access/Ownable.sol";
|
5
|
+
import {ProxyAdmin} from "@openzeppelin5/contracts/proxy/transparent/ProxyAdmin.sol";
|
6
|
+
import {ITransparentUpgradeableProxy} from "@openzeppelin5/contracts/proxy/transparent/TransparentUpgradeableProxy.sol";
|
7
|
+
|
8
|
+
import {IVersionable} from "./IVersionable.sol";
|
9
|
+
import {NftOwnable} from "./NftOwnable.sol";
|
10
|
+
import {UpgradableProxyWithAdmin} from "./UpgradableProxyWithAdmin.sol";
|
11
|
+
|
12
|
+
/// @dev manages proxy deployments for upgradable contracs of type IVersionable
|
13
|
+
contract ProxyManager is
|
14
|
+
NftOwnable
|
15
|
+
{
|
16
|
+
|
17
|
+
event LogProxyDeployed(address indexed proxy, address initialImplementation);
|
18
|
+
event LogProxyDeployedWithSalt(address indexed proxy, address initialImplementation);
|
19
|
+
event LogProxyUpgraded(address indexed proxy, address upgradedImplementation);
|
20
|
+
|
21
|
+
error ErrorAlreadyDeployed();
|
22
|
+
error ErrorAlreadyDeployedWithSalt();
|
23
|
+
error ErrorNotYetDeployed();
|
24
|
+
|
25
|
+
UpgradableProxyWithAdmin internal _proxy;
|
26
|
+
bool internal _isDeployed;
|
27
|
+
|
28
|
+
/// @dev only used to capture proxy owner
|
29
|
+
constructor()
|
30
|
+
NftOwnable()
|
31
|
+
{ }
|
32
|
+
|
33
|
+
/// @dev deploy initial contract
|
34
|
+
function deploy(address initialImplementation, bytes memory initializationData)
|
35
|
+
public
|
36
|
+
virtual
|
37
|
+
onlyOwner()
|
38
|
+
returns (IVersionable versionable)
|
39
|
+
{
|
40
|
+
if (_isDeployed) { revert ErrorAlreadyDeployed(); }
|
41
|
+
|
42
|
+
address currentProxyOwner = getOwner(); // used by implementation
|
43
|
+
address initialProxyAdminOwner = address(this); // used by proxy
|
44
|
+
bytes memory data = getDeployData(initialImplementation, currentProxyOwner, initializationData);
|
45
|
+
|
46
|
+
_proxy = new UpgradableProxyWithAdmin(
|
47
|
+
initialImplementation,
|
48
|
+
initialProxyAdminOwner,
|
49
|
+
data
|
50
|
+
);
|
51
|
+
|
52
|
+
_isDeployed = true;
|
53
|
+
versionable = IVersionable(address(_proxy));
|
54
|
+
|
55
|
+
emit LogProxyDeployed(address(_proxy), initialImplementation);
|
56
|
+
}
|
57
|
+
|
58
|
+
function linkToRegistry(address registryAddress)
|
59
|
+
public
|
60
|
+
virtual
|
61
|
+
{
|
62
|
+
// links ownership for this proxy manager to the owner of the underlying proxy nft
|
63
|
+
// applies onlyOwner modifier internally
|
64
|
+
linkToRegistry(registryAddress, address(_proxy));
|
65
|
+
}
|
66
|
+
|
67
|
+
/// @dev upgrade existing contract
|
68
|
+
function upgrade(address newImplementation, bytes memory upgradeData)
|
69
|
+
public
|
70
|
+
virtual
|
71
|
+
onlyOwner()
|
72
|
+
returns (IVersionable versionable)
|
73
|
+
{
|
74
|
+
if (!_isDeployed) { revert ErrorNotYetDeployed(); }
|
75
|
+
|
76
|
+
address currentProxyOwner = getOwner();
|
77
|
+
ProxyAdmin proxyAdmin = getProxy().getProxyAdmin();
|
78
|
+
ITransparentUpgradeableProxy proxy = ITransparentUpgradeableProxy(address(_proxy));
|
79
|
+
bytes memory data = getUpgradeData(newImplementation, currentProxyOwner, upgradeData);
|
80
|
+
|
81
|
+
proxyAdmin.upgradeAndCall(
|
82
|
+
proxy,
|
83
|
+
newImplementation,
|
84
|
+
data);
|
85
|
+
|
86
|
+
versionable = IVersionable(address(_proxy));
|
87
|
+
|
88
|
+
emit LogProxyUpgraded(address(_proxy), newImplementation);
|
89
|
+
|
90
|
+
}
|
91
|
+
|
92
|
+
function getDeployData(address implementation, address proxyOwner, bytes memory deployData) public pure returns (bytes memory data) {
|
93
|
+
return abi.encodeWithSelector(IVersionable.initialize.selector, implementation, proxyOwner, deployData);
|
94
|
+
}
|
95
|
+
|
96
|
+
function getUpgradeData(address implementation, address proxyOwner, bytes memory upgradeData) public pure returns (bytes memory data) {
|
97
|
+
return abi.encodeWithSelector(IVersionable.upgrade.selector, implementation, proxyOwner, upgradeData);
|
98
|
+
}
|
99
|
+
|
100
|
+
function getProxy() public returns (UpgradableProxyWithAdmin) {
|
101
|
+
return _proxy;
|
102
|
+
}
|
103
|
+
}
|
@@ -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
|
+
}
|
@@ -1,99 +1,147 @@
|
|
1
1
|
// SPDX-License-Identifier: Apache-2.0
|
2
|
-
pragma solidity ^0.8.
|
2
|
+
pragma solidity ^0.8.20;
|
3
3
|
|
4
4
|
import {Initializable} from "@openzeppelin5/contracts/proxy/utils/Initializable.sol";
|
5
5
|
|
6
6
|
import {Blocknumber, blockNumber} from "../types/Blocknumber.sol";
|
7
7
|
import {Timestamp, blockTimestamp} from "../types/Timestamp.sol";
|
8
|
-
import {Version, VersionPart} from "../types/Version.sol";
|
8
|
+
import {Version, VersionPart, VersionLib} from "../types/Version.sol";
|
9
9
|
|
10
10
|
import {IVersionable} from "./IVersionable.sol";
|
11
11
|
|
12
|
-
abstract contract Versionable is Initializable, IVersionable {
|
13
12
|
|
14
|
-
mapping(Version version => VersionInfo info) private _versionHistory;
|
15
|
-
Version [] private _versions;
|
16
13
|
|
14
|
+
abstract contract Versionable is
|
15
|
+
Initializable,
|
16
|
+
IVersionable
|
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;
|
17
20
|
|
18
|
-
// controlled activation for controller contract
|
19
|
-
constructor() {
|
20
|
-
_activate(address(0), msg.sender);
|
21
|
-
}
|
22
21
|
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
{
|
29
|
-
_activate(implementation, activatedBy);
|
22
|
+
/// @custom:storage-location erc7201:gif-next.contracts.shared.Versionable.sol
|
23
|
+
struct VersionableStorage {
|
24
|
+
mapping(Version version => VersionInfo info) _versionHistory;
|
25
|
+
Version [] _versions;
|
26
|
+
Version _v1;
|
30
27
|
}
|
31
|
-
// TODO mock, delete when implementations are ready
|
32
|
-
function activate(address implementation, address activatedBy, bytes memory activatinData) public {}
|
33
|
-
function upgrade(address implementation, address activatedBy, bytes memory upgradeData) external {}
|
34
28
|
|
35
29
|
|
36
|
-
|
37
|
-
|
38
|
-
|
30
|
+
constructor() {
|
31
|
+
_disableInitializers();
|
32
|
+
}
|
33
|
+
// TODO write test where new version of private _updateVersionHistory is added and used...
|
34
|
+
function initialize(
|
39
35
|
address implementation,
|
40
|
-
address activatedBy
|
36
|
+
address activatedBy,
|
37
|
+
bytes memory data
|
41
38
|
)
|
42
|
-
|
39
|
+
public
|
40
|
+
initializer
|
43
41
|
{
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
"ERROR:VRN-001:VERSION_ALREADY_ACTIVATED"
|
48
|
-
);
|
49
|
-
|
50
|
-
// require increasing version number
|
51
|
-
if(_versions.length > 0) {
|
52
|
-
Version lastVersion = _versions[_versions.length - 1];
|
53
|
-
require(
|
54
|
-
thisVersion > lastVersion,
|
55
|
-
"ERROR:VRN-002:VERSION_NOT_INCREASING"
|
56
|
-
);
|
57
|
-
}
|
42
|
+
_updateVersionHistory(implementation, activatedBy);
|
43
|
+
_initialize(activatedBy, data);
|
44
|
+
}
|
58
45
|
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
46
|
+
// TODO activatedBy MUST ALWAYS be an owner?
|
47
|
+
function upgrade(
|
48
|
+
address implementation,
|
49
|
+
address activatedBy,
|
50
|
+
bytes memory data
|
51
|
+
)
|
52
|
+
external
|
53
|
+
reinitializer(VersionLib.toUint64(getVersion()))
|
54
|
+
{
|
55
|
+
_updateVersionHistory(implementation, activatedBy);
|
56
|
+
_upgrade(data);
|
57
|
+
}
|
68
58
|
|
69
|
-
|
59
|
+
function isInitialized(Version _version) public override view returns(bool) {
|
60
|
+
return _getVersionableStorage()._versionHistory[_version].activatedIn.toInt() > 0;
|
70
61
|
}
|
71
62
|
|
63
|
+
function getVersion() public pure virtual returns(Version);
|
72
64
|
|
73
|
-
function
|
74
|
-
return
|
65
|
+
function getVersionCount() public view override returns(uint256) {
|
66
|
+
return _getVersionableStorage()._versions.length;
|
75
67
|
}
|
76
68
|
|
69
|
+
function getVersion(uint256 idx) public view override returns(Version) {
|
70
|
+
return _getVersionableStorage()._versions[idx];
|
71
|
+
}
|
77
72
|
|
78
|
-
function
|
79
|
-
|
73
|
+
function getVersionInfo(Version _version) public override view returns(VersionInfo memory) {
|
74
|
+
return _getVersionableStorage()._versionHistory[_version];
|
75
|
+
}
|
80
76
|
|
81
|
-
function
|
82
|
-
return
|
77
|
+
function getInitializedVersion() public view returns(uint64) {
|
78
|
+
return _getInitializedVersion();
|
83
79
|
}
|
84
80
|
|
85
81
|
|
86
|
-
|
87
|
-
|
82
|
+
|
83
|
+
// IMPORTANT each version must implement this function
|
84
|
+
// each implementation MUST use onlyInitialising modifier
|
85
|
+
// each implementation MUST call intializers of all base contracts...
|
86
|
+
function _initialize(address owner, bytes memory data)
|
87
|
+
internal
|
88
|
+
onlyInitializing
|
89
|
+
virtual
|
90
|
+
{
|
91
|
+
revert();
|
88
92
|
}
|
89
93
|
|
90
94
|
|
91
|
-
|
92
|
-
|
95
|
+
// IMPORTANT each version except version "1" must implement this function
|
96
|
+
// each implementation MUST use onlyInitialising modifier
|
97
|
+
function _upgrade(bytes memory data)
|
98
|
+
internal
|
99
|
+
onlyInitializing
|
100
|
+
virtual
|
101
|
+
{
|
102
|
+
revert();
|
93
103
|
}
|
94
104
|
|
95
|
-
function
|
105
|
+
function _getVersionableStorage() private pure returns (VersionableStorage storage $) {
|
106
|
+
assembly {
|
107
|
+
$.slot := VERSIONABLE_LOCATION_V1
|
108
|
+
}
|
109
|
+
}
|
110
|
+
|
111
|
+
// can only be called once per contract
|
112
|
+
// needs to be called inside the proxy upgrade tx
|
113
|
+
// TODO run reinitializer(version().toUint64()) modifier after "version()" is checked,
|
114
|
+
function _updateVersionHistory(
|
115
|
+
address implementation,
|
116
|
+
address activatedBy
|
117
|
+
)
|
118
|
+
private
|
119
|
+
onlyInitializing
|
96
120
|
{
|
97
|
-
|
121
|
+
VersionableStorage storage $ = _getVersionableStorage();
|
122
|
+
|
123
|
+
uint64 version = _getInitializedVersion();
|
124
|
+
|
125
|
+
Version thisVersion = getVersion();
|
126
|
+
|
127
|
+
if(version == 1) {
|
128
|
+
// thisVersion is alias to version "1"
|
129
|
+
$._v1 = thisVersion;
|
130
|
+
}
|
131
|
+
else {
|
132
|
+
require(thisVersion > $._v1, "INVALID VERSION");
|
133
|
+
}
|
134
|
+
|
135
|
+
// update version history
|
136
|
+
$._versions.push(thisVersion);
|
137
|
+
$._versionHistory[thisVersion] = VersionInfo(
|
138
|
+
thisVersion,
|
139
|
+
implementation,
|
140
|
+
activatedBy,
|
141
|
+
blockTimestamp(),
|
142
|
+
blockNumber()
|
143
|
+
);
|
144
|
+
|
145
|
+
emit LogVersionableInitialized(thisVersion, implementation, activatedBy);
|
98
146
|
}
|
99
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
|
}
|