Skip to content

Add mint to adapters - #340

Draft
naddison36 wants to merge 8 commits into
mainfrom
nicka/adapter-mint
Draft

Add mint to adapters#340
naddison36 wants to merge 8 commits into
mainfrom
nicka/adapter-mint

Conversation

@naddison36

@naddison36 naddison36 commented Aug 20, 2026

Copy link
Copy Markdown
Collaborator

Summary

Adds asynchronous minting to the generic asset-adapter interface, allowing ARM liquidity to be converted into base-asset inventory.

The Paxos adapters use this flow to mint PYUSD and USDG with USDC. Once Paxos settlement completes, the minted assets are claimed by the ARM and can be sold through the existing Uniswap V2-compatible swap interface.

Adapter lifecycle operations are extracted into the externally linked ARMAdapterLib, bringing MultiAssetARM back under Ethereum's EIP-170 contract-size limit without changing optimizer runs or any swap functions.

Changes

Generic adapter interface

  • Add requestMint and claimMint to IAssetAdapter.
  • Add MintNotSupported for adapters that only support redemption.
  • Keep a single IAssetAdapter interface; redemption-only adapters explicitly revert from mint operations.
  • Document the generic adapter interface in the README.

Adapter interface

interface IAssetAdapter {
    error MintNotSupported(); // 0x6b24007b

    function asset() external view returns (address);

    function convertToAssets(uint256 shares) external view returns (uint256 assets);

    function convertToShares(uint256 assets) external view returns (uint256 shares);

    function requestRedeem(uint256 shares) external returns (uint256 sharesRequested, uint256 assetsExpected);

    function redeem(uint256 shares)
        external
        returns (uint256 sharesClaimed, uint256 assetsExpected, uint256 assetsReceived);

    function requestMint(uint256 assets) external returns (uint256 assetsRequested, uint256 sharesExpected);

    function claimMint(uint256 shares)
        external
        returns (uint256 sharesClaimed, uint256 assetsExpected, uint256 sharesReceived);
}

ARM minting and accounting

  • Add owner/operator functions for requesting and claiming asynchronous base-asset mints.
  • Expose pendingMintShares through its public mapping getter.
  • Value pending mint inventory in totalAssets() using the base asset's configured cross price.
  • Prevent liquidity reserved for LP withdrawals from being committed to a mint.
  • Preserve the existing Uniswap V2-compatible swap API and swap implementation.
  • Move adapter redemption and mint lifecycle operations into the linked ARMAdapterLib.

Paxos adapters

  • Add a configurable Paxos USDC mint recipient.
  • Track pending and settling mint assets independently.
  • Support partial mint submission and partial claims.
  • Claim settled PYUSD or USDG back into the ARM's sell inventory.
  • Add excess base-asset recovery while preserving outstanding obligations.
  • Isolate simultaneous mint and redemption balances so one lifecycle cannot consume assets reserved for the other.

Deployment

  • Add ARMDeploymentHelper to deploy ARMAdapterLib and link MultiAssetARM creation bytecode to the deployed library.
  • Add deployment 043 to:
    • deploy and record ARMAdapterLib;
    • deploy the linked USDC ARM implementation;
    • deploy new PYUSD and USDG adapter implementations;
    • simulate the three proxy upgrades through the Ethereum 5/8 Safe; and
    • initialize each existing adapter's mint recipient from its configured Paxos recipient.
  • Keep permanently skipped legacy deployment scripts loadable by commenting out obsolete ARM creation code that would otherwise contain unresolved library links.

Paxos mint flow

  1. The ARM sends USDC to the asset adapter and records the expected base-asset shares.
  2. An owner or operator submits the USDC to the configured Paxos mint recipient.
  3. Paxos mints PYUSD or USDG to the adapter.
  4. The ARM claims the settled base asset.
  5. The ARM sells the inventory through its existing swap interface.

Accounting

Pending mint inventory is valued using the base asset's cross price.

At a cross price of 1e36, requesting, settling, and claiming a mint is NAV-neutral. Below 1e36, the configured discount is recognized when USDC is committed.

Mint and redemption balances are isolated so:

  • pending mint USDC cannot satisfy redemption claims;
  • base assets queued for redemption cannot satisfy mint claims; and
  • recovery functions preserve all pending and settling obligations.

Contract size

  • MultiAssetARM: 24,437 bytes, leaving 139 bytes below Ethereum's 24,576-byte EIP-170 limit.
  • ARMAdapterLib: 2,478 bytes.

The optimizer run count is unchanged.

Tests

Coverage includes:

  • 249 generic MultiAssetARM unit and fuzz tests;
  • 49 Paxos adapter unit tests;
  • 9 Paxos mint fork tests;
  • 27 adapter redemption fork tests;
  • linked-library deployment and artifact checks;
  • the EIP-170 runtime-size regression test;
  • PYUSD and USDG mint-then-sell flows;
  • full and partial mint settlement;
  • simultaneous mint and redemption operations;
  • NAV and cross-price accounting;
  • authorization, unsupported assets, and MintNotSupported behavior;
  • zero and oversized requests or claims;
  • unconfigured Paxos mint recipients;
  • recovery reserve protection; and
  • mainnet-fork deployment and Paxos ARM smoke checks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants