@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,66 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
pragma solidity ^0.8.19;
|
|
3
|
+
|
|
4
|
+
//interfaces
|
|
5
|
+
import {ITownsBase} from "src/tokens/towns/mainnet/ITowns.sol";
|
|
6
|
+
|
|
7
|
+
//libraries
|
|
8
|
+
|
|
9
|
+
//contracts
|
|
10
|
+
import {Deployer} from "scripts/common/Deployer.s.sol";
|
|
11
|
+
import {Towns} from "src/tokens/towns/mainnet/Towns.sol";
|
|
12
|
+
|
|
13
|
+
contract DeployTownsMainnet is Deployer, ITownsBase {
|
|
14
|
+
address public manager;
|
|
15
|
+
address public vault;
|
|
16
|
+
|
|
17
|
+
function inflationConfig(address _manager) public pure returns (InflationConfig memory) {
|
|
18
|
+
return
|
|
19
|
+
InflationConfig({
|
|
20
|
+
initialMintTime: 1_709_667_671, // Tuesday, March 5, 2024 7:41:11 PM
|
|
21
|
+
initialInflationRate: 800,
|
|
22
|
+
finalInflationRate: 200,
|
|
23
|
+
inflationDecayRate: 600,
|
|
24
|
+
finalInflationYears: 20,
|
|
25
|
+
inflationReceiver: _manager
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
function versionName() public pure override returns (string memory) {
|
|
30
|
+
return "townsMainnet";
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
function __deploy(address deployer) internal override returns (address) {
|
|
34
|
+
manager = _getManager();
|
|
35
|
+
vault = _getVault();
|
|
36
|
+
InflationConfig memory config = inflationConfig(manager);
|
|
37
|
+
|
|
38
|
+
vm.broadcast(deployer);
|
|
39
|
+
return address(new Towns({vault: vault, manager: manager, config: config}));
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
function _getVault() internal view returns (address) {
|
|
43
|
+
// Mainnet
|
|
44
|
+
if (block.chainid == 1) {
|
|
45
|
+
return address(0x23b168657744124360d3553F3bc257f3E28cBaf9);
|
|
46
|
+
} else if (block.chainid == 11_155_111) {
|
|
47
|
+
return address(0x23b168657744124360d3553F3bc257f3E28cBaf9);
|
|
48
|
+
} else if (block.chainid == 31_337 || block.chainid == 31_338) {
|
|
49
|
+
return address(0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266); // anvil deployer
|
|
50
|
+
} else {
|
|
51
|
+
revert("DeployTownsMainnet: Invalid network");
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
function _getManager() internal view returns (address) {
|
|
56
|
+
if (block.chainid == 1) {
|
|
57
|
+
return address(0x18038ee5692FCE1cc0B0b3F2D63e09639A597F94);
|
|
58
|
+
} else if (block.chainid == 11_155_111) {
|
|
59
|
+
return address(0x18038ee5692FCE1cc0B0b3F2D63e09639A597F94);
|
|
60
|
+
} else if (block.chainid == 31_337 || block.chainid == 31_338) {
|
|
61
|
+
return address(0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266); // anvil deployer
|
|
62
|
+
} else {
|
|
63
|
+
revert("DeployTownsMainnet: Invalid network");
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
pragma solidity ^0.8.23;
|
|
3
|
+
|
|
4
|
+
// interfaces
|
|
5
|
+
import {IMessageLibManager} from "@layerzerolabs/lz-evm-protocol-v2/contracts/interfaces/IMessageLibManager.sol";
|
|
6
|
+
|
|
7
|
+
// libraries
|
|
8
|
+
import {LibLayerZeroValues} from "./LibLayerZeroValues.sol";
|
|
9
|
+
import {Create2Utils} from "../../../src/utils/libraries/Create2Utils.sol";
|
|
10
|
+
|
|
11
|
+
// contracts
|
|
12
|
+
import {Towns} from "../../../src/tokens/towns/multichain/Towns.sol";
|
|
13
|
+
import {Deployer} from "scripts/common/Deployer.s.sol";
|
|
14
|
+
|
|
15
|
+
contract DeployTownsMulti is Deployer {
|
|
16
|
+
function versionName() public pure override returns (string memory) {
|
|
17
|
+
return "utils/townsBnb";
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
function __deploy(address deployer) internal override returns (address) {
|
|
21
|
+
address endpoint = LibLayerZeroValues.getEndpoint(block.chainid);
|
|
22
|
+
require(endpoint != address(0), "Endpoint not found");
|
|
23
|
+
|
|
24
|
+
IMessageLibManager libManager = IMessageLibManager(endpoint);
|
|
25
|
+
|
|
26
|
+
bytes memory initCode = abi.encodePacked(
|
|
27
|
+
type(Towns).creationCode,
|
|
28
|
+
abi.encode("Towns", "TOWNS", endpoint, deployer)
|
|
29
|
+
);
|
|
30
|
+
|
|
31
|
+
vm.startBroadcast(deployer);
|
|
32
|
+
|
|
33
|
+
// test salt, remove before deploying
|
|
34
|
+
bytes32 salt = keccak256(abi.encodePacked(block.chainid, deployer));
|
|
35
|
+
address towns = Create2Utils.create2Deploy(salt, initCode);
|
|
36
|
+
|
|
37
|
+
libManager.setSendLibrary(
|
|
38
|
+
address(towns),
|
|
39
|
+
LibLayerZeroValues.getEid(1), // Destination chain eid (Mainnet)
|
|
40
|
+
LibLayerZeroValues.getSendLib(block.chainid)
|
|
41
|
+
);
|
|
42
|
+
|
|
43
|
+
libManager.setReceiveLibrary(
|
|
44
|
+
address(towns),
|
|
45
|
+
LibLayerZeroValues.getEid(block.chainid), // Source chain eid
|
|
46
|
+
LibLayerZeroValues.getReceiveLib(block.chainid),
|
|
47
|
+
0
|
|
48
|
+
);
|
|
49
|
+
|
|
50
|
+
vm.stopBroadcast();
|
|
51
|
+
return address(towns);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
pragma solidity ^0.8.23;
|
|
3
|
+
|
|
4
|
+
// interfaces
|
|
5
|
+
import {IMessageLibManager} from "@layerzerolabs/lz-evm-protocol-v2/contracts/interfaces/IMessageLibManager.sol";
|
|
6
|
+
|
|
7
|
+
// libraries
|
|
8
|
+
import {LibLayerZeroValues} from "./LibLayerZeroValues.sol";
|
|
9
|
+
import {Create2Utils} from "../../../src/utils/libraries/Create2Utils.sol";
|
|
10
|
+
|
|
11
|
+
// contracts
|
|
12
|
+
import {wTowns} from "../../../src/tokens/towns/multichain/wTowns.sol";
|
|
13
|
+
import {Deployer} from "scripts/common/Deployer.s.sol";
|
|
14
|
+
|
|
15
|
+
contract DeployWrappedTowns is Deployer {
|
|
16
|
+
function versionName() public pure override returns (string memory) {
|
|
17
|
+
return "utils/wrapped-towns";
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
function __deploy(address deployer) internal override returns (address) {
|
|
21
|
+
address endpoint = LibLayerZeroValues.getEndpoint(block.chainid);
|
|
22
|
+
|
|
23
|
+
IMessageLibManager libManager = IMessageLibManager(endpoint);
|
|
24
|
+
|
|
25
|
+
vm.startBroadcast(deployer);
|
|
26
|
+
|
|
27
|
+
bytes memory initCode = abi.encodePacked(
|
|
28
|
+
type(wTowns).creationCode,
|
|
29
|
+
abi.encode(getDeployment("townsMainnet"), endpoint, deployer)
|
|
30
|
+
);
|
|
31
|
+
|
|
32
|
+
bytes32 salt = keccak256(abi.encodePacked(block.chainid, deployer));
|
|
33
|
+
address wrappedTowns = Create2Utils.create2Deploy(salt, initCode);
|
|
34
|
+
|
|
35
|
+
libManager.setSendLibrary(
|
|
36
|
+
wrappedTowns,
|
|
37
|
+
LibLayerZeroValues.getEid(56), // Destination chain eid (BNB Testnet)
|
|
38
|
+
LibLayerZeroValues.getSendLib(block.chainid)
|
|
39
|
+
);
|
|
40
|
+
|
|
41
|
+
libManager.setReceiveLibrary(
|
|
42
|
+
wrappedTowns,
|
|
43
|
+
LibLayerZeroValues.getEid(block.chainid), // Source chain eid
|
|
44
|
+
LibLayerZeroValues.getReceiveLib(block.chainid),
|
|
45
|
+
0
|
|
46
|
+
);
|
|
47
|
+
|
|
48
|
+
vm.stopBroadcast();
|
|
49
|
+
|
|
50
|
+
return wrappedTowns;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
pragma solidity ^0.8.23;
|
|
3
|
+
|
|
4
|
+
library LibLayerZeroValues {
|
|
5
|
+
function getEndpoint(uint256 chainId) internal pure returns (address) {
|
|
6
|
+
if (chainId == 1) return 0x1a44076050125825900e736c501f859c50fE728c; // Mainnet
|
|
7
|
+
if (chainId == 56) return 0x1a44076050125825900e736c501f859c50fE728c; // Binance
|
|
8
|
+
return address(0);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
function getDeployedToken(uint256 chainId) internal pure returns (address) {
|
|
12
|
+
if (chainId == 1) return 0x00000000Bc5Ff0261B97004a79c6D361002Ba2db; // wTowns
|
|
13
|
+
if (chainId == 56) return 0x00000000bcA93b25a6694ca3d2109d545988b13B; // townsBnb
|
|
14
|
+
return address(0);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
function getEid(uint256 chainId) internal pure returns (uint32) {
|
|
18
|
+
if (chainId == 1) return 30101; // Mainnet
|
|
19
|
+
if (chainId == 56) return 30102; // Binance
|
|
20
|
+
return 0;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
function getSendLib(uint256 chainId) internal pure returns (address) {
|
|
24
|
+
if (chainId == 1) return 0xbB2Ea70C9E858123480642Cf96acbcCE1372dCe1; // Mainnet
|
|
25
|
+
if (chainId == 56) return 0x9F8C645f2D0b2159767Bd6E0839DE4BE49e823DE; // Binance
|
|
26
|
+
return address(0);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
function getReceiveLib(uint256 chainId) internal pure returns (address) {
|
|
30
|
+
if (chainId == 1) return 0xc02Ab410f0734EFa3F14628780e6e695156024C2; // Mainnet
|
|
31
|
+
if (chainId == 56) return 0xB217266c3A98C8B2709Ee26836C98cf12f6cCEC1; // Binance
|
|
32
|
+
return address(0);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
pragma solidity ^0.8.23;
|
|
3
|
+
|
|
4
|
+
//interfaces
|
|
5
|
+
|
|
6
|
+
//libraries
|
|
7
|
+
|
|
8
|
+
//contracts
|
|
9
|
+
import {Deployer} from "scripts/common/Deployer.s.sol";
|
|
10
|
+
import {MockAggregatorV3} from "test/mocks/MockAggregatorV3.sol";
|
|
11
|
+
|
|
12
|
+
abstract contract TieredLogPricing is Deployer {
|
|
13
|
+
int256 public constant EXCHANGE_RATE = 222_616_000_000;
|
|
14
|
+
|
|
15
|
+
function _getOracleAddress() internal view returns (address) {
|
|
16
|
+
if (block.chainid == 8453) {
|
|
17
|
+
// Base
|
|
18
|
+
return 0x71041dddad3595F9CEd3DcCFBe3D1F4b0a16Bb70;
|
|
19
|
+
} else if (block.chainid == 84_532) {
|
|
20
|
+
// Base (Sepolia)
|
|
21
|
+
return 0x4aDC67696bA383F43DD60A9e78F2C97Fbbfc7cb1;
|
|
22
|
+
} else {
|
|
23
|
+
revert("DeployTieredLogPricing: Invalid network");
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function _setupLocalOracle(address deployer) internal returns (address) {
|
|
28
|
+
vm.startBroadcast(deployer);
|
|
29
|
+
MockAggregatorV3 oracle = new MockAggregatorV3({
|
|
30
|
+
_decimals: 8,
|
|
31
|
+
_description: "ETH/USD",
|
|
32
|
+
_version: 1
|
|
33
|
+
});
|
|
34
|
+
oracle.setRoundData({
|
|
35
|
+
_roundId: 1,
|
|
36
|
+
_answer: EXCHANGE_RATE,
|
|
37
|
+
_startedAt: 0,
|
|
38
|
+
_updatedAt: block.timestamp,
|
|
39
|
+
_answeredInRound: 0
|
|
40
|
+
});
|
|
41
|
+
vm.stopBroadcast();
|
|
42
|
+
|
|
43
|
+
return address(oracle);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
pragma solidity ^0.8.23;
|
|
3
|
+
|
|
4
|
+
//interfaces
|
|
5
|
+
import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
|
|
6
|
+
//libraries
|
|
7
|
+
|
|
8
|
+
//contracts
|
|
9
|
+
import {Interaction} from "../common/Interaction.s.sol";
|
|
10
|
+
import {Airdrop} from "src/utils/Airdrop.sol";
|
|
11
|
+
|
|
12
|
+
contract InteractAirdrop is Interaction {
|
|
13
|
+
struct Wallet {
|
|
14
|
+
address account;
|
|
15
|
+
uint256 amount;
|
|
16
|
+
string label;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
struct InputData {
|
|
20
|
+
address airdrop;
|
|
21
|
+
address token;
|
|
22
|
+
Wallet[] wallets;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
function __interact(address deployer) internal override {
|
|
26
|
+
// Read JSON file and parse wallet data
|
|
27
|
+
string memory root = vm.projectRoot();
|
|
28
|
+
string memory path = string.concat(root, "/contracts/in/airdrop-input-data.json");
|
|
29
|
+
|
|
30
|
+
string memory json = vm.readFile(path);
|
|
31
|
+
bytes memory parsedJson = vm.parseJson(json);
|
|
32
|
+
|
|
33
|
+
InputData memory data = abi.decode(parsedJson, (InputData));
|
|
34
|
+
|
|
35
|
+
uint256 totalAccounts = data.wallets.length;
|
|
36
|
+
|
|
37
|
+
address[] memory addresses = new address[](totalAccounts);
|
|
38
|
+
uint256[] memory amounts = new uint256[](totalAccounts);
|
|
39
|
+
|
|
40
|
+
uint256 totalAmount = 0;
|
|
41
|
+
for (uint256 i = 0; i < totalAccounts; i++) {
|
|
42
|
+
addresses[i] = data.wallets[i].account;
|
|
43
|
+
amounts[i] = data.wallets[i].amount;
|
|
44
|
+
totalAmount += data.wallets[i].amount;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
vm.startBroadcast(deployer);
|
|
48
|
+
IERC20(data.token).approve(data.airdrop, totalAmount);
|
|
49
|
+
Airdrop(data.airdrop).airdropERC20({
|
|
50
|
+
token: data.token,
|
|
51
|
+
addresses: addresses,
|
|
52
|
+
amounts: amounts,
|
|
53
|
+
totalAmount: totalAmount
|
|
54
|
+
});
|
|
55
|
+
vm.stopBroadcast();
|
|
56
|
+
}
|
|
57
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
pragma solidity ^0.8.23;
|
|
3
|
+
|
|
4
|
+
// interfaces
|
|
5
|
+
import {IArchitect} from "src/factory/facets/architect/IArchitect.sol";
|
|
6
|
+
|
|
7
|
+
import {IPricingModules} from "src/factory/facets/architect/pricing/IPricingModules.sol";
|
|
8
|
+
import {ISpaceProxyInitializer} from "src/spaces/facets/proxy/ISpaceProxyInitializer.sol";
|
|
9
|
+
|
|
10
|
+
// deployment
|
|
11
|
+
import {DeployTieredLogPricingV3} from "scripts/deployments/utils/DeployTieredLogPricingV3.s.sol";
|
|
12
|
+
|
|
13
|
+
// contracts
|
|
14
|
+
import {Interaction} from "scripts/common/Interaction.s.sol";
|
|
15
|
+
|
|
16
|
+
contract InteractAlphaPost is Interaction {
|
|
17
|
+
DeployTieredLogPricingV3 deployTieredLogPricingV3 = new DeployTieredLogPricingV3();
|
|
18
|
+
|
|
19
|
+
function __interact(address deployer) internal override {
|
|
20
|
+
address spaceFactory = getDeployment("spaceFactory");
|
|
21
|
+
|
|
22
|
+
vm.setEnv("OVERRIDE_DEPLOYMENTS", "1");
|
|
23
|
+
vm.broadcast(deployer);
|
|
24
|
+
address spaceProxyInitializer = deployCode("SpaceProxyInitializer.sol", "");
|
|
25
|
+
address tieredLogPricing = deployTieredLogPricingV3.deploy(deployer);
|
|
26
|
+
|
|
27
|
+
vm.startBroadcast(deployer);
|
|
28
|
+
IArchitect(spaceFactory).setProxyInitializer(ISpaceProxyInitializer(spaceProxyInitializer));
|
|
29
|
+
IPricingModules(spaceFactory).addPricingModule(tieredLogPricing);
|
|
30
|
+
vm.stopBroadcast();
|
|
31
|
+
}
|
|
32
|
+
}
|
|
@@ -0,0 +1,173 @@
|
|
|
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
|
+
import {IDiamondInitHelper} from "../deployments/diamonds/IDiamondInitHelper.sol";
|
|
7
|
+
|
|
8
|
+
import {DiamondHelper} from "@towns-protocol/diamond/scripts/common/helpers/DiamondHelper.s.sol";
|
|
9
|
+
import {Diamond} from "@towns-protocol/diamond/src/Diamond.sol";
|
|
10
|
+
|
|
11
|
+
// libraries
|
|
12
|
+
import {stdJson} from "forge-std/StdJson.sol";
|
|
13
|
+
import "forge-std/console.sol";
|
|
14
|
+
|
|
15
|
+
// contracts
|
|
16
|
+
|
|
17
|
+
import {AlphaHelper, DiamondFacetData, FacetData} from "scripts/interactions/helpers/AlphaHelper.sol";
|
|
18
|
+
|
|
19
|
+
import {DeployBaseRegistry} from "scripts/deployments/diamonds/DeployBaseRegistry.s.sol";
|
|
20
|
+
|
|
21
|
+
import {DeployRiverAirdrop} from "scripts/deployments/diamonds/DeployRiverAirdrop.s.sol";
|
|
22
|
+
import {DeploySpace} from "scripts/deployments/diamonds/DeploySpace.s.sol";
|
|
23
|
+
import {DeploySpaceFactory} from "scripts/deployments/diamonds/DeploySpaceFactory.s.sol";
|
|
24
|
+
import {DeploySpaceOwner} from "scripts/deployments/diamonds/DeploySpaceOwner.s.sol";
|
|
25
|
+
|
|
26
|
+
contract InteractAlphaSparse is AlphaHelper {
|
|
27
|
+
using stdJson for string;
|
|
28
|
+
|
|
29
|
+
mapping(string => address) private diamondDeployments;
|
|
30
|
+
|
|
31
|
+
constructor() {
|
|
32
|
+
// pause to avoid out of gas errors when deploying diamond helpers
|
|
33
|
+
vm.pauseGasMetering();
|
|
34
|
+
|
|
35
|
+
try new DeploySpaceOwner() returns (DeploySpaceOwner spaceOwner) {
|
|
36
|
+
diamondDeployments["spaceOwner"] = address(spaceOwner);
|
|
37
|
+
console.log("spaceOwner deployed to:", address(spaceOwner));
|
|
38
|
+
} catch Error(string memory reason) {
|
|
39
|
+
console.log("Failed to deploy SpaceOwner:", reason);
|
|
40
|
+
} catch (bytes memory) {
|
|
41
|
+
console.log("Failed to deploy SpaceOwner (low level error)");
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
try new DeploySpace() returns (DeploySpace space) {
|
|
45
|
+
diamondDeployments["space"] = address(space);
|
|
46
|
+
console.log("space deployed to:", address(space));
|
|
47
|
+
} catch Error(string memory reason) {
|
|
48
|
+
console.log("Failed to deploy Space:", reason);
|
|
49
|
+
} catch (bytes memory) {
|
|
50
|
+
console.log("Failed to deploy Space (low level error)");
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
try new DeploySpaceFactory() returns (DeploySpaceFactory spaceFactory) {
|
|
54
|
+
diamondDeployments["spaceFactory"] = address(spaceFactory);
|
|
55
|
+
console.log("spaceFactory deployed to:", address(spaceFactory));
|
|
56
|
+
} catch Error(string memory reason) {
|
|
57
|
+
console.log("Failed to deploy SpaceFactory:", reason);
|
|
58
|
+
} catch (bytes memory) {
|
|
59
|
+
console.log("Failed to deploy SpaceFactory (low level error)");
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
try new DeployBaseRegistry() returns (DeployBaseRegistry baseRegistry) {
|
|
63
|
+
diamondDeployments["baseRegistry"] = address(baseRegistry);
|
|
64
|
+
console.log("baseRegistry deployed to:", address(baseRegistry));
|
|
65
|
+
} catch Error(string memory reason) {
|
|
66
|
+
console.log("Failed to deploy BaseRegistry:", reason);
|
|
67
|
+
} catch (bytes memory) {
|
|
68
|
+
console.log("Failed to deploy BaseRegistry (low level error)");
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
try new DeployRiverAirdrop() returns (DeployRiverAirdrop riverAirdrop) {
|
|
72
|
+
diamondDeployments["riverAirdrop"] = address(riverAirdrop);
|
|
73
|
+
console.log("riverAirdrop deployed to:", address(riverAirdrop));
|
|
74
|
+
} catch Error(string memory reason) {
|
|
75
|
+
console.log("Failed to deploy RiverAirdrop:", reason);
|
|
76
|
+
} catch (bytes memory) {
|
|
77
|
+
console.log("Failed to deploy RiverAirdrop (low level error)");
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
vm.resumeGasMetering();
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
string constant DEFAULT_JSON_FILE = "compiled_source_diff.json";
|
|
84
|
+
string constant DEFAULT_REPORT_PATH = "/scripts/bytecode-diff/source-diffs/";
|
|
85
|
+
|
|
86
|
+
string private jsonData;
|
|
87
|
+
|
|
88
|
+
function readJSON(string memory jsonPath) internal {
|
|
89
|
+
jsonData = vm.readFile(jsonPath);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* @notice Decodes diamond and facet data from a JSON file output by the bytecode-diff script
|
|
94
|
+
* @dev Reads the JSON file specified by the DEFAULT_JSON_FILE constant
|
|
95
|
+
* and parses it to extract information about updated diamonds and their facets
|
|
96
|
+
* @return An array of DiamondFacetData structs containing the decoded information
|
|
97
|
+
*/
|
|
98
|
+
function decodeDiamondsFromJSON() internal view returns (DiamondFacetData[] memory) {
|
|
99
|
+
uint256 updatedDiamondLen = abi.decode(vm.parseJson(jsonData, ".numUpdated"), (uint256));
|
|
100
|
+
DiamondFacetData[] memory diamonds = new DiamondFacetData[](updatedDiamondLen);
|
|
101
|
+
|
|
102
|
+
for (uint256 i = 0; i < updatedDiamondLen; i++) {
|
|
103
|
+
// Decode diamond name and number of facets
|
|
104
|
+
DiamondFacetData memory diamondData = abi.decode(
|
|
105
|
+
vm.parseJson(jsonData, string.concat("$.updated[", vm.toString(i), "]")),
|
|
106
|
+
(DiamondFacetData)
|
|
107
|
+
);
|
|
108
|
+
|
|
109
|
+
diamonds[i] = diamondData;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
return diamonds;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* @notice Processes diamond and facet updates based on JSON input
|
|
117
|
+
* @dev This function reads a JSON file containing information about diamond and facet updates,
|
|
118
|
+
* then applies these updates to the corresponding diamonds. It performs the following
|
|
119
|
+
* steps:
|
|
120
|
+
* 1. Sets the OVERRIDE_DEPLOYMENTS environment variable
|
|
121
|
+
* 2. Determines the JSON input path (either from INTERACTION_INPUT_PATH env var or using a
|
|
122
|
+
* default)
|
|
123
|
+
* 3. Reads and decodes the JSON data
|
|
124
|
+
* 4. Iterates through each diamond update:
|
|
125
|
+
* - Identifies the diamond type (space, spaceOwner, spaceFactory, or baseRegistry)
|
|
126
|
+
* - Removes existing facets that are to be updated
|
|
127
|
+
* - Prepares new facet cuts
|
|
128
|
+
* - Executes a diamondCut operation to apply the updates
|
|
129
|
+
* @param deployer The address of the account that will deploy and interact with the contracts
|
|
130
|
+
*/
|
|
131
|
+
function __interact(address deployer) internal override {
|
|
132
|
+
vm.setEnv("OVERRIDE_DEPLOYMENTS", "1");
|
|
133
|
+
|
|
134
|
+
string memory jsonPath;
|
|
135
|
+
try vm.envString("INTERACTION_INPUT_PATH") returns (string memory path) {
|
|
136
|
+
jsonPath = path;
|
|
137
|
+
} catch {
|
|
138
|
+
jsonPath = string.concat(vm.projectRoot(), DEFAULT_REPORT_PATH, DEFAULT_JSON_FILE);
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
readJSON(jsonPath);
|
|
142
|
+
DiamondFacetData[] memory diamonds = decodeDiamondsFromJSON();
|
|
143
|
+
console.log("interact::diamonds decoded", diamonds.length);
|
|
144
|
+
|
|
145
|
+
// Iterate over diamonds array and process each diamond
|
|
146
|
+
for (uint256 i = 0; i < diamonds.length; i++) {
|
|
147
|
+
console.log("interact::diamondName", diamonds[i].diamond);
|
|
148
|
+
string memory diamondName = diamonds[i].diamond;
|
|
149
|
+
address diamondDeployedAddress;
|
|
150
|
+
FacetCut[] memory newCuts;
|
|
151
|
+
uint256 numFacets = diamonds[i].facets.length;
|
|
152
|
+
string[] memory facetNames = new string[](numFacets);
|
|
153
|
+
address[] memory facetAddresses = new address[](numFacets);
|
|
154
|
+
|
|
155
|
+
for (uint256 j = 0; j < numFacets; j++) {
|
|
156
|
+
FacetData memory facetData = diamonds[i].facets[j];
|
|
157
|
+
facetAddresses[j] = facetData.deployedAddress;
|
|
158
|
+
facetNames[j] = facetData.facetName;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
address diamondHelper = diamondDeployments[diamondName];
|
|
162
|
+
if (diamondHelper != address(0)) {
|
|
163
|
+
console.log("interact::diamondDeployedName", diamondName);
|
|
164
|
+
diamondDeployedAddress = getDeployment(diamondName);
|
|
165
|
+
removeRemoteFacetsByAddresses(deployer, diamondDeployedAddress, facetAddresses);
|
|
166
|
+
newCuts = IDiamondInitHelper(diamondHelper).diamondInitHelper(deployer, facetNames);
|
|
167
|
+
|
|
168
|
+
vm.broadcast(deployer);
|
|
169
|
+
IDiamondCut(diamondDeployedAddress).diamondCut(newCuts, address(0), "");
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
}
|
|
@@ -0,0 +1,84 @@
|
|
|
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 {DeployBaseRegistry} from "scripts/deployments/diamonds/DeployBaseRegistry.s.sol";
|
|
11
|
+
import {DeployRiverAirdrop} from "scripts/deployments/diamonds/DeployRiverAirdrop.s.sol";
|
|
12
|
+
import {DeploySpace} from "scripts/deployments/diamonds/DeploySpace.s.sol";
|
|
13
|
+
import {DeploySpaceFactory} from "scripts/deployments/diamonds/DeploySpaceFactory.s.sol";
|
|
14
|
+
import {DeploySpaceOwner} from "scripts/deployments/diamonds/DeploySpaceOwner.s.sol";
|
|
15
|
+
import {AlphaHelper} from "scripts/interactions/helpers/AlphaHelper.sol";
|
|
16
|
+
|
|
17
|
+
contract InteractBaseAlpha is AlphaHelper {
|
|
18
|
+
DeploySpace deploySpace = new DeploySpace();
|
|
19
|
+
DeploySpaceFactory deploySpaceFactory = new DeploySpaceFactory();
|
|
20
|
+
DeployBaseRegistry deployBaseRegistry = new DeployBaseRegistry();
|
|
21
|
+
DeploySpaceOwner deploySpaceOwner = new DeploySpaceOwner();
|
|
22
|
+
DeployRiverAirdrop deployRiverAirdrop = new DeployRiverAirdrop();
|
|
23
|
+
|
|
24
|
+
function __interact(address deployer) internal override {
|
|
25
|
+
vm.setEnv("OVERRIDE_DEPLOYMENTS", "1");
|
|
26
|
+
address space = getDeployment("space");
|
|
27
|
+
address spaceOwner = getDeployment("spaceOwner");
|
|
28
|
+
address spaceFactory = getDeployment("spaceFactory");
|
|
29
|
+
address baseRegistry = getDeployment("baseRegistry");
|
|
30
|
+
address riverAirdrop = getDeployment("riverAirdrop");
|
|
31
|
+
|
|
32
|
+
vm.pauseGasMetering();
|
|
33
|
+
removeRemoteFacets(deployer, space);
|
|
34
|
+
removeRemoteFacets(deployer, spaceOwner);
|
|
35
|
+
removeRemoteFacets(deployer, spaceFactory);
|
|
36
|
+
removeRemoteFacets(deployer, baseRegistry);
|
|
37
|
+
removeRemoteFacets(deployer, riverAirdrop);
|
|
38
|
+
|
|
39
|
+
deploySpaceCuts(deployer, space);
|
|
40
|
+
deploySpaceOwnerCuts(deployer, spaceOwner);
|
|
41
|
+
deploySpaceFactoryCuts(deployer, spaceFactory);
|
|
42
|
+
deployBaseRegistryCuts(deployer, baseRegistry);
|
|
43
|
+
deployRiverAirdropCuts(deployer, riverAirdrop);
|
|
44
|
+
|
|
45
|
+
vm.resumeGasMetering();
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
function deploySpaceCuts(address deployer, address space) internal {
|
|
49
|
+
deploySpace.diamondInitParams(deployer);
|
|
50
|
+
FacetCut[] memory newCuts = deploySpace.getCuts();
|
|
51
|
+
vm.broadcast(deployer);
|
|
52
|
+
IDiamondCut(space).diamondCut(newCuts, address(0), "");
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
function deploySpaceOwnerCuts(address deployer, address spaceOwner) internal {
|
|
56
|
+
deploySpaceOwner.diamondInitParams(deployer);
|
|
57
|
+
FacetCut[] memory newCuts = deploySpaceOwner.getCuts();
|
|
58
|
+
vm.broadcast(deployer);
|
|
59
|
+
IDiamondCut(spaceOwner).diamondCut(newCuts, address(0), "");
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
function deploySpaceFactoryCuts(address deployer, address spaceFactory) internal {
|
|
63
|
+
deploySpaceFactory.diamondInitParams(deployer);
|
|
64
|
+
FacetCut[] memory newCuts = deploySpaceFactory.getCuts();
|
|
65
|
+
address spaceFactoryInit = deploySpaceFactory.spaceFactoryInit();
|
|
66
|
+
bytes memory initData = deploySpaceFactory.spaceFactoryInitData();
|
|
67
|
+
vm.broadcast(deployer);
|
|
68
|
+
IDiamondCut(spaceFactory).diamondCut(newCuts, spaceFactoryInit, initData);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
function deployBaseRegistryCuts(address deployer, address baseRegistry) internal {
|
|
72
|
+
deployBaseRegistry.diamondInitParams(deployer);
|
|
73
|
+
FacetCut[] memory newCuts = deployBaseRegistry.getCuts();
|
|
74
|
+
vm.broadcast(deployer);
|
|
75
|
+
IDiamondCut(baseRegistry).diamondCut(newCuts, address(0), "");
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
function deployRiverAirdropCuts(address deployer, address riverAirdrop) internal {
|
|
79
|
+
deployRiverAirdrop.diamondInitParams(deployer);
|
|
80
|
+
FacetCut[] memory newCuts = deployRiverAirdrop.getCuts();
|
|
81
|
+
vm.broadcast(deployer);
|
|
82
|
+
IDiamondCut(riverAirdrop).diamondCut(newCuts, address(0), "");
|
|
83
|
+
}
|
|
84
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
pragma solidity ^0.8.23;
|
|
3
|
+
|
|
4
|
+
//interfaces
|
|
5
|
+
|
|
6
|
+
import {IL1StandardBridge} from "./interfaces/IL1StandardBridge.sol";
|
|
7
|
+
import {IL2StandardBridge} from "./interfaces/IL2StandardBridge.sol";
|
|
8
|
+
import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
|
|
9
|
+
|
|
10
|
+
//libraries
|
|
11
|
+
|
|
12
|
+
//contracts
|
|
13
|
+
import {Interaction} from "../common/Interaction.s.sol";
|
|
14
|
+
|
|
15
|
+
contract InteractBaseBridge is Interaction {
|
|
16
|
+
address l1StandardBridge = 0xfd0Bf71F60660E2f608ed56e1659C450eB113120;
|
|
17
|
+
address l2StandardBridge = 0x4200000000000000000000000000000000000010;
|
|
18
|
+
|
|
19
|
+
address townsOnSepolia = 0x000000Fa00b200406de700041CFc6b19BbFB4d13;
|
|
20
|
+
address townsOnBaseSepolia = 0x00000000A22C618fd6b4D7E9A335C4B96B189a38;
|
|
21
|
+
uint256 tokensToDeposit = 10 ether;
|
|
22
|
+
|
|
23
|
+
function __interact(address deployer) internal override {
|
|
24
|
+
// Bridge from Base Sepolia to Sepolia
|
|
25
|
+
// vm.startBroadcast(deployer);
|
|
26
|
+
// IERC20(townsOnBaseSepolia).approve(l2StandardBridge, tokensToDeposit);
|
|
27
|
+
// IL2StandardBridge(l2StandardBridge).bridgeERC20({
|
|
28
|
+
// _localToken: townsOnBaseSepolia,
|
|
29
|
+
// _remoteToken: townsOnSepolia,
|
|
30
|
+
// _amount: tokensToDeposit,
|
|
31
|
+
// _minGasLimit: 100000,
|
|
32
|
+
// _extraData: ""
|
|
33
|
+
// });
|
|
34
|
+
// vm.stopBroadcast();
|
|
35
|
+
|
|
36
|
+
// Bridge from Sepolia to Base Sepolia
|
|
37
|
+
vm.startBroadcast(deployer);
|
|
38
|
+
IERC20(townsOnSepolia).approve(l1StandardBridge, tokensToDeposit);
|
|
39
|
+
IL1StandardBridge(l1StandardBridge).depositERC20({
|
|
40
|
+
_l1Token: townsOnSepolia,
|
|
41
|
+
_l2Token: townsOnBaseSepolia,
|
|
42
|
+
_amount: tokensToDeposit,
|
|
43
|
+
_minGasLimit: 100_000,
|
|
44
|
+
_extraData: ""
|
|
45
|
+
});
|
|
46
|
+
vm.stopBroadcast();
|
|
47
|
+
}
|
|
48
|
+
}
|