Skip to content

Contract architecture

The engine owns assets and shares. A stateless lifecycle module executes pool operations in the engine’s context.

Mintware’s engine, hook and integration are unaudited testnet software. An upstream audit does not cover this composition.

The contract map

MintwareMarketEngine

Hookless-pool wrapper. Rejects a nonzero pool hook.

MintwareOwnedPoolMarketEngine

Owned-pool wrapper. Validates the appraisal hook, adapter, factory mapping and pool identity.

Both inherit ↓
MintwareMarketEngineCore

Shares, deposits, withdrawals, NAV, adapter calls and lifecycle guards. Inherits pool identity, owner/guardian pause and reentrancy protection from MintwareV4PoolVault; ERC-20 provides the share ledger.

Reads → IMarketAssetMark

Fixed test mark, ratio-feed mark or appraisal hook. MWMarketValuation checks freshness and converts values.

Calls → IMarketAdapterBinding × 2

Reads claims and capacity; deposits or recalls each underlying token. MWMarketShareMath converts value to shares.

Core calls PoolManager.unlock(data); PoolManager calls engine.unlockCallback(data) ↓
Delegatecall → MintwareMarketLifecycleModule

Collect, add, remove, optional swap, or recenter. MWV4PositionEngine calls PoolManager.modifyLiquidity; swaps call PoolManager.swap. MWV4Settlement pays debts and takes receipts.

Calls execute as the engine ↓
Uniswap PoolManager

Stores pool state and the engine-owned LP position. Settles currency deltas. In an owned pool, calls MintwareRwaAppraisalHook for initialization, liquidity and swap checks.

Arrows describe calls, not separate custody accounts. Library functions are internal code, not additional operators or deployed treasuries.

Why a separate, pinned lifecycle module?

The module separates callback execution from the engine’s claim accounting. It has no asset or share ledger of its own. A delegatecall means its pool and token calls execute as the engine address; it returns liquidity and range results for the engine to persist.

That execution power makes module identity critical. Both concrete engine wrappers pass an expected runtime code hash to the core constructor. Construction rejects any module whose deployed runtime does not match that hash. The module address is immutable, with no module-upgrade setter. The pin covers exact compiled runtime bytes, including metadata where present; it is not merely a contract-name check.

01
Open an unlock
Engine records the hash of typed action data and calls PoolManager.
02
Authenticate callback
Only PoolManager; data must match the active hash. Nested unlocks fail.
03
Execute & persist
Delegatecall pinned module; settle deltas, store returned state, clear hash.

Shared libraries and adapters

Mintware implementation responsibilities
PieceResponsibility
MWMarketShareMathBootstrap normalization, proportional deposit shares and partial-exit share burns. The engine supplies NAV; the library does not choose marks.
MWMarketValuationFresh, nonzero, non-future mark checks and decimal-aware conversion into raw quote units.
MWV4PositionEngineDirect PoolManager liquidity mutations and measured token consumption/receipts during an active unlock.
MWV4Settlementsync/pay/settle/take plumbing. For an owned pool, funds the PermissionsAdapter with underlying, verifies exact funding, then wraps virtual units to PoolManager.
MWV4PositionMath / MWV4TickSpacingLiquidity and token-quantity calculations, quote orientation and tick alignment.
IMarketAdapterBindingIYieldAdapter plus asset() and vault(). The engine verifies token identity and dedicated engine binding before activation.
MintwareIdleYieldAdapterHolds tokens without yield. Only the bound vault supplies/withdraws. Its separate owner-adjustable deposit cap counts supplied principal, not donations.
MintwareERC4626YieldAdapterA source implementation over an external ERC-4626 vault. Reports fee-net redeemable assets, supplies within source capacity, and recalls subject to source liquidity and a per-block cap. Not the idle-only setup in current market records.

Which parts come from whom?

Mintware supplies the engines, lifecycle module, appraisal hook, adapters and MW libraries above, plus registry verification and the app. Uniswap supplies PoolManager and v4 pool mechanics, the PermissionsAdapter and its factory, and permissioned routing infrastructure. The issuer supplies the asset, native token transfer policy, allowlist checker and appraisal observations; those issuer roles use test fixtures in the current RWA demonstration.

The owned engine keeps a direct pooled position, with its own non-transferable shares. It does not use the permissioned PositionManager’s NFT ownership or recovery mechanism. For permission and custody details, continue to RWAs and owned pools.

Source reference

Behavior above follows these files in the Mintware repository. Deployment records describe recorded state, not a fresh chain read.

  • contracts-v4/src/vaults/MintwareMarketEngine.sol
  • contracts-v4/src/vaults/MintwareMarketEngineCore.sol
  • contracts-v4/src/vaults/MintwareOwnedPoolMarketEngine.sol
  • contracts-v4/src/vaults/MintwareMarketLifecycleModule.sol
  • contracts-v4/src/vaults/MintwareV4PoolVault.sol
  • contracts-v4/src/vaults/IMarketAdapterBinding.sol
  • contracts-v4/src/vaults/MintwareIdleYieldAdapter.sol
  • contracts-v4/src/vaults/MintwareERC4626YieldAdapter.sol
  • contracts-v4/src/lib/MWMarketShareMath.sol
  • contracts-v4/src/lib/MWMarketValuation.sol
  • contracts-v4/src/lib/MWV4PositionEngine.sol
  • contracts-v4/src/lib/MWV4Settlement.sol
  • config/deployments.json