@towns-protocol/contracts 0.0.302
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.txt +21 -0
- package/README.md +206 -0
- package/docs/permitAndStake_integration_guide.md +266 -0
- package/docs/swap_integration_guide.md +591 -0
- package/package.json +57 -0
- package/scripts/common/DeployBase.s.sol +26 -0
- package/scripts/common/DeployFacet.s.sol +7 -0
- package/scripts/common/Deployer.s.sol +33 -0
- package/scripts/common/Interaction.s.sol +51 -0
- package/scripts/deployments/diamonds/DeployAppRegistry.s.sol +168 -0
- package/scripts/deployments/diamonds/DeployBaseRegistry.s.sol +263 -0
- package/scripts/deployments/diamonds/DeployRiverAirdrop.s.sol +203 -0
- package/scripts/deployments/diamonds/DeployRiverMigration.s.sol +129 -0
- package/scripts/deployments/diamonds/DeployRiverRegistry.s.sol +175 -0
- package/scripts/deployments/diamonds/DeploySpace.s.sol +285 -0
- package/scripts/deployments/diamonds/DeploySpaceFactory.s.sol +416 -0
- package/scripts/deployments/diamonds/DeploySpaceOwner.s.sol +183 -0
- package/scripts/deployments/diamonds/DeploySwapRouter.s.sol +176 -0
- package/scripts/deployments/diamonds/IDiamondInitHelper.sol +11 -0
- package/scripts/deployments/facets/DeployAppAccount.s.sol +51 -0
- package/scripts/deployments/facets/DeployAppRegistryFacet.s.sol +69 -0
- package/scripts/deployments/facets/DeployArchitect.s.sol +51 -0
- package/scripts/deployments/facets/DeployAttestationRegistry.s.sol +36 -0
- package/scripts/deployments/facets/DeployBanning.s.sol +30 -0
- package/scripts/deployments/facets/DeployChannels.s.sol +35 -0
- package/scripts/deployments/facets/DeployCreateSpace.s.sol +42 -0
- package/scripts/deployments/facets/DeployDropFacet.s.sol +49 -0
- package/scripts/deployments/facets/DeployERC721A.s.sol +48 -0
- package/scripts/deployments/facets/DeployERC721ANonTransferable.s.sol +49 -0
- package/scripts/deployments/facets/DeployERC721AQueryable.s.sol +30 -0
- package/scripts/deployments/facets/DeployEntitlementChecker.s.sol +49 -0
- package/scripts/deployments/facets/DeployEntitlementDataQueryable.s.sol +29 -0
- package/scripts/deployments/facets/DeployEntitlementsManager.s.sol +33 -0
- package/scripts/deployments/facets/DeployExecutorFacet.s.sol +60 -0
- package/scripts/deployments/facets/DeployFeatureManager.s.sol +38 -0
- package/scripts/deployments/facets/DeployGuardianFacet.s.sol +39 -0
- package/scripts/deployments/facets/DeployImplementationRegistry.s.sol +36 -0
- package/scripts/deployments/facets/DeployMainnetDelegation.s.sol +43 -0
- package/scripts/deployments/facets/DeployMembership.s.sol +77 -0
- package/scripts/deployments/facets/DeployMembershipMetadata.s.sol +30 -0
- package/scripts/deployments/facets/DeployMembershipToken.s.sol +47 -0
- package/scripts/deployments/facets/DeployMerkleAirdrop.s.sol +37 -0
- package/scripts/deployments/facets/DeployMetadata.s.sol +39 -0
- package/scripts/deployments/facets/DeployMockLegacyArchitect.s.sol +33 -0
- package/scripts/deployments/facets/DeployNodeOperator.s.sol +49 -0
- package/scripts/deployments/facets/DeployNodeRegistry.s.sol +37 -0
- package/scripts/deployments/facets/DeployOperatorRegistry.s.sol +36 -0
- package/scripts/deployments/facets/DeployPartnerRegistry.s.sol +41 -0
- package/scripts/deployments/facets/DeployPlatformRequirements.s.sol +75 -0
- package/scripts/deployments/facets/DeployPrepayFacet.s.sol +31 -0
- package/scripts/deployments/facets/DeployPricingModules.s.sol +36 -0
- package/scripts/deployments/facets/DeployReferrals.s.sol +34 -0
- package/scripts/deployments/facets/DeployReviewFacet.s.sol +31 -0
- package/scripts/deployments/facets/DeployRewardsDistributionV2.s.sol +76 -0
- package/scripts/deployments/facets/DeployRiverConfig.s.sol +41 -0
- package/scripts/deployments/facets/DeployRoles.s.sol +48 -0
- package/scripts/deployments/facets/DeploySchemaRegistry.s.sol +35 -0
- package/scripts/deployments/facets/DeploySignerFacet.s.sol +47 -0
- package/scripts/deployments/facets/DeploySimpleApp.s.sol +10 -0
- package/scripts/deployments/facets/DeploySpaceDelegation.s.sol +43 -0
- package/scripts/deployments/facets/DeploySpaceEntitlementGated.s.sol +31 -0
- package/scripts/deployments/facets/DeploySpaceFactoryInit.s.sol +33 -0
- package/scripts/deployments/facets/DeploySpaceOwnerFacet.s.sol +71 -0
- package/scripts/deployments/facets/DeployStreamRegistry.s.sol +50 -0
- package/scripts/deployments/facets/DeploySwapFacet.s.sol +33 -0
- package/scripts/deployments/facets/DeploySwapRouterFacet.s.sol +38 -0
- package/scripts/deployments/facets/DeployTipping.s.sol +31 -0
- package/scripts/deployments/facets/DeployTokenMigration.s.sol +40 -0
- package/scripts/deployments/facets/DeployTownsPoints.s.sol +53 -0
- package/scripts/deployments/facets/DeployTreasury.s.sol +30 -0
- package/scripts/deployments/facets/DeployUpgradeableBeacon.s.sol +34 -0
- package/scripts/deployments/facets/DeployWalletLink.s.sol +56 -0
- package/scripts/deployments/facets/DeployXChain.s.sol +35 -0
- package/scripts/deployments/utils/DeployAccountFactory.s.sol +40 -0
- package/scripts/deployments/utils/DeployEntitlementGatedExample.s.sol +23 -0
- package/scripts/deployments/utils/DeployEntrypoint.s.sol +28 -0
- package/scripts/deployments/utils/DeployMember.s.sol +95 -0
- package/scripts/deployments/utils/DeployMockDiamond.s.sol +7 -0
- package/scripts/deployments/utils/DeployMockERC20.s.sol +24 -0
- package/scripts/deployments/utils/DeployMockERC721A.s.sol +45 -0
- package/scripts/deployments/utils/DeployMockLegacyMembership.s.sol +29 -0
- package/scripts/deployments/utils/DeployMockMessenger.s.sol +42 -0
- package/scripts/deployments/utils/DeployMockNFT.s.sol +86 -0
- package/scripts/deployments/utils/DeployPoapEntitlement.s.sol +16 -0
- package/scripts/deployments/utils/DeployProxyBatchDelegation.s.sol +112 -0
- package/scripts/deployments/utils/DeploySpaceProxyInitializer.s.sol +28 -0
- package/scripts/deployments/utils/DeployTieredLogPricingV2.s.sol +23 -0
- package/scripts/deployments/utils/DeployTieredLogPricingV3.s.sol +23 -0
- package/scripts/deployments/utils/DeployTownsBase.s.sol +95 -0
- package/scripts/deployments/utils/DeployTownsMainnet.s.sol +66 -0
- package/scripts/deployments/utils/DeployTownsMulti.s.sol +53 -0
- package/scripts/deployments/utils/DeployWrappedTowns.s.sol +52 -0
- package/scripts/deployments/utils/LibLayerZeroValues.sol +34 -0
- package/scripts/deployments/utils/pricing/TieredLogPricing.s.sol +45 -0
- package/scripts/interactions/InteractAirdrop.s.sol +57 -0
- package/scripts/interactions/InteractAlphaPost.s.sol +32 -0
- package/scripts/interactions/InteractAlphaSparse.s.sol +173 -0
- package/scripts/interactions/InteractBaseAlpha.s.sol +84 -0
- package/scripts/interactions/InteractBaseBridge.s.sol +48 -0
- package/scripts/interactions/InteractBridgeLayerZero.s.sol +102 -0
- package/scripts/interactions/InteractClaimCondition.s.sol +56 -0
- package/scripts/interactions/InteractCreateSpace.s.sol +50 -0
- package/scripts/interactions/InteractDiamondCut.s.sol +47 -0
- package/scripts/interactions/InteractDropFacet.s.sol +32 -0
- package/scripts/interactions/InteractEnableNewSnapshotFormat.s.sol +27 -0
- package/scripts/interactions/InteractEnableNode2NodeAuth.s.sol +27 -0
- package/scripts/interactions/InteractMembership.s.sol +42 -0
- package/scripts/interactions/InteractMockERC721A.s.sol +20 -0
- package/scripts/interactions/InteractNodeOperators.s.sol +41 -0
- package/scripts/interactions/InteractPostDeploy.s.sol +59 -0
- package/scripts/interactions/InteractPrepay.s.sol +30 -0
- package/scripts/interactions/InteractRegisterApp.s.sol +61 -0
- package/scripts/interactions/InteractRiverAlpha.s.sol +30 -0
- package/scripts/interactions/InteractRiverAlphaSparse.s.sol +117 -0
- package/scripts/interactions/InteractRiverMainnet.s.sol +27 -0
- package/scripts/interactions/InteractRiverRegistry.s.sol +36 -0
- package/scripts/interactions/InteractRiverRegistrySetBlocklist.s.sol +30 -0
- package/scripts/interactions/InteractRiverRegistrySetFreq.s.sol +27 -0
- package/scripts/interactions/InteractRiverRegistrySetRepl.s.sol +30 -0
- package/scripts/interactions/InteractSetDefaultUri.s.sol +20 -0
- package/scripts/interactions/InteractSetDefaultUriLocalhost.s.sol +19 -0
- package/scripts/interactions/InteractTransferOwnership.s.sol +21 -0
- package/scripts/interactions/InteractUpdateMbRecencyCheck.s.sol +27 -0
- package/scripts/interactions/InteractUpdateMediaChunkCount.s.sol +27 -0
- package/scripts/interactions/InteractUpdateMediaChunkSize.s.sol +27 -0
- package/scripts/interactions/helpers/AlphaHelper.sol +149 -0
- package/scripts/interactions/helpers/RiverConfigValues.sol +22 -0
- package/scripts/interactions/interfaces/IL1StandardBridge.sol +35 -0
- package/scripts/interactions/interfaces/IL2StandardBridge.sol +69 -0
- package/src/airdrop/drop/DropBase.sol +210 -0
- package/src/airdrop/drop/DropClaim.sol +55 -0
- package/src/airdrop/drop/DropFacet.sol +176 -0
- package/src/airdrop/drop/DropGroup.sol +111 -0
- package/src/airdrop/drop/DropStorage.sol +23 -0
- package/src/airdrop/drop/IDropFacet.sol +136 -0
- package/src/airdrop/points/CheckIn.sol +71 -0
- package/src/airdrop/points/ITownsPoints.sol +64 -0
- package/src/airdrop/points/TownsPoints.sol +196 -0
- package/src/airdrop/points/TownsPointsStorage.sol +22 -0
- package/src/apps/BaseApp.sol +62 -0
- package/src/apps/ITownsApp.sol +28 -0
- package/src/apps/SchemaResolver.sol +170 -0
- package/src/apps/facets/attest/AttestationBase.sol +335 -0
- package/src/apps/facets/attest/AttestationLib.sol +64 -0
- package/src/apps/facets/attest/AttestationRegistry.sol +39 -0
- package/src/apps/facets/attest/AttestationStorage.sol +35 -0
- package/src/apps/facets/attest/IAttestationRegistry.sol +43 -0
- package/src/apps/facets/registry/AppRegistryBase.sol +403 -0
- package/src/apps/facets/registry/AppRegistryFacet.sol +173 -0
- package/src/apps/facets/registry/AppRegistryStorage.sol +53 -0
- package/src/apps/facets/registry/IAppRegistry.sol +159 -0
- package/src/apps/facets/schema/ISchema.sol +14 -0
- package/src/apps/facets/schema/SchemaBase.sol +88 -0
- package/src/apps/facets/schema/SchemaLib.sol +14 -0
- package/src/apps/facets/schema/SchemaRegistry.sol +51 -0
- package/src/apps/facets/schema/SchemaStorage.sol +34 -0
- package/src/apps/helpers/ISimpleApp.sol +51 -0
- package/src/apps/helpers/SimpleApp.sol +97 -0
- package/src/apps/helpers/SimpleAppStorage.sol +27 -0
- package/src/base/registry/facets/checker/EntitlementChecker.sol +237 -0
- package/src/base/registry/facets/checker/EntitlementCheckerStorage.sol +28 -0
- package/src/base/registry/facets/checker/IEntitlementChecker.sol +95 -0
- package/src/base/registry/facets/delegation/ISpaceDelegation.sol +69 -0
- package/src/base/registry/facets/delegation/SpaceDelegationFacet.sol +250 -0
- package/src/base/registry/facets/delegation/SpaceDelegationStorage.sol +35 -0
- package/src/base/registry/facets/distribution/v1/IRewardsDistribution.sol +51 -0
- package/src/base/registry/facets/distribution/v1/RewardsDistribution.sol +439 -0
- package/src/base/registry/facets/distribution/v1/RewardsDistributionStorage.sol +32 -0
- package/src/base/registry/facets/distribution/v2/DelegationProxy.sol +53 -0
- package/src/base/registry/facets/distribution/v2/IRewardsDistribution.sol +372 -0
- package/src/base/registry/facets/distribution/v2/RewardsDistributionBase.sol +299 -0
- package/src/base/registry/facets/distribution/v2/RewardsDistributionStorage.sol +37 -0
- package/src/base/registry/facets/distribution/v2/RewardsDistributionV2.sol +392 -0
- package/src/base/registry/facets/distribution/v2/StakingRewards.sol +466 -0
- package/src/base/registry/facets/mainnet/ICrossDomainMessenger.sol +58 -0
- package/src/base/registry/facets/mainnet/IMainnetDelegation.sol +127 -0
- package/src/base/registry/facets/mainnet/MainnetDelegation.sol +119 -0
- package/src/base/registry/facets/mainnet/MainnetDelegationBase.sol +274 -0
- package/src/base/registry/facets/mainnet/MainnetDelegationStorage.sol +36 -0
- package/src/base/registry/facets/operator/INodeOperator.sol +91 -0
- package/src/base/registry/facets/operator/NodeOperatorFacet.sol +189 -0
- package/src/base/registry/facets/operator/NodeOperatorStorage.sol +39 -0
- package/src/base/registry/facets/xchain/IXChain.sol +54 -0
- package/src/base/registry/facets/xchain/XChain.sol +158 -0
- package/src/base/registry/facets/xchain/XChainCheckLib.sol +105 -0
- package/src/base/registry/facets/xchain/XChainLib.sol +46 -0
- package/src/diamond/facets/beacon/UpgradeableBeacon.sol +38 -0
- package/src/diamond/facets/beacon/UpgradeableBeaconFacet.sol +34 -0
- package/src/diamond/facets/governance/votes/Checkpoints.sol +642 -0
- package/src/diamond/facets/governance/votes/Votes.sol +63 -0
- package/src/diamond/facets/governance/votes/VotesBase.sol +274 -0
- package/src/diamond/facets/governance/votes/VotesStorage.sol +21 -0
- package/src/diamond/facets/governance/votes/enumerable/IVotesEnumerable.sol +38 -0
- package/src/diamond/facets/governance/votes/enumerable/VotesEnumerable.sol +39 -0
- package/src/diamond/facets/governance/votes/enumerable/VotesEnumerableLib.sol +102 -0
- package/src/diamond/facets/metadata/IMetadata.sol +27 -0
- package/src/diamond/facets/metadata/MetadataFacet.sol +71 -0
- package/src/diamond/facets/token/ERC5643/ERC5643.sol +51 -0
- package/src/diamond/facets/token/ERC5643/ERC5643Base.sol +48 -0
- package/src/diamond/facets/token/ERC5643/ERC5643Storage.sol +26 -0
- package/src/diamond/facets/token/ERC5643/IERC5643.sol +44 -0
- package/src/diamond/facets/token/ERC721A/ERC721A.sol +270 -0
- package/src/diamond/facets/token/ERC721A/ERC721ABase.sol +829 -0
- package/src/diamond/facets/token/ERC721A/ERC721ANonTransferable.sol +21 -0
- package/src/diamond/facets/token/ERC721A/ERC721AStorage.sol +115 -0
- package/src/diamond/facets/token/ERC721A/IERC721A.sol +283 -0
- package/src/diamond/facets/token/ERC721A/extensions/ERC721AQueryable.sol +134 -0
- package/src/diamond/facets/token/ERC721A/extensions/IERC721AQueryable.sol +83 -0
- package/src/diamond/utils/Context.sol +19 -0
- package/src/factory/SpaceFactoryInit.sol +17 -0
- package/src/factory/facets/architect/Architect.sol +98 -0
- package/src/factory/facets/architect/ArchitectBase.sol +95 -0
- package/src/factory/facets/architect/ArchitectStorage.sol +28 -0
- package/src/factory/facets/architect/IArchitect.sol +155 -0
- package/src/factory/facets/architect/ImplementationStorage.sol +42 -0
- package/src/factory/facets/architect/pricing/IPricingModules.sol +41 -0
- package/src/factory/facets/architect/pricing/PricingModulesBase.sol +89 -0
- package/src/factory/facets/architect/pricing/PricingModulesFacet.sol +40 -0
- package/src/factory/facets/architect/pricing/PricingModulesStorage.sol +30 -0
- package/src/factory/facets/create/CreateSpace.sol +107 -0
- package/src/factory/facets/create/CreateSpaceLib.sol +335 -0
- package/src/factory/facets/create/ICreateSpace.sol +70 -0
- package/src/factory/facets/feature/FeatureConditionLib.sol +53 -0
- package/src/factory/facets/feature/FeatureManagerFacet.sol +66 -0
- package/src/factory/facets/feature/FeatureManagerLib.sol +168 -0
- package/src/factory/facets/feature/IFeatureManagerFacet.sol +73 -0
- package/src/factory/facets/partner/IPartnerRegistry.sol +56 -0
- package/src/factory/facets/partner/PartnerRegistry.sol +57 -0
- package/src/factory/facets/partner/PartnerRegistryBase.sol +132 -0
- package/src/factory/facets/partner/PartnerRegistryStorage.sol +40 -0
- package/src/factory/facets/platform/requirements/IPlatformRequirements.sol +143 -0
- package/src/factory/facets/platform/requirements/PlatformRequirementsBase.sol +124 -0
- package/src/factory/facets/platform/requirements/PlatformRequirementsFacet.sol +122 -0
- package/src/factory/facets/platform/requirements/PlatformRequirementsStorage.sol +41 -0
- package/src/factory/facets/registry/IImplementationRegistry.sol +46 -0
- package/src/factory/facets/registry/ImplementationRegistry.sol +64 -0
- package/src/factory/facets/registry/ImplementationRegistryStorage.sol +28 -0
- package/src/factory/facets/wallet-link/IWalletLink.sol +218 -0
- package/src/factory/facets/wallet-link/WalletLink.sol +108 -0
- package/src/factory/facets/wallet-link/WalletLinkBase.sol +492 -0
- package/src/factory/facets/wallet-link/interfaces/IDelegateRegistry.sol +63 -0
- package/src/factory/facets/wallet-link/interfaces/IDelegateRegistryV1.sol +35 -0
- package/src/factory/facets/wallet-link/interfaces/ISCL_EIP6565.sol +24 -0
- package/src/factory/facets/wallet-link/libraries/SolanaUtils.sol +161 -0
- package/src/factory/facets/wallet-link/libraries/WalletLib.sol +62 -0
- package/src/river/registry/facets/config/IRiverConfig.sol +117 -0
- package/src/river/registry/facets/config/RiverConfig.sol +174 -0
- package/src/river/registry/facets/node/INodeRegistry.sol +69 -0
- package/src/river/registry/facets/node/NodeRegistry.sol +143 -0
- package/src/river/registry/facets/operator/IOperatorRegistry.sol +28 -0
- package/src/river/registry/facets/operator/OperatorRegistry.sol +86 -0
- package/src/river/registry/facets/stream/IStreamRegistry.sol +184 -0
- package/src/river/registry/facets/stream/StreamRegistry.sol +396 -0
- package/src/river/registry/libraries/RegistryErrors.sol +24 -0
- package/src/river/registry/libraries/RegistryStorage.sol +181 -0
- package/src/router/ISwapRouter.sol +226 -0
- package/src/router/Permit2Hash.sol +92 -0
- package/src/router/SwapRouter.sol +463 -0
- package/src/router/SwapRouterStorage.sol +21 -0
- package/src/spaces/entitlements/ICrossChainEntitlement.sol +22 -0
- package/src/spaces/entitlements/IEntitlement.sol +61 -0
- package/src/spaces/entitlements/PolymarketEntitlement.sol +79 -0
- package/src/spaces/entitlements/poap/IPOAP.sol +26 -0
- package/src/spaces/entitlements/poap/PoapEntitlement.sol +56 -0
- package/src/spaces/entitlements/rule/IRuleEntitlement.sol +174 -0
- package/src/spaces/entitlements/rule/RuleEntitlement.sol +183 -0
- package/src/spaces/entitlements/rule/RuleEntitlementV2.sol +219 -0
- package/src/spaces/entitlements/user/IUserEntitlement.sol +24 -0
- package/src/spaces/entitlements/user/UserEntitlement.sol +273 -0
- package/src/spaces/facets/DependencyLib.sol +60 -0
- package/src/spaces/facets/Entitled.sol +172 -0
- package/src/spaces/facets/Permissions.sol +21 -0
- package/src/spaces/facets/account/AppAccount.sol +93 -0
- package/src/spaces/facets/account/AppAccountBase.sol +275 -0
- package/src/spaces/facets/account/AppAccountStorage.sol +63 -0
- package/src/spaces/facets/account/IAppAccount.sol +71 -0
- package/src/spaces/facets/account/SignerFacet.sol +26 -0
- package/src/spaces/facets/banning/Banning.sol +41 -0
- package/src/spaces/facets/banning/BanningBase.sol +33 -0
- package/src/spaces/facets/banning/BanningStorage.sol +23 -0
- package/src/spaces/facets/banning/IBanning.sol +35 -0
- package/src/spaces/facets/channels/ChannelBase.sol +87 -0
- package/src/spaces/facets/channels/ChannelService.sol +177 -0
- package/src/spaces/facets/channels/ChannelStorage.sol +34 -0
- package/src/spaces/facets/channels/Channels.sol +80 -0
- package/src/spaces/facets/channels/IChannel.sol +98 -0
- package/src/spaces/facets/dispatcher/DispatcherBase.sol +86 -0
- package/src/spaces/facets/dispatcher/DispatcherStorage.sol +21 -0
- package/src/spaces/facets/dispatcher/IDispatcher.sol +6 -0
- package/src/spaces/facets/entitlements/EntitlementsManager.sol +49 -0
- package/src/spaces/facets/entitlements/EntitlementsManagerBase.sol +87 -0
- package/src/spaces/facets/entitlements/EntitlementsManagerService.sol +142 -0
- package/src/spaces/facets/entitlements/EntitlementsManagerStorage.sol +34 -0
- package/src/spaces/facets/entitlements/IEntitlementsManager.sol +67 -0
- package/src/spaces/facets/entitlements/extensions/EntitlementDataQueryable.sol +153 -0
- package/src/spaces/facets/entitlements/extensions/IEntitlementDataQueryable.sol +32 -0
- package/src/spaces/facets/executor/ExecutorBase.sol +564 -0
- package/src/spaces/facets/executor/ExecutorFacet.sol +178 -0
- package/src/spaces/facets/executor/ExecutorStorage.sol +99 -0
- package/src/spaces/facets/executor/GroupLib.sol +128 -0
- package/src/spaces/facets/executor/IExecutor.sol +287 -0
- package/src/spaces/facets/executor/hooks/HookBase.sol +172 -0
- package/src/spaces/facets/executor/hooks/HookLib.sol +38 -0
- package/src/spaces/facets/executor/hooks/IHookBase.sol +48 -0
- package/src/spaces/facets/gated/EntitlementGated.sol +59 -0
- package/src/spaces/facets/gated/EntitlementGatedBase.sol +324 -0
- package/src/spaces/facets/gated/EntitlementGatedStorage.sol +29 -0
- package/src/spaces/facets/gated/IEntitlementGated.sol +55 -0
- package/src/spaces/facets/guardian/GuardianBase.sol +80 -0
- package/src/spaces/facets/guardian/GuardianFacet.sol +43 -0
- package/src/spaces/facets/guardian/GuardianStorage.sol +27 -0
- package/src/spaces/facets/guardian/IGuardian.sol +54 -0
- package/src/spaces/facets/membership/IMembership.sol +216 -0
- package/src/spaces/facets/membership/MembershipBase.sol +272 -0
- package/src/spaces/facets/membership/MembershipFacet.sol +191 -0
- package/src/spaces/facets/membership/MembershipStorage.sol +40 -0
- package/src/spaces/facets/membership/join/MembershipJoin.sol +547 -0
- package/src/spaces/facets/membership/metadata/IMembershipMetadata.sol +9 -0
- package/src/spaces/facets/membership/metadata/MembershipMetadata.sol +32 -0
- package/src/spaces/facets/membership/pricing/IMembershipPricing.sol +18 -0
- package/src/spaces/facets/membership/pricing/fixed/FixedPricing.sol +29 -0
- package/src/spaces/facets/membership/pricing/fixed/FixedPricingStorage.sol +27 -0
- package/src/spaces/facets/membership/pricing/tiered/TieredLogPricingOracleV2.sol +148 -0
- package/src/spaces/facets/membership/pricing/tiered/TieredLogPricingOracleV3.sol +137 -0
- package/src/spaces/facets/membership/token/MembershipToken.sol +25 -0
- package/src/spaces/facets/owner/ISpaceOwner.sol +85 -0
- package/src/spaces/facets/owner/SpaceOwner.sol +174 -0
- package/src/spaces/facets/owner/SpaceOwnerBase.sol +121 -0
- package/src/spaces/facets/owner/SpaceOwnerStorage.sol +41 -0
- package/src/spaces/facets/owner/SpaceOwnerUriBase.sol +54 -0
- package/src/spaces/facets/points/PointsBase.sol +35 -0
- package/src/spaces/facets/prepay/IPrepay.sol +43 -0
- package/src/spaces/facets/prepay/PrepayBase.sol +27 -0
- package/src/spaces/facets/prepay/PrepayFacet.sol +59 -0
- package/src/spaces/facets/prepay/PrepayStorage.sol +26 -0
- package/src/spaces/facets/proxy/ISpaceProxyInitializer.sol +21 -0
- package/src/spaces/facets/proxy/SpaceProxy.sol +15 -0
- package/src/spaces/facets/proxy/SpaceProxyInitializer.sol +55 -0
- package/src/spaces/facets/referrals/IReferrals.sol +98 -0
- package/src/spaces/facets/referrals/ReferralsBase.sol +81 -0
- package/src/spaces/facets/referrals/ReferralsFacet.sol +65 -0
- package/src/spaces/facets/referrals/ReferralsStorage.sol +36 -0
- package/src/spaces/facets/review/IReview.sol +50 -0
- package/src/spaces/facets/review/ReviewFacet.sol +105 -0
- package/src/spaces/facets/review/ReviewStorage.sol +29 -0
- package/src/spaces/facets/roles/IRoles.sol +197 -0
- package/src/spaces/facets/roles/Roles.sol +123 -0
- package/src/spaces/facets/roles/RolesBase.sol +420 -0
- package/src/spaces/facets/roles/RolesStorage.sol +132 -0
- package/src/spaces/facets/swap/ISwapFacet.sol +91 -0
- package/src/spaces/facets/swap/SwapFacet.sol +290 -0
- package/src/spaces/facets/swap/SwapFacetStorage.sol +24 -0
- package/src/spaces/facets/tipping/ITipping.sol +80 -0
- package/src/spaces/facets/tipping/TippingBase.sol +73 -0
- package/src/spaces/facets/tipping/TippingFacet.sol +123 -0
- package/src/spaces/facets/treasury/ITreasury.sol +64 -0
- package/src/spaces/facets/treasury/Treasury.sol +82 -0
- package/src/spaces/facets/xchain/SpaceEntitlementGated.sol +62 -0
- package/src/tokens/Member.sol +246 -0
- package/src/tokens/lock/ILock.sol +42 -0
- package/src/tokens/lock/LockBase.sol +64 -0
- package/src/tokens/lock/LockFacet.sol +44 -0
- package/src/tokens/lock/LockStorage.sol +26 -0
- package/src/tokens/mainnet/claimer/AuthorizedClaimerStorage.sol +26 -0
- package/src/tokens/mainnet/claimer/AuthorizedClaimers.sol +84 -0
- package/src/tokens/mainnet/claimer/IAuthorizedClaimers.sol +36 -0
- package/src/tokens/mainnet/delegation/ProxyBatchDelegation.sol +86 -0
- package/src/tokens/migration/ITokenMigration.sol +35 -0
- package/src/tokens/migration/TokenMigrationFacet.sol +86 -0
- package/src/tokens/migration/TokenMigrationStorage.sol +27 -0
- package/src/tokens/towns/base/IERC7802.sol +30 -0
- package/src/tokens/towns/base/IOptimismMintableERC20.sol +31 -0
- package/src/tokens/towns/base/ISemver.sol +13 -0
- package/src/tokens/towns/base/Towns.sol +283 -0
- package/src/tokens/towns/base/TownsDeployer.sol +32 -0
- package/src/tokens/towns/base/TownsLib.sol +31 -0
- package/src/tokens/towns/base/versions/TownsV2.sol +15 -0
- package/src/tokens/towns/mainnet/ITowns.sol +56 -0
- package/src/tokens/towns/mainnet/Towns.sol +220 -0
- package/src/tokens/towns/mainnet/libs/TokenInflationLib.sol +89 -0
- package/src/tokens/towns/multichain/Towns.sol +19 -0
- package/src/tokens/towns/multichain/wTowns.sol +18 -0
- package/src/utils/Airdrop.sol +156 -0
- package/src/utils/airdrop/merkle/IMerkleAirdrop.sol +55 -0
- package/src/utils/airdrop/merkle/MerkleAirdrop.sol +118 -0
- package/src/utils/airdrop/merkle/MerkleAirdropStorage.sol +29 -0
- package/src/utils/interfaces/AggregatorV3Interface.sol +37 -0
- package/src/utils/interfaces/IMulticall.sol +10 -0
- package/src/utils/interfaces/IWETH.sol +10 -0
- package/src/utils/libraries/BasisPoints.sol +24 -0
- package/src/utils/libraries/Create2Utils.sol +74 -0
- package/src/utils/libraries/CurrencyTransfer.sol +99 -0
- package/src/utils/libraries/CustomRevert.sol +49 -0
- package/src/utils/libraries/Factory.sol +66 -0
- package/src/utils/libraries/StringSet.sol +190 -0
- package/src/utils/libraries/Validator.sol +31 -0
|
@@ -0,0 +1,416 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
pragma solidity ^0.8.23;
|
|
3
|
+
|
|
4
|
+
// interfaces
|
|
5
|
+
import {IDiamondInitHelper} from "./IDiamondInitHelper.sol";
|
|
6
|
+
|
|
7
|
+
// libraries
|
|
8
|
+
import {DeployDiamondCut} from "@towns-protocol/diamond/scripts/deployments/facets/DeployDiamondCut.sol";
|
|
9
|
+
import {DeployDiamondLoupe} from "@towns-protocol/diamond/scripts/deployments/facets/DeployDiamondLoupe.sol";
|
|
10
|
+
import {DeployEIP712Facet} from "@towns-protocol/diamond/scripts/deployments/facets/DeployEIP712Facet.sol";
|
|
11
|
+
import {DeployIntrospection} from "@towns-protocol/diamond/scripts/deployments/facets/DeployIntrospection.sol";
|
|
12
|
+
import {DeployOwnable} from "@towns-protocol/diamond/scripts/deployments/facets/DeployOwnable.sol";
|
|
13
|
+
import {DeployPausable} from "@towns-protocol/diamond/scripts/deployments/facets/DeployPausable.sol";
|
|
14
|
+
import {DeployProxyManager} from "@towns-protocol/diamond/scripts/deployments/utils/DeployProxyManager.sol";
|
|
15
|
+
import {LibDeploy} from "@towns-protocol/diamond/src/utils/LibDeploy.sol";
|
|
16
|
+
import {DeployFeatureManager} from "../facets/DeployFeatureManager.s.sol";
|
|
17
|
+
import {DeployMetadata} from "../facets/DeployMetadata.s.sol";
|
|
18
|
+
import {DeployPricingModules} from "../facets/DeployPricingModules.s.sol";
|
|
19
|
+
import {DeploySpaceFactoryInit} from "../facets/DeploySpaceFactoryInit.s.sol";
|
|
20
|
+
import {DeployArchitect} from "../facets/DeployArchitect.s.sol";
|
|
21
|
+
import {DeployCreateSpace} from "../facets/DeployCreateSpace.s.sol";
|
|
22
|
+
import {DeployImplementationRegistry} from "../facets/DeployImplementationRegistry.s.sol";
|
|
23
|
+
import {DeployMockLegacyArchitect} from "../facets/DeployMockLegacyArchitect.s.sol";
|
|
24
|
+
import {DeployPartnerRegistry} from "../facets/DeployPartnerRegistry.s.sol";
|
|
25
|
+
import {DeployPlatformRequirements} from "../facets/DeployPlatformRequirements.s.sol";
|
|
26
|
+
import {DeployWalletLink} from "../facets/DeployWalletLink.s.sol";
|
|
27
|
+
import {LibString} from "solady/utils/LibString.sol";
|
|
28
|
+
|
|
29
|
+
// contracts
|
|
30
|
+
import {Diamond} from "@towns-protocol/diamond/src/Diamond.sol";
|
|
31
|
+
import {MultiInit} from "@towns-protocol/diamond/src/initializers/MultiInit.sol";
|
|
32
|
+
import {DiamondHelper} from "@towns-protocol/diamond/scripts/common/helpers/DiamondHelper.s.sol";
|
|
33
|
+
|
|
34
|
+
// deployers
|
|
35
|
+
import {DeployFacet} from "../../common/DeployFacet.s.sol";
|
|
36
|
+
import {Deployer} from "../../common/Deployer.s.sol";
|
|
37
|
+
import {DeploySpace} from "scripts/deployments/diamonds/DeploySpace.s.sol";
|
|
38
|
+
import {DeploySpaceOwner} from "scripts/deployments/diamonds/DeploySpaceOwner.s.sol";
|
|
39
|
+
import {DeployTieredLogPricingV2} from "scripts/deployments/utils/DeployTieredLogPricingV2.s.sol";
|
|
40
|
+
import {DeployTieredLogPricingV3} from "scripts/deployments/utils/DeployTieredLogPricingV3.s.sol";
|
|
41
|
+
|
|
42
|
+
contract DeploySpaceFactory is IDiamondInitHelper, DiamondHelper, Deployer {
|
|
43
|
+
using LibString for string;
|
|
44
|
+
|
|
45
|
+
DeployFacet private facetHelper = new DeployFacet();
|
|
46
|
+
|
|
47
|
+
// dependencies
|
|
48
|
+
DeploySpace private deploySpace = new DeploySpace();
|
|
49
|
+
DeploySpaceOwner private deploySpaceOwner = new DeploySpaceOwner();
|
|
50
|
+
DeployTieredLogPricingV2 private deployTieredLogPricingV2 = new DeployTieredLogPricingV2();
|
|
51
|
+
DeployTieredLogPricingV3 private deployTieredLogPricingV3 = new DeployTieredLogPricingV3();
|
|
52
|
+
|
|
53
|
+
// helpers
|
|
54
|
+
address[] private pricingModules;
|
|
55
|
+
|
|
56
|
+
// external contracts
|
|
57
|
+
address public spaceImpl;
|
|
58
|
+
address public userEntitlement;
|
|
59
|
+
address public legacyRuleEntitlement;
|
|
60
|
+
address public ruleEntitlement;
|
|
61
|
+
address public spaceOwner;
|
|
62
|
+
address public tieredLogPricingV2;
|
|
63
|
+
address public tieredLogPricingV3;
|
|
64
|
+
address public fixedPricing;
|
|
65
|
+
address public mockDelegationRegistry;
|
|
66
|
+
|
|
67
|
+
// init
|
|
68
|
+
address public spaceFactoryInit;
|
|
69
|
+
bytes public spaceFactoryInitData;
|
|
70
|
+
|
|
71
|
+
function versionName() public pure override returns (string memory) {
|
|
72
|
+
return "spaceFactory";
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
function addImmutableCuts(address deployer) internal {
|
|
76
|
+
spaceImpl = deploySpace.deploy(deployer);
|
|
77
|
+
spaceOwner = deploySpaceOwner.deploy(deployer);
|
|
78
|
+
|
|
79
|
+
// Queue up all core facets for batch deployment
|
|
80
|
+
facetHelper.add("DiamondCutFacet");
|
|
81
|
+
facetHelper.add("DiamondLoupeFacet");
|
|
82
|
+
facetHelper.add("IntrospectionFacet");
|
|
83
|
+
facetHelper.add("OwnableFacet");
|
|
84
|
+
facetHelper.add("UserEntitlement");
|
|
85
|
+
facetHelper.add("RuleEntitlementV2");
|
|
86
|
+
facetHelper.add("RuleEntitlement");
|
|
87
|
+
facetHelper.add("FixedPricing");
|
|
88
|
+
|
|
89
|
+
// Deploy the first batch of facets
|
|
90
|
+
facetHelper.deployBatch(deployer);
|
|
91
|
+
|
|
92
|
+
// entitlement modules
|
|
93
|
+
userEntitlement = facetHelper.getDeployedAddress("UserEntitlement");
|
|
94
|
+
ruleEntitlement = facetHelper.getDeployedAddress("RuleEntitlementV2");
|
|
95
|
+
legacyRuleEntitlement = facetHelper.getDeployedAddress("RuleEntitlement");
|
|
96
|
+
|
|
97
|
+
// pricing modules
|
|
98
|
+
tieredLogPricingV2 = deployTieredLogPricingV2.deploy(deployer);
|
|
99
|
+
tieredLogPricingV3 = deployTieredLogPricingV3.deploy(deployer);
|
|
100
|
+
fixedPricing = facetHelper.getDeployedAddress("FixedPricing");
|
|
101
|
+
|
|
102
|
+
// pricing modules
|
|
103
|
+
pricingModules.push(tieredLogPricingV2);
|
|
104
|
+
pricingModules.push(tieredLogPricingV3);
|
|
105
|
+
pricingModules.push(fixedPricing);
|
|
106
|
+
|
|
107
|
+
address facet = facetHelper.getDeployedAddress("DiamondCutFacet");
|
|
108
|
+
addFacet(
|
|
109
|
+
makeCut(facet, FacetCutAction.Add, DeployDiamondCut.selectors()),
|
|
110
|
+
facet,
|
|
111
|
+
DeployDiamondCut.makeInitData()
|
|
112
|
+
);
|
|
113
|
+
|
|
114
|
+
facet = facetHelper.getDeployedAddress("DiamondLoupeFacet");
|
|
115
|
+
addFacet(
|
|
116
|
+
makeCut(facet, FacetCutAction.Add, DeployDiamondLoupe.selectors()),
|
|
117
|
+
facet,
|
|
118
|
+
DeployDiamondLoupe.makeInitData()
|
|
119
|
+
);
|
|
120
|
+
|
|
121
|
+
facet = facetHelper.getDeployedAddress("IntrospectionFacet");
|
|
122
|
+
addFacet(
|
|
123
|
+
makeCut(facet, FacetCutAction.Add, DeployIntrospection.selectors()),
|
|
124
|
+
facet,
|
|
125
|
+
DeployIntrospection.makeInitData()
|
|
126
|
+
);
|
|
127
|
+
|
|
128
|
+
facet = facetHelper.getDeployedAddress("OwnableFacet");
|
|
129
|
+
addFacet(
|
|
130
|
+
makeCut(facet, FacetCutAction.Add, DeployOwnable.selectors()),
|
|
131
|
+
facet,
|
|
132
|
+
DeployOwnable.makeInitData(deployer)
|
|
133
|
+
);
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
function diamondInitParams(address deployer) public returns (Diamond.InitParams memory) {
|
|
137
|
+
// Queue up all feature facets for batch deployment
|
|
138
|
+
facetHelper.add("MultiInit");
|
|
139
|
+
facetHelper.add("MetadataFacet");
|
|
140
|
+
facetHelper.add("Architect");
|
|
141
|
+
facetHelper.add("CreateSpaceFacet");
|
|
142
|
+
facetHelper.add("ProxyManager");
|
|
143
|
+
facetHelper.add("PausableFacet");
|
|
144
|
+
facetHelper.add("PlatformRequirementsFacet");
|
|
145
|
+
facetHelper.add("PricingModulesFacet");
|
|
146
|
+
facetHelper.add("ImplementationRegistryFacet");
|
|
147
|
+
facetHelper.add("SCL_EIP6565");
|
|
148
|
+
facetHelper.add("WalletLink");
|
|
149
|
+
facetHelper.add("EIP712Facet");
|
|
150
|
+
facetHelper.add("PartnerRegistry");
|
|
151
|
+
facetHelper.add("FeatureManagerFacet");
|
|
152
|
+
facetHelper.add("SpaceProxyInitializer");
|
|
153
|
+
facetHelper.add("SpaceFactoryInit");
|
|
154
|
+
|
|
155
|
+
if (isAnvil()) {
|
|
156
|
+
facetHelper.add("MockDelegationRegistry");
|
|
157
|
+
facetHelper.add("MockLegacyArchitect");
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
// Deploy the feature facets in a batch
|
|
161
|
+
facetHelper.deployBatch(deployer);
|
|
162
|
+
|
|
163
|
+
if (isAnvil()) {
|
|
164
|
+
mockDelegationRegistry = facetHelper.getDeployedAddress("MockDelegationRegistry");
|
|
165
|
+
address legacyArchitect = facetHelper.getDeployedAddress("MockLegacyArchitect");
|
|
166
|
+
addFacet(
|
|
167
|
+
makeCut(legacyArchitect, FacetCutAction.Add, DeployMockLegacyArchitect.selectors()),
|
|
168
|
+
legacyArchitect,
|
|
169
|
+
DeployMockLegacyArchitect.makeInitData()
|
|
170
|
+
);
|
|
171
|
+
} else {
|
|
172
|
+
mockDelegationRegistry = 0x00000000000000447e69651d841bD8D104Bed493;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
address facet = facetHelper.getDeployedAddress("MetadataFacet");
|
|
176
|
+
addFacet(
|
|
177
|
+
makeCut(facet, FacetCutAction.Add, DeployMetadata.selectors()),
|
|
178
|
+
facet,
|
|
179
|
+
DeployMetadata.makeInitData(bytes32("SpaceFactory"), "")
|
|
180
|
+
);
|
|
181
|
+
|
|
182
|
+
facet = facetHelper.getDeployedAddress("Architect");
|
|
183
|
+
addFacet(
|
|
184
|
+
makeCut(facet, FacetCutAction.Add, DeployArchitect.selectors()),
|
|
185
|
+
facet,
|
|
186
|
+
DeployArchitect.makeInitData(
|
|
187
|
+
spaceOwner,
|
|
188
|
+
userEntitlement,
|
|
189
|
+
ruleEntitlement,
|
|
190
|
+
legacyRuleEntitlement
|
|
191
|
+
)
|
|
192
|
+
);
|
|
193
|
+
|
|
194
|
+
facet = facetHelper.getDeployedAddress("CreateSpaceFacet");
|
|
195
|
+
addFacet(
|
|
196
|
+
makeCut(facet, FacetCutAction.Add, DeployCreateSpace.selectors()),
|
|
197
|
+
facet,
|
|
198
|
+
DeployCreateSpace.makeInitData()
|
|
199
|
+
);
|
|
200
|
+
|
|
201
|
+
facet = facetHelper.getDeployedAddress("ProxyManager");
|
|
202
|
+
addFacet(
|
|
203
|
+
makeCut(facet, FacetCutAction.Add, DeployProxyManager.selectors()),
|
|
204
|
+
facet,
|
|
205
|
+
DeployProxyManager.makeInitData(spaceImpl)
|
|
206
|
+
);
|
|
207
|
+
|
|
208
|
+
facet = facetHelper.getDeployedAddress("PausableFacet");
|
|
209
|
+
addFacet(
|
|
210
|
+
makeCut(facet, FacetCutAction.Add, DeployPausable.selectors()),
|
|
211
|
+
facet,
|
|
212
|
+
DeployPausable.makeInitData()
|
|
213
|
+
);
|
|
214
|
+
|
|
215
|
+
facet = facetHelper.getDeployedAddress("PlatformRequirementsFacet");
|
|
216
|
+
addFacet(
|
|
217
|
+
makeCut(facet, FacetCutAction.Add, DeployPlatformRequirements.selectors()),
|
|
218
|
+
facet,
|
|
219
|
+
DeployPlatformRequirements.makeInitData(
|
|
220
|
+
deployer, // feeRecipient
|
|
221
|
+
500, // membershipBps 5%
|
|
222
|
+
0.0005 ether, // membershipFee
|
|
223
|
+
1000, // membershipFreeAllocation
|
|
224
|
+
365 days, // membershipDuration
|
|
225
|
+
0.001 ether // membershipMinPrice
|
|
226
|
+
)
|
|
227
|
+
);
|
|
228
|
+
|
|
229
|
+
facet = facetHelper.getDeployedAddress("PricingModulesFacet");
|
|
230
|
+
addFacet(
|
|
231
|
+
makeCut(facet, FacetCutAction.Add, DeployPricingModules.selectors()),
|
|
232
|
+
facet,
|
|
233
|
+
DeployPricingModules.makeInitData(pricingModules)
|
|
234
|
+
);
|
|
235
|
+
|
|
236
|
+
facet = facetHelper.getDeployedAddress("ImplementationRegistryFacet");
|
|
237
|
+
addFacet(
|
|
238
|
+
makeCut(facet, FacetCutAction.Add, DeployImplementationRegistry.selectors()),
|
|
239
|
+
facet,
|
|
240
|
+
DeployImplementationRegistry.makeInitData()
|
|
241
|
+
);
|
|
242
|
+
|
|
243
|
+
address sclEip6565 = facetHelper.getDeployedAddress("SCL_EIP6565");
|
|
244
|
+
facet = facetHelper.getDeployedAddress("WalletLink");
|
|
245
|
+
addFacet(
|
|
246
|
+
makeCut(facet, FacetCutAction.Add, DeployWalletLink.selectors()),
|
|
247
|
+
facet,
|
|
248
|
+
DeployWalletLink.makeInitData(sclEip6565)
|
|
249
|
+
);
|
|
250
|
+
|
|
251
|
+
facet = facetHelper.getDeployedAddress("EIP712Facet");
|
|
252
|
+
addFacet(
|
|
253
|
+
makeCut(facet, FacetCutAction.Add, DeployEIP712Facet.selectors()),
|
|
254
|
+
facet,
|
|
255
|
+
DeployEIP712Facet.makeInitData("SpaceFactory", "1")
|
|
256
|
+
);
|
|
257
|
+
|
|
258
|
+
facet = facetHelper.getDeployedAddress("PartnerRegistry");
|
|
259
|
+
addFacet(
|
|
260
|
+
makeCut(facet, FacetCutAction.Add, DeployPartnerRegistry.selectors()),
|
|
261
|
+
facet,
|
|
262
|
+
DeployPartnerRegistry.makeInitData()
|
|
263
|
+
);
|
|
264
|
+
|
|
265
|
+
facet = facetHelper.getDeployedAddress("FeatureManagerFacet");
|
|
266
|
+
addFacet(
|
|
267
|
+
makeCut(facet, FacetCutAction.Add, DeployFeatureManager.selectors()),
|
|
268
|
+
facet,
|
|
269
|
+
DeployFeatureManager.makeInitData()
|
|
270
|
+
);
|
|
271
|
+
|
|
272
|
+
address spaceProxyInitializer = facetHelper.getDeployedAddress("SpaceProxyInitializer");
|
|
273
|
+
spaceFactoryInit = facetHelper.getDeployedAddress("SpaceFactoryInit");
|
|
274
|
+
spaceFactoryInitData = DeploySpaceFactoryInit.makeInitData(spaceProxyInitializer);
|
|
275
|
+
addInit(spaceFactoryInit, spaceFactoryInitData);
|
|
276
|
+
|
|
277
|
+
address multiInit = facetHelper.getDeployedAddress("MultiInit");
|
|
278
|
+
|
|
279
|
+
return
|
|
280
|
+
Diamond.InitParams({
|
|
281
|
+
baseFacets: baseFacets(),
|
|
282
|
+
init: multiInit,
|
|
283
|
+
initData: abi.encodeCall(MultiInit.multiInit, (_initAddresses, _initDatas))
|
|
284
|
+
});
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
function diamondInitParamsFromFacets(address deployer, string[] memory facets) public {
|
|
288
|
+
// Queue up all requested facets for batch deployment
|
|
289
|
+
for (uint256 i; i < facets.length; ++i) {
|
|
290
|
+
facetHelper.add(facets[i]);
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
if (!facetHelper.isDeployed("SCL_EIP6565")) {
|
|
294
|
+
facetHelper.add("SCL_EIP6565");
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
// Deploy all requested facets in a single batch transaction
|
|
298
|
+
facetHelper.deployBatch(deployer);
|
|
299
|
+
|
|
300
|
+
for (uint256 i; i < facets.length; ++i) {
|
|
301
|
+
string memory facetName = facets[i];
|
|
302
|
+
address facet = facetHelper.getDeployedAddress(facetName);
|
|
303
|
+
|
|
304
|
+
if (facetName.eq("MetadataFacet")) {
|
|
305
|
+
addFacet(
|
|
306
|
+
makeCut(facet, FacetCutAction.Add, DeployMetadata.selectors()),
|
|
307
|
+
facet,
|
|
308
|
+
DeployMetadata.makeInitData(bytes32("SpaceFactory"), "")
|
|
309
|
+
);
|
|
310
|
+
} else if (facetName.eq("Architect")) {
|
|
311
|
+
addFacet(
|
|
312
|
+
makeCut(facet, FacetCutAction.Add, DeployArchitect.selectors()),
|
|
313
|
+
facet,
|
|
314
|
+
DeployArchitect.makeInitData(
|
|
315
|
+
spaceOwner,
|
|
316
|
+
userEntitlement,
|
|
317
|
+
ruleEntitlement,
|
|
318
|
+
legacyRuleEntitlement
|
|
319
|
+
)
|
|
320
|
+
);
|
|
321
|
+
} else if (facetName.eq("MockLegacyArchitect")) {
|
|
322
|
+
addFacet(
|
|
323
|
+
makeCut(facet, FacetCutAction.Add, DeployMockLegacyArchitect.selectors()),
|
|
324
|
+
facet,
|
|
325
|
+
DeployMockLegacyArchitect.makeInitData()
|
|
326
|
+
);
|
|
327
|
+
} else if (facetName.eq("ProxyManager")) {
|
|
328
|
+
addFacet(
|
|
329
|
+
makeCut(facet, FacetCutAction.Add, DeployProxyManager.selectors()),
|
|
330
|
+
facet,
|
|
331
|
+
DeployProxyManager.makeInitData(spaceImpl)
|
|
332
|
+
);
|
|
333
|
+
} else if (facetName.eq("PausableFacet")) {
|
|
334
|
+
addFacet(
|
|
335
|
+
makeCut(facet, FacetCutAction.Add, DeployPausable.selectors()),
|
|
336
|
+
facet,
|
|
337
|
+
DeployPausable.makeInitData()
|
|
338
|
+
);
|
|
339
|
+
} else if (facetName.eq("PlatformRequirementsFacet")) {
|
|
340
|
+
addFacet(
|
|
341
|
+
makeCut(facet, FacetCutAction.Add, DeployPlatformRequirements.selectors()),
|
|
342
|
+
facet,
|
|
343
|
+
DeployPlatformRequirements.makeInitData(
|
|
344
|
+
deployer, // feeRecipient
|
|
345
|
+
500, // membershipBps 5%
|
|
346
|
+
0.005 ether, // membershipFee
|
|
347
|
+
1000, // membershipFreeAllocation
|
|
348
|
+
365 days, // membershipDuration
|
|
349
|
+
0.001 ether // membershipMinPrice
|
|
350
|
+
)
|
|
351
|
+
);
|
|
352
|
+
} else if (facetName.eq("PricingModulesFacet")) {
|
|
353
|
+
addFacet(
|
|
354
|
+
makeCut(facet, FacetCutAction.Add, DeployPricingModules.selectors()),
|
|
355
|
+
facet,
|
|
356
|
+
DeployPricingModules.makeInitData(pricingModules)
|
|
357
|
+
);
|
|
358
|
+
} else if (facetName.eq("ImplementationRegistryFacet")) {
|
|
359
|
+
addFacet(
|
|
360
|
+
makeCut(facet, FacetCutAction.Add, DeployImplementationRegistry.selectors()),
|
|
361
|
+
facet,
|
|
362
|
+
DeployImplementationRegistry.makeInitData()
|
|
363
|
+
);
|
|
364
|
+
} else if (facetName.eq("WalletLink")) {
|
|
365
|
+
address sclEip6565 = facetHelper.getDeployedAddress("SCL_EIP6565");
|
|
366
|
+
addFacet(
|
|
367
|
+
makeCut(facet, FacetCutAction.Add, DeployWalletLink.selectors()),
|
|
368
|
+
facet,
|
|
369
|
+
DeployWalletLink.makeInitData(sclEip6565)
|
|
370
|
+
);
|
|
371
|
+
} else if (facetName.eq("EIP712Facet")) {
|
|
372
|
+
addFacet(
|
|
373
|
+
makeCut(facet, FacetCutAction.Add, DeployEIP712Facet.selectors()),
|
|
374
|
+
facet,
|
|
375
|
+
DeployEIP712Facet.makeInitData("SpaceFactory", "1")
|
|
376
|
+
);
|
|
377
|
+
} else if (facetName.eq("PartnerRegistry")) {
|
|
378
|
+
addFacet(
|
|
379
|
+
makeCut(facet, FacetCutAction.Add, DeployPartnerRegistry.selectors()),
|
|
380
|
+
facet,
|
|
381
|
+
DeployPartnerRegistry.makeInitData()
|
|
382
|
+
);
|
|
383
|
+
} else if (facetName.eq("CreateSpaceFacet")) {
|
|
384
|
+
addFacet(
|
|
385
|
+
makeCut(facet, FacetCutAction.Add, DeployCreateSpace.selectors()),
|
|
386
|
+
facet,
|
|
387
|
+
DeployCreateSpace.makeInitData()
|
|
388
|
+
);
|
|
389
|
+
} else if (facetName.eq("FeatureManagerFacet")) {
|
|
390
|
+
addFacet(
|
|
391
|
+
makeCut(facet, FacetCutAction.Add, DeployFeatureManager.selectors()),
|
|
392
|
+
facet,
|
|
393
|
+
DeployFeatureManager.makeInitData()
|
|
394
|
+
);
|
|
395
|
+
}
|
|
396
|
+
}
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
function diamondInitHelper(
|
|
400
|
+
address deployer,
|
|
401
|
+
string[] memory facetNames
|
|
402
|
+
) external override returns (FacetCut[] memory) {
|
|
403
|
+
diamondInitParamsFromFacets(deployer, facetNames);
|
|
404
|
+
return baseFacets();
|
|
405
|
+
}
|
|
406
|
+
|
|
407
|
+
function __deploy(address deployer) internal override returns (address) {
|
|
408
|
+
addImmutableCuts(deployer);
|
|
409
|
+
|
|
410
|
+
Diamond.InitParams memory initDiamondCut = diamondInitParams(deployer);
|
|
411
|
+
vm.broadcast(deployer);
|
|
412
|
+
Diamond diamond = new Diamond(initDiamondCut);
|
|
413
|
+
|
|
414
|
+
return address(diamond);
|
|
415
|
+
}
|
|
416
|
+
}
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
pragma solidity ^0.8.24;
|
|
3
|
+
|
|
4
|
+
// interface
|
|
5
|
+
import {IDiamondInitHelper} from "./IDiamondInitHelper.sol";
|
|
6
|
+
|
|
7
|
+
// libraries
|
|
8
|
+
import {DeployDiamondCut} from "@towns-protocol/diamond/scripts/deployments/facets/DeployDiamondCut.sol";
|
|
9
|
+
import {DeployDiamondLoupe} from "@towns-protocol/diamond/scripts/deployments/facets/DeployDiamondLoupe.sol";
|
|
10
|
+
import {DeployEIP712Facet} from "@towns-protocol/diamond/scripts/deployments/facets/DeployEIP712Facet.sol";
|
|
11
|
+
import {DeployIntrospection} from "@towns-protocol/diamond/scripts/deployments/facets/DeployIntrospection.sol";
|
|
12
|
+
import {DeployOwnable} from "@towns-protocol/diamond/scripts/deployments/facets/DeployOwnable.sol";
|
|
13
|
+
import {LibString} from "solady/utils/LibString.sol";
|
|
14
|
+
import {DeploySpaceOwnerFacet} from "../facets/DeploySpaceOwnerFacet.s.sol";
|
|
15
|
+
import {DeployGuardianFacet} from "../facets/DeployGuardianFacet.s.sol";
|
|
16
|
+
import {DeployMetadata} from "../facets/DeployMetadata.s.sol";
|
|
17
|
+
|
|
18
|
+
// contracts
|
|
19
|
+
import {Diamond} from "@towns-protocol/diamond/src/Diamond.sol";
|
|
20
|
+
import {MultiInit} from "@towns-protocol/diamond/src/initializers/MultiInit.sol";
|
|
21
|
+
import {DiamondHelper} from "@towns-protocol/diamond/scripts/common/helpers/DiamondHelper.s.sol";
|
|
22
|
+
|
|
23
|
+
// deployers
|
|
24
|
+
import {DeployFacet} from "../../common/DeployFacet.s.sol";
|
|
25
|
+
import {Deployer} from "../../common/Deployer.s.sol";
|
|
26
|
+
|
|
27
|
+
contract DeploySpaceOwner is IDiamondInitHelper, DiamondHelper, Deployer {
|
|
28
|
+
using LibString for string;
|
|
29
|
+
|
|
30
|
+
DeployFacet private facetHelper = new DeployFacet();
|
|
31
|
+
|
|
32
|
+
function versionName() public pure override returns (string memory) {
|
|
33
|
+
return "spaceOwner";
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
function addImmutableCuts(address deployer) internal {
|
|
37
|
+
// Queue up all core facets for batch deployment
|
|
38
|
+
facetHelper.add("DiamondCutFacet");
|
|
39
|
+
facetHelper.add("DiamondLoupeFacet");
|
|
40
|
+
facetHelper.add("IntrospectionFacet");
|
|
41
|
+
facetHelper.add("OwnableFacet");
|
|
42
|
+
|
|
43
|
+
// Get predicted addresses
|
|
44
|
+
address facet = facetHelper.predictAddress("DiamondCutFacet");
|
|
45
|
+
addFacet(
|
|
46
|
+
makeCut(facet, FacetCutAction.Add, DeployDiamondCut.selectors()),
|
|
47
|
+
facet,
|
|
48
|
+
DeployDiamondCut.makeInitData()
|
|
49
|
+
);
|
|
50
|
+
|
|
51
|
+
facet = facetHelper.predictAddress("DiamondLoupeFacet");
|
|
52
|
+
addFacet(
|
|
53
|
+
makeCut(facet, FacetCutAction.Add, DeployDiamondLoupe.selectors()),
|
|
54
|
+
facet,
|
|
55
|
+
DeployDiamondLoupe.makeInitData()
|
|
56
|
+
);
|
|
57
|
+
|
|
58
|
+
facet = facetHelper.predictAddress("IntrospectionFacet");
|
|
59
|
+
addFacet(
|
|
60
|
+
makeCut(facet, FacetCutAction.Add, DeployIntrospection.selectors()),
|
|
61
|
+
facet,
|
|
62
|
+
DeployIntrospection.makeInitData()
|
|
63
|
+
);
|
|
64
|
+
|
|
65
|
+
facet = facetHelper.predictAddress("OwnableFacet");
|
|
66
|
+
addFacet(
|
|
67
|
+
makeCut(facet, FacetCutAction.Add, DeployOwnable.selectors()),
|
|
68
|
+
facet,
|
|
69
|
+
DeployOwnable.makeInitData(deployer)
|
|
70
|
+
);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
function diamondInitParams(address deployer) public returns (Diamond.InitParams memory) {
|
|
74
|
+
// Queue up all feature facets for batch deployment
|
|
75
|
+
facetHelper.add("MultiInit");
|
|
76
|
+
facetHelper.add("SpaceOwner");
|
|
77
|
+
facetHelper.add("EIP712Facet");
|
|
78
|
+
facetHelper.add("GuardianFacet");
|
|
79
|
+
facetHelper.add("MetadataFacet");
|
|
80
|
+
|
|
81
|
+
// Deploy all facets in a single batch transaction
|
|
82
|
+
facetHelper.deployBatch(deployer);
|
|
83
|
+
|
|
84
|
+
// Add feature facets
|
|
85
|
+
address facet = facetHelper.getDeployedAddress("SpaceOwner");
|
|
86
|
+
addFacet(
|
|
87
|
+
makeCut(facet, FacetCutAction.Add, DeploySpaceOwnerFacet.selectors()),
|
|
88
|
+
facet,
|
|
89
|
+
DeploySpaceOwnerFacet.makeInitData("Space Owner", "OWNER")
|
|
90
|
+
);
|
|
91
|
+
|
|
92
|
+
facet = facetHelper.getDeployedAddress("EIP712Facet");
|
|
93
|
+
addFacet(
|
|
94
|
+
makeCut(facet, FacetCutAction.Add, DeployEIP712Facet.selectors()),
|
|
95
|
+
facet,
|
|
96
|
+
DeployEIP712Facet.makeInitData("Space Owner", "1")
|
|
97
|
+
);
|
|
98
|
+
|
|
99
|
+
facet = facetHelper.getDeployedAddress("GuardianFacet");
|
|
100
|
+
addFacet(
|
|
101
|
+
makeCut(facet, FacetCutAction.Add, DeployGuardianFacet.selectors()),
|
|
102
|
+
facet,
|
|
103
|
+
DeployGuardianFacet.makeInitData(7 days)
|
|
104
|
+
);
|
|
105
|
+
|
|
106
|
+
facet = facetHelper.getDeployedAddress("MetadataFacet");
|
|
107
|
+
addFacet(
|
|
108
|
+
makeCut(facet, FacetCutAction.Add, DeployMetadata.selectors()),
|
|
109
|
+
facet,
|
|
110
|
+
DeployMetadata.makeInitData(bytes32("Space Owner"), "")
|
|
111
|
+
);
|
|
112
|
+
|
|
113
|
+
address multiInit = facetHelper.getDeployedAddress("MultiInit");
|
|
114
|
+
|
|
115
|
+
return
|
|
116
|
+
Diamond.InitParams({
|
|
117
|
+
baseFacets: baseFacets(),
|
|
118
|
+
init: multiInit,
|
|
119
|
+
initData: abi.encodeCall(MultiInit.multiInit, (_initAddresses, _initDatas))
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
function diamondInitParamsFromFacets(address deployer, string[] memory facets) public {
|
|
124
|
+
// Queue up all requested facets for batch deployment
|
|
125
|
+
for (uint256 i; i < facets.length; ++i) {
|
|
126
|
+
facetHelper.add(facets[i]);
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
// Deploy all requested facets in a single batch transaction
|
|
130
|
+
facetHelper.deployBatch(deployer);
|
|
131
|
+
|
|
132
|
+
// Add the requested facets
|
|
133
|
+
for (uint256 i; i < facets.length; ++i) {
|
|
134
|
+
string memory facetName = facets[i];
|
|
135
|
+
address facet = facetHelper.getDeployedAddress(facetName);
|
|
136
|
+
|
|
137
|
+
if (facetName.eq("MetadataFacet")) {
|
|
138
|
+
addFacet(
|
|
139
|
+
makeCut(facet, FacetCutAction.Add, DeployMetadata.selectors()),
|
|
140
|
+
facet,
|
|
141
|
+
DeployMetadata.makeInitData(bytes32("Space Owner"), "")
|
|
142
|
+
);
|
|
143
|
+
} else if (facetName.eq("SpaceOwner")) {
|
|
144
|
+
addFacet(
|
|
145
|
+
makeCut(facet, FacetCutAction.Add, DeploySpaceOwnerFacet.selectors()),
|
|
146
|
+
facet,
|
|
147
|
+
DeploySpaceOwnerFacet.makeInitData("Space Owner", "OWNER")
|
|
148
|
+
);
|
|
149
|
+
} else if (facetName.eq("EIP712Facet")) {
|
|
150
|
+
addFacet(
|
|
151
|
+
makeCut(facet, FacetCutAction.Add, DeployEIP712Facet.selectors()),
|
|
152
|
+
facet,
|
|
153
|
+
DeployEIP712Facet.makeInitData("Space Owner", "1")
|
|
154
|
+
);
|
|
155
|
+
} else if (facetName.eq("GuardianFacet")) {
|
|
156
|
+
addFacet(
|
|
157
|
+
makeCut(facet, FacetCutAction.Add, DeployGuardianFacet.selectors()),
|
|
158
|
+
facet,
|
|
159
|
+
DeployGuardianFacet.makeInitData(7 days)
|
|
160
|
+
);
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
function diamondInitHelper(
|
|
166
|
+
address deployer,
|
|
167
|
+
string[] memory facetNames
|
|
168
|
+
) external override returns (FacetCut[] memory) {
|
|
169
|
+
diamondInitParamsFromFacets(deployer, facetNames);
|
|
170
|
+
return baseFacets();
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
function __deploy(address deployer) internal override returns (address) {
|
|
174
|
+
addImmutableCuts(deployer);
|
|
175
|
+
|
|
176
|
+
Diamond.InitParams memory initDiamondCut = diamondInitParams(deployer);
|
|
177
|
+
|
|
178
|
+
vm.broadcast(deployer);
|
|
179
|
+
Diamond diamond = new Diamond(initDiamondCut);
|
|
180
|
+
|
|
181
|
+
return address(diamond);
|
|
182
|
+
}
|
|
183
|
+
}
|