Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 38 additions & 24 deletions src/pages/docs/Architecture.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,8 @@ export default function Architecture() {
</h3>

<p className="text-docs-text-secondary leading-relaxed mb-4">
The FHE layer uses a coprocessor-based system. Encrypted types (
The FHE layer is Fhenix CoFHE — a coprocessor that holds the secret key
off-chain and exposes precompiles to the EVM. Encrypted types (
<code className="bg-docs-bg-code border border-docs-border-default rounded px-1.5 py-0.5 font-mono text-[13.5px] text-docs-text-primary">
euint64
</code>
Expand All @@ -141,9 +142,10 @@ export default function Architecture() {
) are stored as handles managed by the coprocessor. Client-side
encryption uses{" "}
<code className="bg-docs-bg-code border border-docs-border-default rounded px-1.5 py-0.5 font-mono text-[13.5px] text-docs-text-primary">
cofhejs
@cofhe/sdk
</code>{" "}
with input types (
(the v0.5 successor to the earlier <code>cofhejs</code>) with input
types (
<code className="bg-docs-bg-code border border-docs-border-default rounded px-1.5 py-0.5 font-mono text-[13.5px] text-docs-text-primary">
InEuint64
</code>
Expand Down Expand Up @@ -180,8 +182,13 @@ export default function Architecture() {
content: " ebool isRedeemed; // encrypted redemption flag",
highlighted: true,
},
{ content: " bool exists; // cleartext existence flag" },
{ content: "}" },
{ content: "" },
{ content: "// Existence is derived from the next-id counter," },
{
content:
"// not a per-escrow plaintext flag — leaving zero plaintext on the struct.",
},
]}
/>

Expand All @@ -197,24 +204,29 @@ export default function Architecture() {
<code className="bg-docs-bg-code border border-docs-border-default rounded px-1.5 py-0.5 font-mono text-[13.5px] text-docs-text-primary">
escrowId
</code>
. Every protocol contract is deployed as an{" "}
<strong className="text-docs-text-primary">immutable singleton</strong>{" "}
at a fixed address — there is no UUPS proxy, no{" "}
<code className="bg-docs-bg-code border border-docs-border-default rounded px-1.5 py-0.5 font-mono text-[13.5px] text-docs-text-primary">
_authorizeUpgrade
</code>{" "}
hook, and no owner or admin upgrade key. Contracts still use ERC-7201
namespaced storage with{" "}
. Contracts use ERC-7201 namespaced storage with{" "}
<code className="bg-docs-bg-code border border-docs-border-default rounded px-1.5 py-0.5 font-mono text-[13.5px] text-docs-text-primary">
__gap[50]
</code>
, but for layout compatibility across deployment versions rather than
in-place upgrades. ERC-2771 meta-transaction support is provided via a
base contract (
</code>{" "}
reserves and inherit a shared base. On chaos-net testnet that base is{" "}
<code className="bg-docs-bg-code border border-docs-border-default rounded px-1.5 py-0.5 font-mono text-[13.5px] text-docs-text-primary">
TestnetCoreBase
</code>
).
</code>{" "}
(Initializable + UUPS + Ownable + ReentrancyGuard + ERC-2771) so we can
iterate without breaking integrators. The v1.0 mainnet deployment drops
UUPS entirely: every protocol contract becomes an immutable singleton —
no{" "}
<code className="bg-docs-bg-code border border-docs-border-default rounded px-1.5 py-0.5 font-mono text-[13.5px] text-docs-text-primary">
_authorizeUpgrade
</code>{" "}
hook, no owner or admin upgrade key. ERC-2771 meta-transaction support
carries over.
</p>
<p className="text-docs-text-secondary text-[14px] leading-relaxed mb-4">
Storage namespace today: <code>privara.storage.*</code> (legacy,
retained for cross-deployment-version compatibility per Whitepaper
§6.2). The <code>reineira.storage.*</code> prefix is canonical from v1.0
mainnet onwards.
</p>

<p className="text-docs-text-secondary leading-relaxed mb-4">
Expand All @@ -237,9 +249,10 @@ export default function Architecture() {

<p className="text-docs-text-secondary leading-relaxed mb-4">
Public mode can deploy on any EVM chain; the current chaos-net
deployment runs on Arbitrum L2. Cross-chain funding arrives over two
rails — Circle CCTP V2 for USDC, and LayerZero OFT / USDT0 for USDT
(available to non-U.S. and non-EU users) — both of which funnel into{" "}
deployment runs on Arbitrum L2. Cross-chain funding arrives over Circle
CCTP V2 for USDC today; the LayerZero OFT / USDT0 rail for USDT
(available to non-U.S. and non-EU users) is specified for v1.0. Both
funnel into{" "}
<code className="bg-docs-bg-code border border-docs-border-default rounded px-1.5 py-0.5 font-mono text-[13.5px] text-docs-text-primary">
ConfidentialEscrow.fundFrom
</code>
Expand All @@ -263,7 +276,7 @@ export default function Architecture() {
<ArchitectureDiagram
title="SYSTEM COMPONENTS"
steps={[
{ label: "Client (SDK)", sublabel: "Encrypts inputs via cofhejs" },
{ label: "Client (SDK)", sublabel: "Encrypts inputs via @cofhe/sdk" },
{ label: "EVM Contracts", sublabel: "ConfidentialEscrow + Gates" },
{ label: "Coordinator", sublabel: "Task distribution" },
{ label: "Operators", sublabel: "CCTP relay + settlement" },
Expand All @@ -288,9 +301,10 @@ export default function Architecture() {
</strong>{" "}
— The SDK encrypts amount and owner address locally using{" "}
<code className="bg-docs-bg-code border border-docs-border-default rounded px-1.5 py-0.5 font-mono text-[13.5px]">
cofhejs.encrypt()
@cofhe/sdk
</code>{" "}
with the network's public FHE key.
(<code>encryptInputs([...]).execute()</code>) with the network's
public FHE key.
</li>
<li>
<strong className="text-docs-text-primary font-semibold">
Expand Down
2 changes: 1 addition & 1 deletion src/pages/docs/BuilderJourney.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ const repoRows = [
{
repo: "reineira-code",
purpose: "Build on-chain plugins (Gates, Policies)",
stack: "Hardhat + Solidity + cofhejs",
stack: "Foundry/Hardhat + Solidity + @cofhe/sdk",
},
{
repo: "platform-modules",
Expand Down
38 changes: 35 additions & 3 deletions src/pages/docs/ConditionPlugins.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,13 @@ const interfaceRows = [
when: "Escrow creation",
purpose: "Parse and store your Gate configuration",
},
{
fn: "getConditionFee",
calledBy: "ConfidentialEscrow._setCondition()",
when: "Stamp time (in create)",
purpose:
"Declare the resolver-author fee in bps (0–10000) and recipient. Return (0, address(0)) for no fee.",
},
{
fn: "isConditionMet",
calledBy: "ConfidentialEscrow.redeem()",
Expand Down Expand Up @@ -90,7 +97,7 @@ export default function ConditionPlugins() {
filename="IConditionResolver.sol"
language="solidity"
lines={[
{ content: "interface IConditionResolver {" },
{ content: "interface IConditionResolver is IERC165 {" },
{
content:
" function isConditionMet(uint256 escrowId) external view returns (bool);",
Expand All @@ -101,13 +108,38 @@ export default function ConditionPlugins() {
" function onConditionSet(uint256 escrowId, bytes calldata data) external;",
highlighted: true,
},
{
content: " function getConditionFee(uint256 escrowId)",
highlighted: true,
},
{
content:
" external view returns (uint16 bps, address recipient);",
highlighted: true,
},
{ content: "}" },
]}
showLineNumbers={true}
/>

<DocsTable columns={interfaceColumns} rows={interfaceRows} />

<Callout variant="info" title="getConditionFee in the examples below">
<p>
Each Solidity example below shows only <code>onConditionSet</code> and{" "}
<code>isConditionMet</code> for clarity. A production resolver must
also implement{" "}
<code>
getConditionFee(uint256 escrowId) view returns (uint16 bps, address
recipient)
</code>{" "}
— the simplest stub is <code>{`{ return (0, address(0)); }`}</code>{" "}
when you don't charge a resolver-author fee. The protocol calls it
once at escrow creation to stamp the Condition fee slot; the sum of
all stamped fees is bounded by <code>MAX_TOTAL_BPS = 10000</code>.
</p>
</Callout>

{/* ------------------------------------------------------------------ */}
<h2
id="pattern-1-zktls"
Expand Down Expand Up @@ -1074,7 +1106,7 @@ export default function ConditionPlugins() {
<p className="text-docs-text-secondary leading-relaxed mb-4">
The fastest way to build a resolver is with{" "}
<a
href="/developers/reineira-code"
href="/developer-tools/reineira-code"
className="text-brand-primary font-medium hover:underline"
>
ReineiraOS Code
Expand All @@ -1090,7 +1122,7 @@ export default function ConditionPlugins() {
title: "ReineiraOS Code",
description:
"Generate production-ready resolvers with AI-assisted development",
href: "/developers/reineira-code",
href: "/developer-tools/reineira-code",
icon: Code2,
},
]}
Expand Down
Loading
Loading