f(t₀)one value, the time it was read, and a signature
The euro’s daily reference rate against the Japanese yen, set by the European Central Bank.
Taken after the ECB’s afternoon publication, through Frankfurter’s mirror of the ECB set, and signed once a day.
Sources
Rights
The ECB publishes these rates free and asks to be cited accurately. It also asks that they not be used for transactions, which is why the feed name and the methodology both say so. Frankfurter, the open source API they are read through, is free for commercial use and charges nothing.
Looking for your wallet
import { IsometryFeeds } from "@isometry-feeds/sdk";
import { privateKeyToAccount } from "viem/accounts";
const feeds = new IsometryFeeds({
gatewayUrl: "https://isometry.me/feeds",
registry: "0x4D8fe5d10462E01eB971B82BDD41A37e0Fe8Ea1f", // checked on chain before every payment
account: privateKeyToAccount(process.env.BUYER_KEY as `0x${string}`),
maxSpendUsdc: 1_000_000n, // 1 USDC at most for the life of this process
});
const report = await feeds.read("isometry/eur-jpy-ecb-reference");
console.log(report.text(), report.observedAt);
// report.encoded and report.signature go straight to a contract built on FeedConsumer// SPDX-License-Identifier: MIT
pragma solidity 0.8.38;
import {FeedConsumer} from "./FeedConsumer.sol";
import {IFeedVerifier} from "./FeedTypes.sol";
/// Keeps the newest "EUR / JPY, ECB reference rate" it is handed. Anyone may submit a report: it proves itself.
contract EurJpyEcbReferenceReader is FeedConsumer {
bytes32 public constant FEED_ID = 0xd72ad84a236230ccb80d3e84ab68039175c541364d2b97f42daf0b94655dcb2d;
int256 public latest; // scaled by 10^4
constructor(IFeedVerifier verifier) FeedConsumer(verifier) {}
function submit(bytes calldata encoded, bytes calldata signature) external returns (int256 value) {
// each report is accepted once, and only if it was observed after the last one
value = _readOnce(
FEED_ID,
encoded,
signature,
Policy({maxAgeSec: 172800, allowedKinds: KIND_MANAGED, minValue: type(int256).min, maxValue: type(int256).max})
);
latest = value;
}
}