Quick reference

Base URL
https://www.basepawn.com/api/v1
Chain
Base mainnet, chain ID 8453
USDC
0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913 (6 decimals)

Instant loan quote

POST /instant-loans/quote analyzes collateral and returns an EIP-712 signed quote. Include borrower to receive an executable quote.

curl -X POST https://www.basepawn.com/api/v1/instant-loans/quote \
  -H "content-type: application/json" \
  -d '{
    "chainId": 8453,
    "collateralToken": "0xYourCollateralToken",
    "collateralAmount": "100",
    "durationDays": 7,
    "borrower": "0xYourWallet"
  }'

Token amounts use human-readable decimals. Returned USDC and signed quote amounts are decimal strings in base units.

Execute with viem

BasePawn never handles caller private keys. Approve the collateral and submit the signed quote from the same borrower wallet before its deadline.

import {
  createPublicClient,
  createWalletClient,
  custom,
  parseAbi
} from "viem";
import { base } from "viem/chains";

const config = await fetch(
  "https://www.basepawn.com/api/v1/config"
).then((response) => response.json());
const vaultAddress = config.contracts.instantLoanVault.address;

const response = await fetch(
  "https://www.basepawn.com/api/v1/instant-loans/quote",
  {
    method: "POST",
    headers: { "content-type": "application/json" },
    body: JSON.stringify({
      chainId: 8453,
      collateralToken,
      collateralAmount: "100",
      durationDays: 7,
      borrower: account
    })
  }
);
const result = await response.json();
if (!result.accepted || !result.quote || !result.signature) {
  throw new Error(result.rejectionReasons?.join(", ") || result.error);
}

const wallet = createWalletClient({
  account,
  chain: base,
  transport: custom(window.ethereum)
});
const publicClient = createPublicClient({
  chain: base,
  transport: custom(window.ethereum)
});
const erc20Abi = parseAbi([
  "function approve(address spender,uint256 amount) returns (bool)"
]);
const vaultAbi = parseAbi([
  "function createLoan((address borrower,address collateralToken,uint256 collateralAmount,uint256 loanAmount,uint256 repaymentAmount,uint256 durationSeconds,uint256 quoteDeadline,uint256 nonce) quote,bytes signature) returns (uint256)"
]);

const approvalHash = await wallet.writeContract({
  address: collateralToken,
  abi: erc20Abi,
  functionName: "approve",
  args: [vaultAddress, BigInt(result.quote.collateralAmount)]
});
await publicClient.waitForTransactionReceipt({ hash: approvalHash });

await wallet.writeContract({
  address: vaultAddress,
  abi: vaultAbi,
  functionName: "createLoan",
  args: [{
    ...result.quote,
    collateralAmount: BigInt(result.quote.collateralAmount),
    loanAmount: BigInt(result.quote.loanAmount),
    repaymentAmount: BigInt(result.quote.repaymentAmount),
    durationSeconds: BigInt(result.quote.durationSeconds),
    quoteDeadline: BigInt(result.quote.quoteDeadline),
    nonce: BigInt(result.quote.nonce)
  }, result.signature]
});

InstantLoanVault: 0x4a7125fB9e371a480DCA63d9b18d6B6bFaf63779

P2P marketplace

GET /p2p/market returns requests, bids, funding readiness, fees, and token metadata. P2P writes are direct wallet-signed contract calls.

curl https://www.basepawn.com/api/v1/p2p/market

Use createLoanRequest, placeBid, acceptBid,repay, and claimCollateral on the marketplace contract. ERC20 approval is required before collateral escrow, accepted-bid funding, or repayment.

Marketplace: 0x622b539c82cd5e6f065CDf532Fc2545bD0EC3279

Limits and safety

Quote requests are rate limited per IP because each analysis calls several external risk sources. Quotes expire after ten minutes and can only be executed once. Contract liquidity, exposure limits, token blocks, signatures, and borrower identity are enforced on-chain.

Compare with the web interface