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

Quick Start

Query Cork Protocol data and simulate operations in minutes

This guide gets you from zero to reading Cork Protocol data and simulating a deposit on a local fork.

Contract Addresses

Cork Phoenix uses deterministic CREATE2 deployment — all addresses are identical across Ethereum mainnet and supported chains.

Contract
Address

CorkPoolManager

0xccCCcCcCCccCfAE2Ee43F0E727A8c2969d74B9eC

CorkAdapter

0xCCcCcCCCcccCBaD6F772a511B337d9CCc9570407

WhitelistManager

0xcCccCcCccCC6e38a2772Eb42D2f408eeB89cb0eE

Find an Active Market

Every Cork Pool is identified by a MarketId. Fetch active markets from the API:

curl -s "https://api-phoenix.cork.tech/v1/pools/?chainId=1" | jq '.items[0] | {poolId, poolName, expiry}'

This returns a MarketId you can use in the examples below. You can also browse the full list at the API interactive docs.

Query Pool State

No setup required beyond Foundry. Query any pool directly with cast:

# Set your RPC endpoint and a MarketId from the API
export RPC_URL="https://eth-mainnet.g.alchemy.com/v2/YOUR_KEY"
export MARKET_ID="0xab4988fb673606b689a98dc06bdb3799c88a1300b6811421cd710aa8f86b702a"
export POOL_MANAGER="0xccCCcCcCCccCfAE2Ee43F0E727A8c2969d74B9eC"

# Get the swap rate (1 REF = rate/1e18 CA)
cast call $POOL_MANAGER \
  "swapRate(bytes32)(uint256)" $MARKET_ID \
  --rpc-url $RPC_URL

# Get pool balances (collateral, reference)
cast call $POOL_MANAGER \
  "assets(bytes32)(uint256,uint256)" $MARKET_ID \
  --rpc-url $RPC_URL

# Get cPT and cST token addresses
cast call $POOL_MANAGER \
  "shares(bytes32)(address,address)" $MARKET_ID \
  --rpc-url $RPC_URL

Install dependencies:

Create query-cork.ts:

Run it:

When you deposit Collateral Asset into a Cork Pool, you receive two tokens: a Cork Principal Token (cPT) representing your principal claim, and a Cork Swap Token (cST) representing your swap rights. See Cork Principal Token and Cork Swap Token for details.

Simulate a Deposit

Fork mainnet locally and simulate a deposit without using real tokens.

1. Start a Local Fork

2. Run a Forge Script

Create script/DepositExample.s.sol:

Run it against your local fork:

The deal cheatcode sets token balances directly — no need to source tokens from an external account. This avoids dependencies on specific whitelisted addresses or funded accounts.

1. Start a Local Fork

2. Run the Deposit Script

Install dependencies:

Create deposit-fork.ts:

Run it:

Production Integration

Solidity integrators: Add Cork as a Foundry dependency:

Then import interfaces directly:

TypeScript integrators: Use viem with the ABI snippets shown above, or install the published package:

Key Gotchas

18-decimal shares — All Cork Principal Token (cPT) and Cork Swap Token (cST) amounts use 18 decimals, regardless of the underlying token's decimals. A market with 6-decimal USDC as Collateral Asset still produces 18-decimal cPT and cST.

Next Steps

Last updated