@etherisc/gif-next 0.0.2-f0d86c2-077 → 0.0.2-f12cf4d-104
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +297 -26
- package/artifacts/contracts/authorization/AccessAdmin.sol/AccessAdmin.dbg.json +4 -0
- package/artifacts/contracts/authorization/AccessAdmin.sol/AccessAdmin.json +1293 -0
- package/artifacts/contracts/authorization/AccessManagerCloneable.sol/AccessManagerCloneable.dbg.json +4 -0
- package/artifacts/contracts/authorization/AccessManagerCloneable.sol/AccessManagerCloneable.json +1206 -0
- package/artifacts/contracts/authorization/Authorization.sol/Authorization.dbg.json +4 -0
- package/artifacts/contracts/authorization/Authorization.sol/Authorization.json +414 -0
- package/artifacts/contracts/authorization/IAccess.sol/IAccess.dbg.json +4 -0
- package/artifacts/contracts/{instance/module/access → authorization}/IAccess.sol/IAccess.json +1 -1
- package/artifacts/contracts/authorization/IAccessAdmin.sol/IAccessAdmin.dbg.json +4 -0
- package/artifacts/contracts/authorization/IAccessAdmin.sol/IAccessAdmin.json +1060 -0
- package/artifacts/contracts/authorization/IAuthorization.sol/IAuthorization.dbg.json +4 -0
- package/artifacts/contracts/authorization/IAuthorization.sol/IAuthorization.json +295 -0
- package/artifacts/contracts/authorization/IServiceAuthorization.sol/IServiceAuthorization.dbg.json +4 -0
- package/artifacts/contracts/authorization/IServiceAuthorization.sol/IServiceAuthorization.json +167 -0
- package/artifacts/contracts/authorization/ReleaseAccessManager.sol/ReleaseAccessManager.dbg.json +4 -0
- package/artifacts/contracts/authorization/ReleaseAccessManager.sol/ReleaseAccessManager.json +1196 -0
- package/artifacts/contracts/authorization/ServiceAuthorization.sol/ServiceAuthorization.dbg.json +4 -0
- package/artifacts/contracts/authorization/ServiceAuthorization.sol/ServiceAuthorization.json +253 -0
- package/artifacts/contracts/distribution/BasicDistribution.sol/BasicDistribution.dbg.json +4 -0
- package/artifacts/contracts/distribution/BasicDistribution.sol/BasicDistribution.json +1324 -0
- package/artifacts/contracts/distribution/BasicDistributionAuthorization.sol/BasicDistributionAuthorization.dbg.json +4 -0
- package/artifacts/contracts/distribution/BasicDistributionAuthorization.sol/BasicDistributionAuthorization.json +470 -0
- package/artifacts/contracts/distribution/Distribution.sol/Distribution.dbg.json +4 -0
- package/artifacts/contracts/distribution/Distribution.sol/Distribution.json +1018 -0
- package/artifacts/contracts/distribution/DistributionService.sol/DistributionService.dbg.json +4 -0
- package/artifacts/contracts/distribution/DistributionService.sol/DistributionService.json +1471 -0
- package/artifacts/contracts/distribution/DistributionServiceManager.sol/DistributionServiceManager.dbg.json +4 -0
- package/artifacts/contracts/distribution/DistributionServiceManager.sol/DistributionServiceManager.json +862 -0
- package/artifacts/contracts/distribution/IDistributionComponent.sol/IDistributionComponent.dbg.json +4 -0
- package/artifacts/contracts/distribution/IDistributionComponent.sol/IDistributionComponent.json +917 -0
- package/artifacts/contracts/distribution/IDistributionService.sol/IDistributionService.dbg.json +4 -0
- package/artifacts/contracts/distribution/IDistributionService.sol/IDistributionService.json +961 -0
- package/artifacts/contracts/examples/fire/DamageLevel.sol/DamageLevelLib.dbg.json +4 -0
- package/artifacts/contracts/examples/fire/DamageLevel.sol/DamageLevelLib.json +22 -0
- package/artifacts/contracts/examples/fire/FirePool.sol/FirePool.dbg.json +4 -0
- package/artifacts/contracts/examples/fire/FirePool.sol/FirePool.json +1429 -0
- package/artifacts/contracts/examples/fire/FirePoolAuthorization.sol/FirePoolAuthorization.dbg.json +4 -0
- package/artifacts/contracts/examples/fire/FirePoolAuthorization.sol/FirePoolAuthorization.json +502 -0
- package/artifacts/contracts/examples/fire/FireProduct.sol/FireProduct.dbg.json +4 -0
- package/artifacts/contracts/examples/fire/FireProduct.sol/FireProduct.json +1979 -0
- package/artifacts/contracts/examples/fire/FireProductAuthorization.sol/FireProductAuthorization.dbg.json +4 -0
- package/artifacts/contracts/examples/fire/FireProductAuthorization.sol/FireProductAuthorization.json +470 -0
- package/artifacts/contracts/examples/fire/FireUSD.sol/FireUSD.dbg.json +4 -0
- package/artifacts/contracts/examples/fire/FireUSD.sol/FireUSD.json +376 -0
- package/artifacts/contracts/examples/unpermissioned/SimpleDistribution.sol/SimpleDistribution.dbg.json +4 -0
- package/artifacts/contracts/examples/unpermissioned/SimpleDistribution.sol/SimpleDistribution.json +1430 -0
- package/artifacts/contracts/examples/unpermissioned/SimpleOracle.sol/SimpleOracle.dbg.json +4 -0
- package/artifacts/contracts/examples/unpermissioned/SimpleOracle.sol/SimpleOracle.json +1177 -0
- package/artifacts/contracts/examples/unpermissioned/SimplePool.sol/SimplePool.dbg.json +4 -0
- package/artifacts/contracts/examples/unpermissioned/SimplePool.sol/SimplePool.json +1606 -0
- package/artifacts/contracts/examples/unpermissioned/SimpleProduct.sol/SimpleProduct.dbg.json +4 -0
- package/artifacts/contracts/examples/unpermissioned/SimpleProduct.sol/SimpleProduct.json +2281 -0
- package/artifacts/contracts/instance/BundleSet.sol/BundleSet.dbg.json +4 -0
- package/artifacts/contracts/instance/BundleSet.sol/BundleSet.json +703 -0
- package/artifacts/contracts/instance/IInstance.sol/IInstance.dbg.json +1 -1
- package/artifacts/contracts/instance/IInstance.sol/IInstance.json +290 -1482
- package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.dbg.json +4 -0
- package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.json +702 -0
- package/artifacts/contracts/instance/Instance.sol/Instance.dbg.json +1 -1
- package/artifacts/contracts/instance/Instance.sol/Instance.json +418 -1761
- package/artifacts/contracts/instance/InstanceAdmin.sol/InstanceAdmin.dbg.json +4 -0
- package/artifacts/contracts/instance/InstanceAdmin.sol/InstanceAdmin.json +1653 -0
- package/artifacts/contracts/instance/InstanceAuthorizationV3.sol/InstanceAuthorizationV3.dbg.json +4 -0
- package/artifacts/contracts/instance/InstanceAuthorizationV3.sol/InstanceAuthorizationV3.json +561 -0
- package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.dbg.json +4 -0
- package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.json +2053 -0
- package/artifacts/contracts/instance/InstanceService.sol/InstanceService.dbg.json +4 -0
- package/artifacts/contracts/instance/InstanceService.sol/InstanceService.json +1011 -0
- package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.dbg.json +4 -0
- package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.json +746 -0
- package/artifacts/contracts/instance/InstanceStore.sol/InstanceStore.dbg.json +4 -0
- package/artifacts/contracts/instance/InstanceStore.sol/InstanceStore.json +3668 -0
- package/artifacts/contracts/instance/base/BalanceStore.sol/BalanceStore.dbg.json +4 -0
- package/artifacts/contracts/instance/base/BalanceStore.sol/BalanceStore.json +318 -0
- package/artifacts/contracts/instance/base/Cloneable.sol/Cloneable.dbg.json +4 -0
- package/artifacts/contracts/instance/base/Cloneable.sol/Cloneable.json +137 -0
- package/artifacts/contracts/instance/base/ObjectCounter.sol/ObjectCounter.dbg.json +4 -0
- package/artifacts/contracts/instance/base/ObjectCounter.sol/ObjectCounter.json +10 -0
- package/artifacts/contracts/instance/base/ObjectLifecycle.sol/ObjectLifecycle.dbg.json +4 -0
- package/artifacts/contracts/instance/base/ObjectLifecycle.sol/ObjectLifecycle.json +223 -0
- package/artifacts/contracts/instance/base/ObjectSet.sol/ObjectSet.dbg.json +4 -0
- package/artifacts/contracts/instance/base/ObjectSet.sol/ObjectSet.json +181 -0
- package/artifacts/contracts/instance/module/IAccess.sol/IAccess.dbg.json +4 -0
- package/artifacts/contracts/instance/module/IAccess.sol/IAccess.json +129 -0
- package/artifacts/contracts/instance/module/IBundle.sol/IBundle.dbg.json +4 -0
- package/artifacts/contracts/instance/module/{bundle/IBundle.sol → IBundle.sol}/IBundle.json +1 -1
- package/artifacts/contracts/instance/module/IComponents.sol/IComponents.dbg.json +4 -0
- package/artifacts/contracts/instance/{base/ModuleBase.sol/ModuleBase.json → module/IComponents.sol/IComponents.json} +2 -2
- package/artifacts/contracts/instance/module/IDistribution.sol/IDistribution.dbg.json +4 -0
- package/artifacts/contracts/instance/module/IDistribution.sol/IDistribution.json +10 -0
- package/artifacts/contracts/instance/module/IPolicy.sol/IPolicy.dbg.json +4 -0
- package/artifacts/contracts/instance/module/{policy/IPolicy.sol → IPolicy.sol}/IPolicy.json +1 -1
- package/artifacts/contracts/instance/module/IRisk.sol/IRisk.dbg.json +4 -0
- package/artifacts/contracts/instance/module/{risk/IRisk.sol → IRisk.sol}/IRisk.json +1 -1
- package/artifacts/contracts/mock/Dip.sol/Dip.dbg.json +4 -0
- package/artifacts/contracts/mock/Dip.sol/Dip.json +376 -0
- package/artifacts/contracts/oracle/BasicOracle.sol/BasicOracle.dbg.json +4 -0
- package/artifacts/contracts/oracle/BasicOracle.sol/BasicOracle.json +961 -0
- package/artifacts/contracts/oracle/BasicOracleAuthorization.sol/BasicOracleAuthorization.dbg.json +4 -0
- package/artifacts/contracts/oracle/BasicOracleAuthorization.sol/BasicOracleAuthorization.json +478 -0
- package/artifacts/contracts/oracle/IOracle.sol/IOracle.dbg.json +4 -0
- package/artifacts/contracts/oracle/IOracle.sol/IOracle.json +52 -0
- package/artifacts/contracts/oracle/IOracleComponent.sol/IOracleComponent.dbg.json +4 -0
- package/artifacts/contracts/oracle/IOracleComponent.sol/IOracleComponent.json +776 -0
- package/artifacts/contracts/oracle/IOracleService.sol/IOracleService.dbg.json +4 -0
- package/artifacts/contracts/oracle/IOracleService.sol/IOracleService.json +709 -0
- package/artifacts/contracts/oracle/Oracle.sol/Oracle.dbg.json +4 -0
- package/artifacts/contracts/oracle/Oracle.sol/Oracle.json +877 -0
- package/artifacts/contracts/oracle/OracleService.sol/OracleService.dbg.json +4 -0
- package/artifacts/contracts/oracle/OracleService.sol/OracleService.json +982 -0
- package/artifacts/contracts/oracle/OracleServiceManager.sol/OracleServiceManager.dbg.json +4 -0
- package/artifacts/contracts/oracle/OracleServiceManager.sol/OracleServiceManager.json +746 -0
- package/artifacts/contracts/pool/BasicPool.sol/BasicPool.dbg.json +4 -0
- package/artifacts/contracts/pool/BasicPool.sol/BasicPool.json +1254 -0
- package/artifacts/contracts/pool/BasicPoolAuthorization.sol/BasicPoolAuthorization.dbg.json +4 -0
- package/artifacts/contracts/pool/BasicPoolAuthorization.sol/BasicPoolAuthorization.json +502 -0
- package/artifacts/contracts/pool/BundleService.sol/BundleService.dbg.json +4 -0
- package/artifacts/contracts/pool/BundleService.sol/BundleService.json +1469 -0
- package/artifacts/contracts/pool/BundleServiceManager.sol/BundleServiceManager.dbg.json +4 -0
- package/artifacts/contracts/pool/BundleServiceManager.sol/BundleServiceManager.json +850 -0
- package/artifacts/contracts/pool/IBundleService.sol/IBundleService.dbg.json +4 -0
- package/artifacts/contracts/pool/IBundleService.sol/IBundleService.json +964 -0
- package/artifacts/contracts/pool/IPoolComponent.sol/IPoolComponent.dbg.json +4 -0
- package/artifacts/contracts/pool/IPoolComponent.sol/IPoolComponent.json +909 -0
- package/artifacts/contracts/pool/IPoolService.sol/IPoolService.dbg.json +4 -0
- package/artifacts/contracts/pool/IPoolService.sol/IPoolService.json +1285 -0
- package/artifacts/contracts/pool/Pool.sol/Pool.dbg.json +4 -0
- package/artifacts/contracts/pool/Pool.sol/Pool.json +1029 -0
- package/artifacts/contracts/pool/PoolService.sol/PoolService.dbg.json +4 -0
- package/artifacts/contracts/pool/PoolService.sol/PoolService.json +1635 -0
- package/artifacts/contracts/pool/PoolServiceManager.sol/PoolServiceManager.dbg.json +4 -0
- package/artifacts/contracts/pool/PoolServiceManager.sol/PoolServiceManager.json +786 -0
- package/artifacts/contracts/product/ApplicationService.sol/ApplicationService.dbg.json +4 -0
- package/artifacts/contracts/product/ApplicationService.sol/ApplicationService.json +787 -0
- package/artifacts/contracts/product/ApplicationServiceManager.sol/ApplicationServiceManager.dbg.json +4 -0
- package/artifacts/contracts/product/ApplicationServiceManager.sol/ApplicationServiceManager.json +734 -0
- package/artifacts/contracts/product/BasicProduct.sol/BasicProduct.dbg.json +4 -0
- package/artifacts/contracts/product/BasicProduct.sol/BasicProduct.json +1148 -0
- package/artifacts/contracts/product/BasicProductAuthorization.sol/BasicProductAuthorization.dbg.json +4 -0
- package/artifacts/contracts/product/BasicProductAuthorization.sol/BasicProductAuthorization.json +470 -0
- package/artifacts/contracts/product/ClaimService.sol/ClaimService.dbg.json +4 -0
- package/artifacts/contracts/product/ClaimService.sol/ClaimService.json +1439 -0
- package/artifacts/contracts/product/ClaimServiceManager.sol/ClaimServiceManager.dbg.json +4 -0
- package/artifacts/contracts/product/ClaimServiceManager.sol/ClaimServiceManager.json +858 -0
- package/artifacts/contracts/product/IApplicationService.sol/IApplicationService.dbg.json +4 -0
- package/artifacts/contracts/product/IApplicationService.sol/IApplicationService.json +546 -0
- package/artifacts/contracts/product/IClaimService.sol/IClaimService.dbg.json +4 -0
- package/artifacts/contracts/product/IClaimService.sol/IClaimService.json +942 -0
- package/artifacts/contracts/product/IPolicyService.sol/IPolicyService.dbg.json +4 -0
- package/artifacts/contracts/product/IPolicyService.sol/IPolicyService.json +931 -0
- package/artifacts/contracts/product/IPricingService.sol/IPricingService.dbg.json +4 -0
- package/artifacts/contracts/product/IPricingService.sol/IPricingService.json +578 -0
- package/artifacts/contracts/product/IProductComponent.sol/IProductComponent.dbg.json +4 -0
- package/artifacts/contracts/product/IProductComponent.sol/IProductComponent.json +1005 -0
- package/artifacts/contracts/product/IRiskService.sol/IRiskService.dbg.json +4 -0
- package/artifacts/contracts/product/IRiskService.sol/IRiskService.json +429 -0
- package/artifacts/contracts/product/PolicyService.sol/PolicyService.dbg.json +4 -0
- package/artifacts/contracts/product/PolicyService.sol/PolicyService.json +1316 -0
- package/artifacts/contracts/product/PolicyServiceManager.sol/PolicyServiceManager.dbg.json +4 -0
- package/artifacts/contracts/product/PolicyServiceManager.sol/PolicyServiceManager.json +802 -0
- package/artifacts/contracts/product/PricingService.sol/PricingService.dbg.json +4 -0
- package/artifacts/contracts/product/PricingService.sol/PricingService.json +923 -0
- package/artifacts/contracts/product/PricingServiceManager.sol/PricingServiceManager.dbg.json +4 -0
- package/artifacts/contracts/product/PricingServiceManager.sol/PricingServiceManager.json +786 -0
- package/artifacts/contracts/product/Product.sol/Product.dbg.json +4 -0
- package/artifacts/contracts/product/Product.sol/Product.json +1106 -0
- package/artifacts/contracts/product/RiskService.sol/RiskService.dbg.json +4 -0
- package/artifacts/contracts/product/RiskService.sol/RiskService.json +638 -0
- package/artifacts/contracts/product/RiskServiceManager.sol/RiskServiceManager.dbg.json +4 -0
- package/artifacts/contracts/product/RiskServiceManager.sol/RiskServiceManager.json +718 -0
- package/artifacts/contracts/registry/ChainNft.sol/ChainNft.dbg.json +1 -1
- package/artifacts/contracts/registry/ChainNft.sol/ChainNft.json +242 -12
- package/artifacts/contracts/registry/IRegistry.sol/IRegistry.dbg.json +1 -1
- package/artifacts/contracts/registry/IRegistry.sol/IRegistry.json +1000 -119
- package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.dbg.json +4 -0
- package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.json +1019 -0
- package/artifacts/contracts/registry/ITransferInterceptor.sol/ITransferInterceptor.dbg.json +4 -0
- package/artifacts/contracts/registry/ITransferInterceptor.sol/ITransferInterceptor.json +39 -0
- package/artifacts/contracts/registry/Registry.sol/Registry.dbg.json +1 -1
- package/artifacts/contracts/registry/Registry.sol/Registry.json +1427 -220
- package/artifacts/contracts/registry/RegistryAdmin.sol/RegistryAdmin.dbg.json +4 -0
- package/artifacts/contracts/registry/RegistryAdmin.sol/RegistryAdmin.json +1899 -0
- package/artifacts/contracts/registry/RegistryService.sol/RegistryService.dbg.json +4 -0
- package/artifacts/contracts/registry/RegistryService.sol/RegistryService.json +1262 -0
- package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.dbg.json +4 -0
- package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.json +737 -0
- package/artifacts/contracts/registry/ReleaseLifecycle.sol/ReleaseLifecycle.dbg.json +4 -0
- package/artifacts/contracts/registry/ReleaseLifecycle.sol/ReleaseLifecycle.json +205 -0
- package/artifacts/contracts/registry/ReleaseRegistry.sol/ReleaseRegistry.dbg.json +4 -0
- package/artifacts/contracts/registry/ReleaseRegistry.sol/ReleaseRegistry.json +1067 -0
- package/artifacts/contracts/registry/ServiceAuthorizationV3.sol/ServiceAuthorizationV3.dbg.json +4 -0
- package/artifacts/contracts/registry/ServiceAuthorizationV3.sol/ServiceAuthorizationV3.json +272 -0
- package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.dbg.json +4 -0
- package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.json +661 -0
- package/artifacts/contracts/shared/Component.sol/Component.dbg.json +4 -0
- package/artifacts/contracts/shared/Component.sol/Component.json +695 -0
- package/artifacts/contracts/shared/ComponentService.sol/ComponentService.dbg.json +4 -0
- package/artifacts/contracts/shared/ComponentService.sol/ComponentService.json +1843 -0
- package/artifacts/contracts/shared/ComponentServiceManager.sol/ComponentServiceManager.dbg.json +4 -0
- package/artifacts/contracts/shared/ComponentServiceManager.sol/ComponentServiceManager.json +834 -0
- package/artifacts/contracts/shared/ComponentVerifyingService.sol/ComponentVerifyingService.dbg.json +4 -0
- package/artifacts/contracts/{instance/service/IProductService.sol/IProductService.json → shared/ComponentVerifyingService.sol/ComponentVerifyingService.json} +232 -235
- package/artifacts/contracts/shared/ContractLib.sol/ContractLib.dbg.json +4 -0
- package/artifacts/contracts/shared/ContractLib.sol/ContractLib.json +111 -0
- package/artifacts/contracts/shared/IComponent.sol/IComponent.dbg.json +4 -0
- package/artifacts/contracts/shared/IComponent.sol/IComponent.json +620 -0
- package/artifacts/contracts/shared/IComponentService.sol/IComponentService.dbg.json +4 -0
- package/artifacts/contracts/shared/IComponentService.sol/IComponentService.json +1402 -0
- package/artifacts/contracts/shared/IInstanceLinkedComponent.sol/IInstanceLinkedComponent.dbg.json +4 -0
- package/artifacts/contracts/shared/IInstanceLinkedComponent.sol/IInstanceLinkedComponent.json +711 -0
- package/artifacts/contracts/shared/IKeyValueStore.sol/IKeyValueStore.dbg.json +4 -0
- package/artifacts/contracts/{instance/base → shared}/IKeyValueStore.sol/IKeyValueStore.json +140 -141
- package/artifacts/contracts/shared/ILifecycle.sol/ILifecycle.dbg.json +4 -0
- package/artifacts/contracts/{instance/base → shared}/ILifecycle.sol/ILifecycle.json +35 -4
- package/artifacts/contracts/shared/INftOwnable.sol/INftOwnable.dbg.json +4 -0
- package/artifacts/contracts/{components/IBaseComponent.sol/IBaseComponent.json → shared/INftOwnable.sol/INftOwnable.json} +47 -74
- package/artifacts/contracts/shared/IPolicyHolder.sol/IPolicyHolder.dbg.json +4 -0
- package/artifacts/contracts/shared/IPolicyHolder.sol/IPolicyHolder.json +175 -0
- package/artifacts/contracts/shared/IRegisterable.sol/IRegisterable.dbg.json +1 -1
- package/artifacts/contracts/shared/IRegisterable.sol/IRegisterable.json +113 -24
- package/artifacts/contracts/shared/IRegistryLinked.sol/IRegistryLinked.dbg.json +4 -0
- package/artifacts/contracts/{registry → shared}/IRegistryLinked.sol/IRegistryLinked.json +13 -2
- package/artifacts/contracts/shared/IService.sol/IService.dbg.json +4 -0
- package/artifacts/contracts/{instance/service/IComponentOwnerService.sol/IComponentOwnerService.json → shared/IService.sol/IService.json} +182 -171
- package/artifacts/contracts/shared/InitializableERC165.sol/InitializableERC165.dbg.json +4 -0
- package/artifacts/contracts/shared/InitializableERC165.sol/InitializableERC165.json +53 -0
- package/artifacts/contracts/shared/InstanceLinkedComponent.sol/InstanceLinkedComponent.dbg.json +4 -0
- package/artifacts/contracts/shared/InstanceLinkedComponent.sol/InstanceLinkedComponent.json +799 -0
- package/artifacts/contracts/shared/KeyValueStore.sol/KeyValueStore.dbg.json +4 -0
- package/artifacts/contracts/shared/KeyValueStore.sol/KeyValueStore.json +538 -0
- package/artifacts/contracts/shared/Lifecycle.sol/Lifecycle.dbg.json +4 -0
- package/artifacts/contracts/shared/Lifecycle.sol/Lifecycle.json +174 -0
- package/artifacts/contracts/shared/NftIdSet.sol/NftIdSet.dbg.json +4 -0
- package/artifacts/contracts/shared/NftIdSet.sol/NftIdSet.json +306 -0
- package/artifacts/contracts/shared/NftOwnable.sol/NftOwnable.dbg.json +4 -0
- package/artifacts/contracts/shared/NftOwnable.sol/NftOwnable.json +209 -0
- package/artifacts/contracts/shared/PolicyHolder.sol/PolicyHolder.dbg.json +4 -0
- package/artifacts/contracts/shared/PolicyHolder.sol/PolicyHolder.json +198 -0
- package/artifacts/contracts/shared/Registerable.sol/Registerable.dbg.json +1 -1
- package/artifacts/contracts/shared/Registerable.sol/Registerable.json +224 -23
- package/artifacts/contracts/shared/RegistryLinked.sol/RegistryLinked.dbg.json +4 -0
- package/artifacts/contracts/shared/RegistryLinked.sol/RegistryLinked.json +58 -0
- package/artifacts/contracts/shared/Service.sol/Service.dbg.json +4 -0
- package/artifacts/contracts/{instance/service/IPoolService.sol/IPoolService.json → shared/Service.sol/Service.json} +239 -173
- package/artifacts/contracts/shared/TokenHandler.sol/TokenHandler.dbg.json +4 -0
- package/artifacts/contracts/shared/TokenHandler.sol/TokenHandler.json +822 -0
- package/artifacts/contracts/shared/TokenHandler.sol/TokenHandlerBase.dbg.json +4 -0
- package/artifacts/contracts/shared/TokenHandler.sol/TokenHandlerBase.json +395 -0
- package/artifacts/contracts/shared/TokenHandlerDeployerLib.sol/TokenHandlerDeployerLib.dbg.json +4 -0
- package/artifacts/contracts/shared/TokenHandlerDeployerLib.sol/TokenHandlerDeployerLib.json +172 -0
- package/artifacts/contracts/staking/IStaking.sol/IStaking.dbg.json +4 -0
- package/artifacts/contracts/staking/IStaking.sol/IStaking.json +1435 -0
- package/artifacts/contracts/staking/IStakingService.sol/IStakingService.dbg.json +4 -0
- package/artifacts/contracts/staking/IStakingService.sol/IStakingService.json +1043 -0
- package/artifacts/contracts/staking/StakeManagerLib.sol/StakeManagerLib.dbg.json +4 -0
- package/artifacts/contracts/staking/StakeManagerLib.sol/StakeManagerLib.json +440 -0
- package/artifacts/contracts/staking/Staking.sol/Staking.dbg.json +4 -0
- package/artifacts/contracts/staking/Staking.sol/Staking.json +1816 -0
- package/artifacts/contracts/staking/StakingLifecycle.sol/StakingLifecycle.dbg.json +4 -0
- package/artifacts/contracts/staking/StakingLifecycle.sol/StakingLifecycle.json +205 -0
- package/artifacts/contracts/staking/StakingManager.sol/StakingManager.dbg.json +4 -0
- package/artifacts/contracts/staking/StakingManager.sol/StakingManager.json +780 -0
- package/artifacts/contracts/staking/StakingReader.sol/StakingReader.dbg.json +4 -0
- package/artifacts/contracts/staking/StakingReader.sol/StakingReader.json +587 -0
- package/artifacts/contracts/staking/StakingService.sol/StakingService.dbg.json +4 -0
- package/artifacts/contracts/staking/StakingService.sol/StakingService.json +1265 -0
- package/artifacts/contracts/staking/StakingServiceManager.sol/StakingServiceManager.dbg.json +4 -0
- package/artifacts/contracts/staking/StakingServiceManager.sol/StakingServiceManager.json +734 -0
- package/artifacts/contracts/staking/StakingStore.sol/StakingStore.dbg.json +4 -0
- package/artifacts/contracts/staking/StakingStore.sol/StakingStore.json +2283 -0
- package/artifacts/contracts/staking/TargetManagerLib.sol/TargetManagerLib.dbg.json +4 -0
- package/artifacts/contracts/staking/TargetManagerLib.sol/TargetManagerLib.json +607 -0
- package/artifacts/contracts/type/AddressSet.sol/LibAddressSet.dbg.json +4 -0
- package/artifacts/contracts/type/AddressSet.sol/LibAddressSet.json +10 -0
- package/artifacts/contracts/type/Amount.sol/AmountLib.dbg.json +4 -0
- package/artifacts/contracts/type/Amount.sol/AmountLib.json +398 -0
- package/artifacts/contracts/type/Blocknumber.sol/BlocknumberLib.dbg.json +4 -0
- package/artifacts/contracts/type/Blocknumber.sol/BlocknumberLib.json +225 -0
- package/artifacts/contracts/type/ClaimId.sol/ClaimIdLib.dbg.json +4 -0
- package/artifacts/contracts/type/ClaimId.sol/ClaimIdLib.json +203 -0
- package/artifacts/contracts/type/DistributorType.sol/DistributorTypeLib.dbg.json +4 -0
- package/artifacts/contracts/type/DistributorType.sol/DistributorTypeLib.json +104 -0
- package/artifacts/contracts/type/Fee.sol/FeeLib.dbg.json +4 -0
- package/artifacts/contracts/type/Fee.sol/FeeLib.json +317 -0
- package/artifacts/contracts/type/Key32.sol/Key32Lib.dbg.json +4 -0
- package/artifacts/contracts/type/Key32.sol/Key32Lib.json +125 -0
- package/artifacts/contracts/type/NftId.sol/NftIdLib.dbg.json +4 -0
- package/artifacts/contracts/type/NftId.sol/NftIdLib.json +209 -0
- package/artifacts/contracts/type/NftIdSet.sol/LibNftIdSet.dbg.json +4 -0
- package/artifacts/contracts/type/NftIdSet.sol/LibNftIdSet.json +33 -0
- package/artifacts/contracts/type/ObjectType.sol/ObjectTypeLib.dbg.json +4 -0
- package/artifacts/contracts/type/ObjectType.sol/ObjectTypeLib.json +239 -0
- package/artifacts/contracts/type/PayoutId.sol/PayoutIdLib.dbg.json +4 -0
- package/artifacts/contracts/type/PayoutId.sol/PayoutIdLib.json +209 -0
- package/artifacts/contracts/type/Referral.sol/ReferralLib.dbg.json +4 -0
- package/artifacts/contracts/type/Referral.sol/ReferralLib.json +142 -0
- package/artifacts/contracts/type/RequestId.sol/RequestIdLib.dbg.json +4 -0
- package/artifacts/contracts/type/RequestId.sol/RequestIdLib.json +204 -0
- package/artifacts/contracts/type/RiskId.sol/RiskIdLib.dbg.json +4 -0
- package/artifacts/contracts/type/RiskId.sol/RiskIdLib.json +142 -0
- package/artifacts/contracts/type/RoleId.sol/RoleIdLib.dbg.json +4 -0
- package/artifacts/contracts/type/RoleId.sol/RoleIdLib.json +369 -0
- package/artifacts/contracts/type/Seconds.sol/SecondsLib.dbg.json +4 -0
- package/artifacts/contracts/type/Seconds.sol/SecondsLib.json +246 -0
- package/artifacts/contracts/type/Selector.sol/SelectorLib.dbg.json +4 -0
- package/artifacts/contracts/type/Selector.sol/SelectorLib.json +129 -0
- package/artifacts/contracts/type/Selector.sol/SelectorSetLib.dbg.json +4 -0
- package/artifacts/contracts/type/Selector.sol/SelectorSetLib.json +10 -0
- package/artifacts/contracts/type/StateId.sol/StateIdLib.dbg.json +4 -0
- package/artifacts/contracts/type/StateId.sol/StateIdLib.json +105 -0
- package/artifacts/contracts/type/String.sol/StrLib.dbg.json +4 -0
- package/artifacts/contracts/type/String.sol/StrLib.json +132 -0
- package/artifacts/contracts/type/Timestamp.sol/TimestampLib.dbg.json +4 -0
- package/artifacts/contracts/type/Timestamp.sol/TimestampLib.json +312 -0
- package/artifacts/contracts/type/UFixed.sol/MathLib.dbg.json +4 -0
- package/artifacts/contracts/type/UFixed.sol/MathLib.json +16 -0
- package/artifacts/contracts/type/UFixed.sol/UFixedLib.dbg.json +4 -0
- package/artifacts/contracts/type/UFixed.sol/UFixedLib.json +548 -0
- package/artifacts/contracts/type/Version.sol/VersionLib.dbg.json +4 -0
- package/artifacts/contracts/type/Version.sol/VersionLib.json +177 -0
- package/artifacts/contracts/type/Version.sol/VersionPartLib.dbg.json +4 -0
- package/artifacts/contracts/type/Version.sol/VersionPartLib.json +68 -0
- package/artifacts/contracts/upgradeability/IVersionable.sol/IVersionable.dbg.json +4 -0
- package/artifacts/contracts/upgradeability/IVersionable.sol/IVersionable.json +55 -0
- package/artifacts/contracts/upgradeability/ProxyManager.sol/ProxyManager.dbg.json +4 -0
- package/artifacts/contracts/upgradeability/ProxyManager.sol/ProxyManager.json +618 -0
- package/artifacts/contracts/upgradeability/UpgradableProxyWithAdmin.sol/UpgradableProxyWithAdmin.dbg.json +4 -0
- package/artifacts/contracts/upgradeability/UpgradableProxyWithAdmin.sol/UpgradableProxyWithAdmin.json +129 -0
- package/artifacts/contracts/upgradeability/Versionable.sol/Versionable.dbg.json +4 -0
- package/artifacts/contracts/upgradeability/Versionable.sol/Versionable.json +78 -0
- package/contracts/authorization/AccessAdmin.sol +596 -0
- package/contracts/authorization/AccessManagerCloneable.sol +16 -0
- package/contracts/authorization/Authorization.sol +289 -0
- package/contracts/authorization/IAccess.sol +49 -0
- package/contracts/authorization/IAccessAdmin.sol +137 -0
- package/contracts/authorization/IAuthorization.sol +60 -0
- package/contracts/authorization/IServiceAuthorization.sol +40 -0
- package/contracts/authorization/ReleaseAccessManager.sol +38 -0
- package/contracts/authorization/ServiceAuthorization.sol +106 -0
- package/contracts/distribution/BasicDistribution.sol +139 -0
- package/contracts/distribution/BasicDistributionAuthorization.sol +47 -0
- package/contracts/distribution/Distribution.sol +285 -0
- package/contracts/distribution/DistributionService.sol +355 -0
- package/contracts/distribution/DistributionServiceManager.sol +39 -0
- package/contracts/distribution/IDistributionComponent.sol +52 -0
- package/contracts/distribution/IDistributionService.sol +101 -0
- package/contracts/examples/fire/DamageLevel.sol +59 -0
- package/contracts/examples/fire/FirePool.sol +86 -0
- package/contracts/examples/fire/FirePoolAuthorization.sol +34 -0
- package/contracts/examples/fire/FireProduct.sol +431 -0
- package/contracts/examples/fire/FireProductAuthorization.sol +44 -0
- package/contracts/examples/fire/FireUSD.sol +26 -0
- package/contracts/examples/unpermissioned/SimpleDistribution.sol +58 -0
- package/contracts/examples/unpermissioned/SimpleOracle.sol +137 -0
- package/contracts/examples/unpermissioned/SimplePool.sol +108 -0
- package/contracts/examples/unpermissioned/SimpleProduct.sol +345 -0
- package/contracts/instance/BundleSet.sol +126 -0
- package/contracts/instance/IInstance.sol +58 -44
- package/contracts/instance/IInstanceService.sol +71 -0
- package/contracts/instance/Instance.sol +218 -54
- package/contracts/instance/InstanceAdmin.sol +277 -0
- package/contracts/instance/InstanceAuthorizationV3.sol +194 -0
- package/contracts/instance/InstanceReader.sol +495 -0
- package/contracts/instance/InstanceService.sol +414 -0
- package/contracts/instance/InstanceServiceManager.sol +39 -0
- package/contracts/instance/InstanceStore.sol +287 -0
- package/contracts/instance/base/BalanceStore.sol +123 -0
- package/contracts/instance/base/Cloneable.sol +28 -0
- package/contracts/instance/base/ObjectCounter.sol +21 -0
- package/contracts/instance/base/ObjectLifecycle.sol +111 -0
- package/contracts/instance/base/ObjectSet.sol +79 -0
- package/contracts/instance/module/IAccess.sol +46 -0
- package/contracts/instance/module/IBundle.sol +20 -0
- package/contracts/instance/module/IComponents.sol +50 -0
- package/contracts/instance/module/IDistribution.sol +41 -0
- package/contracts/instance/module/IPolicy.sol +85 -0
- package/contracts/instance/module/IRisk.sol +11 -0
- package/contracts/{test/Usdc.sol → mock/Dip.sol} +6 -6
- package/contracts/oracle/BasicOracle.sol +47 -0
- package/contracts/oracle/BasicOracleAuthorization.sol +46 -0
- package/contracts/oracle/IOracle.sol +36 -0
- package/contracts/oracle/IOracleComponent.sol +33 -0
- package/contracts/oracle/IOracleService.sol +66 -0
- package/contracts/oracle/Oracle.sol +156 -0
- package/contracts/oracle/OracleService.sol +292 -0
- package/contracts/oracle/OracleServiceManager.sol +39 -0
- package/contracts/pool/BasicPool.sol +175 -0
- package/contracts/pool/BasicPoolAuthorization.sol +68 -0
- package/contracts/pool/BundleService.sol +485 -0
- package/contracts/pool/BundleServiceManager.sol +39 -0
- package/contracts/pool/IBundleService.sol +140 -0
- package/contracts/pool/IPoolComponent.sol +62 -0
- package/contracts/pool/IPoolService.sol +172 -0
- package/contracts/pool/Pool.sol +345 -0
- package/contracts/pool/PoolService.sol +620 -0
- package/contracts/pool/PoolServiceManager.sol +39 -0
- package/contracts/product/ApplicationService.sol +259 -0
- package/contracts/product/ApplicationServiceManager.sol +38 -0
- package/contracts/product/BasicProduct.sol +49 -0
- package/contracts/product/BasicProductAuthorization.sol +42 -0
- package/contracts/product/ClaimService.sol +614 -0
- package/contracts/product/ClaimServiceManager.sol +38 -0
- package/contracts/product/IApplicationService.sol +63 -0
- package/contracts/product/IClaimService.sol +123 -0
- package/contracts/product/IPolicyService.sol +82 -0
- package/contracts/product/IPricingService.sol +39 -0
- package/contracts/product/IProductComponent.sol +59 -0
- package/contracts/product/IRiskService.sol +33 -0
- package/contracts/product/PolicyService.sol +695 -0
- package/contracts/product/PolicyServiceManager.sol +39 -0
- package/contracts/product/PricingService.sol +300 -0
- package/contracts/product/PricingServiceManager.sol +39 -0
- package/contracts/product/Product.sol +432 -0
- package/contracts/product/RiskService.sol +96 -0
- package/contracts/product/RiskServiceManager.sol +39 -0
- package/contracts/registry/ChainNft.sol +128 -40
- package/contracts/registry/IRegistry.sol +144 -28
- package/contracts/registry/IRegistryService.sol +62 -0
- package/contracts/registry/ITransferInterceptor.sol +6 -0
- package/contracts/registry/Registry.sol +626 -282
- package/contracts/registry/RegistryAdmin.sol +462 -0
- package/contracts/registry/RegistryService.sol +241 -0
- package/contracts/registry/RegistryServiceManager.sol +53 -0
- package/contracts/registry/ReleaseLifecycle.sol +30 -0
- package/contracts/registry/ReleaseRegistry.sol +485 -0
- package/contracts/registry/ServiceAuthorizationV3.sol +203 -0
- package/contracts/registry/TokenRegistry.sol +315 -0
- package/contracts/shared/Component.sol +229 -0
- package/contracts/shared/ComponentService.sol +779 -0
- package/contracts/shared/ComponentServiceManager.sol +38 -0
- package/contracts/shared/ComponentVerifyingService.sol +128 -0
- package/contracts/shared/ContractLib.sol +54 -0
- package/contracts/shared/IComponent.sol +67 -0
- package/contracts/shared/IComponentService.sol +130 -0
- package/contracts/shared/IInstanceLinkedComponent.sol +41 -0
- package/contracts/shared/IKeyValueStore.sol +54 -0
- package/contracts/{instance/base → shared}/ILifecycle.sol +6 -5
- package/contracts/shared/INftOwnable.sol +25 -0
- package/contracts/shared/IPolicyHolder.sol +35 -0
- package/contracts/shared/IRegisterable.sol +23 -21
- package/contracts/shared/IRegistryLinked.sol +11 -0
- package/contracts/shared/IService.sol +25 -0
- package/contracts/shared/InitializableERC165.sol +27 -0
- package/contracts/shared/InstanceLinkedComponent.sol +205 -0
- package/contracts/shared/KeyValueStore.sol +131 -0
- package/contracts/shared/Lifecycle.sol +88 -0
- package/contracts/shared/NftIdSet.sol +65 -0
- package/contracts/shared/NftOwnable.sol +127 -0
- package/contracts/shared/PolicyHolder.sol +62 -0
- package/contracts/shared/Registerable.sol +60 -63
- package/contracts/shared/RegistryLinked.sol +38 -0
- package/contracts/shared/Service.sol +84 -0
- package/contracts/shared/TokenHandler.sol +397 -0
- package/contracts/shared/TokenHandlerDeployerLib.sol +20 -0
- package/contracts/staking/IStaking.sol +173 -0
- package/contracts/staking/IStakingService.sol +157 -0
- package/contracts/staking/StakeManagerLib.sol +224 -0
- package/contracts/staking/Staking.sol +505 -0
- package/contracts/staking/StakingLifecycle.sol +23 -0
- package/contracts/staking/StakingManager.sol +52 -0
- package/contracts/staking/StakingReader.sol +190 -0
- package/contracts/staking/StakingService.sol +453 -0
- package/contracts/staking/StakingServiceManager.sol +44 -0
- package/contracts/staking/StakingStore.sol +605 -0
- package/contracts/staking/TargetManagerLib.sol +211 -0
- package/contracts/{types → type}/AddressSet.sol +1 -1
- package/contracts/type/Amount.sol +150 -0
- package/contracts/{types → type}/Blocknumber.sol +27 -3
- package/contracts/type/ClaimId.sol +80 -0
- package/contracts/type/DistributorType.sol +55 -0
- package/contracts/type/Fee.sol +66 -0
- package/contracts/{types → type}/Key32.sol +8 -3
- package/contracts/{types → type}/NftId.sol +22 -15
- package/contracts/type/NftIdSet.sol +62 -0
- package/contracts/type/ObjectType.sol +276 -0
- package/contracts/type/PayoutId.sol +82 -0
- package/contracts/type/Referral.sol +90 -0
- package/contracts/type/RequestId.sol +75 -0
- package/contracts/type/RiskId.sol +57 -0
- package/contracts/type/RoleId.sol +162 -0
- package/contracts/type/Seconds.sol +101 -0
- package/contracts/type/Selector.sol +102 -0
- package/contracts/{types → type}/StateId.sol +53 -5
- package/contracts/type/String.sol +53 -0
- package/contracts/{types → type}/Timestamp.sol +38 -15
- package/contracts/type/UFixed.sol +355 -0
- package/contracts/{types → type}/Version.sol +17 -2
- package/contracts/upgradeability/IVersionable.sol +53 -0
- package/contracts/upgradeability/ProxyManager.sol +232 -0
- package/contracts/upgradeability/UpgradableProxyWithAdmin.sol +14 -0
- package/contracts/upgradeability/Versionable.sol +59 -0
- package/package.json +12 -7
- package/artifacts/contracts/components/BaseComponent.sol/BaseComponent.dbg.json +0 -4
- package/artifacts/contracts/components/BaseComponent.sol/BaseComponent.json +0 -174
- package/artifacts/contracts/components/IBaseComponent.sol/IBaseComponent.dbg.json +0 -4
- package/artifacts/contracts/components/IPoolComponent.sol/IPoolComponent.dbg.json +0 -4
- package/artifacts/contracts/components/IPoolComponent.sol/IPoolComponent.json +0 -356
- package/artifacts/contracts/components/IProductComponent.sol/IProductComponent.dbg.json +0 -4
- package/artifacts/contracts/components/IProductComponent.sol/IProductComponent.json +0 -279
- package/artifacts/contracts/components/Pool.sol/Pool.dbg.json +0 -4
- package/artifacts/contracts/components/Pool.sol/Pool.json +0 -387
- package/artifacts/contracts/components/Product.sol/Product.dbg.json +0 -4
- package/artifacts/contracts/components/Product.sol/Product.json +0 -305
- package/artifacts/contracts/experiment/errors/Require.sol/Require.dbg.json +0 -4
- package/artifacts/contracts/experiment/errors/Require.sol/Require.json +0 -105
- package/artifacts/contracts/experiment/errors/Revert.sol/Revert.dbg.json +0 -4
- package/artifacts/contracts/experiment/errors/Revert.sol/Revert.json +0 -105
- package/artifacts/contracts/experiment/inheritance/A.sol/A.dbg.json +0 -4
- package/artifacts/contracts/experiment/inheritance/A.sol/A.json +0 -128
- package/artifacts/contracts/experiment/inheritance/A.sol/AShared.dbg.json +0 -4
- package/artifacts/contracts/experiment/inheritance/A.sol/AShared.json +0 -42
- package/artifacts/contracts/experiment/inheritance/B.sol/B.dbg.json +0 -4
- package/artifacts/contracts/experiment/inheritance/B.sol/B.json +0 -76
- package/artifacts/contracts/experiment/inheritance/C.sol/C.dbg.json +0 -4
- package/artifacts/contracts/experiment/inheritance/C.sol/C.json +0 -89
- package/artifacts/contracts/experiment/inheritance/IA.sol/IA.dbg.json +0 -4
- package/artifacts/contracts/experiment/inheritance/IA.sol/IA.json +0 -128
- package/artifacts/contracts/experiment/inheritance/IA.sol/ISharedA.dbg.json +0 -4
- package/artifacts/contracts/experiment/inheritance/IA.sol/ISharedA.json +0 -37
- package/artifacts/contracts/experiment/inheritance/IB.sol/IB.dbg.json +0 -4
- package/artifacts/contracts/experiment/inheritance/IB.sol/IB.json +0 -50
- package/artifacts/contracts/experiment/inheritance/IC.sol/IC.dbg.json +0 -4
- package/artifacts/contracts/experiment/inheritance/IC.sol/IC.json +0 -63
- package/artifacts/contracts/experiment/statemachine/Dummy.sol/LifeCycleModule.dbg.json +0 -4
- package/artifacts/contracts/experiment/statemachine/Dummy.sol/LifeCycleModule.json +0 -59
- package/artifacts/contracts/experiment/statemachine/ISM.sol/ISM.dbg.json +0 -4
- package/artifacts/contracts/experiment/statemachine/ISM.sol/ISM.json +0 -124
- package/artifacts/contracts/experiment/statemachine/ISM.sol/ISMEE.dbg.json +0 -4
- package/artifacts/contracts/experiment/statemachine/ISM.sol/ISMEE.json +0 -74
- package/artifacts/contracts/experiment/statemachine/SM.sol/SM.dbg.json +0 -4
- package/artifacts/contracts/experiment/statemachine/SM.sol/SM.json +0 -124
- package/artifacts/contracts/experiment/statemachine/SimpleStateMachine.sol/SimpleStateMachine.dbg.json +0 -4
- package/artifacts/contracts/experiment/statemachine/SimpleStateMachine.sol/SimpleStateMachine.json +0 -207
- package/artifacts/contracts/experiment/types/TypeA.sol/TypeALib.dbg.json +0 -4
- package/artifacts/contracts/experiment/types/TypeA.sol/TypeALib.json +0 -10
- package/artifacts/contracts/experiment/types/TypeB.sol/TypeBLib.dbg.json +0 -4
- package/artifacts/contracts/experiment/types/TypeB.sol/TypeBLib.json +0 -10
- package/artifacts/contracts/instance/IInstanceLinked.sol/IInstanceLinked.dbg.json +0 -4
- package/artifacts/contracts/instance/IInstanceLinked.sol/IInstanceLinked.json +0 -24
- package/artifacts/contracts/instance/base/ComponentServiceBase.sol/ComponentServiceBase.dbg.json +0 -4
- package/artifacts/contracts/instance/base/ComponentServiceBase.sol/ComponentServiceBase.json +0 -300
- package/artifacts/contracts/instance/base/IInstanceBase.sol/IInstanceBase.dbg.json +0 -4
- package/artifacts/contracts/instance/base/IInstanceBase.sol/IInstanceBase.json +0 -63
- package/artifacts/contracts/instance/base/IKeyValueStore.sol/IKeyValueStore.dbg.json +0 -4
- package/artifacts/contracts/instance/base/ILifecycle.sol/ILifecycle.dbg.json +0 -4
- package/artifacts/contracts/instance/base/IService.sol/IService.dbg.json +0 -4
- package/artifacts/contracts/instance/base/IService.sol/IService.json +0 -300
- package/artifacts/contracts/instance/base/InstanceBase.sol/InstanceBase.dbg.json +0 -4
- package/artifacts/contracts/instance/base/InstanceBase.sol/InstanceBase.json +0 -326
- package/artifacts/contracts/instance/base/KeyValueStore.sol/KeyValueStore.dbg.json +0 -4
- package/artifacts/contracts/instance/base/KeyValueStore.sol/KeyValueStore.json +0 -692
- package/artifacts/contracts/instance/base/Lifecycle.sol/Lifecycle.dbg.json +0 -4
- package/artifacts/contracts/instance/base/Lifecycle.sol/Lifecycle.json +0 -169
- package/artifacts/contracts/instance/base/ModuleBase.sol/ModuleBase.dbg.json +0 -4
- package/artifacts/contracts/instance/base/ServiceBase.sol/ServiceBase.dbg.json +0 -4
- package/artifacts/contracts/instance/base/ServiceBase.sol/ServiceBase.json +0 -300
- package/artifacts/contracts/instance/module/access/Access.sol/AccessModule.dbg.json +0 -4
- package/artifacts/contracts/instance/module/access/Access.sol/AccessModule.json +0 -333
- package/artifacts/contracts/instance/module/access/IAccess.sol/IAccess.dbg.json +0 -4
- package/artifacts/contracts/instance/module/access/IAccess.sol/IAccessModule.dbg.json +0 -4
- package/artifacts/contracts/instance/module/access/IAccess.sol/IAccessModule.json +0 -333
- package/artifacts/contracts/instance/module/bundle/BundleModule.sol/BundleModule.dbg.json +0 -4
- package/artifacts/contracts/instance/module/bundle/BundleModule.sol/BundleModule.json +0 -296
- package/artifacts/contracts/instance/module/bundle/IBundle.sol/IBundle.dbg.json +0 -4
- package/artifacts/contracts/instance/module/bundle/IBundle.sol/IBundleModule.dbg.json +0 -4
- package/artifacts/contracts/instance/module/bundle/IBundle.sol/IBundleModule.json +0 -296
- package/artifacts/contracts/instance/module/compensation/CompensationModule.sol/CompensationModule.dbg.json +0 -4
- package/artifacts/contracts/instance/module/compensation/CompensationModule.sol/CompensationModule.json +0 -10
- package/artifacts/contracts/instance/module/compensation/ICompensation.sol/ICompensation.dbg.json +0 -4
- package/artifacts/contracts/instance/module/compensation/ICompensation.sol/ICompensation.json +0 -10
- package/artifacts/contracts/instance/module/compensation/ICompensation.sol/ICompensationModule.dbg.json +0 -4
- package/artifacts/contracts/instance/module/compensation/ICompensation.sol/ICompensationModule.json +0 -10
- package/artifacts/contracts/instance/module/component/ComponentModule.sol/ComponentModule.dbg.json +0 -4
- package/artifacts/contracts/instance/module/component/ComponentModule.sol/ComponentModule.json +0 -188
- package/artifacts/contracts/instance/module/component/IComponent.sol/IComponent.dbg.json +0 -4
- package/artifacts/contracts/instance/module/component/IComponent.sol/IComponent.json +0 -10
- package/artifacts/contracts/instance/module/component/IComponent.sol/IComponentModule.dbg.json +0 -4
- package/artifacts/contracts/instance/module/component/IComponent.sol/IComponentModule.json +0 -188
- package/artifacts/contracts/instance/module/policy/IPolicy.sol/IPolicy.dbg.json +0 -4
- package/artifacts/contracts/instance/module/policy/IPolicy.sol/IPolicyModule.dbg.json +0 -4
- package/artifacts/contracts/instance/module/policy/IPolicy.sol/IPolicyModule.json +0 -261
- package/artifacts/contracts/instance/module/policy/PolicyModule.sol/PolicyModule.dbg.json +0 -4
- package/artifacts/contracts/instance/module/policy/PolicyModule.sol/PolicyModule.json +0 -261
- package/artifacts/contracts/instance/module/pool/IPoolModule.sol/IPool.dbg.json +0 -4
- package/artifacts/contracts/instance/module/pool/IPoolModule.sol/IPool.json +0 -10
- package/artifacts/contracts/instance/module/pool/IPoolModule.sol/IPoolModule.dbg.json +0 -4
- package/artifacts/contracts/instance/module/pool/IPoolModule.sol/IPoolModule.json +0 -149
- package/artifacts/contracts/instance/module/pool/PoolModule.sol/PoolModule.dbg.json +0 -4
- package/artifacts/contracts/instance/module/pool/PoolModule.sol/PoolModule.json +0 -149
- package/artifacts/contracts/instance/module/risk/IRisk.sol/IRisk.dbg.json +0 -4
- package/artifacts/contracts/instance/module/risk/IRisk.sol/IRiskModule.dbg.json +0 -4
- package/artifacts/contracts/instance/module/risk/IRisk.sol/IRiskModule.json +0 -10
- package/artifacts/contracts/instance/module/risk/RiskModule.sol/RiskModule.dbg.json +0 -4
- package/artifacts/contracts/instance/module/risk/RiskModule.sol/RiskModule.json +0 -10
- package/artifacts/contracts/instance/module/treasury/ITreasury.sol/ITreasury.dbg.json +0 -4
- package/artifacts/contracts/instance/module/treasury/ITreasury.sol/ITreasury.json +0 -10
- package/artifacts/contracts/instance/module/treasury/ITreasury.sol/ITreasuryModule.dbg.json +0 -4
- package/artifacts/contracts/instance/module/treasury/ITreasury.sol/ITreasuryModule.json +0 -533
- package/artifacts/contracts/instance/module/treasury/TokenHandler.sol/TokenHandler.dbg.json +0 -4
- package/artifacts/contracts/instance/module/treasury/TokenHandler.sol/TokenHandler.json +0 -76
- package/artifacts/contracts/instance/module/treasury/TreasuryModule.sol/TreasuryModule.dbg.json +0 -4
- package/artifacts/contracts/instance/module/treasury/TreasuryModule.sol/TreasuryModule.json +0 -533
- package/artifacts/contracts/instance/service/ComponentOwnerService.sol/ComponentOwnerService.dbg.json +0 -4
- package/artifacts/contracts/instance/service/ComponentOwnerService.sol/ComponentOwnerService.json +0 -523
- package/artifacts/contracts/instance/service/IComponentOwnerService.sol/IComponentOwnerService.dbg.json +0 -4
- package/artifacts/contracts/instance/service/IPoolService.sol/IPoolService.dbg.json +0 -4
- package/artifacts/contracts/instance/service/IProductService.sol/IProductService.dbg.json +0 -4
- package/artifacts/contracts/instance/service/PoolService.sol/PoolService.dbg.json +0 -4
- package/artifacts/contracts/instance/service/PoolService.sol/PoolService.json +0 -471
- package/artifacts/contracts/instance/service/ProductService.sol/ProductService.dbg.json +0 -4
- package/artifacts/contracts/instance/service/ProductService.sol/ProductService.json +0 -673
- package/artifacts/contracts/registry/IChainNft.sol/IChainNft.dbg.json +0 -4
- package/artifacts/contracts/registry/IChainNft.sol/IChainNft.json +0 -452
- package/artifacts/contracts/registry/IRegistryLinked.sol/IRegistryLinked.dbg.json +0 -4
- package/artifacts/contracts/shared/ERC165.sol/ERC165.dbg.json +0 -4
- package/artifacts/contracts/shared/ERC165.sol/ERC165.json +0 -35
- package/artifacts/contracts/shared/IOwnable.sol/IOwnable.dbg.json +0 -4
- package/artifacts/contracts/shared/IOwnable.sol/IOwnable.json +0 -24
- package/artifacts/contracts/shared/IVersionable.sol/IVersionable.dbg.json +0 -4
- package/artifacts/contracts/shared/IVersionable.sol/IVersionable.json +0 -164
- package/artifacts/contracts/shared/Versionable.sol/Versionable.dbg.json +0 -4
- package/artifacts/contracts/shared/Versionable.sol/Versionable.json +0 -164
- package/artifacts/contracts/test/TestFee.sol/TestFee.dbg.json +0 -4
- package/artifacts/contracts/test/TestFee.sol/TestFee.json +0 -119
- package/artifacts/contracts/test/TestPool.sol/TestPool.dbg.json +0 -4
- package/artifacts/contracts/test/TestPool.sol/TestPool.json +0 -387
- package/artifacts/contracts/test/TestProduct.sol/TestProduct.dbg.json +0 -4
- package/artifacts/contracts/test/TestProduct.sol/TestProduct.json +0 -393
- package/artifacts/contracts/test/TestRegisterable.sol/TestRegisterable.dbg.json +0 -4
- package/artifacts/contracts/test/TestRegisterable.sol/TestRegisterable.json +0 -137
- package/artifacts/contracts/test/TestRoleId.sol/TestRoleId.dbg.json +0 -4
- package/artifacts/contracts/test/TestRoleId.sol/TestRoleId.json +0 -116
- package/artifacts/contracts/test/TestService.sol/TestService.dbg.json +0 -4
- package/artifacts/contracts/test/TestService.sol/TestService.json +0 -379
- package/artifacts/contracts/test/TestToken.sol/TestUsdc.dbg.json +0 -4
- package/artifacts/contracts/test/TestToken.sol/TestUsdc.json +0 -338
- package/artifacts/contracts/test/TestVersion.sol/TestVersion.dbg.json +0 -4
- package/artifacts/contracts/test/TestVersion.sol/TestVersion.json +0 -218
- package/artifacts/contracts/test/TestVersionable.sol/TestVersionable.dbg.json +0 -4
- package/artifacts/contracts/test/TestVersionable.sol/TestVersionable.json +0 -206
- package/artifacts/contracts/test/Usdc.sol/USDC.dbg.json +0 -4
- package/artifacts/contracts/test/Usdc.sol/USDC.json +0 -338
- package/artifacts/contracts/types/AddressSet.sol/LibAddressSet.dbg.json +0 -4
- package/artifacts/contracts/types/AddressSet.sol/LibAddressSet.json +0 -10
- package/artifacts/contracts/types/Blocknumber.sol/BlocknumberLib.dbg.json +0 -4
- package/artifacts/contracts/types/Blocknumber.sol/BlocknumberLib.json +0 -174
- package/artifacts/contracts/types/ChainId.sol/ChainIdLib.dbg.json +0 -4
- package/artifacts/contracts/types/ChainId.sol/ChainIdLib.json +0 -10
- package/artifacts/contracts/types/Fee.sol/FeeLib.dbg.json +0 -4
- package/artifacts/contracts/types/Fee.sol/FeeLib.json +0 -218
- package/artifacts/contracts/types/Key32.sol/Key32Lib.dbg.json +0 -4
- package/artifacts/contracts/types/Key32.sol/Key32Lib.json +0 -111
- package/artifacts/contracts/types/NftId.sol/NftIdLib.dbg.json +0 -4
- package/artifacts/contracts/types/NftId.sol/NftIdLib.json +0 -153
- package/artifacts/contracts/types/NftIdSet.sol/LibNftIdSet.dbg.json +0 -4
- package/artifacts/contracts/types/NftIdSet.sol/LibNftIdSet.json +0 -10
- package/artifacts/contracts/types/ObjectType.sol/ObjectTypeLib.dbg.json +0 -4
- package/artifacts/contracts/types/ObjectType.sol/ObjectTypeLib.json +0 -92
- package/artifacts/contracts/types/RoleId.sol/RoleIdLib.dbg.json +0 -4
- package/artifacts/contracts/types/RoleId.sol/RoleIdLib.json +0 -30
- package/artifacts/contracts/types/StateId.sol/StateIdLib.dbg.json +0 -4
- package/artifacts/contracts/types/StateId.sol/StateIdLib.json +0 -92
- package/artifacts/contracts/types/Timestamp.sol/TimestampLib.dbg.json +0 -4
- package/artifacts/contracts/types/Timestamp.sol/TimestampLib.json +0 -236
- package/artifacts/contracts/types/UFixed.sol/UFixedMathLib.dbg.json +0 -4
- package/artifacts/contracts/types/UFixed.sol/UFixedMathLib.json +0 -479
- package/artifacts/contracts/types/Version.sol/VersionLib.dbg.json +0 -4
- package/artifacts/contracts/types/Version.sol/VersionLib.json +0 -139
- package/artifacts/contracts/types/Version.sol/VersionPartLib.dbg.json +0 -4
- package/artifacts/contracts/types/Version.sol/VersionPartLib.json +0 -30
- package/contracts/components/BaseComponent.sol +0 -88
- package/contracts/components/IBaseComponent.sol +0 -19
- package/contracts/components/IPoolComponent.sol +0 -57
- package/contracts/components/IProductComponent.sol +0 -19
- package/contracts/components/Pool.sol +0 -174
- package/contracts/components/Product.sol +0 -117
- package/contracts/experiment/errors/Require.sol +0 -38
- package/contracts/experiment/errors/Revert.sol +0 -44
- package/contracts/experiment/inheritance/A.sol +0 -53
- package/contracts/experiment/inheritance/B.sol +0 -28
- package/contracts/experiment/inheritance/C.sol +0 -34
- package/contracts/experiment/inheritance/IA.sol +0 -13
- package/contracts/experiment/inheritance/IB.sol +0 -10
- package/contracts/experiment/inheritance/IC.sol +0 -12
- package/contracts/experiment/statemachine/Dummy.sol +0 -27
- package/contracts/experiment/statemachine/ISM.sol +0 -25
- package/contracts/experiment/statemachine/README.md +0 -112
- package/contracts/experiment/statemachine/SM.sol +0 -57
- package/contracts/experiment/statemachine/SimpleStateMachine.sol +0 -31
- package/contracts/experiment/types/TypeA.sol +0 -47
- package/contracts/experiment/types/TypeB.sol +0 -29
- package/contracts/instance/IInstanceLinked.sol +0 -8
- package/contracts/instance/base/ComponentServiceBase.sol +0 -42
- package/contracts/instance/base/IInstanceBase.sol +0 -14
- package/contracts/instance/base/IKeyValueStore.sol +0 -49
- package/contracts/instance/base/IService.sol +0 -15
- package/contracts/instance/base/InstanceBase.sol +0 -80
- package/contracts/instance/base/KeyValueStore.sol +0 -156
- package/contracts/instance/base/Lifecycle.sol +0 -95
- package/contracts/instance/base/ModuleBase.sol +0 -52
- package/contracts/instance/base/ServiceBase.sol +0 -37
- package/contracts/instance/module/access/Access.sol +0 -149
- package/contracts/instance/module/access/IAccess.sol +0 -53
- package/contracts/instance/module/bundle/BundleModule.sol +0 -136
- package/contracts/instance/module/bundle/IBundle.sol +0 -58
- package/contracts/instance/module/compensation/CompensationModule.sol +0 -8
- package/contracts/instance/module/compensation/ICompensation.sol +0 -10
- package/contracts/instance/module/component/ComponentModule.sol +0 -95
- package/contracts/instance/module/component/IComponent.sol +0 -53
- package/contracts/instance/module/policy/IPolicy.sol +0 -60
- package/contracts/instance/module/policy/PolicyModule.sol +0 -76
- package/contracts/instance/module/pool/IPoolModule.sol +0 -41
- package/contracts/instance/module/pool/PoolModule.sol +0 -87
- package/contracts/instance/module/risk/IRisk.sol +0 -10
- package/contracts/instance/module/risk/RiskModule.sol +0 -8
- package/contracts/instance/module/treasury/ITreasury.sol +0 -103
- package/contracts/instance/module/treasury/TokenHandler.sol +0 -48
- package/contracts/instance/module/treasury/TreasuryModule.sol +0 -152
- package/contracts/instance/service/ComponentOwnerService.sol +0 -170
- package/contracts/instance/service/IComponentOwnerService.sol +0 -22
- package/contracts/instance/service/IPoolService.sol +0 -30
- package/contracts/instance/service/IProductService.sol +0 -58
- package/contracts/instance/service/PoolService.sol +0 -123
- package/contracts/instance/service/ProductService.sol +0 -354
- package/contracts/registry/IChainNft.sol +0 -21
- package/contracts/registry/IRegistryLinked.sol +0 -8
- package/contracts/shared/ERC165.sol +0 -21
- package/contracts/shared/IOwnable.sol +0 -6
- package/contracts/shared/IVersionable.sol +0 -52
- package/contracts/shared/Versionable.sol +0 -89
- package/contracts/test/TestFee.sol +0 -25
- package/contracts/test/TestPool.sol +0 -22
- package/contracts/test/TestProduct.sol +0 -44
- package/contracts/test/TestRegisterable.sol +0 -19
- package/contracts/test/TestRoleId.sol +0 -14
- package/contracts/test/TestService.sol +0 -32
- package/contracts/test/TestToken.sol +0 -26
- package/contracts/test/TestVersion.sol +0 -44
- package/contracts/test/TestVersionable.sol +0 -17
- package/contracts/types/ChainId.sol +0 -38
- package/contracts/types/Fee.sol +0 -51
- package/contracts/types/NftIdSet.sol +0 -60
- package/contracts/types/ObjectType.sol +0 -115
- package/contracts/types/RoleId.sol +0 -38
- package/contracts/types/UFixed.sol +0 -209
@@ -0,0 +1,355 @@
|
|
1
|
+
// SPDX-License-Identifier: Apache-2.0
|
2
|
+
pragma solidity ^0.8.20;
|
3
|
+
|
4
|
+
/// @dev UFixed is a fixed point number with 18 decimals precision.
|
5
|
+
type UFixed is uint256;
|
6
|
+
|
7
|
+
using {
|
8
|
+
addUFixed as +,
|
9
|
+
subUFixed as -,
|
10
|
+
mulUFixed as *,
|
11
|
+
divUFixed as /,
|
12
|
+
gtUFixed as >,
|
13
|
+
gteUFixed as >=,
|
14
|
+
ltUFixed as <,
|
15
|
+
lteUFixed as <=,
|
16
|
+
eqUFixed as ==,
|
17
|
+
neUFixed as !=,
|
18
|
+
UFixedLib.gt,
|
19
|
+
UFixedLib.gtz,
|
20
|
+
UFixedLib.toInt,
|
21
|
+
UFixedLib.toInt1000
|
22
|
+
} for UFixed global;
|
23
|
+
|
24
|
+
// TODO move to UFixedLib and rename to zero()
|
25
|
+
function zeroUFixed() pure returns (UFixed zero) {
|
26
|
+
return UFixed.wrap(0);
|
27
|
+
}
|
28
|
+
|
29
|
+
function addUFixed(UFixed a, UFixed b) pure returns (UFixed) {
|
30
|
+
return UFixed.wrap(UFixed.unwrap(a) + UFixed.unwrap(b));
|
31
|
+
}
|
32
|
+
|
33
|
+
function subUFixed(UFixed a, UFixed b) pure returns (UFixed) {
|
34
|
+
if (a < b) {
|
35
|
+
revert UFixedLib.UFixedLibNegativeResult();
|
36
|
+
}
|
37
|
+
return UFixed.wrap(UFixed.unwrap(a) - UFixed.unwrap(b));
|
38
|
+
}
|
39
|
+
|
40
|
+
function mulUFixed(UFixed a, UFixed b) pure returns (UFixed) {
|
41
|
+
return
|
42
|
+
UFixed.wrap(MathLib.mulDiv(UFixed.unwrap(a), UFixed.unwrap(b), 10 ** 18));
|
43
|
+
}
|
44
|
+
|
45
|
+
function divUFixed(UFixed a, UFixed b) pure returns (UFixed) {
|
46
|
+
if (UFixed.unwrap(b) == 0) {
|
47
|
+
revert UFixedLib.UFixedLibDivisionByZero();
|
48
|
+
}
|
49
|
+
|
50
|
+
return
|
51
|
+
UFixed.wrap(MathLib.mulDiv(UFixed.unwrap(a), 10 ** 18, UFixed.unwrap(b)));
|
52
|
+
}
|
53
|
+
|
54
|
+
function gtUFixed(UFixed a, UFixed b) pure returns (bool isGreaterThan) {
|
55
|
+
return UFixed.unwrap(a) > UFixed.unwrap(b);
|
56
|
+
}
|
57
|
+
|
58
|
+
function gteUFixed(UFixed a, UFixed b) pure returns (bool isGreaterThan) {
|
59
|
+
return UFixed.unwrap(a) >= UFixed.unwrap(b);
|
60
|
+
}
|
61
|
+
|
62
|
+
function ltUFixed(UFixed a, UFixed b) pure returns (bool isGreaterThan) {
|
63
|
+
return UFixed.unwrap(a) < UFixed.unwrap(b);
|
64
|
+
}
|
65
|
+
|
66
|
+
function lteUFixed(UFixed a, UFixed b) pure returns (bool isGreaterThan) {
|
67
|
+
return UFixed.unwrap(a) <= UFixed.unwrap(b);
|
68
|
+
}
|
69
|
+
|
70
|
+
function eqUFixed(UFixed a, UFixed b) pure returns (bool isEqual) {
|
71
|
+
return UFixed.unwrap(a) == UFixed.unwrap(b);
|
72
|
+
}
|
73
|
+
|
74
|
+
function neUFixed(UFixed a, UFixed b) pure returns (bool isEqual) {
|
75
|
+
return UFixed.unwrap(a) != UFixed.unwrap(b);
|
76
|
+
}
|
77
|
+
|
78
|
+
function gtzUFixed(UFixed a) pure returns (bool isZero) {
|
79
|
+
return UFixed.unwrap(a) > 0;
|
80
|
+
}
|
81
|
+
|
82
|
+
function eqzUFixed(UFixed a) pure returns (bool isZero) {
|
83
|
+
return UFixed.unwrap(a) == 0;
|
84
|
+
}
|
85
|
+
|
86
|
+
function deltaUFixed(UFixed a, UFixed b) pure returns (UFixed) {
|
87
|
+
if (a > b) {
|
88
|
+
return a - b;
|
89
|
+
}
|
90
|
+
|
91
|
+
return b - a;
|
92
|
+
}
|
93
|
+
|
94
|
+
/// @dev copied from https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v4.9.3/contracts/utils/math/Math.sol
|
95
|
+
library MathLib {
|
96
|
+
|
97
|
+
error MathLigMulDivOverflow();
|
98
|
+
|
99
|
+
enum Rounding {
|
100
|
+
Down, // Toward negative infinity
|
101
|
+
Up, // Toward infinity
|
102
|
+
Zero // Toward zero
|
103
|
+
}
|
104
|
+
|
105
|
+
/**
|
106
|
+
* @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0
|
107
|
+
* @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)
|
108
|
+
* with further edits by Uniswap Labs also under MIT license.
|
109
|
+
*/
|
110
|
+
function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) {
|
111
|
+
unchecked {
|
112
|
+
// 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use
|
113
|
+
// use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256
|
114
|
+
// variables such that product = prod1 * 2^256 + prod0.
|
115
|
+
uint256 prod0; // Least significant 256 bits of the product
|
116
|
+
uint256 prod1; // Most significant 256 bits of the product
|
117
|
+
assembly {
|
118
|
+
let mm := mulmod(x, y, not(0))
|
119
|
+
prod0 := mul(x, y)
|
120
|
+
prod1 := sub(sub(mm, prod0), lt(mm, prod0))
|
121
|
+
}
|
122
|
+
|
123
|
+
// Handle non-overflow cases, 256 by 256 division.
|
124
|
+
if (prod1 == 0) {
|
125
|
+
// Solidity will revert if denominator == 0, unlike the div opcode on its own.
|
126
|
+
// The surrounding unchecked block does not change this fact.
|
127
|
+
// See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic.
|
128
|
+
return prod0 / denominator;
|
129
|
+
}
|
130
|
+
|
131
|
+
// Make sure the result is less than 2^256. Also prevents denominator == 0.
|
132
|
+
if (denominator <= prod1) {
|
133
|
+
revert MathLigMulDivOverflow();
|
134
|
+
}
|
135
|
+
|
136
|
+
///////////////////////////////////////////////
|
137
|
+
// 512 by 256 division.
|
138
|
+
///////////////////////////////////////////////
|
139
|
+
|
140
|
+
// Make division exact by subtracting the remainder from [prod1 prod0].
|
141
|
+
uint256 remainder;
|
142
|
+
assembly {
|
143
|
+
// Compute remainder using mulmod.
|
144
|
+
remainder := mulmod(x, y, denominator)
|
145
|
+
|
146
|
+
// Subtract 256 bit number from 512 bit number.
|
147
|
+
prod1 := sub(prod1, gt(remainder, prod0))
|
148
|
+
prod0 := sub(prod0, remainder)
|
149
|
+
}
|
150
|
+
|
151
|
+
// Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.
|
152
|
+
// See https://cs.stackexchange.com/q/138556/92363.
|
153
|
+
|
154
|
+
// Does not overflow because the denominator cannot be zero at this stage in the function.
|
155
|
+
uint256 twos = denominator & (~denominator + 1);
|
156
|
+
assembly {
|
157
|
+
// Divide denominator by twos.
|
158
|
+
denominator := div(denominator, twos)
|
159
|
+
|
160
|
+
// Divide [prod1 prod0] by twos.
|
161
|
+
prod0 := div(prod0, twos)
|
162
|
+
|
163
|
+
// Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.
|
164
|
+
twos := add(div(sub(0, twos), twos), 1)
|
165
|
+
}
|
166
|
+
|
167
|
+
// Shift in bits from prod1 into prod0.
|
168
|
+
prod0 |= prod1 * twos;
|
169
|
+
|
170
|
+
// Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such
|
171
|
+
// that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for
|
172
|
+
// four bits. That is, denominator * inv = 1 mod 2^4.
|
173
|
+
uint256 inverse = (3 * denominator) ^ 2;
|
174
|
+
|
175
|
+
// Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works
|
176
|
+
// in modular arithmetic, doubling the correct bits in each step.
|
177
|
+
inverse *= 2 - denominator * inverse; // inverse mod 2^8
|
178
|
+
inverse *= 2 - denominator * inverse; // inverse mod 2^16
|
179
|
+
inverse *= 2 - denominator * inverse; // inverse mod 2^32
|
180
|
+
inverse *= 2 - denominator * inverse; // inverse mod 2^64
|
181
|
+
inverse *= 2 - denominator * inverse; // inverse mod 2^128
|
182
|
+
inverse *= 2 - denominator * inverse; // inverse mod 2^256
|
183
|
+
|
184
|
+
// Because the division is now exact we can divide by multiplying with the modular inverse of denominator.
|
185
|
+
// This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is
|
186
|
+
// less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1
|
187
|
+
// is no longer required.
|
188
|
+
result = prod0 * inverse;
|
189
|
+
return result;
|
190
|
+
}
|
191
|
+
}
|
192
|
+
|
193
|
+
/**
|
194
|
+
* @notice Calculates x * y / denominator with full precision, following the selected rounding direction.
|
195
|
+
*/
|
196
|
+
function mulDiv(uint256 x, uint256 y, uint256 denominator, Rounding rounding) internal pure returns (uint256) {
|
197
|
+
uint256 result = mulDiv(x, y, denominator);
|
198
|
+
if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {
|
199
|
+
result += 1;
|
200
|
+
}
|
201
|
+
return result;
|
202
|
+
}
|
203
|
+
|
204
|
+
}
|
205
|
+
|
206
|
+
library UFixedLib {
|
207
|
+
error UFixedLibNegativeResult();
|
208
|
+
error UFixedLibDivisionByZero();
|
209
|
+
|
210
|
+
error UFixedLibExponentTooSmall(int8 exp);
|
211
|
+
error UFixedLibExponentTooLarge(int8 exp);
|
212
|
+
|
213
|
+
int8 public constant EXP = 18;
|
214
|
+
uint256 public constant MULTIPLIER = 10 ** uint256(int256(EXP));
|
215
|
+
uint256 public constant MULTIPLIER_HALF = MULTIPLIER / 2;
|
216
|
+
|
217
|
+
/// @dev returns the rounding mode DOWN - 0.4 becomes 0, 0.5 becomes 0, 0.6 becomes 0
|
218
|
+
function ROUNDING_DOWN() public pure returns (uint8) {
|
219
|
+
return uint8(0);
|
220
|
+
}
|
221
|
+
|
222
|
+
/// @dev returns the rounding mode UP - 0.4 becomes 1, 0.5 becomes 1, 0.6 becomes 1
|
223
|
+
function ROUNDING_UP() public pure returns (uint8) {
|
224
|
+
return uint8(1);
|
225
|
+
}
|
226
|
+
|
227
|
+
/// @dev returns the rounding mode HALF_UP - 0.4 becomes 0, 0.5 becomes 1, 0.6 becomes 1
|
228
|
+
function ROUNDING_HALF_UP() public pure returns (uint8) {
|
229
|
+
return uint8(2);
|
230
|
+
}
|
231
|
+
|
232
|
+
/// @dev Converts the uint256 to a UFixed.
|
233
|
+
function toUFixed(uint256 a) public pure returns (UFixed) {
|
234
|
+
return UFixed.wrap(a * MULTIPLIER);
|
235
|
+
}
|
236
|
+
|
237
|
+
/// @dev Converts the uint256 to a UFixed with given exponent.
|
238
|
+
function toUFixed(uint256 a, int8 exp) public pure returns (UFixed) {
|
239
|
+
if (EXP + exp < 0) {
|
240
|
+
revert UFixedLibExponentTooSmall(exp);
|
241
|
+
}
|
242
|
+
if (EXP + exp > 64) {
|
243
|
+
revert UFixedLibExponentTooLarge(exp);
|
244
|
+
}
|
245
|
+
|
246
|
+
return UFixed.wrap(a * 10 ** uint8(EXP + exp));
|
247
|
+
}
|
248
|
+
|
249
|
+
/// @dev returns the decimals precision of the UFixed type
|
250
|
+
function decimals() public pure returns (uint256) {
|
251
|
+
return uint8(EXP);
|
252
|
+
}
|
253
|
+
|
254
|
+
/// @dev Converts a UFixed to a uint256.
|
255
|
+
function toInt(UFixed a) public pure returns (uint256) {
|
256
|
+
return toIntWithRounding(a, ROUNDING_HALF_UP());
|
257
|
+
}
|
258
|
+
|
259
|
+
/// @dev Converts a UFixed to a uint256.
|
260
|
+
function toInt1000(UFixed a) public pure returns (uint256) {
|
261
|
+
return toIntWithRounding(toUFixed(1000) * a, ROUNDING_HALF_UP());
|
262
|
+
}
|
263
|
+
|
264
|
+
/// @dev Converts a UFixed to a uint256 with given rounding mode.
|
265
|
+
function toIntWithRounding(UFixed a, uint8 rounding) public pure returns (uint256) {
|
266
|
+
if (rounding == ROUNDING_HALF_UP()) {
|
267
|
+
return
|
268
|
+
MathLib.mulDiv(
|
269
|
+
UFixed.unwrap(a) + MULTIPLIER_HALF,
|
270
|
+
1,
|
271
|
+
MULTIPLIER,
|
272
|
+
MathLib.Rounding.Down
|
273
|
+
);
|
274
|
+
} else if (rounding == ROUNDING_DOWN()) {
|
275
|
+
return
|
276
|
+
MathLib.mulDiv(
|
277
|
+
UFixed.unwrap(a),
|
278
|
+
1,
|
279
|
+
MULTIPLIER,
|
280
|
+
MathLib.Rounding.Down
|
281
|
+
);
|
282
|
+
} else {
|
283
|
+
return
|
284
|
+
MathLib.mulDiv(UFixed.unwrap(a), 1, MULTIPLIER, MathLib.Rounding.Up);
|
285
|
+
}
|
286
|
+
}
|
287
|
+
|
288
|
+
/// @dev adds two UFixed numbers
|
289
|
+
function add(UFixed a, UFixed b) public pure returns (UFixed) {
|
290
|
+
return addUFixed(a, b);
|
291
|
+
}
|
292
|
+
|
293
|
+
/// @dev subtracts two UFixed numbers
|
294
|
+
function sub(UFixed a, UFixed b) public pure returns (UFixed) {
|
295
|
+
return subUFixed(a, b);
|
296
|
+
}
|
297
|
+
|
298
|
+
/// @dev multiplies two UFixed numbers
|
299
|
+
function mul(UFixed a, UFixed b) public pure returns (UFixed) {
|
300
|
+
return mulUFixed(a, b);
|
301
|
+
}
|
302
|
+
|
303
|
+
/// @dev divides two UFixed numbers
|
304
|
+
function div(UFixed a, UFixed b) public pure returns (UFixed) {
|
305
|
+
return divUFixed(a, b);
|
306
|
+
}
|
307
|
+
|
308
|
+
/// @dev return true if UFixed a is greater than UFixed b
|
309
|
+
function gt(UFixed a, UFixed b) public pure returns (bool isGreaterThan) {
|
310
|
+
return gtUFixed(a, b);
|
311
|
+
}
|
312
|
+
|
313
|
+
/// @dev return true if UFixed a is greater than or equal to UFixed b
|
314
|
+
function gte(UFixed a, UFixed b) public pure returns (bool isGreaterThan) {
|
315
|
+
return gteUFixed(a, b);
|
316
|
+
}
|
317
|
+
|
318
|
+
/// @dev return true if UFixed a is less than UFixed b
|
319
|
+
function lt(UFixed a, UFixed b) public pure returns (bool isGreaterThan) {
|
320
|
+
return ltUFixed(a, b);
|
321
|
+
}
|
322
|
+
|
323
|
+
/// @dev return true if UFixed a is less than or equal to UFixed b
|
324
|
+
function lte(UFixed a, UFixed b) public pure returns (bool isGreaterThan) {
|
325
|
+
return lteUFixed(a, b);
|
326
|
+
}
|
327
|
+
|
328
|
+
/// @dev return true if UFixed a is equal to UFixed b
|
329
|
+
function eq(UFixed a, UFixed b) public pure returns (bool isEqual) {
|
330
|
+
return eqUFixed(a, b);
|
331
|
+
}
|
332
|
+
|
333
|
+
/// @dev return true if UFixed a is not zero
|
334
|
+
function gtz(UFixed a) public pure returns (bool isZero) {
|
335
|
+
return gtzUFixed(a);
|
336
|
+
}
|
337
|
+
|
338
|
+
/// @dev return true if UFixed a is zero
|
339
|
+
function eqz(UFixed a) public pure returns (bool isZero) {
|
340
|
+
return eqzUFixed(a);
|
341
|
+
}
|
342
|
+
|
343
|
+
function zero() public pure returns (UFixed) {
|
344
|
+
return UFixed.wrap(0);
|
345
|
+
}
|
346
|
+
|
347
|
+
function one() public pure returns (UFixed) {
|
348
|
+
return UFixed.wrap(MULTIPLIER);
|
349
|
+
}
|
350
|
+
|
351
|
+
/// @dev return the absolute delta between two UFixed numbers
|
352
|
+
function delta(UFixed a, UFixed b) public pure returns (UFixed) {
|
353
|
+
return deltaUFixed(a, b);
|
354
|
+
}
|
355
|
+
}
|
@@ -1,20 +1,25 @@
|
|
1
1
|
// SPDX-License-Identifier: Apache-2.0
|
2
|
-
pragma solidity ^0.8.
|
2
|
+
pragma solidity ^0.8.20;
|
3
3
|
|
4
4
|
type VersionPart is uint8;
|
5
5
|
|
6
6
|
using {
|
7
7
|
versionPartGt as >,
|
8
8
|
versionPartEq as ==,
|
9
|
+
versionPartNe as !=,
|
10
|
+
VersionPartLib.eqz,
|
9
11
|
VersionPartLib.toInt
|
10
12
|
}
|
11
13
|
for VersionPart global;
|
12
14
|
|
13
15
|
function versionPartGt(VersionPart a, VersionPart b) pure returns(bool isGreaterThan) { return VersionPart.unwrap(a) > VersionPart.unwrap(b); }
|
14
16
|
function versionPartEq(VersionPart a, VersionPart b) pure returns(bool isSame) { return VersionPart.unwrap(a) == VersionPart.unwrap(b); }
|
17
|
+
function versionPartNe(VersionPart a, VersionPart b) pure returns(bool isSame) { return VersionPart.unwrap(a) != VersionPart.unwrap(b); }
|
15
18
|
|
16
19
|
library VersionPartLib {
|
17
|
-
function
|
20
|
+
function eqz(VersionPart a) external pure returns(bool) { return VersionPart.unwrap(a) == 0; }
|
21
|
+
function toInt(VersionPart a) external pure returns(uint256) { return VersionPart.unwrap(a); }
|
22
|
+
function toVersionPart(uint256 a) external pure returns(VersionPart) { return VersionPart.wrap(uint8(a)); }
|
18
23
|
}
|
19
24
|
|
20
25
|
type Version is uint24; // contains major,minor,patch version parts
|
@@ -23,6 +28,7 @@ using {
|
|
23
28
|
versionGt as >,
|
24
29
|
versionEq as ==,
|
25
30
|
VersionLib.toInt,
|
31
|
+
VersionLib.toUint64,
|
26
32
|
VersionLib.toMajorPart,
|
27
33
|
VersionLib.toVersionParts
|
28
34
|
}
|
@@ -34,6 +40,8 @@ function versionEq(Version a, Version b) pure returns(bool isSame) { return Vers
|
|
34
40
|
library VersionLib {
|
35
41
|
function toInt(Version version) external pure returns(uint) { return Version.unwrap(version); }
|
36
42
|
|
43
|
+
function toUint64(Version version) external pure returns(uint64) { return Version.unwrap(version); }
|
44
|
+
|
37
45
|
function toMajorPart(Version version)
|
38
46
|
external
|
39
47
|
pure
|
@@ -89,6 +97,13 @@ library VersionLib {
|
|
89
97
|
(major << 16) + (minor << 8) + patch));
|
90
98
|
}
|
91
99
|
|
100
|
+
// TODO check for overflow?
|
101
|
+
function toVersion(uint64 versionNumber) external pure returns(Version) {
|
102
|
+
//assert(versionNumber <= type(Version).max);
|
103
|
+
return Version.wrap(uint24(versionNumber));
|
104
|
+
}
|
105
|
+
|
106
|
+
// TODO rename to zero()
|
92
107
|
function zeroVersion() external pure returns(Version) {
|
93
108
|
return Version.wrap(0);
|
94
109
|
}
|
@@ -0,0 +1,53 @@
|
|
1
|
+
// SPDX-License-Identifier: Apache-2.0
|
2
|
+
pragma solidity ^0.8.20;
|
3
|
+
|
4
|
+
import {Version} from "../type/Version.sol";
|
5
|
+
|
6
|
+
/// IMPORTANT
|
7
|
+
// Upgradeable contract MUST:
|
8
|
+
// 1) inherit from Versionable
|
9
|
+
// 2) implement version() function
|
10
|
+
// 3) implement internal _initialize() function with onlyInitializing modifier
|
11
|
+
// 4) implement internal _upgrade() function with onlyInitializing modifier (1st version MUST revert)
|
12
|
+
// 5) have onlyInitialising modifier for each function callable inside _initialize()/_upgrade() (MUST use different functions for initialization/upgrade and normal operations)
|
13
|
+
// 6) use default empty constructor -> _disableInitializer() is called from Versionable contructor
|
14
|
+
// 7) use namespace storage (should this be needed)
|
15
|
+
// 8) since now inheritance is used for upgradability, contract MUST BE inherited ONLY by the next version
|
16
|
+
// Upgradeable contract SHOULD:
|
17
|
+
// 9) define all non private methods as virtual (in order to be able to upgrade them latter)
|
18
|
+
// otherwise, it is still possible to upgrade contract, but everyone who is using it will have to switch to a new fucntions
|
19
|
+
// in some cases this ok but not in the others...
|
20
|
+
//
|
21
|
+
// IMPORTANT
|
22
|
+
// If introducting/amending storage related to Versionable version MUST:
|
23
|
+
// 1) define namespace storage struct if accessing storage
|
24
|
+
// - DO NOT use structs inside, except
|
25
|
+
// - CAN use structs ONLY inside mappings
|
26
|
+
// 2) ALWAYS define private getter if accessing storage
|
27
|
+
// - MUST use default implementation, CAN change ONLY return type
|
28
|
+
|
29
|
+
interface IVersionable {
|
30
|
+
|
31
|
+
/**
|
32
|
+
* @dev IMPORTANT
|
33
|
+
* implementation MUST be guarded by initializer modifier
|
34
|
+
* new version MUST inherit from previous version
|
35
|
+
*/
|
36
|
+
function initializeVersionable(address activatedBy, bytes memory activationData) external;
|
37
|
+
|
38
|
+
/**
|
39
|
+
* @dev
|
40
|
+
* implementation MUST be guarded by reinitializer(version().toUint64()) modifier
|
41
|
+
* new version MUST inherit from previous version
|
42
|
+
* the first verion MUST revert
|
43
|
+
*/
|
44
|
+
function upgradeVersionable(bytes memory upgradeData) external;
|
45
|
+
|
46
|
+
/**
|
47
|
+
* @dev returns version of this contract
|
48
|
+
* each new implementation MUST implement this function
|
49
|
+
* version number MUST increase
|
50
|
+
*/
|
51
|
+
function getVersion() external pure returns(Version);
|
52
|
+
|
53
|
+
}
|
@@ -0,0 +1,232 @@
|
|
1
|
+
// SPDX-License-Identifier: Apache-2.0
|
2
|
+
pragma solidity ^0.8.20;
|
3
|
+
|
4
|
+
import {ProxyAdmin} from "@openzeppelin/contracts/proxy/transparent/ProxyAdmin.sol";
|
5
|
+
import {ITransparentUpgradeableProxy} from "@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol";
|
6
|
+
|
7
|
+
import {Blocknumber, blockNumber} from "../type/Blocknumber.sol";
|
8
|
+
import {IVersionable} from "./IVersionable.sol";
|
9
|
+
import {NftId} from "../type/NftId.sol";
|
10
|
+
import {NftOwnable} from "../shared/NftOwnable.sol";
|
11
|
+
import {Timestamp, TimestampLib} from "../type/Timestamp.sol";
|
12
|
+
import {UpgradableProxyWithAdmin} from "./UpgradableProxyWithAdmin.sol";
|
13
|
+
import {Version, VersionLib} from "../type/Version.sol";
|
14
|
+
|
15
|
+
/// @dev manages proxy deployments for upgradable contracs of type IVersionable
|
16
|
+
contract ProxyManager is
|
17
|
+
NftOwnable
|
18
|
+
{
|
19
|
+
|
20
|
+
struct VersionInfo {
|
21
|
+
Version version;
|
22
|
+
address implementation;
|
23
|
+
address activatedBy;
|
24
|
+
Timestamp activatedAt;
|
25
|
+
Blocknumber activatedIn;
|
26
|
+
}
|
27
|
+
|
28
|
+
event LogProxyManagerVersionableDeployed(address indexed proxy, address initialImplementation);
|
29
|
+
event LogProxyManagerVersionableUpgraded(address indexed proxy, address upgradedImplementation);
|
30
|
+
|
31
|
+
error ErrorProxyManagerAlreadyDeployed();
|
32
|
+
error ErrorProxyManagerNotYetDeployed();
|
33
|
+
|
34
|
+
error ErrorProxyManagerZeroVersion();
|
35
|
+
error ErrorProxyManagerNextVersionNotIncreasing(Version nextVersion);
|
36
|
+
|
37
|
+
UpgradableProxyWithAdmin internal _proxy;
|
38
|
+
|
39
|
+
// state to keep version history
|
40
|
+
mapping(Version version => VersionInfo info) _versionHistory;
|
41
|
+
Version [] _versions;
|
42
|
+
|
43
|
+
/// @dev convencience initializer
|
44
|
+
function initialize(
|
45
|
+
address registry,
|
46
|
+
address implementation,
|
47
|
+
bytes memory data,
|
48
|
+
bytes32 salt
|
49
|
+
)
|
50
|
+
public
|
51
|
+
initializer()
|
52
|
+
returns (IVersionable versionable)
|
53
|
+
{
|
54
|
+
versionable = deployDetermenistic(
|
55
|
+
registry,
|
56
|
+
implementation,
|
57
|
+
data,
|
58
|
+
salt);
|
59
|
+
}
|
60
|
+
|
61
|
+
/// @dev deploy initial contract
|
62
|
+
function deploy(
|
63
|
+
address registry,
|
64
|
+
address initialImplementation,
|
65
|
+
bytes memory initializationData
|
66
|
+
)
|
67
|
+
public
|
68
|
+
virtual
|
69
|
+
onlyInitializing()
|
70
|
+
returns (IVersionable versionable)
|
71
|
+
{
|
72
|
+
(
|
73
|
+
address currentProxyOwner,
|
74
|
+
address initialProxyAdminOwner
|
75
|
+
) = _preDeployChecksAndSetup(registry);
|
76
|
+
|
77
|
+
_proxy = new UpgradableProxyWithAdmin(
|
78
|
+
initialImplementation,
|
79
|
+
initialProxyAdminOwner,
|
80
|
+
getDeployData(currentProxyOwner, initializationData)
|
81
|
+
);
|
82
|
+
|
83
|
+
versionable = _updateVersionHistory(
|
84
|
+
initialImplementation,
|
85
|
+
currentProxyOwner);
|
86
|
+
|
87
|
+
emit LogProxyManagerVersionableDeployed(address(versionable), initialImplementation);
|
88
|
+
}
|
89
|
+
|
90
|
+
function deployDetermenistic(
|
91
|
+
address registry,
|
92
|
+
address initialImplementation,
|
93
|
+
bytes memory initializationData,
|
94
|
+
bytes32 salt
|
95
|
+
)
|
96
|
+
public
|
97
|
+
virtual
|
98
|
+
onlyInitializing()
|
99
|
+
returns (IVersionable versionable)
|
100
|
+
{
|
101
|
+
(
|
102
|
+
address currentProxyOwner,
|
103
|
+
address initialProxyAdminOwner
|
104
|
+
) = _preDeployChecksAndSetup(registry);
|
105
|
+
|
106
|
+
_proxy = new UpgradableProxyWithAdmin{salt: salt}(
|
107
|
+
initialImplementation,
|
108
|
+
initialProxyAdminOwner,
|
109
|
+
getDeployData(currentProxyOwner, initializationData)
|
110
|
+
);
|
111
|
+
|
112
|
+
versionable = _updateVersionHistory(
|
113
|
+
initialImplementation,
|
114
|
+
currentProxyOwner);
|
115
|
+
|
116
|
+
emit LogProxyManagerVersionableDeployed(address(versionable), initialImplementation);
|
117
|
+
}
|
118
|
+
|
119
|
+
/// @dev upgrade existing contract
|
120
|
+
function upgrade(address newImplementation, bytes memory upgradeData)
|
121
|
+
public
|
122
|
+
virtual
|
123
|
+
onlyOwner()
|
124
|
+
returns (IVersionable versionable)
|
125
|
+
{
|
126
|
+
if (_versions.length == 0) {
|
127
|
+
revert ErrorProxyManagerNotYetDeployed();
|
128
|
+
}
|
129
|
+
|
130
|
+
address currentProxyOwner = getOwner();
|
131
|
+
ProxyAdmin proxyAdmin = getProxy().getProxyAdmin();
|
132
|
+
ITransparentUpgradeableProxy proxy = ITransparentUpgradeableProxy(address(_proxy));
|
133
|
+
|
134
|
+
proxyAdmin.upgradeAndCall(
|
135
|
+
proxy,
|
136
|
+
newImplementation,
|
137
|
+
getUpgradeData(upgradeData));
|
138
|
+
|
139
|
+
versionable = _updateVersionHistory(
|
140
|
+
newImplementation,
|
141
|
+
currentProxyOwner);
|
142
|
+
|
143
|
+
emit LogProxyManagerVersionableUpgraded(address(versionable), newImplementation);
|
144
|
+
|
145
|
+
}
|
146
|
+
|
147
|
+
function linkToProxy() public returns (NftId) {
|
148
|
+
return _linkToNftOwnable(address(_proxy));
|
149
|
+
}
|
150
|
+
|
151
|
+
function getDeployData(address proxyOwner, bytes memory deployData) public pure returns (bytes memory data) {
|
152
|
+
return abi.encodeWithSelector(
|
153
|
+
IVersionable.initializeVersionable.selector,
|
154
|
+
proxyOwner,
|
155
|
+
deployData);
|
156
|
+
}
|
157
|
+
|
158
|
+
function getUpgradeData(bytes memory upgradeData) public pure returns (bytes memory data) {
|
159
|
+
return abi.encodeWithSelector(
|
160
|
+
IVersionable.upgradeVersionable.selector,
|
161
|
+
upgradeData);
|
162
|
+
}
|
163
|
+
|
164
|
+
function getProxy() public view returns (UpgradableProxyWithAdmin) {
|
165
|
+
return _proxy;
|
166
|
+
}
|
167
|
+
|
168
|
+
function getVersion() external view virtual returns(Version) {
|
169
|
+
return IVersionable(address(_proxy)).getVersion();
|
170
|
+
}
|
171
|
+
|
172
|
+
function getVersionCount() external view returns(uint256) {
|
173
|
+
return _versions.length;
|
174
|
+
}
|
175
|
+
|
176
|
+
function getVersion(uint256 idx) external view returns(Version) {
|
177
|
+
return _versions[idx];
|
178
|
+
}
|
179
|
+
|
180
|
+
function getVersionInfo(Version _version) external view returns(VersionInfo memory) {
|
181
|
+
return _versionHistory[_version];
|
182
|
+
}
|
183
|
+
|
184
|
+
function _preDeployChecksAndSetup(address registry)
|
185
|
+
private
|
186
|
+
returns (
|
187
|
+
address currentProxyOwner,
|
188
|
+
address initialProxyAdminOwner
|
189
|
+
)
|
190
|
+
{
|
191
|
+
if (_versions.length > 0) {
|
192
|
+
revert ErrorProxyManagerAlreadyDeployed();
|
193
|
+
}
|
194
|
+
|
195
|
+
address initialOwner = msg.sender;
|
196
|
+
_initializeNftOwnable(registry, initialOwner);
|
197
|
+
|
198
|
+
currentProxyOwner = getOwner(); // used by implementation
|
199
|
+
initialProxyAdminOwner = address(this); // used by proxy
|
200
|
+
}
|
201
|
+
|
202
|
+
function _updateVersionHistory(
|
203
|
+
address implementation,
|
204
|
+
address activatedBy
|
205
|
+
)
|
206
|
+
private
|
207
|
+
returns (IVersionable versionable)
|
208
|
+
{
|
209
|
+
versionable = IVersionable(address(_proxy));
|
210
|
+
Version newVersion = versionable.getVersion();
|
211
|
+
|
212
|
+
if(newVersion == VersionLib.zeroVersion()) {
|
213
|
+
revert ErrorProxyManagerZeroVersion();
|
214
|
+
}
|
215
|
+
|
216
|
+
if(_versions.length > 0) {
|
217
|
+
if(newVersion.toInt() <= _versions[_versions.length-1].toInt()) {
|
218
|
+
revert ErrorProxyManagerNextVersionNotIncreasing(newVersion);
|
219
|
+
}
|
220
|
+
}
|
221
|
+
|
222
|
+
// update version history
|
223
|
+
_versions.push(newVersion);
|
224
|
+
_versionHistory[newVersion] = VersionInfo(
|
225
|
+
newVersion,
|
226
|
+
implementation,
|
227
|
+
activatedBy,
|
228
|
+
TimestampLib.blockTimestamp(),
|
229
|
+
blockNumber()
|
230
|
+
);
|
231
|
+
}
|
232
|
+
}
|