Concepts
NAV and the price
NAV is what the errand's money is worth, in USDC, at a given moment. The target is compared with it, and the fee comes from it.
What counts
The program keeps its own ledger of the errand's money:
- the USDC it tracks in the account, starting at the principal;
- the receipts it tracks in each lender, valued at that lender's current exchange rate.
Only moves made through Errand change the ledger. USDC you add to the account on top of the principal, or tokens someone else sends to it, stay yours: they are left out of the NAV, the caps and the fee.
How a lender position is valued
Each lender's receipts are valued with the lender's own reserve data, read and refreshed in the same transaction: Kamino's and Solend's reserve accounts give the USDC each receipt is worth, net of the reserve's protocol fees. Interest the lenders pay raises that value over the term.
The price
Every measurement also reads Pyth's USDC/USD price. Errand accepts it only when it is fully verified, no older than 60 seconds and with a confidence interval within 1% of the price. Because every position is in USDC, the price doesn't change the USDC NAV; it is recorded with each measurement.
When NAV is measured
The program measures NAV at every move: posting, award, each deposit or withdrawal, recall and settlement. Errand's worker also records a snapshot regularly while an errand runs, which is what the errand's page draws.