Contracts overview
Technical reference for every smart contract in Kairence. For high-level user flow see How it works; for token-level descriptions see Tokens.
Contract map
USER ENTRY POINTS
Locker User → lock DIEM, get PT20/PT721 + DD
Redeemer User → redeem PT20/PT721, request unstake
DailyAuction User → bid for inference, claim refund
STATE ANCHORS
VeniceStakingVault Custodies DIEM, calls Venice stake/unstake
kDIEM Internal escrow token (1:1 with staked DIEM)
PT20 (one per maturity) ERC-5095 principal claim for monthly maturities
PT721 ERC-721 principal claim for arbitrary maturities
DailyUnstakeQueue Batches user unstakes into Venice cooldown windows
POLICY MODULES
DDMinter Computes DD issuance, mints DD on lock
PT20Factory CREATE2-deploys monthly PT20 contracts
UNIVERSAL TOKENS
DD ERC-20 Burnable inference credit (1 DD = $1 inference)
KAI ERC-20 Votes fixed-supply governance + auction premiumWiring graph
┌──────────────┐
│ Locker │
└──────┬───────┘
┌──────────┬───────┼─────────┬──────────┐
▼ ▼ ▼ ▼ ▼
┌────────┐ ┌─────────┐ ┌──┐ ┌────────┐ ┌────────┐
│ Vault │ │ kDIEM │ │DD│ │PT20Factory│ │ PT721 │
└───┬────┘ │ Minter │ │ │ └───┬────┘ └────────┘
│ └─────────┘ └──┘ │
│ ▼
│ ┌────────┐
│ │ PT20 │ (one per maturity)
│ └────────┘
│
▼
┌─────────┐
│ Queue │ ← Redeemer (writes)
└─────────┘ PT20/PT721 (source of redeem)
┌──────────────┐
│ DailyAuction │ ← reads Vault.dailyCap()
└──────────────┘Per-contract pages
- Locker — user-facing lock entry point
- Redeemer — user-facing redeem entry point
- VeniceStakingVault — DIEM custody + Venice staker
- DailyUnstakeQueue — day-batched exit queue
- DailyAuction — T+1 inference auction
- DDMinter — DD issuance policy
- PT20Factory — CREATE2 deployer for PTs
- PT20 — ERC-5095 principal token
- PT721 — ERC-721 principal NFT
- kDIEM — internal escrow ERC-20
- DD — Dollar Day inference credit
- KAI — governance + auction premium
Standards used
| OpenZeppelin module | Where |
|---|---|
ERC20 | DD, KAI, kDIEM, PT20 |
ERC20Burnable | DD, KAI |
ERC20Permit | DD, KAI |
ERC20Votes | KAI |
ERC721 | PT721 |
Ownable2Step | Every admin contract |
Pausable | DD, Locker, Redeemer |
ReentrancyGuard | Locker, Redeemer, Vault, Queue, Auction |
SafeERC20 | All token interactions |
Solidity version
All contracts compile with Solidity 0.8.28 under via-IR, evm_version = "cancun", optimizer_runs = 200.
Deploy script
script/Deploy.s.sol performs the full wire-up in the right order:
- Deploy 11 contracts.
- Call every
setXxxInitial/addXxxInitialin the right order. auction.registerPlatform(vault)._verifyWiring()reads back every slot and reverts if any drift.
Run with:
sh
forge script script/Deploy.s.sol --rpc-url $BASE_RPC_URL \
--account kairence-deployer \
--sender 0x95EE9AFc670C4c9973b1768c72Ab03546993dadb \
--broadcastPost-deploy: forge script script/VerifyKAI.s.sol --rpc-url $BASE_RPC_URL to verify the four KAI tranches distributed correctly.