@etherisc/gif-next 0.0.2-bdcb44f-543 → 0.0.2-be8b3db-650
Sign up to get free protection for your applications and to get access to all the features.
- package/artifacts/contracts/components/Component.sol/Component.dbg.json +1 -1
- package/artifacts/contracts/components/Component.sol/Component.json +40 -0
- package/artifacts/contracts/components/Distribution.sol/Distribution.dbg.json +1 -1
- package/artifacts/contracts/components/Distribution.sol/Distribution.json +41 -19
- package/artifacts/contracts/components/IComponent.sol/IComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IComponent.sol/IComponent.json +40 -0
- package/artifacts/contracts/components/IDistributionComponent.sol/IDistributionComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IDistributionComponent.sol/IDistributionComponent.json +41 -19
- package/artifacts/contracts/components/IPoolComponent.sol/IPoolComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IPoolComponent.sol/IPoolComponent.json +57 -150
- package/artifacts/contracts/components/IProductComponent.sol/IProductComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IProductComponent.sol/IProductComponent.json +40 -0
- package/artifacts/contracts/components/Pool.sol/Pool.dbg.json +1 -1
- package/artifacts/contracts/components/Pool.sol/Pool.json +76 -189
- package/artifacts/contracts/components/Product.sol/Product.dbg.json +1 -1
- package/artifacts/contracts/components/Product.sol/Product.json +40 -0
- package/artifacts/contracts/instance/BundleManager.sol/BundleManager.dbg.json +1 -1
- package/artifacts/contracts/instance/BundleManager.sol/BundleManager.json +30 -11
- package/artifacts/contracts/instance/Cloneable.sol/Cloneable.dbg.json +1 -1
- package/artifacts/contracts/instance/IInstance.sol/IInstance.dbg.json +1 -1
- package/artifacts/contracts/instance/IInstance.sol/IInstance.json +32 -174
- package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.dbg.json +1 -1
- package/artifacts/contracts/instance/Instance.sol/Instance.dbg.json +1 -1
- package/artifacts/contracts/instance/Instance.sol/Instance.json +103 -238
- package/artifacts/contracts/instance/InstanceAccessManager.sol/InstanceAccessManager.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceAccessManager.sol/InstanceAccessManager.json +2 -2
- package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.json +73 -144
- package/artifacts/contracts/instance/InstanceService.sol/InstanceService.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceService.sol/InstanceService.json +32 -32
- package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.json +17 -17
- package/artifacts/contracts/instance/ObjectManager.sol/ObjectManager.dbg.json +1 -1
- package/artifacts/contracts/instance/ObjectManager.sol/ObjectManager.json +2 -2
- package/artifacts/contracts/instance/base/ComponentService.sol/ComponentService.dbg.json +1 -1
- package/artifacts/contracts/instance/base/IKeyValueStore.sol/IKeyValueStore.dbg.json +1 -1
- package/artifacts/contracts/instance/base/ILifecycle.sol/ILifecycle.dbg.json +1 -1
- package/artifacts/contracts/instance/base/KeyValueStore.sol/KeyValueStore.dbg.json +1 -1
- package/artifacts/contracts/instance/base/KeyValueStore.sol/KeyValueStore.json +40 -10
- package/artifacts/contracts/instance/base/Lifecycle.sol/Lifecycle.dbg.json +1 -1
- package/artifacts/contracts/instance/base/Lifecycle.sol/Lifecycle.json +36 -11
- package/artifacts/contracts/instance/module/IAccess.sol/IAccess.dbg.json +1 -1
- package/artifacts/contracts/instance/module/IBundle.sol/IBundle.dbg.json +1 -1
- package/artifacts/contracts/instance/module/IComponents.sol/IComponents.dbg.json +4 -0
- package/artifacts/contracts/instance/module/IComponents.sol/IComponents.json +10 -0
- package/artifacts/contracts/instance/module/IDistribution.sol/IDistribution.dbg.json +1 -1
- package/artifacts/contracts/instance/module/IPolicy.sol/IPolicy.dbg.json +1 -1
- package/artifacts/contracts/instance/module/IRisk.sol/IRisk.dbg.json +1 -1
- package/artifacts/contracts/instance/module/ISetup.sol/ISetup.dbg.json +1 -1
- package/artifacts/contracts/instance/module/ITreasury.sol/ITreasury.dbg.json +1 -1
- package/artifacts/contracts/instance/service/ApplicationService.sol/ApplicationService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/ApplicationService.sol/ApplicationService.json +14 -14
- package/artifacts/contracts/instance/service/ApplicationServiceManager.sol/ApplicationServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/ApplicationServiceManager.sol/ApplicationServiceManager.json +8 -8
- package/artifacts/contracts/instance/service/BundleService.sol/BundleService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/BundleService.sol/BundleService.json +132 -135
- package/artifacts/contracts/instance/service/BundleServiceManager.sol/BundleServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/BundleServiceManager.sol/BundleServiceManager.json +12 -12
- package/artifacts/contracts/instance/service/ClaimService.sol/ClaimService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/ClaimService.sol/ClaimService.json +2 -2
- package/artifacts/contracts/instance/service/ClaimServiceManager.sol/ClaimServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/ClaimServiceManager.sol/ClaimServiceManager.json +2 -2
- package/artifacts/contracts/instance/service/DistributionService.sol/DistributionService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/DistributionService.sol/DistributionService.json +234 -63
- package/artifacts/contracts/instance/service/DistributionServiceManager.sol/DistributionServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/DistributionServiceManager.sol/DistributionServiceManager.json +40 -32
- package/artifacts/contracts/instance/service/IApplicationService.sol/IApplicationService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IBundleService.sol/IBundleService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IBundleService.sol/IBundleService.json +89 -92
- package/artifacts/contracts/instance/service/IClaimService.sol/IClaimService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IDistributionService.sol/IDistributionService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IDistributionService.sol/IDistributionService.json +156 -1
- package/artifacts/contracts/instance/service/IPolicyService.sol/IPolicyService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IPolicyService.sol/IPolicyService.json +21 -0
- package/artifacts/contracts/instance/service/IPoolService.sol/IPoolService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IPoolService.sol/IPoolService.json +81 -0
- package/artifacts/contracts/instance/service/IProductService.sol/IProductService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/PolicyService.sol/PolicyService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/PolicyService.sol/PolicyService.json +31 -10
- package/artifacts/contracts/instance/service/PolicyServiceManager.sol/PolicyServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/PolicyServiceManager.sol/PolicyServiceManager.json +6 -6
- package/artifacts/contracts/instance/service/PoolService.sol/PoolService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/PoolService.sol/PoolService.json +105 -16
- package/artifacts/contracts/instance/service/PoolServiceManager.sol/PoolServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/PoolServiceManager.sol/PoolServiceManager.json +13 -9
- package/artifacts/contracts/instance/service/ProductService.sol/ProductService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/ProductService.sol/ProductService.json +2 -2
- package/artifacts/contracts/instance/service/ProductServiceManager.sol/ProductServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/ProductServiceManager.sol/ProductServiceManager.json +2 -2
- package/artifacts/contracts/registry/ChainNft.sol/ChainNft.dbg.json +1 -1
- package/artifacts/contracts/registry/ChainNft.sol/ChainNft.json +15 -2
- package/artifacts/contracts/registry/IRegistry.sol/IRegistry.dbg.json +1 -1
- package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.dbg.json +1 -1
- package/artifacts/contracts/registry/ITransferInterceptor.sol/ITransferInterceptor.dbg.json +1 -1
- package/artifacts/contracts/registry/Registry.sol/Registry.dbg.json +1 -1
- package/artifacts/contracts/registry/Registry.sol/Registry.json +4 -4
- package/artifacts/contracts/registry/RegistryAccessManager.sol/RegistryAccessManager.dbg.json +1 -1
- package/artifacts/contracts/registry/RegistryAccessManager.sol/RegistryAccessManager.json +2 -2
- package/artifacts/contracts/registry/RegistryService.sol/RegistryService.dbg.json +1 -1
- package/artifacts/contracts/registry/RegistryService.sol/RegistryService.json +12 -12
- package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.dbg.json +1 -1
- package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.json +7 -7
- package/artifacts/contracts/registry/ReleaseManager.sol/ReleaseManager.dbg.json +1 -1
- package/artifacts/contracts/registry/ReleaseManager.sol/ReleaseManager.json +3 -3
- package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.dbg.json +1 -1
- package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.json +2 -2
- package/artifacts/contracts/shared/ContractDeployerLib.sol/ContractDeployerLib.dbg.json +1 -1
- package/artifacts/contracts/shared/ERC165.sol/ERC165.dbg.json +1 -1
- package/artifacts/contracts/shared/INftOwnable.sol/INftOwnable.dbg.json +1 -1
- package/artifacts/contracts/shared/IPolicyHolder.sol/IPolicyHolder.dbg.json +1 -1
- package/artifacts/contracts/shared/IRegisterable.sol/IRegisterable.dbg.json +1 -1
- package/artifacts/contracts/shared/IRegistryLinked.sol/IRegistryLinked.dbg.json +1 -1
- package/artifacts/contracts/shared/IService.sol/IService.dbg.json +1 -1
- package/artifacts/contracts/shared/IVersionable.sol/IVersionable.dbg.json +1 -1
- package/artifacts/contracts/shared/NftOwnable.sol/NftOwnable.dbg.json +1 -1
- package/artifacts/contracts/shared/NftOwnable.sol/NftOwnable.json +2 -2
- package/artifacts/contracts/shared/PolicyHolder.sol/PolicyHolder.dbg.json +1 -1
- package/artifacts/contracts/shared/PolicyHolder.sol/PolicyHolder.json +2 -2
- package/artifacts/contracts/shared/ProxyManager.sol/ProxyManager.dbg.json +1 -1
- package/artifacts/contracts/shared/ProxyManager.sol/ProxyManager.json +2 -2
- package/artifacts/contracts/shared/Registerable.sol/Registerable.dbg.json +1 -1
- package/artifacts/contracts/shared/Registerable.sol/Registerable.json +2 -2
- package/artifacts/contracts/shared/RegistryLinked.sol/RegistryLinked.dbg.json +1 -1
- package/artifacts/contracts/shared/RegistryLinked.sol/RegistryLinked.json +2 -2
- package/artifacts/contracts/shared/Service.sol/Service.dbg.json +1 -1
- package/artifacts/contracts/shared/TokenHandler.sol/TokenHandler.dbg.json +1 -1
- package/artifacts/contracts/shared/TokenHandler.sol/TokenHandler.json +2 -2
- package/artifacts/contracts/shared/UpgradableProxyWithAdmin.sol/UpgradableProxyWithAdmin.dbg.json +1 -1
- package/artifacts/contracts/shared/UpgradableProxyWithAdmin.sol/UpgradableProxyWithAdmin.json +2 -2
- package/artifacts/contracts/shared/Versionable.sol/Versionable.dbg.json +1 -1
- package/artifacts/contracts/test/TestFee.sol/TestFee.dbg.json +1 -1
- package/artifacts/contracts/test/TestFee.sol/TestFee.json +2 -2
- package/artifacts/contracts/test/TestRegisterable.sol/TestRegisterable.dbg.json +1 -1
- package/artifacts/contracts/test/TestRegisterable.sol/TestRegisterable.json +2 -2
- package/artifacts/contracts/test/TestRoleId.sol/TestRoleId.dbg.json +1 -1
- package/artifacts/contracts/test/TestRoleId.sol/TestRoleId.json +2 -2
- package/artifacts/contracts/test/TestService.sol/TestService.dbg.json +1 -1
- package/artifacts/contracts/test/TestService.sol/TestService.json +2 -2
- 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/Blocknumber.sol/BlocknumberLib.json +2 -2
- package/artifacts/contracts/types/ChainId.sol/ChainIdLib.dbg.json +1 -1
- package/artifacts/contracts/types/ClaimId.sol/ClaimIdLib.dbg.json +1 -1
- package/artifacts/contracts/types/DistributorType.sol/DistributorTypeLib.dbg.json +1 -1
- package/artifacts/contracts/types/DistributorType.sol/DistributorTypeLib.json +2 -2
- package/artifacts/contracts/types/Fee.sol/FeeLib.dbg.json +1 -1
- package/artifacts/contracts/types/Fee.sol/FeeLib.json +2 -2
- package/artifacts/contracts/types/Key32.sol/Key32Lib.dbg.json +1 -1
- package/artifacts/contracts/types/Key32.sol/Key32Lib.json +2 -2
- package/artifacts/contracts/types/NftId.sol/NftIdLib.dbg.json +1 -1
- package/artifacts/contracts/types/NftId.sol/NftIdLib.json +17 -4
- package/artifacts/contracts/types/NftIdSet.sol/LibNftIdSet.dbg.json +1 -1
- package/artifacts/contracts/types/NftIdSet.sol/LibNftIdSet.json +2 -2
- package/artifacts/contracts/types/NumberId.sol/NumberIdLib.dbg.json +1 -1
- package/artifacts/contracts/types/ObjectType.sol/ObjectTypeLib.dbg.json +1 -1
- package/artifacts/contracts/types/ObjectType.sol/ObjectTypeLib.json +2 -2
- package/artifacts/contracts/types/PayoutId.sol/PayoutIdLib.dbg.json +1 -1
- package/artifacts/contracts/types/Referral.sol/ReferralLib.dbg.json +1 -1
- package/artifacts/contracts/types/Referral.sol/ReferralLib.json +23 -4
- package/artifacts/contracts/types/RiskId.sol/RiskIdLib.dbg.json +1 -1
- package/artifacts/contracts/types/RiskId.sol/RiskIdLib.json +2 -2
- package/artifacts/contracts/types/RoleId.sol/RoleIdLib.dbg.json +1 -1
- package/artifacts/contracts/types/RoleId.sol/RoleIdLib.json +2 -2
- package/artifacts/contracts/types/Seconds.sol/SecondsLib.dbg.json +1 -1
- package/artifacts/contracts/types/StateId.sol/StateIdLib.dbg.json +1 -1
- package/artifacts/contracts/types/StateId.sol/StateIdLib.json +2 -2
- package/artifacts/contracts/types/Timestamp.sol/TimestampLib.dbg.json +1 -1
- package/artifacts/contracts/types/Timestamp.sol/TimestampLib.json +2 -2
- package/artifacts/contracts/types/UFixed.sol/MathLib.dbg.json +1 -1
- package/artifacts/contracts/types/UFixed.sol/MathLib.json +2 -2
- package/artifacts/contracts/types/UFixed.sol/UFixedLib.dbg.json +1 -1
- package/artifacts/contracts/types/UFixed.sol/UFixedLib.json +2 -2
- 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/Component.sol +20 -0
- package/contracts/components/Distribution.sol +0 -13
- package/contracts/components/IComponent.sol +6 -0
- package/contracts/components/IDistributionComponent.sol +0 -8
- package/contracts/components/IPoolComponent.sol +5 -43
- package/contracts/components/Pool.sol +38 -117
- package/contracts/components/Product.sol +4 -0
- package/contracts/instance/BundleManager.sol +6 -4
- package/contracts/instance/IInstance.sol +3 -2
- package/contracts/instance/IInstanceService.sol +2 -1
- package/contracts/instance/Instance.sol +8 -4
- package/contracts/instance/InstanceReader.sol +4 -3
- package/contracts/instance/InstanceService.sol +5 -6
- package/contracts/instance/base/KeyValueStore.sol +5 -2
- package/contracts/instance/base/Lifecycle.sol +11 -2
- package/contracts/instance/module/IComponents.sol +35 -0
- package/contracts/instance/module/ISetup.sol +4 -17
- package/contracts/instance/service/ApplicationService.sol +6 -5
- package/contracts/instance/service/BundleService.sol +72 -35
- package/contracts/instance/service/DistributionService.sol +75 -19
- package/contracts/instance/service/IBundleService.sol +16 -9
- package/contracts/instance/service/IDistributionService.sol +13 -1
- package/contracts/instance/service/IPolicyService.sol +2 -0
- package/contracts/instance/service/IPoolService.sol +17 -2
- package/contracts/instance/service/PolicyService.sol +46 -45
- package/contracts/instance/service/PoolService.sol +72 -18
- package/contracts/registry/ChainNft.sol +4 -0
- package/contracts/registry/Registry.sol +10 -12
- package/contracts/shared/TokenHandler.sol +11 -5
- package/contracts/types/Blocknumber.sol +1 -0
- package/contracts/types/Fee.sol +1 -0
- package/contracts/types/NftId.sol +8 -0
- package/contracts/types/ObjectType.sol +1 -0
- package/contracts/types/Referral.sol +4 -0
- package/contracts/types/StateId.sol +1 -0
- package/contracts/types/Timestamp.sol +1 -0
- package/contracts/types/UFixed.sol +1 -0
- package/contracts/types/Version.sol +1 -0
- package/package.json +1 -1
@@ -6,20 +6,20 @@ import {IRegistry} from "../../registry/IRegistry.sol";
|
|
6
6
|
import {IInstance} from "../../instance/IInstance.sol";
|
7
7
|
import {IBundle} from "../../instance/module/IBundle.sol";
|
8
8
|
import {TokenHandler} from "../../instance/module/ITreasury.sol";
|
9
|
-
import {
|
9
|
+
import {IComponents} from "../module/IComponents.sol";
|
10
10
|
import {IPolicy} from "../module/IPolicy.sol";
|
11
11
|
|
12
12
|
import {IVersionable} from "../../shared/IVersionable.sol";
|
13
13
|
import {Versionable} from "../../shared/Versionable.sol";
|
14
14
|
import {INftOwnable} from "../../shared/INftOwnable.sol";
|
15
15
|
|
16
|
+
import {Fee, FeeLib} from "../../types/Fee.sol";
|
16
17
|
import {NftId, NftIdLib, zeroNftId} from "../../types/NftId.sol";
|
17
18
|
import {ObjectType, POOL, BUNDLE} from "../../types/ObjectType.sol";
|
18
|
-
import {POOL_OWNER_ROLE,
|
19
|
-
import {
|
20
|
-
import {Version, VersionLib} from "../../types/Version.sol";
|
21
|
-
import {KEEP_STATE, StateId} from "../../types/StateId.sol";
|
19
|
+
import {RoleId, POOL_OWNER_ROLE, PUBLIC_ROLE} from "../../types/RoleId.sol";
|
20
|
+
import {StateId, KEEP_STATE} from "../../types/StateId.sol";
|
22
21
|
import {TimestampLib, zeroTimestamp} from "../../types/Timestamp.sol";
|
22
|
+
import {Version, VersionLib} from "../../types/Version.sol";
|
23
23
|
|
24
24
|
import {IService} from "../../shared/IService.sol";
|
25
25
|
import {Service} from "../../shared/Service.sol";
|
@@ -78,32 +78,86 @@ contract PoolService is
|
|
78
78
|
POOL_OWNER_ROLE());
|
79
79
|
|
80
80
|
IPoolComponent pool = IPoolComponent(poolAddress);
|
81
|
-
IRegistry.ObjectInfo memory
|
81
|
+
IRegistry.ObjectInfo memory registryInfo = getRegistryService().registerPool(pool, owner);
|
82
82
|
pool.linkToRegisteredNftId();
|
83
|
-
poolNftId =
|
83
|
+
poolNftId = registryInfo.nftId;
|
84
|
+
|
85
|
+
// amend component info with pool specific token handler
|
86
|
+
IComponents.ComponentInfo memory componentInfo = pool.getComponentInfo();
|
87
|
+
componentInfo.tokenHandler = new TokenHandler(address(componentInfo.token));
|
88
|
+
|
89
|
+
// save amended component info with instance
|
90
|
+
instance.createPoolSetup(poolNftId, componentInfo);
|
84
91
|
|
85
|
-
instance.createPoolSetup(poolNftId, pool.getSetupInfo());
|
86
92
|
getInstanceService().createGifTarget(instanceNftId, poolAddress, pool.getName());
|
87
93
|
getInstanceService().grantPoolDefaultPermissions(instanceNftId, poolAddress, pool.getName());
|
88
94
|
}
|
89
95
|
|
96
|
+
|
97
|
+
function setMaxCapitalAmount(uint256 maxCapitalAmount)
|
98
|
+
external
|
99
|
+
virtual
|
100
|
+
{
|
101
|
+
(IRegistry.ObjectInfo memory registryInfo, IInstance instance) = _getAndVerifyComponentInfoAndInstance(POOL());
|
102
|
+
InstanceReader instanceReader = instance.getInstanceReader();
|
103
|
+
NftId poolNftId = registryInfo.nftId;
|
104
|
+
|
105
|
+
IComponents.ComponentInfo memory componentInfo = instanceReader.getComponentInfo(poolNftId);
|
106
|
+
IComponents.PoolInfo memory poolInfo = abi.decode(componentInfo.data, (IComponents.PoolInfo));
|
107
|
+
uint256 previousMaxCapitalAmount = poolInfo.maxCapitalAmount;
|
108
|
+
|
109
|
+
poolInfo.maxCapitalAmount = maxCapitalAmount;
|
110
|
+
componentInfo.data = abi.encode(poolInfo);
|
111
|
+
instance.updatePoolSetup(poolNftId, componentInfo, KEEP_STATE());
|
112
|
+
|
113
|
+
emit LogPoolServiceMaxCapitalAmountUpdated(poolNftId, previousMaxCapitalAmount, maxCapitalAmount);
|
114
|
+
}
|
115
|
+
|
116
|
+
function setBundleOwnerRole(RoleId bundleOwnerRole)
|
117
|
+
external
|
118
|
+
virtual
|
119
|
+
{
|
120
|
+
(IRegistry.ObjectInfo memory registryInfo, IInstance instance) = _getAndVerifyComponentInfoAndInstance(POOL());
|
121
|
+
InstanceReader instanceReader = instance.getInstanceReader();
|
122
|
+
NftId poolNftId = registryInfo.nftId;
|
123
|
+
|
124
|
+
IComponents.ComponentInfo memory componentInfo = instanceReader.getComponentInfo(poolNftId);
|
125
|
+
IComponents.PoolInfo memory poolInfo = abi.decode(componentInfo.data, (IComponents.PoolInfo));
|
126
|
+
|
127
|
+
// bundle owner role may only be set once per pool
|
128
|
+
if(poolInfo.bundleOwnerRole != PUBLIC_ROLE()) {
|
129
|
+
revert ErrorPoolServiceBundleOwnerRoleAlreadySet(poolNftId);
|
130
|
+
}
|
131
|
+
|
132
|
+
poolInfo.bundleOwnerRole = bundleOwnerRole;
|
133
|
+
componentInfo.data = abi.encode(poolInfo);
|
134
|
+
instance.updatePoolSetup(poolNftId, componentInfo, KEEP_STATE());
|
135
|
+
|
136
|
+
emit LogPoolServiceBundleOwnerRoleSet(poolNftId, bundleOwnerRole);
|
137
|
+
}
|
138
|
+
|
139
|
+
|
90
140
|
function setFees(
|
91
141
|
Fee memory poolFee,
|
92
142
|
Fee memory stakingFee,
|
93
143
|
Fee memory performanceFee
|
94
144
|
)
|
95
145
|
external
|
96
|
-
|
146
|
+
virtual
|
97
147
|
{
|
98
|
-
(IRegistry.ObjectInfo memory
|
148
|
+
(IRegistry.ObjectInfo memory registryInfo, IInstance instance) = _getAndVerifyComponentInfoAndInstance(POOL());
|
99
149
|
InstanceReader instanceReader = instance.getInstanceReader();
|
100
|
-
NftId poolNftId =
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
150
|
+
NftId poolNftId = registryInfo.nftId;
|
151
|
+
|
152
|
+
IComponents.ComponentInfo memory componentInfo = instanceReader.getComponentInfo(poolNftId);
|
153
|
+
IComponents.PoolInfo memory poolInfo = abi.decode(componentInfo.data, (IComponents.PoolInfo));
|
154
|
+
|
155
|
+
poolInfo.poolFee = poolFee;
|
156
|
+
poolInfo.stakingFee = stakingFee;
|
157
|
+
poolInfo.performanceFee = performanceFee;
|
158
|
+
componentInfo.data = abi.encode(poolInfo);
|
159
|
+
instance.updatePoolSetup(poolNftId, componentInfo, KEEP_STATE());
|
160
|
+
|
161
|
+
// TODO add logging
|
108
162
|
}
|
109
163
|
}
|
@@ -195,6 +195,10 @@ contract ChainNft is ERC721Enumerable {
|
|
195
195
|
_chainIdDigits;
|
196
196
|
}
|
197
197
|
|
198
|
+
function getNextTokenId() external view returns (uint256) {
|
199
|
+
return calculateTokenId(_idNext);
|
200
|
+
}
|
201
|
+
|
198
202
|
function _getNextTokenId() private returns (uint256 id) {
|
199
203
|
id = calculateTokenId(_idNext);
|
200
204
|
_idNext++;
|
@@ -149,7 +149,6 @@ contract Registry is
|
|
149
149
|
}
|
150
150
|
|
151
151
|
if(
|
152
|
-
|
153
152
|
parentType == PROTOCOL() ||
|
154
153
|
parentType == REGISTRY() ||
|
155
154
|
parentType == SERVICE()
|
@@ -287,18 +286,9 @@ contract Registry is
|
|
287
286
|
}
|
288
287
|
|
289
288
|
address interceptor = _getInterceptor(info.isInterceptor, info.objectAddress, parentInfo.isInterceptor, parentAddress);
|
289
|
+
uint256 tokenId = _chainNft.getNextTokenId();
|
290
|
+
nftId = toNftId(tokenId);
|
290
291
|
|
291
|
-
// TODO does external call
|
292
|
-
// compute next nftId, do all checks and stores, mint() at most end...
|
293
|
-
uint256 mintedTokenId = _chainNft.mint(
|
294
|
-
info.initialOwner,
|
295
|
-
interceptor,
|
296
|
-
EMPTY_URI);
|
297
|
-
nftId = toNftId(mintedTokenId);
|
298
|
-
|
299
|
-
// TODO move nftId out of info struct
|
300
|
-
// getters by nftId -> return struct without nftId
|
301
|
-
// getters by address -> return nftId AND struct
|
302
292
|
info.nftId = nftId;
|
303
293
|
_info[nftId] = info;
|
304
294
|
|
@@ -314,6 +304,14 @@ contract Registry is
|
|
314
304
|
}
|
315
305
|
|
316
306
|
emit LogRegistration(nftId, parentNftId, objectType, info.isInterceptor, info.objectAddress, info.initialOwner);
|
307
|
+
|
308
|
+
// calls nft receiver(1) and interceptor(2)
|
309
|
+
uint256 mintedTokenId = _chainNft.mint(
|
310
|
+
info.initialOwner,
|
311
|
+
interceptor,
|
312
|
+
EMPTY_URI);
|
313
|
+
assert(mintedTokenId == tokenId);
|
314
|
+
|
317
315
|
}
|
318
316
|
|
319
317
|
/// @dev obtain interceptor address for this nft if applicable, address(0) otherwise
|
@@ -4,6 +4,8 @@ pragma solidity ^0.8.20;
|
|
4
4
|
import {IERC20Metadata} from "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol";
|
5
5
|
import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
|
6
6
|
|
7
|
+
/// @dev token specific transfer helper
|
8
|
+
/// relies internally on oz SafeERC20.safeTransferFrom
|
7
9
|
contract TokenHandler {
|
8
10
|
IERC20Metadata private _token;
|
9
11
|
|
@@ -11,17 +13,21 @@ contract TokenHandler {
|
|
11
13
|
_token = IERC20Metadata(token);
|
12
14
|
}
|
13
15
|
|
14
|
-
// TODO add logging
|
15
16
|
function transfer(
|
16
17
|
address from,
|
17
18
|
address to,
|
18
|
-
uint256 amount
|
19
|
-
)
|
19
|
+
uint256 amount
|
20
|
+
)
|
21
|
+
external
|
22
|
+
{
|
20
23
|
SafeERC20.safeTransferFrom(_token, from, to, amount);
|
21
|
-
// _token.transferFrom(from, to, amount);
|
22
24
|
}
|
23
25
|
|
24
|
-
function getToken()
|
26
|
+
function getToken()
|
27
|
+
external
|
28
|
+
view
|
29
|
+
returns (IERC20Metadata)
|
30
|
+
{
|
25
31
|
return _token;
|
26
32
|
}
|
27
33
|
}
|
@@ -52,6 +52,7 @@ function blockBlocknumber() view returns (Blocknumber) {
|
|
52
52
|
return toBlocknumber(block.number);
|
53
53
|
}
|
54
54
|
|
55
|
+
// TODO move to BlocknumberLib and rename to zero()
|
55
56
|
/// @dev Return the Blocknumber zero (0)
|
56
57
|
function zeroBlocknumber() pure returns (Blocknumber) {
|
57
58
|
return toBlocknumber(0);
|
package/contracts/types/Fee.sol
CHANGED
@@ -24,6 +24,7 @@ function toNftId(uint256 id) pure returns (NftId) {
|
|
24
24
|
return NftId.wrap(uint96(id));
|
25
25
|
}
|
26
26
|
|
27
|
+
// TODO move to NftIdLib and rename to zero()
|
27
28
|
/// @dev Return the NftId zero (0)
|
28
29
|
function zeroNftId() pure returns (NftId) {
|
29
30
|
return NftId.wrap(0);
|
@@ -40,6 +41,13 @@ function neNftId(NftId a, NftId b) pure returns (bool isDifferent) {
|
|
40
41
|
|
41
42
|
// library functions that operate on user defined type
|
42
43
|
library NftIdLib {
|
44
|
+
|
45
|
+
/// @dev the zero nft id
|
46
|
+
/// is never a valid nft id and implies a non-initialized value
|
47
|
+
function zero() public pure returns (NftId) {
|
48
|
+
return NftId.wrap(0);
|
49
|
+
}
|
50
|
+
|
43
51
|
/// @dev Converts the NftId to a uint256.
|
44
52
|
function toInt(NftId nftId) public pure returns (uint96) {
|
45
53
|
return uint96(NftId.unwrap(nftId));
|
@@ -115,6 +115,7 @@ function toObjectType(uint256 objectType) pure returns (ObjectType) {
|
|
115
115
|
return ObjectType.wrap(uint8(objectType));
|
116
116
|
}
|
117
117
|
|
118
|
+
// TODO move to ObjecTypeLib and rename to zero()
|
118
119
|
/// @dev Return the ObjectType zero (0)
|
119
120
|
function zeroObjectType() pure returns (ObjectType) {
|
120
121
|
return ObjectType.wrap(0);
|
@@ -67,6 +67,7 @@ function toStateId(uint256 id) pure returns (StateId) {
|
|
67
67
|
return StateId.wrap(uint8(id));
|
68
68
|
}
|
69
69
|
|
70
|
+
// TODO move to StateIdLib and rename to zero()
|
70
71
|
/// @dev Return the StateId zero (0)
|
71
72
|
function zeroStateId() pure returns (StateId) {
|
72
73
|
return StateId.wrap(0);
|
@@ -53,6 +53,7 @@ function toTimestamp(uint256 timestamp) pure returns (Timestamp) {
|
|
53
53
|
return Timestamp.wrap(uint40(timestamp));
|
54
54
|
}
|
55
55
|
|
56
|
+
// TODO move to TimestampLib and rename to zero()
|
56
57
|
/// @dev Return the Timestamp zero (0)
|
57
58
|
function zeroTimestamp() pure returns (Timestamp) {
|
58
59
|
return toTimestamp(0);
|
package/package.json
CHANGED