@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,176 @@
|
|
|
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 {DeployIntrospection} from "@towns-protocol/diamond/scripts/deployments/facets/DeployIntrospection.sol";
|
|
11
|
+
import {DeployOwnable} from "@towns-protocol/diamond/scripts/deployments/facets/DeployOwnable.sol";
|
|
12
|
+
import {DeployPausable} from "@towns-protocol/diamond/scripts/deployments/facets/DeployPausable.sol";
|
|
13
|
+
import {DeployMetadata} from "../facets/DeployMetadata.s.sol";
|
|
14
|
+
import {DeploySwapRouterFacet} from "../facets/DeploySwapRouterFacet.s.sol";
|
|
15
|
+
import {LibString} from "solady/utils/LibString.sol";
|
|
16
|
+
|
|
17
|
+
// contracts
|
|
18
|
+
import {Diamond} from "@towns-protocol/diamond/src/Diamond.sol";
|
|
19
|
+
import {MultiInit} from "@towns-protocol/diamond/src/initializers/MultiInit.sol";
|
|
20
|
+
import {DiamondHelper} from "@towns-protocol/diamond/scripts/common/helpers/DiamondHelper.s.sol";
|
|
21
|
+
|
|
22
|
+
// deployers
|
|
23
|
+
import {DeployFacet} from "../../common/DeployFacet.s.sol";
|
|
24
|
+
import {Deployer} from "../../common/Deployer.s.sol";
|
|
25
|
+
|
|
26
|
+
contract DeploySwapRouter is IDiamondInitHelper, DiamondHelper, Deployer {
|
|
27
|
+
using LibString for string;
|
|
28
|
+
|
|
29
|
+
DeployFacet private facetHelper = new DeployFacet();
|
|
30
|
+
address private spaceFactory;
|
|
31
|
+
|
|
32
|
+
function versionName() public pure override returns (string memory) {
|
|
33
|
+
return "swapRouter";
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
function setDependencies(address spaceFactory_) external {
|
|
37
|
+
spaceFactory = spaceFactory_;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
function getSpaceFactory() internal returns (address) {
|
|
41
|
+
if (spaceFactory != address(0)) return spaceFactory;
|
|
42
|
+
return getDeployment("spaceFactory");
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
function addImmutableCuts(address deployer) internal {
|
|
46
|
+
// Queue up all core facets for batch deployment
|
|
47
|
+
facetHelper.add("DiamondCutFacet");
|
|
48
|
+
facetHelper.add("DiamondLoupeFacet");
|
|
49
|
+
facetHelper.add("IntrospectionFacet");
|
|
50
|
+
facetHelper.add("OwnableFacet");
|
|
51
|
+
|
|
52
|
+
// Get predicted addresses
|
|
53
|
+
address facet = facetHelper.predictAddress("DiamondCutFacet");
|
|
54
|
+
addFacet(
|
|
55
|
+
makeCut(facet, FacetCutAction.Add, DeployDiamondCut.selectors()),
|
|
56
|
+
facet,
|
|
57
|
+
DeployDiamondCut.makeInitData()
|
|
58
|
+
);
|
|
59
|
+
|
|
60
|
+
facet = facetHelper.predictAddress("DiamondLoupeFacet");
|
|
61
|
+
addFacet(
|
|
62
|
+
makeCut(facet, FacetCutAction.Add, DeployDiamondLoupe.selectors()),
|
|
63
|
+
facet,
|
|
64
|
+
DeployDiamondLoupe.makeInitData()
|
|
65
|
+
);
|
|
66
|
+
|
|
67
|
+
facet = facetHelper.predictAddress("IntrospectionFacet");
|
|
68
|
+
addFacet(
|
|
69
|
+
makeCut(facet, FacetCutAction.Add, DeployIntrospection.selectors()),
|
|
70
|
+
facet,
|
|
71
|
+
DeployIntrospection.makeInitData()
|
|
72
|
+
);
|
|
73
|
+
|
|
74
|
+
facet = facetHelper.predictAddress("OwnableFacet");
|
|
75
|
+
addFacet(
|
|
76
|
+
makeCut(facet, FacetCutAction.Add, DeployOwnable.selectors()),
|
|
77
|
+
facet,
|
|
78
|
+
DeployOwnable.makeInitData(deployer)
|
|
79
|
+
);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
function diamondInitParams(address deployer) public returns (Diamond.InitParams memory) {
|
|
83
|
+
// Queue additional facets for batch deployment
|
|
84
|
+
facetHelper.add("MultiInit");
|
|
85
|
+
facetHelper.add("SwapRouter");
|
|
86
|
+
facetHelper.add("MetadataFacet");
|
|
87
|
+
facetHelper.add("PausableFacet");
|
|
88
|
+
|
|
89
|
+
// Deploy all queued facets in a single batch transaction
|
|
90
|
+
facetHelper.deployBatch(deployer);
|
|
91
|
+
|
|
92
|
+
// Add each facet to the diamond cut using its deployment library
|
|
93
|
+
address facet = facetHelper.getDeployedAddress("SwapRouter");
|
|
94
|
+
addFacet(
|
|
95
|
+
makeCut(facet, FacetCutAction.Add, DeploySwapRouterFacet.selectors()),
|
|
96
|
+
facet,
|
|
97
|
+
DeploySwapRouterFacet.makeInitData(getSpaceFactory())
|
|
98
|
+
);
|
|
99
|
+
|
|
100
|
+
facet = facetHelper.getDeployedAddress("MetadataFacet");
|
|
101
|
+
addFacet(
|
|
102
|
+
makeCut(facet, FacetCutAction.Add, DeployMetadata.selectors()),
|
|
103
|
+
facet,
|
|
104
|
+
DeployMetadata.makeInitData(bytes32("SwapRouter"), "")
|
|
105
|
+
);
|
|
106
|
+
|
|
107
|
+
facet = facetHelper.getDeployedAddress("PausableFacet");
|
|
108
|
+
addFacet(
|
|
109
|
+
makeCut(facet, FacetCutAction.Add, DeployPausable.selectors()),
|
|
110
|
+
facet,
|
|
111
|
+
DeployPausable.makeInitData()
|
|
112
|
+
);
|
|
113
|
+
|
|
114
|
+
address multiInit = facetHelper.getDeployedAddress("MultiInit");
|
|
115
|
+
|
|
116
|
+
return
|
|
117
|
+
Diamond.InitParams({
|
|
118
|
+
baseFacets: baseFacets(),
|
|
119
|
+
init: multiInit,
|
|
120
|
+
initData: abi.encodeCall(MultiInit.multiInit, (_initAddresses, _initDatas))
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
function diamondInitParamsFromFacets(address deployer, string[] memory facetNames) public {
|
|
125
|
+
// Queue requested facets for batch deployment
|
|
126
|
+
for (uint256 i; i < facetNames.length; ++i) {
|
|
127
|
+
facetHelper.add(facetNames[i]);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
// Deploy all requested facets in a single batch transaction
|
|
131
|
+
facetHelper.deployBatch(deployer);
|
|
132
|
+
|
|
133
|
+
for (uint256 i; i < facetNames.length; ++i) {
|
|
134
|
+
string memory facetName = facetNames[i];
|
|
135
|
+
address facet = facetHelper.getDeployedAddress(facetName);
|
|
136
|
+
|
|
137
|
+
if (facetName.eq("SwapRouter")) {
|
|
138
|
+
addFacet(
|
|
139
|
+
makeCut(facet, FacetCutAction.Add, DeploySwapRouterFacet.selectors()),
|
|
140
|
+
facet,
|
|
141
|
+
DeploySwapRouterFacet.makeInitData(getSpaceFactory())
|
|
142
|
+
);
|
|
143
|
+
} else if (facetName.eq("MetadataFacet")) {
|
|
144
|
+
addFacet(
|
|
145
|
+
makeCut(facet, FacetCutAction.Add, DeployMetadata.selectors()),
|
|
146
|
+
facet,
|
|
147
|
+
DeployMetadata.makeInitData(bytes32("SwapRouter"), "")
|
|
148
|
+
);
|
|
149
|
+
} else if (facetName.eq("PausableFacet")) {
|
|
150
|
+
addFacet(
|
|
151
|
+
makeCut(facet, FacetCutAction.Add, DeployPausable.selectors()),
|
|
152
|
+
facet,
|
|
153
|
+
DeployPausable.makeInitData()
|
|
154
|
+
);
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
function diamondInitHelper(
|
|
160
|
+
address deployer,
|
|
161
|
+
string[] memory facetNames
|
|
162
|
+
) external override returns (FacetCut[] memory) {
|
|
163
|
+
diamondInitParamsFromFacets(deployer, facetNames);
|
|
164
|
+
return baseFacets();
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
function __deploy(address deployer) internal override returns (address) {
|
|
168
|
+
addImmutableCuts(deployer);
|
|
169
|
+
|
|
170
|
+
Diamond.InitParams memory initDiamondCut = diamondInitParams(deployer);
|
|
171
|
+
vm.broadcast(deployer);
|
|
172
|
+
Diamond diamond = new Diamond(initDiamondCut);
|
|
173
|
+
|
|
174
|
+
return address(diamond);
|
|
175
|
+
}
|
|
176
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
pragma solidity ^0.8.0;
|
|
3
|
+
|
|
4
|
+
import {IDiamond} from "@towns-protocol/diamond/src/Diamond.sol";
|
|
5
|
+
|
|
6
|
+
interface IDiamondInitHelper is IDiamond {
|
|
7
|
+
function diamondInitHelper(
|
|
8
|
+
address deployer,
|
|
9
|
+
string[] memory facetNames
|
|
10
|
+
) external returns (FacetCut[] memory);
|
|
11
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
pragma solidity ^0.8.23;
|
|
3
|
+
|
|
4
|
+
// interfaces
|
|
5
|
+
import {IDiamond} from "@towns-protocol/diamond/src/IDiamond.sol";
|
|
6
|
+
|
|
7
|
+
// libraries
|
|
8
|
+
import {LibDeploy} from "@towns-protocol/diamond/src/utils/LibDeploy.sol";
|
|
9
|
+
|
|
10
|
+
// contracts
|
|
11
|
+
import {AppAccount} from "src/spaces/facets/account/AppAccount.sol";
|
|
12
|
+
import {DynamicArrayLib} from "solady/utils/DynamicArrayLib.sol";
|
|
13
|
+
|
|
14
|
+
library DeployAppAccount {
|
|
15
|
+
using DynamicArrayLib for DynamicArrayLib.DynamicArray;
|
|
16
|
+
|
|
17
|
+
function selectors() internal pure returns (bytes4[] memory res) {
|
|
18
|
+
DynamicArrayLib.DynamicArray memory arr = DynamicArrayLib.p().reserve(11);
|
|
19
|
+
arr.p(AppAccount.execute.selector);
|
|
20
|
+
arr.p(AppAccount.onInstallApp.selector);
|
|
21
|
+
arr.p(AppAccount.onUninstallApp.selector);
|
|
22
|
+
arr.p(AppAccount.onRenewApp.selector);
|
|
23
|
+
arr.p(AppAccount.isAppEntitled.selector);
|
|
24
|
+
arr.p(AppAccount.disableApp.selector);
|
|
25
|
+
arr.p(AppAccount.getInstalledApps.selector);
|
|
26
|
+
arr.p(AppAccount.getAppId.selector);
|
|
27
|
+
arr.p(AppAccount.enableApp.selector);
|
|
28
|
+
arr.p(AppAccount.getAppExpiration.selector);
|
|
29
|
+
arr.p(AppAccount.isAppInstalled.selector);
|
|
30
|
+
bytes32[] memory selectors_ = arr.asBytes32Array();
|
|
31
|
+
assembly ("memory-safe") {
|
|
32
|
+
res := selectors_
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
function makeCut(
|
|
37
|
+
address facetAddress,
|
|
38
|
+
IDiamond.FacetCutAction action
|
|
39
|
+
) internal pure returns (IDiamond.FacetCut memory) {
|
|
40
|
+
return
|
|
41
|
+
IDiamond.FacetCut({
|
|
42
|
+
action: action,
|
|
43
|
+
facetAddress: facetAddress,
|
|
44
|
+
functionSelectors: selectors()
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
function deploy() internal returns (address) {
|
|
49
|
+
return LibDeploy.deployCode("AppAccount.sol", "");
|
|
50
|
+
}
|
|
51
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
pragma solidity ^0.8.23;
|
|
3
|
+
|
|
4
|
+
//interfaces
|
|
5
|
+
import {IDiamond} from "@towns-protocol/diamond/src/IDiamond.sol";
|
|
6
|
+
import {ISchemaResolver} from "@ethereum-attestation-service/eas-contracts/resolver/ISchemaResolver.sol";
|
|
7
|
+
|
|
8
|
+
//libraries
|
|
9
|
+
|
|
10
|
+
//contracts
|
|
11
|
+
import {LibDeploy} from "@towns-protocol/diamond/src/utils/LibDeploy.sol";
|
|
12
|
+
import {AppRegistryFacet} from "src/apps/facets/registry/AppRegistryFacet.sol";
|
|
13
|
+
import {DynamicArrayLib} from "solady/utils/DynamicArrayLib.sol";
|
|
14
|
+
|
|
15
|
+
library DeployAppRegistryFacet {
|
|
16
|
+
using DynamicArrayLib for DynamicArrayLib.DynamicArray;
|
|
17
|
+
|
|
18
|
+
function selectors() internal pure returns (bytes4[] memory res) {
|
|
19
|
+
DynamicArrayLib.DynamicArray memory arr = DynamicArrayLib.p().reserve(16);
|
|
20
|
+
arr.p(AppRegistryFacet.getAppSchema.selector);
|
|
21
|
+
arr.p(AppRegistryFacet.getAppSchemaId.selector);
|
|
22
|
+
arr.p(AppRegistryFacet.getAppById.selector);
|
|
23
|
+
arr.p(AppRegistryFacet.getLatestAppId.selector);
|
|
24
|
+
arr.p(AppRegistryFacet.registerApp.selector);
|
|
25
|
+
arr.p(AppRegistryFacet.removeApp.selector);
|
|
26
|
+
arr.p(AppRegistryFacet.createApp.selector);
|
|
27
|
+
arr.p(AppRegistryFacet.installApp.selector);
|
|
28
|
+
arr.p(AppRegistryFacet.uninstallApp.selector);
|
|
29
|
+
arr.p(AppRegistryFacet.getAppPrice.selector);
|
|
30
|
+
arr.p(AppRegistryFacet.getAppDuration.selector);
|
|
31
|
+
arr.p(AppRegistryFacet.adminRegisterAppSchema.selector);
|
|
32
|
+
arr.p(AppRegistryFacet.adminBanApp.selector);
|
|
33
|
+
arr.p(AppRegistryFacet.isAppBanned.selector);
|
|
34
|
+
arr.p(AppRegistryFacet.getAppByClient.selector);
|
|
35
|
+
arr.p(AppRegistryFacet.renewApp.selector);
|
|
36
|
+
bytes32[] memory selectors_ = arr.asBytes32Array();
|
|
37
|
+
assembly ("memory-safe") {
|
|
38
|
+
res := selectors_
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
function makeCut(
|
|
43
|
+
address facetAddress,
|
|
44
|
+
IDiamond.FacetCutAction action
|
|
45
|
+
) internal pure returns (IDiamond.FacetCut memory) {
|
|
46
|
+
return
|
|
47
|
+
IDiamond.FacetCut({
|
|
48
|
+
action: action,
|
|
49
|
+
facetAddress: facetAddress,
|
|
50
|
+
functionSelectors: selectors()
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
function makeInitData(
|
|
55
|
+
address spaceFactory,
|
|
56
|
+
string memory schema,
|
|
57
|
+
address resolver
|
|
58
|
+
) internal pure returns (bytes memory) {
|
|
59
|
+
return
|
|
60
|
+
abi.encodeCall(
|
|
61
|
+
AppRegistryFacet.__AppRegistry_init,
|
|
62
|
+
(spaceFactory, schema, ISchemaResolver(resolver))
|
|
63
|
+
);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
function deploy() internal returns (address) {
|
|
67
|
+
return LibDeploy.deployCode("AppRegistryFacet.sol", "");
|
|
68
|
+
}
|
|
69
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
pragma solidity ^0.8.23;
|
|
3
|
+
|
|
4
|
+
//interfaces
|
|
5
|
+
import {IDiamond} from "@towns-protocol/diamond/src/IDiamond.sol";
|
|
6
|
+
import {IArchitect} from "src/factory/facets/architect/IArchitect.sol";
|
|
7
|
+
|
|
8
|
+
//libraries
|
|
9
|
+
import {LibDeploy} from "@towns-protocol/diamond/src/utils/LibDeploy.sol";
|
|
10
|
+
|
|
11
|
+
//contracts
|
|
12
|
+
import {Architect} from "src/factory/facets/architect/Architect.sol";
|
|
13
|
+
|
|
14
|
+
library DeployArchitect {
|
|
15
|
+
function selectors() internal pure returns (bytes4[] memory _selectors) {
|
|
16
|
+
_selectors = new bytes4[](6);
|
|
17
|
+
_selectors[0] = IArchitect.getSpaceByTokenId.selector;
|
|
18
|
+
_selectors[1] = IArchitect.getTokenIdBySpace.selector;
|
|
19
|
+
_selectors[2] = IArchitect.setSpaceArchitectImplementations.selector;
|
|
20
|
+
_selectors[3] = IArchitect.getSpaceArchitectImplementations.selector;
|
|
21
|
+
_selectors[4] = IArchitect.setProxyInitializer.selector;
|
|
22
|
+
_selectors[5] = IArchitect.getProxyInitializer.selector;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
function makeCut(
|
|
26
|
+
address facetAddress,
|
|
27
|
+
IDiamond.FacetCutAction action
|
|
28
|
+
) internal pure returns (IDiamond.FacetCut memory) {
|
|
29
|
+
return IDiamond.FacetCut(facetAddress, action, selectors());
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
function makeInitData(
|
|
33
|
+
address _spaceOwnerToken,
|
|
34
|
+
address _userEntitlement,
|
|
35
|
+
address _ruleEntitlement,
|
|
36
|
+
address _legacyRuleEntitlement
|
|
37
|
+
) internal pure returns (bytes memory) {
|
|
38
|
+
return
|
|
39
|
+
abi.encodeWithSelector(
|
|
40
|
+
Architect.__Architect_init.selector,
|
|
41
|
+
_spaceOwnerToken,
|
|
42
|
+
_userEntitlement,
|
|
43
|
+
_ruleEntitlement,
|
|
44
|
+
_legacyRuleEntitlement
|
|
45
|
+
);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
function deploy() internal returns (address) {
|
|
49
|
+
return LibDeploy.deployCode("Architect.sol", "");
|
|
50
|
+
}
|
|
51
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
pragma solidity ^0.8.23;
|
|
3
|
+
|
|
4
|
+
//interfaces
|
|
5
|
+
import {IDiamond} from "@towns-protocol/diamond/src/IDiamond.sol";
|
|
6
|
+
|
|
7
|
+
//libraries
|
|
8
|
+
|
|
9
|
+
//contracts
|
|
10
|
+
import {LibDeploy} from "@towns-protocol/diamond/src/utils/LibDeploy.sol";
|
|
11
|
+
import {AttestationRegistry} from "src/apps/facets/attest/AttestationRegistry.sol";
|
|
12
|
+
|
|
13
|
+
library DeployAttestationRegistry {
|
|
14
|
+
function selectors() internal pure returns (bytes4[] memory _selectors) {
|
|
15
|
+
_selectors = new bytes4[](3);
|
|
16
|
+
_selectors[0] = AttestationRegistry.attest.selector;
|
|
17
|
+
_selectors[1] = AttestationRegistry.revoke.selector;
|
|
18
|
+
_selectors[2] = AttestationRegistry.getAttestation.selector;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
function makeCut(
|
|
22
|
+
address facetAddress,
|
|
23
|
+
IDiamond.FacetCutAction action
|
|
24
|
+
) internal pure returns (IDiamond.FacetCut memory) {
|
|
25
|
+
return
|
|
26
|
+
IDiamond.FacetCut({
|
|
27
|
+
action: action,
|
|
28
|
+
facetAddress: facetAddress,
|
|
29
|
+
functionSelectors: selectors()
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
function deploy() internal returns (address) {
|
|
34
|
+
return LibDeploy.deployCode("AttestationRegistry.sol", "");
|
|
35
|
+
}
|
|
36
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
pragma solidity ^0.8.23;
|
|
3
|
+
|
|
4
|
+
// interfaces
|
|
5
|
+
import {IDiamond} from "@towns-protocol/diamond/src/Diamond.sol";
|
|
6
|
+
import {IBanning} from "src/spaces/facets/banning/IBanning.sol";
|
|
7
|
+
|
|
8
|
+
// libraries
|
|
9
|
+
import {LibDeploy} from "@towns-protocol/diamond/src/utils/LibDeploy.sol";
|
|
10
|
+
|
|
11
|
+
library DeployBanning {
|
|
12
|
+
function selectors() internal pure returns (bytes4[] memory res) {
|
|
13
|
+
res = new bytes4[](4);
|
|
14
|
+
res[0] = IBanning.ban.selector;
|
|
15
|
+
res[1] = IBanning.unban.selector;
|
|
16
|
+
res[2] = IBanning.isBanned.selector;
|
|
17
|
+
res[3] = IBanning.banned.selector;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
function makeCut(
|
|
21
|
+
address facetAddress,
|
|
22
|
+
IDiamond.FacetCutAction action
|
|
23
|
+
) internal pure returns (IDiamond.FacetCut memory) {
|
|
24
|
+
return IDiamond.FacetCut(facetAddress, action, selectors());
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function deploy() internal returns (address) {
|
|
28
|
+
return LibDeploy.deployCode("Banning.sol", "");
|
|
29
|
+
}
|
|
30
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
pragma solidity ^0.8.23;
|
|
3
|
+
|
|
4
|
+
// interfaces
|
|
5
|
+
import {IDiamond} from "@towns-protocol/diamond/src/Diamond.sol";
|
|
6
|
+
import {IChannel} from "src/spaces/facets/channels/IChannel.sol";
|
|
7
|
+
|
|
8
|
+
// libraries
|
|
9
|
+
import {LibDeploy} from "@towns-protocol/diamond/src/utils/LibDeploy.sol";
|
|
10
|
+
|
|
11
|
+
library DeployChannels {
|
|
12
|
+
function selectors() internal pure returns (bytes4[] memory res) {
|
|
13
|
+
res = new bytes4[](9);
|
|
14
|
+
res[0] = IChannel.createChannel.selector;
|
|
15
|
+
res[1] = IChannel.getChannel.selector;
|
|
16
|
+
res[2] = IChannel.getChannels.selector;
|
|
17
|
+
res[3] = IChannel.updateChannel.selector;
|
|
18
|
+
res[4] = IChannel.removeChannel.selector;
|
|
19
|
+
res[5] = IChannel.addRoleToChannel.selector;
|
|
20
|
+
res[6] = IChannel.getRolesByChannel.selector;
|
|
21
|
+
res[7] = IChannel.removeRoleFromChannel.selector;
|
|
22
|
+
res[8] = IChannel.createChannelWithOverridePermissions.selector;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
function makeCut(
|
|
26
|
+
address facetAddress,
|
|
27
|
+
IDiamond.FacetCutAction action
|
|
28
|
+
) internal pure returns (IDiamond.FacetCut memory) {
|
|
29
|
+
return IDiamond.FacetCut(facetAddress, action, selectors());
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
function deploy() internal returns (address) {
|
|
33
|
+
return LibDeploy.deployCode("Channels.sol", "");
|
|
34
|
+
}
|
|
35
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
pragma solidity ^0.8.23;
|
|
3
|
+
|
|
4
|
+
// interfaces
|
|
5
|
+
import {IDiamond} from "@towns-protocol/diamond/src/IDiamond.sol";
|
|
6
|
+
|
|
7
|
+
// libraries
|
|
8
|
+
import {LibDeploy} from "@towns-protocol/diamond/src/utils/LibDeploy.sol";
|
|
9
|
+
|
|
10
|
+
// contracts
|
|
11
|
+
import {CreateSpaceFacet} from "src/factory/facets/create/CreateSpace.sol";
|
|
12
|
+
|
|
13
|
+
library DeployCreateSpace {
|
|
14
|
+
function selectors() internal pure returns (bytes4[] memory _selectors) {
|
|
15
|
+
_selectors = new bytes4[](5);
|
|
16
|
+
// createSpace(SpaceInfo) - Basic space creation with SpaceInfo struct
|
|
17
|
+
_selectors[0] = 0xf822028d;
|
|
18
|
+
// createSpaceWithPrepay(CreateSpace) - Space creation with prepay (new format)
|
|
19
|
+
_selectors[1] = 0xcd55d94c;
|
|
20
|
+
// createSpaceWithPrepay(CreateSpaceOld) - Space creation with prepay (legacy format)
|
|
21
|
+
_selectors[2] = 0xc07ed896;
|
|
22
|
+
// createSpaceV2(CreateSpace, SpaceOptions) - Space creation with options
|
|
23
|
+
_selectors[3] = CreateSpaceFacet.createSpaceV2.selector;
|
|
24
|
+
// createSpace(Action, bytes) - Unified entry point with action dispatch
|
|
25
|
+
_selectors[4] = bytes4(keccak256("createSpace(uint8,bytes)"));
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function makeCut(
|
|
29
|
+
address facetAddress,
|
|
30
|
+
IDiamond.FacetCutAction action
|
|
31
|
+
) internal pure returns (IDiamond.FacetCut memory) {
|
|
32
|
+
return IDiamond.FacetCut(facetAddress, action, selectors());
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
function makeInitData() internal pure returns (bytes memory) {
|
|
36
|
+
return abi.encodeCall(CreateSpaceFacet.__CreateSpace_init, ());
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
function deploy() internal returns (address) {
|
|
40
|
+
return LibDeploy.deployCode("CreateSpaceFacet", "");
|
|
41
|
+
}
|
|
42
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
pragma solidity ^0.8.23;
|
|
3
|
+
|
|
4
|
+
// interfaces
|
|
5
|
+
import {IDiamond} from "@towns-protocol/diamond/src/IDiamond.sol";
|
|
6
|
+
|
|
7
|
+
// libraries
|
|
8
|
+
import {LibDeploy} from "@towns-protocol/diamond/src/utils/LibDeploy.sol";
|
|
9
|
+
import {DynamicArrayLib} from "solady/utils/DynamicArrayLib.sol";
|
|
10
|
+
|
|
11
|
+
// contracts
|
|
12
|
+
import {DropFacet} from "src/airdrop/drop/DropFacet.sol";
|
|
13
|
+
|
|
14
|
+
library DeployDropFacet {
|
|
15
|
+
using DynamicArrayLib for DynamicArrayLib.DynamicArray;
|
|
16
|
+
|
|
17
|
+
function selectors() internal pure returns (bytes4[] memory res) {
|
|
18
|
+
DynamicArrayLib.DynamicArray memory arr = DynamicArrayLib.p().reserve(9);
|
|
19
|
+
arr.p(DropFacet.claimWithPenalty.selector);
|
|
20
|
+
arr.p(DropFacet.claimAndStake.selector);
|
|
21
|
+
arr.p(DropFacet.setClaimConditions.selector);
|
|
22
|
+
arr.p(DropFacet.addClaimCondition.selector);
|
|
23
|
+
arr.p(DropFacet.getActiveClaimConditionId.selector);
|
|
24
|
+
arr.p(DropFacet.getClaimConditionById.selector);
|
|
25
|
+
arr.p(DropFacet.getSupplyClaimedByWallet.selector);
|
|
26
|
+
arr.p(DropFacet.getDepositIdByWallet.selector);
|
|
27
|
+
arr.p(DropFacet.getClaimConditions.selector);
|
|
28
|
+
|
|
29
|
+
bytes32[] memory selectors_ = arr.asBytes32Array();
|
|
30
|
+
assembly ("memory-safe") {
|
|
31
|
+
res := selectors_
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
function makeCut(
|
|
36
|
+
address facetAddress,
|
|
37
|
+
IDiamond.FacetCutAction action
|
|
38
|
+
) internal pure returns (IDiamond.FacetCut memory) {
|
|
39
|
+
return IDiamond.FacetCut(facetAddress, action, selectors());
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
function makeInitData(address stakingContract) internal pure returns (bytes memory) {
|
|
43
|
+
return abi.encodeCall(DropFacet.__DropFacet_init, (stakingContract));
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
function deploy() internal returns (address) {
|
|
47
|
+
return LibDeploy.deployCode("DropFacet.sol", "");
|
|
48
|
+
}
|
|
49
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
pragma solidity ^0.8.23;
|
|
3
|
+
|
|
4
|
+
// interfaces
|
|
5
|
+
import {IDiamond} from "@towns-protocol/diamond/src/Diamond.sol";
|
|
6
|
+
import {IERC721A} from "../../../src/diamond/facets/token/ERC721A/IERC721A.sol";
|
|
7
|
+
|
|
8
|
+
// libraries
|
|
9
|
+
import {LibDeploy} from "@towns-protocol/diamond/src/utils/LibDeploy.sol";
|
|
10
|
+
import {DynamicArrayLib} from "solady/utils/DynamicArrayLib.sol";
|
|
11
|
+
|
|
12
|
+
// contracts
|
|
13
|
+
|
|
14
|
+
library DeployERC721A {
|
|
15
|
+
using DynamicArrayLib for DynamicArrayLib.DynamicArray;
|
|
16
|
+
|
|
17
|
+
function selectors() internal pure returns (bytes4[] memory res) {
|
|
18
|
+
DynamicArrayLib.DynamicArray memory arr = DynamicArrayLib.p().reserve(13);
|
|
19
|
+
arr.p(IERC721A.totalSupply.selector);
|
|
20
|
+
arr.p(IERC721A.balanceOf.selector);
|
|
21
|
+
arr.p(IERC721A.ownerOf.selector);
|
|
22
|
+
arr.p(IERC721A.transferFrom.selector);
|
|
23
|
+
arr.p(IERC721A.approve.selector);
|
|
24
|
+
arr.p(IERC721A.getApproved.selector);
|
|
25
|
+
arr.p(IERC721A.setApprovalForAll.selector);
|
|
26
|
+
arr.p(IERC721A.isApprovedForAll.selector);
|
|
27
|
+
arr.p(bytes4(keccak256("safeTransferFrom(address,address,uint256)")));
|
|
28
|
+
arr.p(bytes4(keccak256("safeTransferFrom(address,address,uint256,bytes)")));
|
|
29
|
+
arr.p(IERC721A.name.selector);
|
|
30
|
+
arr.p(IERC721A.symbol.selector);
|
|
31
|
+
arr.p(IERC721A.tokenURI.selector);
|
|
32
|
+
bytes32[] memory selectors_ = arr.asBytes32Array();
|
|
33
|
+
assembly ("memory-safe") {
|
|
34
|
+
res := selectors_
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function makeCut(
|
|
39
|
+
address facetAddress,
|
|
40
|
+
IDiamond.FacetCutAction action
|
|
41
|
+
) internal pure returns (IDiamond.FacetCut memory) {
|
|
42
|
+
return IDiamond.FacetCut(facetAddress, action, selectors());
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
function deploy() internal returns (address) {
|
|
46
|
+
return LibDeploy.deployCode("ERC721A.sol", "");
|
|
47
|
+
}
|
|
48
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
pragma solidity ^0.8.23;
|
|
3
|
+
|
|
4
|
+
//interfaces
|
|
5
|
+
import {IDiamond} from "@towns-protocol/diamond/src/IDiamond.sol";
|
|
6
|
+
import {IERC721A} from "src/diamond/facets/token/ERC721A/IERC721A.sol";
|
|
7
|
+
|
|
8
|
+
//libraries
|
|
9
|
+
import {LibDeploy} from "@towns-protocol/diamond/src/utils/LibDeploy.sol";
|
|
10
|
+
|
|
11
|
+
//contracts
|
|
12
|
+
import {ERC721A} from "src/diamond/facets/token/ERC721A/ERC721A.sol";
|
|
13
|
+
|
|
14
|
+
library DeployERC721ANonTransferable {
|
|
15
|
+
function selectors() internal pure returns (bytes4[] memory res) {
|
|
16
|
+
res = new bytes4[](13);
|
|
17
|
+
res[0] = IERC721A.totalSupply.selector;
|
|
18
|
+
res[1] = IERC721A.balanceOf.selector;
|
|
19
|
+
res[2] = IERC721A.ownerOf.selector;
|
|
20
|
+
res[3] = IERC721A.transferFrom.selector;
|
|
21
|
+
res[4] = IERC721A.approve.selector;
|
|
22
|
+
res[5] = IERC721A.getApproved.selector;
|
|
23
|
+
res[6] = IERC721A.setApprovalForAll.selector;
|
|
24
|
+
res[7] = IERC721A.isApprovedForAll.selector;
|
|
25
|
+
res[8] = IERC721A.name.selector;
|
|
26
|
+
res[9] = IERC721A.symbol.selector;
|
|
27
|
+
res[10] = IERC721A.tokenURI.selector;
|
|
28
|
+
res[11] = bytes4(keccak256("safeTransferFrom(address,address,uint256)"));
|
|
29
|
+
res[12] = bytes4(keccak256("safeTransferFrom(address,address,uint256,bytes)"));
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
function makeCut(
|
|
33
|
+
address facetAddress,
|
|
34
|
+
IDiamond.FacetCutAction action
|
|
35
|
+
) internal pure returns (IDiamond.FacetCut memory) {
|
|
36
|
+
return IDiamond.FacetCut(facetAddress, action, selectors());
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
function makeInitData(
|
|
40
|
+
string memory name,
|
|
41
|
+
string memory symbol
|
|
42
|
+
) internal pure returns (bytes memory) {
|
|
43
|
+
return abi.encodeCall(ERC721A.__ERC721A_init, (name, symbol));
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
function deploy() internal returns (address) {
|
|
47
|
+
return LibDeploy.deployCode("ERC721ANonTransferable.sol", "");
|
|
48
|
+
}
|
|
49
|
+
}
|