Skip to content

Latest commit

 

History

History
153 lines (126 loc) · 8 KB

File metadata and controls

153 lines (126 loc) · 8 KB

Lean Intent Framework

A lightweight cross-chain intent settlement framework that enables intent execution without requiring smart contracts on either the origin or destination chains. Meant to keep onchain costs on source / destination to a minimum.

NOTE: This is an early alpha version not meant for production use. Reach out to us for production usage.

Overview

The Lean Intent Framework is a low calorie alternative to the Open Intents Framework (OIF) that achieves cross-chain intent settlement through:

  • NEAR as the settlement layer - All validation and signing happens on NEAR Protocol
  • Polymer proofs - Cross chain proofs of EVM transactions bind escrow / fills to an intent order
  • MPC signing - NEAR's Chain Signatures (threshold ECDSA) signs release transactions
  • No origin/destination contracts - Users interact directly with EOAs; no InputSettler or OutputSettler contracts needed

Lean vs Traditional OIF

Aspect Traditional OIF Lean Intent Framework
Origin Chain Requires InputSettlerEscrow contract Direct transfer to MPC-controlled EOA
Destination Chain Requires OutputSettler contract Solver fills via direct transfer
Proof System On-chain oracle verification Polymer proofs verified on NEAR
Settlement On-chain atomic settlement NEAR validates proofs, MPC signs release
Gas Costs High (multiple contract calls) Low (simple transfers + NEAR validation)
Deployment Deploy contracts per chain Zero EVM deployment required

How It Works

Source Chain                    NEAR Contract                 Destination Chain
     |                               |                               |
     |  1. User escrows funds        |                               |
     |     to MPC-controlled EOA     |                               |
     |     (order_id in calldata)    |                               |
     |                               |                               |
     |                               |   2. Solver fills order       |
     |                               |      (order_id in calldata)   |
     |                               |                               |
     |  3. Polymer generates         |   Polymer generates           |
     |     escrow_proof              |   fill_proof                  |
     |                               |                               |
     |          4. Solver calls settle(escrow_proof, fill_proof, order)
     |                               |                               |
     |                    5. NEAR validates:                         |
     |                       - escrow_proof.tx_data has order_id     |
     |                       - fill_proof.tx_data has same order_id  |
     |                       - order.hash() == order_id              |
     |                       - fill matches order.outputs[0]         |
     |                               |                               |
     |                    6. MPC signs release_tx                    |
     |                       (transfers escrow to solver)            |
     |                               |                               |
     |  7. Solver broadcasts         |                               |
     |     release_tx to claim       |                               |
     |     escrowed funds            |                               |

OIF Order Types

This framework adopts the OIF StandardOrder type definitions for cross-chain compatibility:

StandardOrder

struct StandardOrder {
    address user;           // Order creator
    uint256 nonce;          // Replay protection
    uint256 originChainId;  // Source chain
    uint32 expires;         // Order expiration timestamp
    uint32 fillDeadline;    // Deadline for solver to fill
    address inputOracle;    // Oracle for input verification
    uint256[2][] inputs;    // [token, amount] pairs escrowed
    MandateOutput[] outputs; // Required outputs on destination chain(s)
}

MandateOutput

struct MandateOutput {
    bytes32 oracle;       // Output verification oracle
    bytes32 settler;      // Settlement contract (unused in lean approach)
    uint256 chainId;      // Destination chain
    bytes32 token;        // Output token
    uint256 amount;       // Amount to deliver
    bytes32 recipient;    // Recipient address
    bytes callbackData;   // Optional callback data
    bytes context;        // Additional context
}

Order Identifier

The order_id is computed as:

keccak256(abi.encodePacked(
    block.chainid,
    escrowAddress,       // MPC-controlled EOA
    order.user,
    order.nonce,
    order.expires,
    order.fillDeadline,
    order.inputOracle,
    keccak256(abi.encodePacked(order.inputs)),
    abi.encode(order.outputs)
))

This order_id is included in the calldata of both escrow and fill transactions, allowing the NEAR contract to verify they reference the same order.

Architecture

┌─────────────────────────────────────────────────────────────────┐
│                         NEAR Protocol                            │
├─────────────────────────────────────────────────────────────────┤
│  polymer-near contract                                          │
│  ├── Validates Polymer proofs (escrow + fill)                   │
│  ├── Verifies order_id matches in both proofs                   │
│  ├── Validates order parameters against proven transactions     │
│  └── Requests MPC signature for release transaction             │
├─────────────────────────────────────────────────────────────────┤
│  MPC Network (Chain Signatures)                                 │
│  └── Signs release transaction with threshold ECDSA             │
└─────────────────────────────────────────────────────────────────┘
          │                                    │
          │ Polymer Proofs                     │ Signed Release TX
          ▼                                    ▼
┌──────────────────┐                 ┌──────────────────┐
│  Source Chain    │                 │  Dest Chain      │
│  (e.g., OP)      │                 │  (e.g., Base)    │
├──────────────────┤                 ├──────────────────┤
│  User escrows    │                 │  Solver fills    │
│  to MPC EOA      │                 │  recipient       │
└──────────────────┘                 └──────────────────┘

Components

  • near/polymer-near - NEAR smart contract for proof validation and MPC signing
  • near/order-server - Offchain order book for publishing and discovering orders
  • evm_contracts - Proof validation contracts and test utilities
  • repos/proof-api - Polymer proof generation service
  • repos/payload-signer - State root attestation service

Getting Started

See individual component READMEs for setup instructions.

License

MIT