UBIQUIN: Inside the Tiny Stablecoin Engine That Treats the Oracle Like the Real Vault

A clean-room CDP protocol that separates debt, treasury, and price checks so the system stays solvent even when the market gets messy.

7 to 9 min read View on GitHub More from Anshul-NSUT41

A vault split into three linked chambers, with a weather-station-like oracle tower on one side and an idle mint press on the other. The central chamber holds collateral, and narrow gates only open when the price signal passes every check. It explains that UBIQUIN treats price verification as the real security boundary.
UBIQUIN’s design is less about printing a stablecoin and more about refusing to act until the price signal is safe enough to trust.
Key Takeaways

The Oracle Is the Vault

UBIQUIN does not start with minting. It starts with the question that decides whether minting should happen at all: can the protocol trust the price feed? That is the real boundary in this repo, and the whole design leans into it.

The defensive posture shows up in the oracle wrapper. It rejects stale data, incomplete rounds, and non-positive answers before a price ever reaches the Treasury. That means the protocol is not just reading a feed. It is filtering the feed into something safe enough to govern debt.

A price feed does not become usable simply because it exists. UBIQUIN first validates, then normalizes, then lets the Treasury act.

A close-up cutaway of a price pipeline entering a small inspection chamber. Three internal gates block stale timestamps, incomplete rounds, and invalid prices before the normalized value exits toward the Treasury. It explains that UBIQUIN turns the oracle into a sequence of refusals, not a simple lookup.
The oracle layer is where UBIQUIN turns external market data into a controlled internal input.

How UBIQUIN Keeps Positions Solvent

Once the price is trusted, the next job is solvency. UBIQUIN’s Treasury tracks collateral and debt, then checks whether a position still clears the liquidation threshold before allowing risky actions like redemption or further minting.

That is why the health factor is not a dashboard metric here. It is an enforcement mechanism. If the position slips under the threshold, the protocol refuses to let the user continue as though nothing happened.

function redeemCollateral(address token, uint256 amount) external nonReentrant {
    _redeemCollateral(msg.sender, token, amount);
    _revertIfHealthFactorBroken(msg.sender);
}

function _revertIfHealthFactorBroken(address user) internal view {
    uint256 healthFactor = _healthFactor(user);
    if (healthFactor < MIN_HEALTH_FACTOR) revert Treasury__HealthFactorBroken();
}

The pattern is simple, but the discipline matters. UBIQUIN does not ask whether a user wants to redeem. It asks whether the protocol can survive the redemption afterward.

Treasury, Token, Governance: Three Jobs, Three Files

The repo keeps the important responsibilities apart. Treasury handles collateral and debt accounting. StableCoin is the debt instrument. GovernanceToken is the future control layer. That separation keeps the dangerous part of the system narrow and readable.

ComponentJobWhy it matters
Treasury.solTracks collateral, debt, and solvencyThis is the protocol’s execution layer, where safety checks actually bite.
StableCoin.solRepresents the minted debt tokenIt stays simple so mint authority can remain tightly controlled.
GovernanceToken.solImplements voting and permit behaviorIt points toward future governance without mixing it into the debt engine.
OracleLibrary.solValidates and normalizes external price dataIt acts like a security boundary before the Treasury makes any decision.

That split is the project’s cleanest architectural choice. Many stablecoin repos blur token logic, vault logic, and access control into one place. UBIQUIN keeps them separate enough that each file reads like a single job description.

Why This Feels Like a Serious Protocol, Even at Prototype Scale

The repo looks small, but the bones are correct. It uses Foundry, custom errors, OpenZeppelin building blocks, and explicit roles such as pausing and management. Those details matter because they show the author is not improvising on core safety primitives.

The test and deployment structure adds the same signal. Forge tests live alongside Sepolia broadcast logs, which suggests a real habit of verifying behavior instead of only sketching it. This is not production readiness. It is something more useful at this stage: architectural seriousness.

SignalWhat it suggestsWhy readers should care
Foundry layoutStandard Ethereum development workflowThe code is organized for testing and deployment, not just experimentation.
Custom errorsGas-aware Solidity styleThe repo is using modern, maintainable contract patterns.
Access control rolesOperational cautionMinting and admin actions are intentionally constrained.
Broadcast logsTestnet deployment activityThe project has moved beyond local-only tinkering.

UBIQUIN vs. the Usual Stablecoin Mental Models

UBIQUIN does not try to out-Maker Maker or out-Liquity Liquity. It borrows the mental model of overcollateralized minting, then strips it down until the safety boundaries are visible in plain code.

QuestionUBIQUINMaker-style CDPLiquity-style minting
What is the first concern?Oracle safety and refusal pathsCollateralized debt managementOvercollateralized issuance and liquidation design
How is mint authority handled?Role-gated through TreasuryProtocol-specific vault logicProtocol rules define issuance directly
How explicit is price validation?Very explicit in OracleLibraryDistributed across system assumptionsOften abstracted behind protocol mechanics
What is the teaching value?High. The boundary lines are visibleHigh, but broader and heavierHigh, but tuned to its own model

The comparison is not about who wins. It is about clarity. UBIQUIN is valuable because it makes the hidden costs of stablecoin design visible without dragging in the full weight of a mature protocol.

What the Repo Actually Teaches

A good stablecoin system is not a token contract plus a mint button. It is a coordination problem. The hard parts are price integrity, solvency, and authority separation, and UBIQUIN puts those concerns where you can see them.

That is why the repo is interesting even as a prototype. It does not pretend the market is clean. It builds for the moment when the feed is stale, the round is incomplete, or the position is unsafe, and it makes those failures part of the design instead of bugs around the edges.