<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[pap0nt]]></title><description><![CDATA[pap0nt]]></description><link>https://aletheiarfq.hashnode.dev</link><image><url>https://cdn.hashnode.com/uploads/logos/69c0283dd9da55a9a5be3028/5b5f9185-a36f-41e8-8ae5-60c43b10a59e.jpg</url><title>pap0nt</title><link>https://aletheiarfq.hashnode.dev</link></image><generator>RSS for Node</generator><lastBuildDate>Sun, 22 Nov 2026 20:09:56 GMT</lastBuildDate><atom:link href="https://aletheiarfq.hashnode.dev/rss.xml" rel="self" type="application/rss+xml"/><language><![CDATA[en]]></language><ttl>60</ttl><item><title><![CDATA[Building a Confidence-Adaptive RFQ with Pyth Pro + Pyth Lazer]]></title><description><![CDATA[Built a confidence-adaptive RFQ on Base Sepolia using Pyth Pro and Pyth Lazer: signed off-chain quotes, on-chain oracle verification, and execution gu]]></description><link>https://aletheiarfq.hashnode.dev/building-a-confidence-adaptive-rfq-with-pyth-pro-pyth-lazer</link><guid isPermaLink="true">https://aletheiarfq.hashnode.dev/building-a-confidence-adaptive-rfq-with-pyth-pro-pyth-lazer</guid><dc:creator><![CDATA[pap0nt]]></dc:creator><pubDate>Sun, 22 Mar 2026 18:21:07 GMT</pubDate><enclosure url="https://cdn.hashnode.com/uploads/covers/69c0283dd9da55a9a5be3028/ee9adf87-5d23-4aac-acc3-fa727717df24.gif" length="0" type="image/jpeg"/><content:encoded><![CDATA[<hr />
<p>I started exploring this during the Pyth hackathon with one clear goal: build something practical.</p>
<p>Not another demo that reads a price once, executes a trade, and assumes the market is still fine.</p>
<p>In RFQ systems, a valid maker signature proves agreement at quote time, but it does not prove execution is still safe now.</p>
<p>That gap became the core problem I wanted to solve.</p>
<p>So I built a <strong>confidence-adaptive RFQ settlement flow</strong>.</p>
<p>Instead of treating oracle data as passive input, the contract uses live oracle conditions as execution guardrails. A quote can be valid and still unsafe.</p>
<h2>Core idea</h2>
<p>I use Pyth data as both pricing input and risk signal.</p>
<p>At execution time, the contract enforces checks on:</p>
<ul>
<li><p>price</p>
</li>
<li><p>confidence</p>
</li>
<li><p>publish time (freshness)</p>
</li>
</ul>
<p>If oracle data is stale, execution is blocked.<br />If confidence is too wide, execution is blocked.<br />If adverse market movement exceeds allowed deviation, execution is blocked.</p>
<p>This shifts oracle usage from “read a number” to “decide if execution is still acceptable.”</p>
<h2>Architecture in one flow</h2>
<ol>
<li><p>Maker signs RFQ quote off-chain (EIP-712).</p>
</li>
<li><p>Backend streams latest oracle update from Pyth Pro WS.</p>
</li>
<li><p>Backend returns an atomic bundle: <strong>quote + signature + update + verification fee</strong>.</p>
</li>
<li><p>Taker submits bundle to settlement contract.</p>
</li>
<li><p>Contract verifies signature and verifies oracle update on-chain via Pyth Lazer.</p>
</li>
<li><p>Contract executes only if risk checks pass.</p>
</li>
</ol>
<p>The atomic bundle part matters a lot: settlement references one coherent oracle snapshot, reducing mismatches between quote and update data.</p>
<h2>Risk checks in settlement</h2>
<h3>1) Staleness check</h3>
<p>The contract rejects updates older than configured <code>maxAge</code>.</p>
<p>If data is not fresh enough, settlement stops.</p>
<h3>2) Confidence check</h3>
<p>The contract computes confidence ratio and compares it to <code>maxConfBps</code>.</p>
<p>If confidence is too wide, settlement stops.</p>
<h3>3) Adverse deviation check</h3>
<p>The contract compares quote floor vs oracle-implied floor at execution time.</p>
<p>If the move is adverse for taker and deviation is above <code>maxDeviationBps</code>, settlement stops.</p>
<p>Important: this is asymmetric risk protection, not a blanket “block any drift.”</p>
<h2>Adaptive execution</h2>
<p>The execution amount is confidence-adaptive:</p>
<ul>
<li><p>If oracle-implied output is better than quote floor, taker gets the better amount.</p>
</li>
<li><p>If oracle-implied output is worse, quote floor still protects taker (within configured deviation guard).</p>
</li>
</ul>
<p>So the contract does not just block unsafe execution; it also preserves favorable movement for the taker.</p>
<h2>Why this matters</h2>
<p>The main takeaway for me is simple:</p>
<p><strong>Oracle integration should not stop at fetching price.</strong></p>
<p>For RFQ settlement, safety depends on:</p>
<ul>
<li><p>freshness</p>
</li>
<li><p>confidence</p>
</li>
<li><p>market drift at execution time</p>
</li>
</ul>
<p>Without those checks, “valid signature” is often treated as “safe execution,” and those are not the same thing.</p>
<h2>Closing</h2>
<p>This started as a hackathon MVP, but it clarified a strong design principle:</p>
<p>A better RFQ system should be fast when conditions are good, defensive when risk rises, and willing to reject execution when oracle signals degrade.</p>
<p>That is what I tried to build with this confidence-adaptive RFQ.</p>
<hr />
<p><strong>Demo:</strong> <a href="https://aletheiarfq.xyz/">aletheiarfq.xyz</a></p>
<p><strong>Code:</strong> <a href="https://github.com/pap0nt/AletheiaRFQ">https://github.com/pap0nt/AletheiaRFQ</a></p>
<p><strong>X:</strong> <a href="https://x.com/pap0nt">pap0nt</a></p>
]]></content:encoded></item></channel></rss>