Skip to main content

Smart Contracts

Doga is composed of eight contracts on Base mainnet. Seven sit behind ERC1967 proxies and are upgradeable; one (Roles) is the root of trust and is intentionally non-upgradeable.

ContractAddressWhat it does
LendingCore0x0610a09af09c4f6feb2b145cea3d5da1feb3636bThe composer. Holds collateral, tracks debt, runs deposit/borrow/repay/liquidate/capital-deployment. Every user action enters here.
CollateralRegistry0x0cdc1459479fff3758106ac1fde9ccbb2a74b504Whitelist + risk parameters per collateral token (LTV, liquidation threshold, penalty, oracle staleness).
FiatCurrencyRegistry0xb5e62acb608784ae3f21ab1c8e62ea7b15de4816Per-currency APR, LTV cap, debt ceiling, and the cumulative interest index.
BorrowerAllowlist0xe25fce794e37c00017bdc3771e0296d6b8a7dca9Per-currency KYC list + per-user country code.
CryptoPriceOracle0xe1971fe423d6d58e4948094ca6e6f7a0d28c1b69Chainlink wrapper, normalises every feed to 8-decimal USD.
FxOracle0x400a21abf720de5a28bc9a57d45b374d3b59eeacEIP-712 signed-push oracle for KES/NGN/GHS. ≥ 2 of 3 signers per update.
Treasury0x5695924fac66b0620fa94585fa4c169eb61c5dffUSDC repayments, liquidation penalties, withdrawal fees, bad-debt accounting.
Roles0x8e1164b25766b0442b74bb5e02aa9fa97df4e815OpenZeppelin AccessControl with 9 named roles. The single source of truth for permissions.

USDC on Base (0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913) is the universal settlement asset.

Calling contracts

You can integrate against Doga at three layers:

  1. Direct contract calls (this section). Send transactions to LendingCore etc. with your own viem/ethers/Foundry setup. Maximum control, you handle ABI encoding.
  2. REST API (next section). The API encodes calldata for you and exposes every read. Same on-chain semantics, less typing.
  3. MCP server (last section). For AI agents.

Reading the per-contract pages

Every contract page in this section follows the same shape:

  • Address + responsibility at the top.
  • Storage shape so you know what state is live.
  • Per-function reference with: signature, semantics, computation pseudo-code, reverts table, events emitted, runnable example.
  • Worked example at the end of each function group.

Standard reverts

All Doga contracts use custom errors rather than revert strings. You'll see these signatures in failed transaction traces:

SelectorErrorMeans
0x82b42900Unauthorized(address caller, bytes32 role)Caller doesn't hold the required role.
0x1f2a2005ZeroAmount()An amount argument was 0 where the contract requires > 0.
0xd92e233dZeroAddress()An address argument was the zero address.
(per contract)Paused()The relevant pause flag is set.
(per contract)NotFound(...) / AlreadyExists(...)Registry lookup failure.

Decode them with cast 4byte 0x82b42900 or by referencing the per-contract pages.