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

AI Context

Structured protocol reference optimized for AI assistants and LLM consumption

This page provides a consolidated, structured reference for AI assistants integrating with or answering questions about Cork Protocol. It complements the detailed pages in this documentation by bringing together contract addresses, key function signatures, operations, and common gotchas in one place.


What is Cork?

Cork is a programmable risk layer for onchain assets such as RWAs, vault tokens, and yield-bearing stablecoins. Cork's risk infrastructure primitive enables asset managers and issuers to spin up custom swap markets that enhance redemption liquidity, risk transparency, and market confidence for their onchain assets.

Each Cork Pool is built around a Collateral Asset (CA) and Reference Asset (REF) pair. Depositors provide CA and receive two tokens: Cork Principal Token (cPT) representing principal claims, and Cork Swap Token (cST) representing swap/exercise rights. cST holders can exercise coverage by exchanging REF + cST for CA — guaranteeing redemption liquidity regardless of market conditions.

All pools are managed by a single CorkPoolManager contract (singleton architecture). For write operations with slippage and deadline protection, use CorkAdapter. For read operations, query CorkPoolManager directly.


Core Concepts

  • Cork Pool: A singleton-managed pool holding Collateral Asset, issuing cPT + cST on deposit. Each pool is identified by a MarketId.

  • Cork Principal Token (cPT): ERC20 token representing a depositor's principal claim. Redeemable for proportional CA + REF after expiry.

  • Cork Swap Token (cST): ERC20 token granting the right to exercise — exchange REF + cST for CA (minus a fee) before expiry.

  • Collateral Asset (CA): The yield-bearing asset deposited into the pool (e.g., sUSDe, wstETH).

  • Reference Asset (REF): The asset whose risk is being covered (e.g., vbUSDC, ezETH).

  • Market struct: 8 fields defining a pool — collateralAsset, referenceAsset, expiryTimestamp, rateMin, rateMax, rateChangePerDayMax, rateChangeCapacityMax, rateOracle.

  • MarketId: keccak256(abi.encode(Market)) — deterministic hash of all 8 Market fields. Same parameters always produce the same MarketId on any chain.

  • Swap Rate: Exchange rate between REF and CA, scaled to 18 decimals. collateralOut = referenceIn * swapRate / 1e18.


Contract Addresses

All addresses are identical across Ethereum mainnet and supported chains (deterministic CREATE2 deployment).

Contract
Address
Purpose

CorkPoolManager

0xccCCcCcCCccCfAE2Ee43F0E727A8c2969d74B9eC

Singleton — all pool state and operations

CorkAdapter

0xCCcCcCCCcccCBaD6F772a511B337d9CCc9570407

Safe wrappers with slippage/deadline protection

DefaultCorkController

0xcCcCcCccCccbC06627F8aad7aAF13fe3a457f779

Governance: pool creation, fees, pause control

WhitelistManager

0xcCccCcCccCC6e38a2772Eb42D2f408eeB89cb0eE

Global and per-market access control

ConstraintRateAdapter

0xCCcCcCcccCccEF378949D1a61ED2283C831AF03A

Oracle rate protection with daily change limits

SharesFactory

0xcCCCccCCCcCc1782617fe14A386AC910a20D4324

cPT/cST token pair deployment


Key Functions

Read Operations (call CorkPoolManager)

Write Operations (call CorkAdapter for production use)

MarketId Computation


Operations Summary

Before Expiry

Operation
You Provide
You Receive

Deposit

Collateral Asset

cPT + cST

Unwind Deposit

cPT + cST

Collateral Asset

Withdraw

cPT

CA + REF (proportional)

Exercise

REF + cST

Collateral Asset (minus fee)

Repurchase

Collateral Asset

REF + cST

After Expiry

Operation
You Provide
You Receive

Redeem

cPT

CA + REF (proportional to pool composition)


API

  • Base URL: https://api-phoenix.cork.tech

  • Key endpoints:

    • GET /v1/pools/?chainId=1 — list pools with TVL, fees, pause status

    • GET /v1/pools/whitelisted-addresses?chainId=1 — check whitelist status

    • GET /v1/flows/?chainId=1 — transaction history

    • GET /v1/limit-orders/markets?chainId=1 — limit order markets

  • Always include chainId=1 for Ethereum mainnet


Key Gotchas

  • 18-decimal shares: cPT and cST always use 18 decimals, regardless of the underlying token's decimals (e.g., 6-decimal USDC produces 18-decimal cPT/cST)

  • Fees: 18-decimal precision where 1e18 = 1%. Maximum fee is 5e18 (5%). Fees apply to Exercise and Repurchase operations.

  • Whitelist: Some markets require addresses to be whitelisted before depositing. Check isWhitelisted(marketId, address) on WhitelistManager before attempting deposits.

  • MarketId: Computed from ALL 8 Market struct fields, not just collateralAsset and referenceAsset. The same Market parameters produce the same MarketId on any chain.

  • CorkAdapter vs CorkPoolManager: Use CorkAdapter (safe* functions) for production writes — it adds slippage and deadline protection. Use CorkPoolManager directly for reads.


Last updated