For the complete documentation index, see llms.txt. This page is also available as Markdown.

ProtocolManagerDeployment

Overview

ProtocolManagerDeployment is a standalone deployment-phase manager for PMD market setup. It atomically lists a two-token isolated market, seeds the cToken dead-share reserves, pauses minting on both tokens, writes both token configs, and records a one-time mint-unpause allowance for that market.

The contract does not inherit ProtocolManager because it does not need period-limit tracking or a managed-address registry. Its surface is intentionally small: deploy a market, consume the one-time mint unpause, or revoke that unpause allowance.

Core Architecture

Item
Getter
Purpose

Central registry

centralRegistry()

Used to validate market-manager registration and market-permission callers.

Deployment owner

owner()

Address authorized to call deployMarket() and unpauseMarket().

Reserve amount

BASE_UNDERLYING_RESERVE()

77777 raw units of each underlying asset, matching the cToken initialization reserve.

Pending unpause state

pendingUnpause(address)

One-time mint-unpause allowance keyed by market manager.

The deployed ProtocolManagerDeployment contract must have market permissions in CentralRegistry before it can call listTokens(), setMintPaused(), or updateTokenConfig() on MarketManagerIsolated.

Deployment Flow

deployMarket() performs this sequence:

  1. Checks that msg.sender == owner.

  2. Checks that config0.cToken == token0 and config1.cToken == token1.

  3. Checks that centralRegistry.isMarketManager(marketManager) is true.

  4. Reads each cToken's underlying asset through ICToken.asset().

  5. Rejects the call if either underlying address has no code.

  6. Pulls 77777 raw units of each underlying from the caller.

  7. Approves each cToken to spend its corresponding reserve amount.

  8. Calls MarketManagerIsolated.listTokens(token0, token1).

  9. Pauses minting on both listed tokens.

  10. Calls updateTokenConfig() for both token configs.

  11. Sets pendingUnpause[marketManager] = true.

The reserve transfer happens before listing so listTokens() can call each cToken's initializeDeposits() path and pull the reserve from ProtocolManagerDeployment.

Token Config Shape

deployMarket() accepts two MarketManagerIsolated.TokenConfig structs. The field order is:

ProtocolManagerDeployment only checks the cToken address matches the explicit token argument. The full token-config validation is enforced by MarketManagerIsolated.updateTokenConfig().

One-Time Mint Unpause

unpauseMarket() consumes pendingUnpause[marketManager], reads the market's listed tokens with queryTokensListed(), and calls setMintPaused(token, false) for every listed token.

This unpause is intentionally narrow:

  • It only affects mint pause flags.

  • It does not change collateralization, borrow, liquidation, redeem, or transfer pause flags.

  • It can only be used while pendingUnpause[marketManager] is true.

  • A second unpauseMarket() call for the same allowance reverts with ProtocolManagerDeployment__NoPendingUnpause().

revokeUnpause() deletes the pending allowance without changing any market pause flags. It is callable by the deployment owner or by any address with market permissions, and it is idempotent.

Deployment Scripts

script/deployment/DeployProtocolManager_Deployment.s.sol deploys this manager:

The script emits ContractDeployed(address(pm), "ProtocolManagerDeployment") through the shared deployment recorder.

After deployment, grant the new contract market permissions before using it:

script/deployment/RevokeProtocolManagerDeploymentUnpause.s.sol clears a pending allowance:

Events and Errors

ProtocolManagerDeployment does not define custom events. Downstream calls emit market events such as TokenListed, TokenActionPaused, and TokenConfigUpdated.

Error
Meaning

ProtocolManagerDeployment__Unauthorized()

Caller is not authorized for the requested operation.

ProtocolManagerDeployment__ParametersAreInvalid()

Constructor owner is zero, token config does not match token argument, market is unregistered, or an underlying asset has no code.

ProtocolManagerDeployment__NoPendingUnpause()

unpauseMarket() was called without an active pending allowance.

Integration Considerations

  • The owner must approve ProtocolManagerDeployment for 77777 raw units of each underlying asset before calling deployMarket().

  • The target market manager must already be registered in CentralRegistry.

  • The manager contract must already have market permissions.

  • Expect minting to be paused immediately after deployMarket().

  • Use pendingUnpause(marketManager) to check whether the one-time mint unpause is still available.

  • Use revokeUnpause() to clear stale allowances before relying on another actor's pause state.

  • Do not treat unpauseMarket() as a general unpause tool. It only unpauses minting on the market's listed tokens.

Callable Functions

Constructor

Validates the central registry, rejects a zero owner, and stores both immutable values.

Reads

Use these reads to inspect the deployment authority, reserve requirement, registry, and pending mint-unpause state.

Market Deployment

Lists the two cTokens, initializes the cToken reserve deposits, pauses minting for both tokens, writes both token configs, and records a pending one-time mint unpause.

Mint Unpause

Consumes the pending allowance for marketManager and unpauses minting for every token returned by queryTokensListed().

Allowance Revocation

Deletes the pending allowance for marketManager. The caller must be the owner or have market permissions in CentralRegistry.

Last updated

Was this helpful?