PageSourceSearch

https://docs.yearn.fi/assets/js/6a30f871.768ae474.js

js yearn.fi collected 2026-10-02 14:55:37 UTC 6,084 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunkyearn_devdocs=self.webpackChunkyearn_devdocs||[]).push([["2308"],{96889:function(e,s,n){n.r(s),n.d(s,{metadata:()=>r,default:()=>h,frontMatter:()=>t,contentTitle:()=>d,toc:()=>l,assets:()=>c});var r=JSON.parse('{"id":"yvusd/api","title":"yvUSD API","description":"The yvUSD API aggregates and serves a mix of onchain data (vault/strategy accounting and APR-oracle reads) and an offchain service that periodically computes and caches results for fast frontend access.","source":"@site/docs/developers/yvusd/api.md","sourceDirName":"yvusd","slug":"/yvusd/api","permalink":"/developers/yvusd/api","draft":false,"unlisted":false,"tags":[],"version":"current","frontMatter":{},"sidebar":"developers","previous":{"title":"Locked yvUSD (Cooldown Vault)","permalink":"/developers/yvusd/locked-yvusd"},"next":{"title":"yVaults v3","permalink":"/developers/v3/overview"}}'),i=n(74848),a=n(28453);let t={},d="yvUSD API",c={},l=[{value:"Sources Of Truth",id:"sources-of-truth",level:2},{value:"Onchain APR Oracle",id:"onchain-apr-oracle",level:2},{value:"APR Service (Offchain)",id:"apr-service-offchain",level:2},{value:"API Routes",id:"api-routes",level:3},{value:"Data Freshness",id:"data-freshness",level:2},{value:"Links",id:"links",level:2}];function o(e){let s={a:"a",code:"code",h1:"h1",h2:"h2",h3:"h3",header:"header",li:"li",p:"p",strong:"strong",ul:"ul",...(0,a.R)(),...e.components},{PrettyLink:n}=s;return n||function(e,s){throw Error("Expected "+(s?"component":"object")+" `"+e+"` to be defined: you likely forgot to import, pass, or provide it.")}("PrettyLink",!0),(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(s.header,{children:(0,i.jsx)(s.h1,{id:"yvusd-api",children:"yvUSD API"})}),"\n",(0,i.jsxs)(s.p,{children:[(0,i.jsx)(s.a,{href:"https://yvusd-api.yearn.fi",children:"The yvUSD"})," API aggregates and serves a mix of onchain data (vault/strategy accounting and APR-oracle reads) and an offchain service that periodically computes and caches results for fast frontend access."]}),"\n",(0,i.jsx)(s.h2,{id:"sources-of-truth",children:"Sources Of Truth"}),"\n",(0,i.jsxs)(s.ul,{children:["\n",(0,i.jsxs)(s.li,{children:[(0,i.jsx)(s.strong,{children:"Vault/strategy accounting"})," is onchain (ERC-4626 ",(0,i.jsx)(s.code,{children:"totalAssets"}),", ",(0,i.jsx)(s.code,{children:"totalSupply"}),", strategy debt allocations, fee config)"]}),"\n",(0,i.jsxs)(s.li,{children:[(0,i.jsx)(s.strong,{children:"APR oracle"})," is onchain and provides strategy-level APR estimation"]}),"\n",(0,i.jsxs)(s.li,{children:[(0,i.jsx)(s.strong,{children:"APR service"})," aggregates these inputs into a debt-weighted vault APR and exposes it via a cached API"]}),"\n"]}),"\n",(0,i.jsx)(s.h2,{id:"onchain-apr-oracle",children:"Onchain APR Oracle"}),"\n",(0,i.jsx)(s.p,{children:"The API is configured to read an onchain APR oracle address. This oracle is used to fetch strategy APRs and to compute derivatives like Locked yvUSD's locker bonus APR."}),"\n",(0,i.jsx)(s.h2,{id:"apr-service-offchain",children:"APR Service (Offchain)"}),"\n",(0,i.jsx)(s.p,{children:"The yvUSD API:"}),"\n",(0,i.jsxs)(s.ul,{children:["\n",(0,i.jsx)(s.li,{children:"Indexes strategy membership from onchain events."}),"\n",(0,i.jsx)(s.li,{children:"Hydrates onchain metadata for strategies and vaults."}),"\n",(0,i.jsxs)(s.li,{children:["Computes a ",(0,i.jsx)(s.strong,{children:"debt-weighted"})," APR for each configured vault."]}),"\n"]}),"\n",(0,i.jsx)(s.p,{children:"The service is designed so frontends can read APR data without performing expensive onchain reads on every request."}),"\n",(0,i.jsx)(s.h3,{id:"api-routes",children:"API Routes"}),"\n",(0,i.jsxs)(s.p,{children:[(0,i.jsx)(s.a,{href:"https://yvusd-api.yearn.fi",children:"The API"})," exposes routes like:"]}),"\n",(0,i.jsxs)(s.ul,{children:["\n",(0,i.jsxs)(s.li,{children:[(0,i.jsx)(s.code,{children:"GET /api/health"}),": Health and data freshness."]}),"\n",(0,i.jsxs)(s.li,{children:[(0,i.jsx)(s.code,{children:"GET /api/sync"}),": run a full sync + recompute cycle (typically triggered by cron)."]}),"\n",(0,i.jsxs)(s.li,{children:[(0,i.jsx)(s.code,{children:"GET /api/aprs"}),": return precomputed APR results."]}),"\n",(0,i.jsxs)(s.li,{children:[(0,i.jsx)(s.code,{children:"GET /api/aprs/<address>"}),": APR for a single vault address."]}),"\n",(0,i.jsxs)(s.li,{children:[(0,i.jsx)(s.code,{children:"GET /api/snapsh
1ot"}),": raw indexed strategy cache."]}),"\n"]}),"\n",(0,i.jsx)(s.h2,{id:"data-freshness",children:"Data Freshness"}),"\n",(0,i.jsx)(s.p,{children:"APR outputs can be stale if:"}),"\n",(0,i.jsxs)(s.ul,{children:["\n",(0,i.jsx)(s.li,{children:"The sync job has not run recently."}),"\n",(0,i.jsx)(s.li,{children:"One of the configured RPC endpoints is degraded."}),"\n",(0,i.jsx)(s.li,{children:"A particular strategy type requires an offchain calculator that fails or is temporarily disabled."}),"\n"]}),"\n",(0,i.jsx)(s.p,{children:"In these cases, vault operations (deposit/withdraw/report) continue unaffected; only the rate display is impacted."}),"\n",(0,i.jsx)(s.h2,{id:"links",children:"Links"}),"\n",(0,i.jsx)(n,{children:(0,i.jsx)(s.a,{href:"https://yvusd-api.yearn.fi",children:"Live API"})}),"\n",(0,i.jsx)(n,{children:(0,i.jsx)(s.a,{href:"https://github.com/yearn/yearn-yvusd-apr-service",children:"yvUSD api github"})}),"\n",(0,i.jsx)(n,{children:(0,i.jsx)(s.a,{href:"/developers/yvusd",children:"yvUSD developer docs index"})}),"\n",(0,i.jsx)(n,{children:(0,i.jsx)(s.a,{href:"/developers/addresses/yvusd-contracts",children:"yvUSD contract addresses"})})]})}function h(e={}){let{wrapper:s}={...(0,a.R)(),...e.components};return s?(0,i.jsx)(s,{...e,children:(0,i.jsx)(o,{...e})}):o(e)}},28453:function(e,s,n){n.d(s,{R:()=>t,x:()=>d});var r=n(96540);let i={},a=r.createContext(i);function t(e){let s=r.useContext(a);return r.useMemo(function(){return"function"==typeof e?e(s):{...s,...e}},[s,e])}function d(e){let s;return s=e.disableParentContext?"function"==typeof e.components?e.components(i):e.components||i:t(e.components),r.createElement(a.Provider,{value:s},e.children)}}}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.