The project includes deploy and upgrade scripts.
Foundry runbooks: Day-two operations (contract upgrades, single-contract redeployments, parameter changes via wallet or Fireblocks) are documented next to the scripts under script/. Start with script/upgrades/settlement-chain/README.md and script/single-deployments/settlement-chain/README.md. Greenfield environment rollout in this document uses the ./dev/* shell helpers, which wrap forge script (for example script/Deploy.s.sol).
-
The
FeeTokenmust be a singleton contract with respect to all XMTP App Chains that use it as their underlying gas token, so its deployment on a blockchain is not per-environment, but rather per set of XMTP App Chains that roll up to the XMTP Settlement Chain. TheFeeTokenrelies on a singleParameterRegistryon the XMTP Settlement Chain (i.e., for migration purposes). -
The
Gatewaymust be a singleton contract with respect to all XMTP App Chains in an environment, and handles bridging parameters and the Fee Token between a singleParameterRegistryon its chain and theParameterRegistryon the XMTP App Chains. It also relies on a singleParameterRegistry(i.e., for migration purposes). -
The
Factorymust be a singleton contract with respect to a set of contracts in an environment (i.e., for theFeeToken,ParameterRegistry, andGateway) to deploy them at deterministic and consistent addresses across all chains. It also relies on a singleParameterRegistry(i.e., for migration purposes). -
The
ParameterRegistrymust be a singleton contract with respect to a set of contracts in an environment (i.e., for theFeeToken,Factory, andGateway) to be a source of administrated parameter values.
Because of the above, for each XMTP Settlement Chain, regardless of environment, a set of base contracts must be deployed only once. This deployment includes the Factory, SettlementChainParameterRegistry, FeeToken (and MockUnderlyingFeeToken if it is a testnet), and SettlementChainGateway for the XMTP Settlement Chain, and the Factory, AppChainParameterRegistry, and AppChainGateway for the XMTP App Chain. These are called the "base contracts" because they are the base contracts that are required before any environment-specific contracts are deployed.
These base contracts are deployed via:
./dev/deploy-base <CHAIN_NAME>They are verified via:
./dev/verify-base <CHAIN_NAME> basescan
./dev/verify-base <CHAIN_NAME> blockscoutThis deployment includes the PayerRegistry, RateRegistry, NodeRegistry, PayerReportManager, DistributionManager, and DepositSplitter for the XMTP Settlement Chain, and the GroupMessageBroadcaster, IdentityUpdateBroadcaster for the XMTP App Chain.
These are deployed via:
./dev/deploy <ENVIRONMENT> settlement-chain
./dev/deploy <ENVIRONMENT> app-chainThey are verified via:
./dev/verify <ENVIRONMENT> settlement-chain basescan
./dev/verify <ENVIRONMENT> settlement-chain blockscout
./dev/verify <ENVIRONMENT> app-chain alchemyThe starting parameters are defined via:
./dev/set-starting-parameters <ENVIRONMENT>The parameters are applied at each XMTP Settlement Chain contract via:
./dev/update-starting-parameters <ENVIRONMENT> settlement-chainSome parameters are bridged to the XMTP App Chain via:
./dev/bridge-starting-parameters <ENVIRONMENT>The parameters are applied at each XMTP App Chain contract via:
./dev/update-starting-parameters <ENVIRONMENT> app-chain