FeedPlumb · Build
FeedKit Open-source integration kit
Read Plugin feeds safely in Solidity, starting from tested templates.
FeedKit at a glance
- Who it's for
- Solidity developers integrating Plugin price feeds on XDC.
- The problem it solves
- Decimals differ per feed, some feeds are stale or access-controlled, and a naive read can pass a bad price into your protocol.
Key features
- Checked adapter in the feed's native decimals, with round and staleness checks
- Per-feed staleness defaults from observed heartbeats
- Optional 8-decimal Chainlink-style wrapper
2 more features
- Automation upkeep template, ERC-4626 rate guard and TWAP fallback
- Foundry tests with mocks and read-only mainnet fork tests, published with the sources
MIT-licensed and unaudited. The templates are intended for testnet, fork and local use. Get an independent review before you use them with real value. This is not an audit and not investment advice.
Install
# Foundry project: sources, tests and foundry.toml (solc 0.8.24, evm_version = "cancun";
# XDC mainnet does not run Prague yet). Browse them at https://feedplumb.com/kit/sources.html
curl -sO https://feedplumb.com/kit/feedkit.tar.gz -O https://feedplumb.com/kit/SHA256SUMS
sha256sum -c SHA256SUMS # checks the archive
tar xzf feedkit.tar.gz && cd feedkit
forge install foundry-rs/forge-std@v1.17.0 --no-git # test library (not bundled)
forge build && forge test --no-match-path 'test/fork/*' # unit tests with mocks
XDC_FORK_RPC=https://rpc.xinfin.network forge test --match-path 'test/fork/*' # read-only mainnet forkDocumentation
- Overview and contract reference
- Feed defaults table: staleness per feed, market-hours and reverting flags; the same list as data in feeds.json
- Solidity sources and tests, download as feedkit.tar.gz (SHA-256 checksum), and the MIT licence
- Reading a feed: integrating without the kit
Example
import {PluginOracleAdapter} from "./PluginOracleAdapter.sol";
import {IPluginFeed} from "./interfaces/IPluginFeed.sol";
contract MyVault {
// XDC/USDT proxy, 16 decimals. maxStaleness 0 = kit default (1 h); bounds off.
PluginOracleAdapter public immutable xdcUsdt =
new PluginOracleAdapter(IPluginFeed(0x896CC6fE8AD04dF9f481332606c445768e286076), 0, 0, 0);
function collateralValue(uint256 xdcAmount) external view returns (uint256) {
// reverts on stale / zero / incomplete rounds, and on access-controlled or broken feeds
return xdcAmount * xdcUsdt.latestPrice() / 10 ** xdcUsdt.decimals();
}
}Note: this proxy's description() returns "0xUSDT", not "XDC/USDT", and it has a different owner from most feeds. Don't assert description() in constructors for this feed; check the proxy address instead.
Good to know
- Staleness: defaults come from heartbeats observed on 21 Oct 2026. Daily FX, stock and metal feeds default to 72 hours because they do not update at weekends;
marketHours(feed)lets you apply a stricter weekday limit. Some crypto feeds (ALGO, DOGE, ATOM, POL and CAKE) were seen with gaps of about 1 to 3 hours, longer than the 30-minute heartbeat the kit assumes when Plugin publishes none, so their defaults follow what was observed. - Reverting feeds: proxies marked reverting (access-controlled or broken) here and in the feed table revert for every caller. "No access" means the feed is restricted: ask Plugin to add your contract to its access list.
- The TWAP fallback is off by default. The XSwap WXDC/USDC pool is far too thin (about 42 USDC) and fails the minimum-liquidity check.
- Automation: Plugin has not published its XDC registry and forwarder addresses, so the upkeep template stays locked until you set the forwarder.
- RPC endpoints: the xinfin endpoints may return HTTP 403 to non-browser clients that send no User-Agent.
rpc.xdcrpc.comanswers without a key today, but XDC Gateway documents its endpoints as key-authenticated, so don't treat it as a guaranteed keyless endpoint. - VRF is experimental. A VRF v2 consumer is included under
src/experimental/, unsupported and outside the documentation above.