Skip to main content
Coming Soon: The Developers section is under active development. Documentation will be available soon.

Contract Structure

Centuari consists of several core contracts working together:
┌─────────────────────────────────────────────────────────────┐
│                     Core Protocol                           │
├─────────────────────────────────────────────────────────────┤
│                                                             │
│  OrderBook.sol          - Order matching engine            │
│  CBTFactory.sol         - Bond token creation              │
│  CollateralManager.sol  - Collateral handling              │
│  VaultFactory.sol       - Vault creation                   │
│  YieldRouter.sol        - Idle capital deployment          │
│                                                             │
├─────────────────────────────────────────────────────────────┤
│                     Periphery                               │
├─────────────────────────────────────────────────────────────┤
│                                                             │
│  OracleAdapter.sol      - Price feed aggregation           │
│  BridgeAdapter.sol      - Cross-chain integration          │
│  RelayerHub.sol         - Meta-transaction handling        │
│                                                             │
└─────────────────────────────────────────────────────────────┘

Core Contracts

OrderBook.sol

The central matching engine for all fixed-rate orders.
FunctionDescription
placeLendOrderCreate new lend order
placeBorrowOrderCreate new borrow order
cancelOrderCancel unfilled order
matchOrdersExecute order matching

CBTFactory.sol

Manages CBT (Centuari Bond Token) creation and lifecycle.
FunctionDescription
createCBTDeploy new CBT for asset/maturity
mintMint CBT to lender
redeemRedeem CBT at maturity
getCBTGet CBT address for parameters

CollateralManager.sol

Handles all collateral operations.
FunctionDescription
depositDeposit collateral
withdrawWithdraw collateral
getBorrowingPowerCalculate max borrow
liquidateExecute liquidation

VaultFactory.sol

Creates and manages curator vaults.
FunctionDescription
createVaultDeploy new vault
depositDeposit to vault
withdrawWithdraw from vault
rebalanceCurator rebalance

YieldRouter.sol

Manages idle capital deployment.
FunctionDescription
deployDeploy capital to yield source
recallRecall capital for matching
harvestCollect accrued yield

Contract Interfaces

IOrderBook

interface IOrderBook {
    struct Order {
        address maker;
        address asset;
        uint256 amount;
        uint256 rate;      // basis points
        uint256 maturity;
        bool isLend;
        OrderStatus status;
    }

    function placeLendOrder(
        address asset,
        uint256 amount,
        uint256 rate,
        uint256 maturity
    ) external returns (bytes32 orderId);

    function placeBorrowOrder(
        address asset,
        uint256 amount,
        uint256 maxRate,
        uint256 maturity
    ) external returns (bytes32 orderId);

    function cancelOrder(bytes32 orderId) external;

    function getOrder(bytes32 orderId) external view returns (Order memory);
}

ICBT

interface ICBT is IERC20 {
    function underlying() external view returns (address);
    function maturity() external view returns (uint256);
    function redeem(uint256 amount) external returns (uint256);
    function redeemTo(address to, uint256 amount) external returns (uint256);
}

ICollateralManager

interface ICollateralManager {
    function deposit(address asset, uint256 amount) external;
    function withdraw(address asset, uint256 amount) external;

    function getCollateralValue(address user) external view returns (uint256);
    function getBorrowingPower(address user) external view returns (uint256);
    function getHealthFactor(address user) external view returns (uint256);

    function liquidate(
        address user,
        address debtAsset,
        uint256 debtAmount,
        address collateralAsset
    ) external returns (uint256 collateralSeized);
}

Events

OrderBook Events

event OrderPlaced(
    bytes32 indexed orderId,
    address indexed maker,
    address asset,
    uint256 amount,
    uint256 rate,
    uint256 maturity,
    bool isLend
);

event OrderMatched(
    bytes32 indexed lendOrderId,
    bytes32 indexed borrowOrderId,
    uint256 matchedAmount,
    uint256 rate
);

event OrderCancelled(bytes32 indexed orderId);

CollateralManager Events

event CollateralDeposited(
    address indexed user,
    address indexed asset,
    uint256 amount
);

event CollateralWithdrawn(
    address indexed user,
    address indexed asset,
    uint256 amount
);

event Liquidation(
    address indexed user,
    address indexed liquidator,
    address debtAsset,
    uint256 debtCovered,
    address collateralAsset,
    uint256 collateralSeized
);

Security Features

Access Control

RolePermissions
AdminPause, emergency functions
KeeperLiquidations, yield harvesting
GovernanceParameter changes

Pause Mechanism

// Emergency pause
function pause() external onlyAdmin;

// Granular pause
function pauseFunction(bytes4 selector) external onlyAdmin;

Reentrancy Protection

All state-changing functions use reentrancy guards:
modifier nonReentrant() {
    require(!_locked, "Reentrant call");
    _locked = true;
    _;
    _locked = false;
}

Upgradeability

Contracts use transparent proxy pattern:
  • Implementation contracts are immutable
  • Proxy delegates to implementation
  • Upgrades require timelock (48h)
  • Admin multi-sig required