Skip to content
Español

For developers

The programmable deposit, for your app.

Accasa is an app, but the reservation lives in an open contract on Base. Any app can lock tokenized stocks as a deposit in someone else's favor, with a margin, a claim, a dispute and an arbiter. It works for a home deposit, a rental deposit or any commitment with a deadline.

Code on GitHub

Contracts

Base Sepolia, Base's test network (chain id 84532).

  • ReservationEscrow

    Holds the stocks as the deposit and enforces the rules: claim, dispute, arbiter and payout in USDC.

    Verified source
    0x5584…4a95
  • StockOracle

    Lists the accepted stocks with their margin and USD price from Chainlink feeds. Rejects stale prices.

    Verified source
    0x04d3…101d
  • GoalRegistry

    One goal per account: the home and the stock it saves in.

    Verified source
    0x67cE…8Dca
  • Payout market

    The only router the contract may sell stocks through when paying a claim. On the test network it is a simulated market.

    View on the explorer
    0xeda4…C9F7

How a reservation lives

  1. createReservation

    The buyer locks stocks worth the deposit plus that stock's margin (15% to 100%). They pay 1% of the deposit, in stocks.

  2. fileClaim

    If the sale falls through, the beneficiary (the broker) claims up to the deposit, until 15 days after the end date.

  3. acceptClaim or disputeClaim

    The buyer has 3 days to accept or dispute. Without an answer, the claim stands.

  4. resolveDispute

    If disputed, the arbiter awards between zero and the claim. If they don't decide within 14 days, the default arbiter can.

  5. settleClaim

    Anyone can run the payout. The contract sells only the shares needed, at a price under 26 hours old and at most 2% below it, and pays in USDC. The rest goes back to the buyer.

  6. release

    If the sale closes, the beneficiary releases the stocks at any time. If nobody claims, anyone can release them 15 days after the end date.

Create a reservation from your app

Ask the API how much to lock and sign two calls: approve the token and create the reservation.

import { erc20Abi, keccak256, parseUnits, toHex, zeroAddress } from "viem";

const ESCROW = "0x5584F9a333faCbB8f01D22524c517Cf2BaB84a95"; // ReservationEscrow on Base Sepolia
// ABI: verified on the explorer, or src/contracts/abis.ts in the repo.

// 1. How much of the stock to lock for a USD 5,000 deposit (margin and fee included)
const [quote] = await fetch(
  `https://accasa.vercel.app/api/quote?coverageUsd=5000&token=${token}`,
).then((response) => response.json());

// 2. Approve the stock, then lock it as the deposit
await wallet.writeContract({
  address: token,
  abi: erc20Abi,
  functionName: "approve",
  args: [ESCROW, BigInt(quote.totalTokens)],
});
await wallet.writeContract({
  address: ESCROW,
  abi: reservationEscrowAbi,
  functionName: "createReservation",
  args: [{
    beneficiary: broker,        // who can claim the deposit
    arbiter: zeroAddress,       // zero picks the protocol's default arbiter
    token,
    collateral: BigInt(quote.collateral),
    coverageUsd: parseUnits("5000", 18),
    endsAt: BigInt(Math.floor(Date.now() / 1000) + 60 * 86_400),
    propertyRef: keccak256(toHex("your-listing-id")),
  }],
});

Also: topUp lets anyone add stocks to a reservation, withdrawExcess takes out what is above the margin and extendEndDate moves the end date.

Read without signing anything

Public API, no keys. USD amounts use 18 decimals.

GET /api/stocks
Accepted stocks: price, margin, last update and whether they are paused.
GET /api/quote?coverageUsd=5000
How much of each stock to lock for a deposit, fee included.
GET /api/reservations/{id}
One reservation: its status, the claim and what the stocks are worth today.
GET /api/reservations?account=0x…
An account's reservations, as buyer or as broker.
GET /api/stats
Live totals: goals, reservations and value locked.

Good to know

  • It runs on Base's test network today. The stocks are test tokens priced from the real Chainlink feeds on Base, and the market they are sold in at payout is simulated.
  • On the test network prices never go stale. On mainnet they follow US market hours.
  • The app reads each stock's pause from Coinbase's registry and blocks reserving and payouts during a pause. Before mainnet, the contract will read it too.
  • Tokenized stocks track the share price and carry no vote in the company.
  • Every transaction carries Accasa's Builder Code (bc_ypl8v014), per ERC-8021.