@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,55 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
pragma solidity ^0.8.23;
|
|
3
|
+
|
|
4
|
+
// interfaces
|
|
5
|
+
import {IRuleEntitlement} from "src/spaces/entitlements/rule/IRuleEntitlement.sol";
|
|
6
|
+
|
|
7
|
+
interface IEntitlementGatedBase {
|
|
8
|
+
enum NodeVoteStatus {
|
|
9
|
+
NOT_VOTED,
|
|
10
|
+
PASSED,
|
|
11
|
+
FAILED
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
struct NodeVote {
|
|
15
|
+
address node;
|
|
16
|
+
NodeVoteStatus vote;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
struct Transaction {
|
|
20
|
+
bool finalized;
|
|
21
|
+
address clientAddress;
|
|
22
|
+
mapping(uint256 => NodeVote[]) nodeVotesArray;
|
|
23
|
+
mapping(uint256 => bool) isCompleted;
|
|
24
|
+
IRuleEntitlement entitlement;
|
|
25
|
+
uint256[] roleIds;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
error EntitlementGated_InvalidAddress();
|
|
29
|
+
error EntitlementGated_TransactionCheckAlreadyRegistered();
|
|
30
|
+
error EntitlementGated_TransactionCheckAlreadyCompleted();
|
|
31
|
+
error EntitlementGated_TransactionNotRegistered();
|
|
32
|
+
error EntitlementGated_NodeNotFound();
|
|
33
|
+
error EntitlementGated_NodeAlreadyVoted();
|
|
34
|
+
error EntitlementGated_OnlyEntitlementChecker();
|
|
35
|
+
error EntitlementGated_InvalidEntitlement();
|
|
36
|
+
error EntitlementGated_RequestIdNotFound();
|
|
37
|
+
error EntitlementGated_InvalidValue();
|
|
38
|
+
/*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
|
|
39
|
+
/* EVENTS */
|
|
40
|
+
/*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
|
|
41
|
+
event EntitlementCheckResultPosted(bytes32 indexed transactionId, NodeVoteStatus result);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
interface IEntitlementGated is IEntitlementGatedBase {
|
|
45
|
+
function postEntitlementCheckResult(
|
|
46
|
+
bytes32 transactionId,
|
|
47
|
+
uint256 roleId,
|
|
48
|
+
NodeVoteStatus result
|
|
49
|
+
) external;
|
|
50
|
+
|
|
51
|
+
function getRuleData(
|
|
52
|
+
bytes32 transactionId,
|
|
53
|
+
uint256 roleId
|
|
54
|
+
) external view returns (IRuleEntitlement.RuleData memory);
|
|
55
|
+
}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
pragma solidity ^0.8.23;
|
|
3
|
+
|
|
4
|
+
// interfaces
|
|
5
|
+
import {IGuardianBase} from "./IGuardian.sol";
|
|
6
|
+
|
|
7
|
+
// libraries
|
|
8
|
+
|
|
9
|
+
import {GuardianStorage} from "./GuardianStorage.sol";
|
|
10
|
+
import {Address} from "@openzeppelin/contracts/utils/Address.sol";
|
|
11
|
+
import {SpaceOwnerStorage} from "src/spaces/facets/owner/SpaceOwnerStorage.sol";
|
|
12
|
+
|
|
13
|
+
abstract contract GuardianBase is IGuardianBase {
|
|
14
|
+
function _setDefaultCooldown(uint256 cooldown) internal {
|
|
15
|
+
GuardianStorage.layout().defaultCooldown = cooldown;
|
|
16
|
+
emit GuardianDefaultCooldownUpdated(cooldown);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
function _getDefaultCooldown() internal view returns (uint256) {
|
|
20
|
+
return GuardianStorage.layout().defaultCooldown;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* @notice Enables a guardian
|
|
25
|
+
* @param guardian The guardian address
|
|
26
|
+
*/
|
|
27
|
+
function _enableGuardian(address guardian) internal {
|
|
28
|
+
GuardianStorage.Layout storage ds = GuardianStorage.layout();
|
|
29
|
+
|
|
30
|
+
if (ds.cooldownByAddress[guardian] == 0) {
|
|
31
|
+
revert Guardian_AlreadyEnabled();
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
ds.cooldownByAddress[guardian] = 0;
|
|
35
|
+
|
|
36
|
+
emit GuardianUpdated(guardian, true, 0, block.timestamp);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* @notice Disables a guardian
|
|
41
|
+
* @param guardian The guardian address
|
|
42
|
+
*/
|
|
43
|
+
function _disableGuardian(address guardian) internal {
|
|
44
|
+
GuardianStorage.Layout storage ds = GuardianStorage.layout();
|
|
45
|
+
|
|
46
|
+
if (ds.cooldownByAddress[guardian] != 0) {
|
|
47
|
+
revert Guardian_AlreadyDisabled();
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
ds.cooldownByAddress[guardian] = block.timestamp + ds.defaultCooldown;
|
|
51
|
+
|
|
52
|
+
emit GuardianUpdated(
|
|
53
|
+
guardian,
|
|
54
|
+
false,
|
|
55
|
+
block.timestamp + ds.defaultCooldown,
|
|
56
|
+
block.timestamp
|
|
57
|
+
);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
function _guardianCooldown(address guardian) internal view returns (uint256) {
|
|
61
|
+
return GuardianStorage.layout().cooldownByAddress[guardian];
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* @notice Returns true if the guardian is enabled
|
|
66
|
+
* @param guardian The guardian address
|
|
67
|
+
* @return True if the guardian is enabled
|
|
68
|
+
*/
|
|
69
|
+
function _guardianEnabled(address guardian) internal view returns (bool) {
|
|
70
|
+
GuardianStorage.Layout storage ds = GuardianStorage.layout();
|
|
71
|
+
|
|
72
|
+
// guardian is enabled if it is not a contract and
|
|
73
|
+
// - it has no cooldown or
|
|
74
|
+
// - it has a cooldown but it has not passed yet
|
|
75
|
+
return
|
|
76
|
+
SpaceOwnerStorage.layout().factory != guardian &&
|
|
77
|
+
(ds.cooldownByAddress[guardian] == 0 ||
|
|
78
|
+
block.timestamp < ds.cooldownByAddress[guardian]);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
pragma solidity ^0.8.23;
|
|
3
|
+
|
|
4
|
+
// interfaces
|
|
5
|
+
import {IGuardian} from "./IGuardian.sol";
|
|
6
|
+
|
|
7
|
+
// libraries
|
|
8
|
+
|
|
9
|
+
// contracts
|
|
10
|
+
import {GuardianBase} from "./GuardianBase.sol";
|
|
11
|
+
|
|
12
|
+
import {Facet} from "@towns-protocol/diamond/src/facets/Facet.sol";
|
|
13
|
+
import {OwnableBase} from "@towns-protocol/diamond/src/facets/ownable/OwnableBase.sol";
|
|
14
|
+
|
|
15
|
+
contract GuardianFacet is IGuardian, GuardianBase, OwnableBase, Facet {
|
|
16
|
+
function __GuardianFacet_init(uint256 cooldown) external onlyInitializing {
|
|
17
|
+
_setDefaultCooldown(cooldown);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
function enableGuardian() external {
|
|
21
|
+
_enableGuardian(msg.sender);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
function guardianCooldown(address guardian) external view returns (uint256) {
|
|
25
|
+
return _guardianCooldown(guardian);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function disableGuardian() external {
|
|
29
|
+
_disableGuardian(msg.sender);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
function isGuardianEnabled(address guardian) external view returns (bool) {
|
|
33
|
+
return _guardianEnabled(guardian);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
function getDefaultCooldown() external view returns (uint256) {
|
|
37
|
+
return _getDefaultCooldown();
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
function setDefaultCooldown(uint256 cooldown) external onlyOwner {
|
|
41
|
+
_setDefaultCooldown(cooldown);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
pragma solidity ^0.8.23;
|
|
3
|
+
|
|
4
|
+
// interfaces
|
|
5
|
+
|
|
6
|
+
// libraries
|
|
7
|
+
|
|
8
|
+
// contracts
|
|
9
|
+
|
|
10
|
+
library GuardianStorage {
|
|
11
|
+
// keccak256(abi.encode(uint256(keccak256("spaces.facets.guardian.storage")) - 1)) &
|
|
12
|
+
// ~bytes32(uint256(0xff))
|
|
13
|
+
bytes32 constant STORAGE_POSITION =
|
|
14
|
+
0x0c89d3aad1b583c77a2e9f9fffa651b386c9c29e300bf2a8e2f3de1bb0100a00;
|
|
15
|
+
|
|
16
|
+
struct Layout {
|
|
17
|
+
uint256 defaultCooldown;
|
|
18
|
+
mapping(address => uint256) cooldownByAddress;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
function layout() internal pure returns (Layout storage l) {
|
|
22
|
+
bytes32 slot = STORAGE_POSITION;
|
|
23
|
+
assembly {
|
|
24
|
+
l.slot := slot
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
pragma solidity ^0.8.23;
|
|
3
|
+
|
|
4
|
+
// interfaces
|
|
5
|
+
|
|
6
|
+
// libraries
|
|
7
|
+
|
|
8
|
+
// contracts
|
|
9
|
+
|
|
10
|
+
interface IGuardianBase {
|
|
11
|
+
error Guardian_Enabled();
|
|
12
|
+
error Guardian_AlreadyEnabled();
|
|
13
|
+
error Guardian_AlreadyDisabled();
|
|
14
|
+
|
|
15
|
+
event GuardianUpdated(
|
|
16
|
+
address indexed caller,
|
|
17
|
+
bool indexed enabled,
|
|
18
|
+
uint256 cooldown,
|
|
19
|
+
uint256 timestamp
|
|
20
|
+
);
|
|
21
|
+
|
|
22
|
+
event GuardianDefaultCooldownUpdated(uint256 indexed cooldown);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
interface IGuardian is IGuardianBase {
|
|
26
|
+
/// @notice Enables the guardian mode for the caller
|
|
27
|
+
/// @dev Can only be called by an EOA (Externally Owned Account)
|
|
28
|
+
/// @dev Emits a GuardianUpdated event
|
|
29
|
+
function enableGuardian() external;
|
|
30
|
+
|
|
31
|
+
/// @notice Disables the guardian mode for the caller
|
|
32
|
+
/// @dev Can only be called by an EOA (Externally Owned Account)
|
|
33
|
+
/// @dev Emits a GuardianUpdated event
|
|
34
|
+
function disableGuardian() external;
|
|
35
|
+
|
|
36
|
+
/// @notice Returns the cooldown period for a specific guardian
|
|
37
|
+
/// @param guardian The address of the guardian to check
|
|
38
|
+
/// @return The cooldown period in seconds
|
|
39
|
+
function guardianCooldown(address guardian) external view returns (uint256);
|
|
40
|
+
|
|
41
|
+
/// @notice Checks if guardian mode is enabled for a specific address
|
|
42
|
+
/// @param guardian The address to check
|
|
43
|
+
/// @return True if guardian mode is enabled, false otherwise
|
|
44
|
+
function isGuardianEnabled(address guardian) external view returns (bool);
|
|
45
|
+
|
|
46
|
+
/// @notice Returns the default cooldown period
|
|
47
|
+
/// @return The default cooldown period in seconds
|
|
48
|
+
function getDefaultCooldown() external view returns (uint256);
|
|
49
|
+
|
|
50
|
+
/// @notice Sets the default cooldown period
|
|
51
|
+
/// @dev Can only be called by the contract owner
|
|
52
|
+
/// @param cooldown The new default cooldown period in seconds
|
|
53
|
+
function setDefaultCooldown(uint256 cooldown) external;
|
|
54
|
+
}
|
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
pragma solidity ^0.8.23;
|
|
3
|
+
|
|
4
|
+
interface IMembershipBase {
|
|
5
|
+
/*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
|
|
6
|
+
/* ENUMS */
|
|
7
|
+
/*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
|
|
8
|
+
|
|
9
|
+
/// @notice JoinType enum for unified membership join dispatch
|
|
10
|
+
/// @dev To encode data for each action:
|
|
11
|
+
/// switch (action) {
|
|
12
|
+
/// case JoinType.Basic:
|
|
13
|
+
/// data = abi.encode(address receiver);
|
|
14
|
+
/// case JoinType.WithReferral:
|
|
15
|
+
/// data = abi.encode(address receiver, ReferralTypes memory referral);
|
|
16
|
+
/// }
|
|
17
|
+
enum JoinType {
|
|
18
|
+
Basic, // Basic join with just receiver address
|
|
19
|
+
WithReferral // Join with referral information
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
|
|
23
|
+
/* STRUCTS */
|
|
24
|
+
/*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
|
|
25
|
+
|
|
26
|
+
struct Membership {
|
|
27
|
+
string name;
|
|
28
|
+
string symbol;
|
|
29
|
+
uint256 price;
|
|
30
|
+
uint256 maxSupply;
|
|
31
|
+
uint64 duration;
|
|
32
|
+
address currency;
|
|
33
|
+
address feeRecipient;
|
|
34
|
+
uint256 freeAllocation;
|
|
35
|
+
address pricingModule;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
struct ReferralTypes {
|
|
39
|
+
address partner;
|
|
40
|
+
address userReferral;
|
|
41
|
+
string referralCode;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
struct PricingDetails {
|
|
45
|
+
uint256 basePrice;
|
|
46
|
+
uint256 amountDue;
|
|
47
|
+
bool shouldCharge;
|
|
48
|
+
bool isPrepaid;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
|
|
52
|
+
/* ERRORS */
|
|
53
|
+
/*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
|
|
54
|
+
|
|
55
|
+
error Membership__InvalidAddress();
|
|
56
|
+
error Membership__InvalidPrice();
|
|
57
|
+
error Membership__InvalidLimit();
|
|
58
|
+
error Membership__InvalidCurrency();
|
|
59
|
+
error Membership__InvalidFeeRecipient();
|
|
60
|
+
error Membership__InvalidDuration();
|
|
61
|
+
error Membership__InvalidMaxSupply();
|
|
62
|
+
error Membership__InvalidFreeAllocation();
|
|
63
|
+
error Membership__InvalidPricingModule();
|
|
64
|
+
error Membership__AlreadyMember();
|
|
65
|
+
error Membership__InsufficientPayment();
|
|
66
|
+
error Membership__PriceTooLow();
|
|
67
|
+
error Membership__MaxSupplyReached();
|
|
68
|
+
error Membership__InvalidTokenId();
|
|
69
|
+
error Membership__NotExpired();
|
|
70
|
+
error Membership__InsufficientAllowance();
|
|
71
|
+
error Membership__InvalidPayment();
|
|
72
|
+
error Membership__InvalidTransactionType();
|
|
73
|
+
error Membership__Banned();
|
|
74
|
+
error Membership__InvalidAction();
|
|
75
|
+
|
|
76
|
+
/*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
|
|
77
|
+
/* EVENTS */
|
|
78
|
+
/*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
|
|
79
|
+
|
|
80
|
+
event MembershipPriceUpdated(uint256 indexed price);
|
|
81
|
+
event MembershipLimitUpdated(uint256 indexed limit);
|
|
82
|
+
event MembershipCurrencyUpdated(address indexed currency);
|
|
83
|
+
event MembershipFeeRecipientUpdated(address indexed recipient);
|
|
84
|
+
event MembershipFreeAllocationUpdated(uint256 indexed allocation);
|
|
85
|
+
event MembershipWithdrawal(address indexed recipient, uint256 amount);
|
|
86
|
+
event MembershipTokenIssued(address indexed recipient, uint256 indexed tokenId);
|
|
87
|
+
event MembershipTokenRejected(address indexed recipient);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
interface IMembership is IMembershipBase {
|
|
91
|
+
/*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
|
|
92
|
+
/* MINTING */
|
|
93
|
+
/*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
|
|
94
|
+
|
|
95
|
+
/// @notice Unified entry point for joining spaces with different configurations
|
|
96
|
+
/// @param action The type of join action to perform
|
|
97
|
+
/// @param data ABI-encoded data for the specific action type
|
|
98
|
+
function joinSpace(JoinType action, bytes calldata data) external payable;
|
|
99
|
+
|
|
100
|
+
/// @notice Join a space
|
|
101
|
+
/// @param receiver The address of the receiver
|
|
102
|
+
function joinSpace(address receiver) external payable;
|
|
103
|
+
|
|
104
|
+
/// @notice Join a space with a referral
|
|
105
|
+
/// @param receiver The address of the receiver
|
|
106
|
+
/// @param referral The referral data
|
|
107
|
+
function joinSpaceWithReferral(
|
|
108
|
+
address receiver,
|
|
109
|
+
ReferralTypes memory referral
|
|
110
|
+
) external payable;
|
|
111
|
+
|
|
112
|
+
/// @notice Renew a space membership
|
|
113
|
+
/// @param tokenId The token id of the membership
|
|
114
|
+
function renewMembership(uint256 tokenId) external payable;
|
|
115
|
+
|
|
116
|
+
/// @notice Return the expiration date of a membership
|
|
117
|
+
/// @param tokenId The token id of the membership
|
|
118
|
+
function expiresAt(uint256 tokenId) external view returns (uint256);
|
|
119
|
+
|
|
120
|
+
/*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
|
|
121
|
+
/* DURATION */
|
|
122
|
+
/*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
|
|
123
|
+
|
|
124
|
+
/// @notice Get the membership duration
|
|
125
|
+
/// @return The membership duration
|
|
126
|
+
function getMembershipDuration() external view returns (uint64);
|
|
127
|
+
|
|
128
|
+
/// @notice Set the membership duration
|
|
129
|
+
/// @param duration The new membership duration in seconds
|
|
130
|
+
function setMembershipDuration(uint64 duration) external;
|
|
131
|
+
|
|
132
|
+
/*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
|
|
133
|
+
/* PRICING MODULE */
|
|
134
|
+
/*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
|
|
135
|
+
|
|
136
|
+
/// @notice Set the membership pricing module
|
|
137
|
+
/// @param pricingModule The new pricing module
|
|
138
|
+
function setMembershipPricingModule(address pricingModule) external;
|
|
139
|
+
|
|
140
|
+
/// @notice Get the membership pricing module
|
|
141
|
+
/// @return The membership pricing module
|
|
142
|
+
function getMembershipPricingModule() external view returns (address);
|
|
143
|
+
|
|
144
|
+
/// @notice Get the protocol fee
|
|
145
|
+
/// @return The protocol fee
|
|
146
|
+
function getProtocolFee() external view returns (uint256);
|
|
147
|
+
|
|
148
|
+
/*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
|
|
149
|
+
/* PRICING */
|
|
150
|
+
/*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
|
|
151
|
+
|
|
152
|
+
/// @notice Set the membership price
|
|
153
|
+
/// @param newPrice The new membership price
|
|
154
|
+
function setMembershipPrice(uint256 newPrice) external;
|
|
155
|
+
|
|
156
|
+
/// @notice Get the membership price
|
|
157
|
+
/// @return The membership price
|
|
158
|
+
function getMembershipPrice() external view returns (uint256);
|
|
159
|
+
|
|
160
|
+
/// @notice Get the membership renewal price
|
|
161
|
+
/// @param tokenId The token id of the membership
|
|
162
|
+
/// @return The membership renewal price
|
|
163
|
+
function getMembershipRenewalPrice(uint256 tokenId) external view returns (uint256);
|
|
164
|
+
|
|
165
|
+
/*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
|
|
166
|
+
/* ALLOCATION */
|
|
167
|
+
/*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
|
|
168
|
+
|
|
169
|
+
/// @notice Set the membership free allocation
|
|
170
|
+
/// @param newAllocation The new membership free allocation
|
|
171
|
+
function setMembershipFreeAllocation(uint256 newAllocation) external;
|
|
172
|
+
|
|
173
|
+
/// @notice Get the membership free allocation
|
|
174
|
+
/// @return The membership free allocation
|
|
175
|
+
function getMembershipFreeAllocation() external view returns (uint256);
|
|
176
|
+
|
|
177
|
+
/*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
|
|
178
|
+
/* LIMITS */
|
|
179
|
+
/*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
|
|
180
|
+
|
|
181
|
+
/// @notice Set the membership limit
|
|
182
|
+
/// @param newLimit The new membership limit
|
|
183
|
+
function setMembershipLimit(uint256 newLimit) external;
|
|
184
|
+
|
|
185
|
+
/// @notice Get the membership limit
|
|
186
|
+
/// @return The membership limit
|
|
187
|
+
function getMembershipLimit() external view returns (uint256);
|
|
188
|
+
|
|
189
|
+
/*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
|
|
190
|
+
/* IMAGE */
|
|
191
|
+
/*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
|
|
192
|
+
|
|
193
|
+
/// @notice Set the membership image
|
|
194
|
+
/// @param image The new membership image
|
|
195
|
+
function setMembershipImage(string calldata image) external;
|
|
196
|
+
|
|
197
|
+
/// @notice Get the membership image
|
|
198
|
+
/// @return The membership image
|
|
199
|
+
function getMembershipImage() external view returns (string memory);
|
|
200
|
+
|
|
201
|
+
/*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
|
|
202
|
+
/* GETTERS */
|
|
203
|
+
/*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
|
|
204
|
+
|
|
205
|
+
/// @notice Get the membership currency
|
|
206
|
+
/// @return The membership currency
|
|
207
|
+
function getMembershipCurrency() external view returns (address);
|
|
208
|
+
|
|
209
|
+
/// @notice Get the space factory
|
|
210
|
+
/// @return The space factory
|
|
211
|
+
function getSpaceFactory() external view returns (address);
|
|
212
|
+
|
|
213
|
+
/// @notice Get the current balance of funds held by the space
|
|
214
|
+
/// @return The current balance of funds held by the space
|
|
215
|
+
function revenue() external view returns (uint256);
|
|
216
|
+
}
|