Integrations
A practical guide for protocols and front-ends integrating with Fira's on-chain contracts.
Last updated
// Current FW exchange rate (1e18 scale)
uint256 rate = IFiraWrappedStandardized(fw).exchangeRate();
// Market state including implied rate, reserves, TWAP
MarketState memory state = IPMarket(market).readState(router);
// BC Index (yield accrual factor for CT)
uint256 bcIndex = IBCToken(ct).bcIndexCurrent();
// TWAP observations (array of secondsAgo offsets)
uint32[] memory secs = new uint32[](2);
secs[0] = 1800; // 30 min ago
secs[1] = 0; // now
uint216[] memory cumRates = IPMarket(market).observe(secs);// How many FW shares for a given USDC deposit
uint256 fwOut = IFiraWrappedStandardized(fw).previewDeposit(usdc, amount);
// How much USDC for redeeming a given amount of FW
uint256 usdcOut = IFiraWrappedStandardized(fw).previewRedeem(usdc, fwAmount);bool expired = IPMarket(market).isExpired();
uint256 expiryTs = IPMarket(market).expiry();