@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,102 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
pragma solidity ^0.8.23;
|
|
3
|
+
|
|
4
|
+
// common
|
|
5
|
+
import {Interaction} from "scripts/common/Interaction.s.sol";
|
|
6
|
+
import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
|
|
7
|
+
|
|
8
|
+
// libraries
|
|
9
|
+
import {LibLayerZeroValues} from "scripts/deployments/utils/LibLayerZeroValues.sol";
|
|
10
|
+
|
|
11
|
+
// contracts
|
|
12
|
+
import {Towns} from "src/tokens/towns/multichain/Towns.sol";
|
|
13
|
+
import {SendParam} from "@layerzerolabs/oft-evm/contracts/interfaces/IOFT.sol";
|
|
14
|
+
import {OptionsBuilder} from "@layerzerolabs/oapp-evm/contracts/oapp/libs/OptionsBuilder.sol";
|
|
15
|
+
import {MessagingFee} from "@layerzerolabs/oapp-evm/contracts/oapp/OApp.sol";
|
|
16
|
+
|
|
17
|
+
// debugging
|
|
18
|
+
import {console} from "forge-std/console.sol";
|
|
19
|
+
contract InteractBridgeLayerZero is Interaction {
|
|
20
|
+
using OptionsBuilder for bytes;
|
|
21
|
+
|
|
22
|
+
address internal BNB_MULTISIG = address(1);
|
|
23
|
+
|
|
24
|
+
function addressToBytes32(address _addr) internal pure returns (bytes32) {
|
|
25
|
+
return bytes32(uint256(uint160(_addr)));
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function __interact(address deployer) internal override {}
|
|
29
|
+
|
|
30
|
+
function sendToEth(address deployer) internal {
|
|
31
|
+
address towns = getDeployment("townsBnb");
|
|
32
|
+
uint256 amount = 11 ether;
|
|
33
|
+
uint32 dstEid = LibLayerZeroValues.getEid(1); // Ethereum
|
|
34
|
+
|
|
35
|
+
Towns oft = Towns(towns);
|
|
36
|
+
|
|
37
|
+
bytes memory extraOptions = OptionsBuilder.newOptions().addExecutorLzReceiveOption(
|
|
38
|
+
65000,
|
|
39
|
+
0
|
|
40
|
+
);
|
|
41
|
+
SendParam memory sendParam = SendParam({
|
|
42
|
+
dstEid: dstEid,
|
|
43
|
+
to: addressToBytes32(deployer),
|
|
44
|
+
amountLD: amount,
|
|
45
|
+
minAmountLD: (amount * 95) / 100, // 5% slippage tolerance
|
|
46
|
+
extraOptions: extraOptions,
|
|
47
|
+
composeMsg: "",
|
|
48
|
+
oftCmd: ""
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
// Get fee quote
|
|
52
|
+
MessagingFee memory fee = oft.quoteSend(sendParam, false);
|
|
53
|
+
|
|
54
|
+
console.log("Sending tokens...");
|
|
55
|
+
console.log("Towns address:", towns);
|
|
56
|
+
console.log("Fee amount:", fee.nativeFee);
|
|
57
|
+
|
|
58
|
+
// Send tokens
|
|
59
|
+
vm.startBroadcast(deployer);
|
|
60
|
+
oft.send{value: fee.nativeFee}(sendParam, fee, msg.sender);
|
|
61
|
+
vm.stopBroadcast();
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
function sendToBnb(address deployer) internal {
|
|
65
|
+
address towns = getDeployment("townsMainnet");
|
|
66
|
+
address wrappedTowns = getDeployment("wTowns");
|
|
67
|
+
uint256 amount = 11 ether;
|
|
68
|
+
uint32 dstEid = LibLayerZeroValues.getEid(56); // Binance
|
|
69
|
+
|
|
70
|
+
Towns oft = Towns(wrappedTowns);
|
|
71
|
+
|
|
72
|
+
bytes memory extraOptions = OptionsBuilder.newOptions().addExecutorLzReceiveOption(
|
|
73
|
+
65000,
|
|
74
|
+
0
|
|
75
|
+
);
|
|
76
|
+
|
|
77
|
+
SendParam memory sendParam = SendParam({
|
|
78
|
+
dstEid: dstEid,
|
|
79
|
+
to: addressToBytes32(BNB_MULTISIG),
|
|
80
|
+
amountLD: amount,
|
|
81
|
+
minAmountLD: (amount * 95) / 100, // 5% slippage tolerance
|
|
82
|
+
extraOptions: extraOptions,
|
|
83
|
+
composeMsg: "",
|
|
84
|
+
oftCmd: ""
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
// Get fee quote
|
|
88
|
+
MessagingFee memory fee = oft.quoteSend(sendParam, false);
|
|
89
|
+
|
|
90
|
+
console.log("Sending tokens...");
|
|
91
|
+
console.log("Towns address:", towns);
|
|
92
|
+
console.log("Wrapped Towns address:", wrappedTowns);
|
|
93
|
+
console.log("Fee amount:", fee.nativeFee);
|
|
94
|
+
|
|
95
|
+
// Send tokens
|
|
96
|
+
vm.startBroadcast(deployer);
|
|
97
|
+
IERC20(towns).approve(address(oft), amount);
|
|
98
|
+
oft.send{value: fee.nativeFee}(sendParam, fee, msg.sender);
|
|
99
|
+
IERC20(towns).approve(address(oft), 0);
|
|
100
|
+
vm.stopBroadcast();
|
|
101
|
+
}
|
|
102
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
pragma solidity ^0.8.23;
|
|
3
|
+
|
|
4
|
+
// interfaces
|
|
5
|
+
import {IDropFacet, IDropFacetBase} from "src/airdrop/drop/IDropFacet.sol";
|
|
6
|
+
|
|
7
|
+
// libraries
|
|
8
|
+
import {DropGroup} from "src/airdrop/drop/DropGroup.sol";
|
|
9
|
+
import {MerkleTree} from "test/utils/MerkleTree.sol";
|
|
10
|
+
|
|
11
|
+
// contracts
|
|
12
|
+
import {Interaction} from "scripts/common/Interaction.s.sol";
|
|
13
|
+
|
|
14
|
+
// deployments
|
|
15
|
+
import {DeployRiverAirdrop} from "scripts/deployments/diamonds/DeployRiverAirdrop.s.sol";
|
|
16
|
+
import {DeployTownsBase} from "scripts/deployments/utils/DeployTownsBase.s.sol";
|
|
17
|
+
|
|
18
|
+
uint256 constant MAX_CLAIMABLE_SUPPLY = 5 ether;
|
|
19
|
+
|
|
20
|
+
contract InteractClaimCondition is IDropFacetBase, Interaction {
|
|
21
|
+
address[] public wallets;
|
|
22
|
+
uint256[] public amounts;
|
|
23
|
+
uint256[] public points;
|
|
24
|
+
|
|
25
|
+
function setUp() public {
|
|
26
|
+
wallets.push(0x86312a65B491CF25D9D265f6218AB013DaCa5e19);
|
|
27
|
+
amounts.push(1 ether); // equivalent to 1 token
|
|
28
|
+
points.push(1);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
function __interact(address deployer) internal override {
|
|
32
|
+
vm.pauseGasMetering();
|
|
33
|
+
|
|
34
|
+
DeployRiverAirdrop deployRiverAirdrop = new DeployRiverAirdrop();
|
|
35
|
+
DeployTownsBase deployTownsBase = new DeployTownsBase();
|
|
36
|
+
MerkleTree merkleTree = new MerkleTree();
|
|
37
|
+
|
|
38
|
+
address riverAirdrop = deployRiverAirdrop.deploy(deployer);
|
|
39
|
+
address townsBase = deployTownsBase.deploy(deployer);
|
|
40
|
+
(bytes32 root, ) = merkleTree.constructTree(wallets, amounts, points);
|
|
41
|
+
|
|
42
|
+
DropGroup.ClaimCondition[] memory conditions = new DropGroup.ClaimCondition[](1);
|
|
43
|
+
conditions[0] = DropGroup.ClaimCondition({
|
|
44
|
+
startTimestamp: uint40(block.timestamp),
|
|
45
|
+
endTimestamp: 0,
|
|
46
|
+
maxClaimableSupply: MAX_CLAIMABLE_SUPPLY,
|
|
47
|
+
supplyClaimed: 0,
|
|
48
|
+
merkleRoot: root,
|
|
49
|
+
currency: address(townsBase),
|
|
50
|
+
penaltyBps: 1000 // 10%
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
vm.broadcast(deployer);
|
|
54
|
+
IDropFacet(riverAirdrop).setClaimConditions(conditions);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
pragma solidity ^0.8.23;
|
|
3
|
+
|
|
4
|
+
// interfaces
|
|
5
|
+
import {IArchitectBase} from "src/factory/facets/architect/IArchitect.sol";
|
|
6
|
+
|
|
7
|
+
import {IPricingModules, IPricingModulesBase} from "src/factory/facets/architect/pricing/IPricingModules.sol";
|
|
8
|
+
import {ICreateSpace} from "src/factory/facets/create/ICreateSpace.sol";
|
|
9
|
+
|
|
10
|
+
// common
|
|
11
|
+
import {Interaction} from "scripts/common/Interaction.s.sol";
|
|
12
|
+
import {SpaceHelper} from "test/spaces/SpaceHelper.sol";
|
|
13
|
+
|
|
14
|
+
// libraries
|
|
15
|
+
import {LibString} from "solady/utils/LibString.sol";
|
|
16
|
+
|
|
17
|
+
// debugging
|
|
18
|
+
import {console} from "forge-std/console.sol";
|
|
19
|
+
|
|
20
|
+
contract InteractCreateSpace is Interaction, SpaceHelper, IPricingModulesBase {
|
|
21
|
+
string public constant TIERED_LOG_PRICING_MODULE = "TieredLogPricingOracleV3";
|
|
22
|
+
|
|
23
|
+
function __interact(address deployer) internal override {
|
|
24
|
+
// Get SpaceFactory deployment address
|
|
25
|
+
address spaceFactory = getDeployment("spaceFactory");
|
|
26
|
+
|
|
27
|
+
ICreateSpace createSpace = ICreateSpace(spaceFactory);
|
|
28
|
+
IPricingModules pricingModules = IPricingModules(spaceFactory);
|
|
29
|
+
|
|
30
|
+
PricingModule[] memory modules = pricingModules.listPricingModules();
|
|
31
|
+
|
|
32
|
+
address tieredLogPricing;
|
|
33
|
+
for (uint256 i = 0; i < modules.length; i++) {
|
|
34
|
+
if (LibString.eq(modules[i].name, TIERED_LOG_PRICING_MODULE)) {
|
|
35
|
+
tieredLogPricing = modules[i].module;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
require(tieredLogPricing != address(0), "TieredLogPricingOracleV3 not found");
|
|
40
|
+
|
|
41
|
+
IArchitectBase.SpaceInfo memory info = _createEveryoneSpaceInfo("test");
|
|
42
|
+
info.membership.settings.pricingModule = tieredLogPricing;
|
|
43
|
+
|
|
44
|
+
vm.startBroadcast(deployer);
|
|
45
|
+
address space = createSpace.createSpace(info);
|
|
46
|
+
vm.stopBroadcast();
|
|
47
|
+
|
|
48
|
+
console.log("Space created at address:", space);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
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 {IDiamondCut} from "@towns-protocol/diamond/src/facets/cut/IDiamondCut.sol";
|
|
7
|
+
|
|
8
|
+
// libraries
|
|
9
|
+
import {console} from "forge-std/console.sol";
|
|
10
|
+
|
|
11
|
+
// contracts
|
|
12
|
+
import {Interaction} from "../common/Interaction.s.sol";
|
|
13
|
+
import {AlphaHelper} from "./helpers/AlphaHelper.sol";
|
|
14
|
+
|
|
15
|
+
// facet
|
|
16
|
+
import {DeploySpaceOwnerFacet} from "scripts/deployments/facets/DeploySpaceOwnerFacet.s.sol";
|
|
17
|
+
|
|
18
|
+
contract InteractDiamondCut is Interaction, AlphaHelper {
|
|
19
|
+
function __interact(address deployer) internal override {
|
|
20
|
+
address diamond = getDeployment("spaceOwner");
|
|
21
|
+
address spaceOwnerFacet = 0x09FCbC926F9Ec236fa3f825bF65b62776a9413aD;
|
|
22
|
+
|
|
23
|
+
address[] memory facetAddresses = new address[](1);
|
|
24
|
+
facetAddresses[0] = spaceOwnerFacet;
|
|
25
|
+
|
|
26
|
+
// add the diamond cut to remove the facet
|
|
27
|
+
addCutsToRemove(diamond, facetAddresses);
|
|
28
|
+
|
|
29
|
+
// deploy the new facet
|
|
30
|
+
console.log("deployer", deployer);
|
|
31
|
+
vm.setEnv("OVERRIDE_DEPLOYMENTS", "1");
|
|
32
|
+
vm.broadcast(deployer);
|
|
33
|
+
spaceOwnerFacet = DeploySpaceOwnerFacet.deploy();
|
|
34
|
+
|
|
35
|
+
// add the new facet to the diamond
|
|
36
|
+
addCut(DeploySpaceOwnerFacet.makeCut(spaceOwnerFacet, FacetCutAction.Add));
|
|
37
|
+
|
|
38
|
+
bytes memory initData = "";
|
|
39
|
+
|
|
40
|
+
vm.broadcast(deployer);
|
|
41
|
+
IDiamondCut(diamond).diamondCut(
|
|
42
|
+
baseFacets(),
|
|
43
|
+
initData.length > 0 ? spaceOwnerFacet : address(0),
|
|
44
|
+
initData
|
|
45
|
+
);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
pragma solidity ^0.8.23;
|
|
3
|
+
|
|
4
|
+
// interfaces
|
|
5
|
+
import {IDropFacet, IDropFacetBase} from "src/airdrop/drop/IDropFacet.sol";
|
|
6
|
+
import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
|
|
7
|
+
|
|
8
|
+
// libraries
|
|
9
|
+
import {DropClaim} from "src/airdrop/drop/DropClaim.sol";
|
|
10
|
+
import {DropGroup} from "src/airdrop/drop/DropGroup.sol";
|
|
11
|
+
|
|
12
|
+
// contracts
|
|
13
|
+
import {Interaction} from "scripts/common/Interaction.s.sol";
|
|
14
|
+
import {console} from "forge-std/console.sol";
|
|
15
|
+
|
|
16
|
+
// deployments
|
|
17
|
+
import {DeployRiverAirdrop} from "scripts/deployments/diamonds/DeployRiverAirdrop.s.sol";
|
|
18
|
+
import {DropFacet} from "src/airdrop/drop/DropFacet.sol";
|
|
19
|
+
|
|
20
|
+
contract InteractDropFacet is Interaction, IDropFacetBase {
|
|
21
|
+
function __interact(address) internal override {
|
|
22
|
+
address airdrop = getDeployment("riverAirdrop");
|
|
23
|
+
address dropFacet = 0x8DB408fD918e80D09Afb895f41480076ba96C74b;
|
|
24
|
+
|
|
25
|
+
DropFacet facet = new DropFacet();
|
|
26
|
+
bytes memory bytecode = address(facet).code;
|
|
27
|
+
vm.etch(dropFacet, bytecode);
|
|
28
|
+
|
|
29
|
+
vm.expectRevert(DropFacet__NoActiveClaimCondition.selector);
|
|
30
|
+
IDropFacet(airdrop).getActiveClaimConditionId();
|
|
31
|
+
}
|
|
32
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
pragma solidity ^0.8.24;
|
|
3
|
+
|
|
4
|
+
// interfaces
|
|
5
|
+
import {IRiverConfig} from "src/river/registry/facets/config/IRiverConfig.sol";
|
|
6
|
+
|
|
7
|
+
// libraries
|
|
8
|
+
import {RiverConfigValues} from "scripts/interactions/helpers/RiverConfigValues.sol";
|
|
9
|
+
|
|
10
|
+
// contracts
|
|
11
|
+
import {Interaction} from "scripts/common/Interaction.s.sol";
|
|
12
|
+
|
|
13
|
+
contract InteractEnableNewSnapshotFormat is Interaction {
|
|
14
|
+
function __interact(address deployer) internal override {
|
|
15
|
+
address riverRegistry = getDeployment("riverRegistry");
|
|
16
|
+
|
|
17
|
+
uint64 value = 1;
|
|
18
|
+
|
|
19
|
+
vm.startBroadcast(deployer);
|
|
20
|
+
IRiverConfig(riverRegistry).setConfiguration(
|
|
21
|
+
RiverConfigValues.ENABLE_NEW_SNAPSHOT_FORMAT,
|
|
22
|
+
0,
|
|
23
|
+
abi.encode(value)
|
|
24
|
+
);
|
|
25
|
+
vm.stopBroadcast();
|
|
26
|
+
}
|
|
27
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
pragma solidity ^0.8.24;
|
|
3
|
+
|
|
4
|
+
// interfaces
|
|
5
|
+
import {IRiverConfig} from "src/river/registry/facets/config/IRiverConfig.sol";
|
|
6
|
+
|
|
7
|
+
// libraries
|
|
8
|
+
import {RiverConfigValues} from "scripts/interactions/helpers/RiverConfigValues.sol";
|
|
9
|
+
|
|
10
|
+
// contracts
|
|
11
|
+
import {Interaction} from "scripts/common/Interaction.s.sol";
|
|
12
|
+
|
|
13
|
+
contract InteractEnableNode2NodeAuth is Interaction {
|
|
14
|
+
function __interact(address deployer) internal override {
|
|
15
|
+
address riverRegistry = getDeployment("riverRegistry");
|
|
16
|
+
|
|
17
|
+
uint64 value = 1;
|
|
18
|
+
|
|
19
|
+
vm.startBroadcast(deployer);
|
|
20
|
+
IRiverConfig(riverRegistry).setConfiguration(
|
|
21
|
+
RiverConfigValues.ENABLE_NODE_2_NODE_AUTH,
|
|
22
|
+
0,
|
|
23
|
+
abi.encode(value)
|
|
24
|
+
);
|
|
25
|
+
vm.stopBroadcast();
|
|
26
|
+
}
|
|
27
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
pragma solidity ^0.8.23;
|
|
3
|
+
|
|
4
|
+
import {Interaction} from "scripts/common/Interaction.s.sol";
|
|
5
|
+
import {IMembership} from "src/spaces/facets/membership/IMembership.sol";
|
|
6
|
+
import {MembershipFacet} from "src/spaces/facets/membership/MembershipFacet.sol";
|
|
7
|
+
import {IPlatformRequirements} from "src/factory/facets/platform/requirements/IPlatformRequirements.sol";
|
|
8
|
+
|
|
9
|
+
import {console} from "forge-std/console.sol";
|
|
10
|
+
|
|
11
|
+
contract InteractMembership is Interaction {
|
|
12
|
+
address SPACE = 0x5494249cFF3F856d4611159f00C0eE916A96396D;
|
|
13
|
+
address MEMBERSHIP_FACET = 0xfE645928B2EdB6176E6b792c09708d9421E7f91b;
|
|
14
|
+
address SPACE_FACTORY = 0xC09Ac0FFeecAaE5100158247512DC177AeacA3e3;
|
|
15
|
+
|
|
16
|
+
function __interact(address) internal override {
|
|
17
|
+
IPlatformRequirements requirements = _getMembershipReqs();
|
|
18
|
+
|
|
19
|
+
console.log("requirements.getMembershipMinPrice()", requirements.getMembershipMinPrice());
|
|
20
|
+
console.log("requirements.getMembershipFee()", requirements.getMembershipFee());
|
|
21
|
+
|
|
22
|
+
MembershipFacet facet = new MembershipFacet();
|
|
23
|
+
bytes memory bytecode = address(facet).code;
|
|
24
|
+
vm.etch(MEMBERSHIP_FACET, bytecode);
|
|
25
|
+
|
|
26
|
+
IMembership membership = IMembership(SPACE);
|
|
27
|
+
|
|
28
|
+
console.log("membership.getMembershipPrice()", membership.getMembershipPrice());
|
|
29
|
+
console.log(
|
|
30
|
+
"membership.getMembershipRenewalPrice(0)",
|
|
31
|
+
membership.getMembershipRenewalPrice(0)
|
|
32
|
+
);
|
|
33
|
+
console.log(
|
|
34
|
+
"membership.getMembershipRenewalPrice(1)",
|
|
35
|
+
membership.getMembershipRenewalPrice(1)
|
|
36
|
+
);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
function _getMembershipReqs() internal view returns (IPlatformRequirements) {
|
|
40
|
+
return IPlatformRequirements(SPACE_FACTORY);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
pragma solidity ^0.8.23;
|
|
3
|
+
|
|
4
|
+
// interfaces
|
|
5
|
+
|
|
6
|
+
// libraries
|
|
7
|
+
|
|
8
|
+
// contracts
|
|
9
|
+
import {Interaction} from "scripts/common/Interaction.s.sol";
|
|
10
|
+
import {MockERC721A} from "test/mocks/MockERC721A.sol";
|
|
11
|
+
|
|
12
|
+
contract InteractMockERC721A is Interaction {
|
|
13
|
+
function __interact(address deployer) internal override {
|
|
14
|
+
address nft = getDeployment("mockERC721A");
|
|
15
|
+
|
|
16
|
+
vm.startBroadcast(deployer);
|
|
17
|
+
MockERC721A(nft).mintTo(deployer);
|
|
18
|
+
vm.stopBroadcast();
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
pragma solidity ^0.8.23;
|
|
3
|
+
|
|
4
|
+
// interfaces
|
|
5
|
+
import {NodeOperatorStatus} from "src/base/registry/facets/operator/NodeOperatorStorage.sol";
|
|
6
|
+
|
|
7
|
+
// libraries
|
|
8
|
+
|
|
9
|
+
// contracts
|
|
10
|
+
import {Interaction} from "scripts/common/Interaction.s.sol";
|
|
11
|
+
import {NodeOperatorFacet} from "src/base/registry/facets/operator/NodeOperatorFacet.sol";
|
|
12
|
+
|
|
13
|
+
// debugging
|
|
14
|
+
import {console} from "forge-std/console.sol";
|
|
15
|
+
|
|
16
|
+
contract InteractNodeOperators is Interaction {
|
|
17
|
+
function __interact(address) internal override {
|
|
18
|
+
address baseRegistry = getDeployment("baseRegistry");
|
|
19
|
+
|
|
20
|
+
address[] memory operators = NodeOperatorFacet(baseRegistry).getOperators();
|
|
21
|
+
|
|
22
|
+
for (uint256 i = 0; i < operators.length; i++) {
|
|
23
|
+
address operator = operators[i];
|
|
24
|
+
NodeOperatorStatus status = NodeOperatorFacet(baseRegistry).getOperatorStatus(operator);
|
|
25
|
+
console.log("Operator:", operator);
|
|
26
|
+
_logStatus(status);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
function _logStatus(NodeOperatorStatus status) internal pure {
|
|
31
|
+
if (status == NodeOperatorStatus.Exiting) {
|
|
32
|
+
console.log("Exiting");
|
|
33
|
+
} else if (status == NodeOperatorStatus.Standby) {
|
|
34
|
+
console.log("Standby");
|
|
35
|
+
} else if (status == NodeOperatorStatus.Approved) {
|
|
36
|
+
console.log("Approved");
|
|
37
|
+
} else if (status == NodeOperatorStatus.Active) {
|
|
38
|
+
console.log("Active");
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
pragma solidity ^0.8.23;
|
|
3
|
+
|
|
4
|
+
// interfaces
|
|
5
|
+
import {IImplementationRegistry} from "../../src/factory/facets/registry/IImplementationRegistry.sol";
|
|
6
|
+
import {ISpaceDelegation} from "src/base/registry/facets/delegation/ISpaceDelegation.sol";
|
|
7
|
+
import {IMainnetDelegation} from "src/base/registry/facets/mainnet/IMainnetDelegation.sol";
|
|
8
|
+
import {ISpaceOwner} from "src/spaces/facets/owner/ISpaceOwner.sol";
|
|
9
|
+
import {INodeOperator} from "src/base/registry/facets/operator/INodeOperator.sol";
|
|
10
|
+
import {IRewardsDistribution} from "src/base/registry/facets/distribution/v2/IRewardsDistribution.sol";
|
|
11
|
+
|
|
12
|
+
// libraries
|
|
13
|
+
import {NodeOperatorStatus} from "src/base/registry/facets/operator/NodeOperatorStorage.sol";
|
|
14
|
+
|
|
15
|
+
// contracts
|
|
16
|
+
import {MAX_CLAIMABLE_SUPPLY} from "./InteractClaimCondition.s.sol";
|
|
17
|
+
import {Interaction} from "scripts/common/Interaction.s.sol";
|
|
18
|
+
import {MockTowns} from "test/mocks/MockTowns.sol";
|
|
19
|
+
|
|
20
|
+
// deployments
|
|
21
|
+
import {DeployProxyBatchDelegation} from "scripts/deployments/utils/DeployProxyBatchDelegation.s.sol";
|
|
22
|
+
import {DeployTownsBase} from "scripts/deployments/utils/DeployTownsBase.s.sol";
|
|
23
|
+
|
|
24
|
+
contract InteractPostDeploy is Interaction {
|
|
25
|
+
DeployProxyBatchDelegation deployProxyDelegation = new DeployProxyBatchDelegation();
|
|
26
|
+
DeployTownsBase deployTownsBase = new DeployTownsBase();
|
|
27
|
+
|
|
28
|
+
address internal constant OPERATOR = 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266;
|
|
29
|
+
address internal constant STAKER = 0x70997970C51812dc3A010C7d01b50e0d17dc79C8;
|
|
30
|
+
|
|
31
|
+
function __interact(address deployer) internal override {
|
|
32
|
+
vm.pauseGasMetering();
|
|
33
|
+
address spaceOwner = getDeployment("spaceOwner");
|
|
34
|
+
address spaceFactory = getDeployment("spaceFactory");
|
|
35
|
+
address baseRegistry = getDeployment("baseRegistry");
|
|
36
|
+
address riverAirdrop = getDeployment("riverAirdrop");
|
|
37
|
+
address appRegistry = getDeployment("appRegistry");
|
|
38
|
+
address townsBase = deployTownsBase.deploy(deployer);
|
|
39
|
+
address proxyDelegation = deployProxyDelegation.deploy(deployer);
|
|
40
|
+
|
|
41
|
+
// this is for anvil deployment only
|
|
42
|
+
vm.startBroadcast(deployer);
|
|
43
|
+
MockTowns(townsBase).localMint(riverAirdrop, MAX_CLAIMABLE_SUPPLY);
|
|
44
|
+
MockTowns(townsBase).localMint(STAKER, MAX_CLAIMABLE_SUPPLY);
|
|
45
|
+
MockTowns(townsBase).localMint(baseRegistry, MAX_CLAIMABLE_SUPPLY);
|
|
46
|
+
ISpaceOwner(spaceOwner).setFactory(spaceFactory);
|
|
47
|
+
IImplementationRegistry(spaceFactory).addImplementation(baseRegistry);
|
|
48
|
+
IImplementationRegistry(spaceFactory).addImplementation(riverAirdrop);
|
|
49
|
+
IImplementationRegistry(spaceFactory).addImplementation(appRegistry);
|
|
50
|
+
IMainnetDelegation(baseRegistry).setProxyDelegation(proxyDelegation);
|
|
51
|
+
IRewardsDistribution(baseRegistry).setRewardNotifier(deployer, true);
|
|
52
|
+
IRewardsDistribution(baseRegistry).notifyRewardAmount(MAX_CLAIMABLE_SUPPLY);
|
|
53
|
+
|
|
54
|
+
INodeOperator operatorFacet = INodeOperator(baseRegistry);
|
|
55
|
+
operatorFacet.registerOperator(OPERATOR);
|
|
56
|
+
operatorFacet.setOperatorStatus(OPERATOR, NodeOperatorStatus.Approved);
|
|
57
|
+
vm.stopBroadcast();
|
|
58
|
+
}
|
|
59
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
pragma solidity ^0.8.23;
|
|
3
|
+
|
|
4
|
+
// interfaces
|
|
5
|
+
|
|
6
|
+
// libraries
|
|
7
|
+
|
|
8
|
+
// contracts
|
|
9
|
+
import {Interaction} from "scripts/common/Interaction.s.sol";
|
|
10
|
+
import {IPrepay} from "src/spaces/facets/prepay/IPrepay.sol";
|
|
11
|
+
|
|
12
|
+
// debuggging
|
|
13
|
+
import {console} from "forge-std/console.sol";
|
|
14
|
+
|
|
15
|
+
contract InteractPrepay is Interaction {
|
|
16
|
+
IPrepay prepay = IPrepay(0x0000000000000000000000000000000000000000);
|
|
17
|
+
|
|
18
|
+
function __interact(address deployer) internal override {
|
|
19
|
+
uint256 expectedAmount = 1000;
|
|
20
|
+
uint256 totalAmount = prepay.calculateMembershipPrepayFee(expectedAmount);
|
|
21
|
+
|
|
22
|
+
console.log("paying:", totalAmount);
|
|
23
|
+
|
|
24
|
+
vm.startBroadcast(deployer);
|
|
25
|
+
IPrepay(prepay).prepayMembership{value: totalAmount}(expectedAmount);
|
|
26
|
+
vm.stopBroadcast();
|
|
27
|
+
|
|
28
|
+
console.log("prepaidSupply", prepay.prepaidMembershipSupply());
|
|
29
|
+
}
|
|
30
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
pragma solidity ^0.8.23;
|
|
3
|
+
|
|
4
|
+
//interfaces
|
|
5
|
+
import {IAppRegistry} from "src/apps/facets/registry/IAppRegistry.sol";
|
|
6
|
+
|
|
7
|
+
//contracts
|
|
8
|
+
import {Interaction} from "../common/Interaction.s.sol";
|
|
9
|
+
import {SimpleApp} from "src/apps/helpers/SimpleApp.sol";
|
|
10
|
+
import {IAppRegistryBase} from "src/apps/facets/registry/IAppRegistry.sol";
|
|
11
|
+
|
|
12
|
+
contract InteractRegisterApp is Interaction, IAppRegistryBase {
|
|
13
|
+
function __interact(address deployer) internal override {
|
|
14
|
+
address appRegistry = getDeployment("appRegistry");
|
|
15
|
+
|
|
16
|
+
// update with the bot public keys you want to register
|
|
17
|
+
address client = deployer; // update this with you public key bot address
|
|
18
|
+
|
|
19
|
+
// update with the permissions you want to set for the app
|
|
20
|
+
bytes32[] memory permissions = new bytes32[](1);
|
|
21
|
+
permissions[0] = bytes32("Read");
|
|
22
|
+
|
|
23
|
+
uint256 installPrice = 0.001 ether;
|
|
24
|
+
uint48 accessDuration = 365 days;
|
|
25
|
+
|
|
26
|
+
AppParams memory appData = AppParams({
|
|
27
|
+
name: "simple.app",
|
|
28
|
+
permissions: permissions,
|
|
29
|
+
client: client,
|
|
30
|
+
installPrice: installPrice,
|
|
31
|
+
accessDuration: accessDuration
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
vm.broadcast(deployer);
|
|
35
|
+
(address app, bytes32 appId) = IAppRegistry(appRegistry).createApp(appData);
|
|
36
|
+
|
|
37
|
+
saveApp("SimpleApp", appId, address(app));
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
function saveApp(string memory versionName, bytes32 appId, address contractAddr) internal {
|
|
41
|
+
if (!shouldSaveDeployments()) {
|
|
42
|
+
debug("(set SAVE_DEPLOYMENTS=1 to save deployments to file)");
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
string memory networkDir = networkDirPath();
|
|
47
|
+
|
|
48
|
+
// create addresses directory
|
|
49
|
+
createDir(string.concat(networkDir, "/apps"));
|
|
50
|
+
|
|
51
|
+
// get deployment path
|
|
52
|
+
string memory path = string.concat(networkDir, "/apps/", versionName, ".json");
|
|
53
|
+
|
|
54
|
+
// save deployment
|
|
55
|
+
debug("saving deployment to: ", path);
|
|
56
|
+
string memory contractJson = vm.serializeAddress("apps", "address", contractAddr);
|
|
57
|
+
string memory appJson = vm.serializeBytes32("apps", "appId", appId);
|
|
58
|
+
vm.writeJson(contractJson, path);
|
|
59
|
+
vm.writeJson(appJson, path);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
pragma solidity ^0.8.23;
|
|
3
|
+
|
|
4
|
+
// interfaces
|
|
5
|
+
import {IDiamondCut} from "@towns-protocol/diamond/src/facets/cut/IDiamondCut.sol";
|
|
6
|
+
|
|
7
|
+
// libraries
|
|
8
|
+
|
|
9
|
+
// contracts
|
|
10
|
+
import {AlphaHelper} from "scripts/interactions/helpers/AlphaHelper.sol";
|
|
11
|
+
|
|
12
|
+
import {DeployRiverRegistry} from "scripts/deployments/diamonds/DeployRiverRegistry.s.sol";
|
|
13
|
+
|
|
14
|
+
contract InteractRiverAlpha is AlphaHelper {
|
|
15
|
+
DeployRiverRegistry deployRiverRegistry = new DeployRiverRegistry();
|
|
16
|
+
|
|
17
|
+
function __interact(address deployer) internal override {
|
|
18
|
+
vm.setEnv("OVERRIDE_DEPLOYMENTS", "1");
|
|
19
|
+
address riverRegistry = getDeployment("riverRegistry");
|
|
20
|
+
|
|
21
|
+
removeRemoteFacets(deployer, riverRegistry);
|
|
22
|
+
FacetCut[] memory newCuts;
|
|
23
|
+
|
|
24
|
+
deployRiverRegistry.diamondInitParams(deployer);
|
|
25
|
+
newCuts = deployRiverRegistry.getCuts();
|
|
26
|
+
|
|
27
|
+
vm.broadcast(deployer);
|
|
28
|
+
IDiamondCut(riverRegistry).diamondCut(newCuts, address(0), "");
|
|
29
|
+
}
|
|
30
|
+
}
|