> For the complete documentation index, see [llms.txt](https://docs.fira.money/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.fira.money/developers/integrations/interfaces.md).

# Interfaces

All interfaces live in `src/interfaces/`. They are the canonical reference for integrators.

## FW (Fira Wrapped)

### IFiraWrappedStandardized

The yield-bearing wrapper token (e.g. USDCFW wrapping USDC into a SisuVault).

```solidity
function deposit(address receiver, address tokenIn, uint256 amountTokenToDeposit, uint256 minSharesOut)
    external payable returns (uint256 amountSharesOut);

function redeem(address receiver, uint256 amountSharesToRedeem, address tokenOut, uint256 minTokenOut, bool burnFromInternalBalance)
    external returns (uint256 amountTokenOut);

function exchangeRate() external view returns (uint256);
function previewDeposit(address tokenIn, uint256 amountTokenToDeposit) external view returns (uint256);
function previewRedeem(address tokenOut, uint256 amountSharesToRedeem) external view returns (uint256);
function claimRewards(address user) external returns (uint256[] memory);
function accruedRewards(address user) external view returns (uint256[] memory);
function getTokensIn() external view returns (address[] memory);
function getTokensOut() external view returns (address[] memory);
function assetInfo() external view returns (AssetType, address, uint8);
```

## Market

### IPMarket

The BT/FW AMM pool. Also an ERC-20 (LP token).

```solidity
function mint(address receiver, uint256 netFwDesired, uint256 netBtDesired)
    external returns (uint256 netLpOut, uint256 netFwUsed, uint256 netBtUsed);

function burn(address receiverFw, address receiverBt, uint256 netLpToBurn)
    external returns (uint256 netFwOut, uint256 netBtOut);

function swapExactBtForFw(address receiver, uint256 exactBtIn, bytes calldata data)
    external returns (uint256 netFwOut, uint256 netFwFee);

function swapFwForExactBt(address receiver, uint256 exactBtOut, bytes calldata data)
    external returns (uint256 netFwIn, uint256 netFwFee);

function readState(address router) external view returns (MarketState memory);
function readTokens() external view returns (IFiraWrappedStandardized, IBondToken, IBCToken);
function observe(uint32[] memory secondsAgos) external view returns (uint216[] memory);
function isExpired() external view returns (bool);
function expiry() external view returns (uint256);
```

### IPMarketFactoryV3

```solidity
function createNewMarket(address BT, int256 scalarRoot, int256 initialAnchor, uint80 lnFeeRateRoot)
    external returns (address market);
function isValidMarket(address market) external view returns (bool);
```

### IPMarketSwapCallback

Implement this if calling FiraMarket swap functions directly (not via Router).

```solidity
function swapCallback(int256 btToAccount, int256 fwToAccount, bytes calldata data) external;
```

## Yield contracts

### IBondToken

Fixed-rate principal token. ERC-20 with restricted mint/burn.

```solidity
function mint(address to, uint256 amount) external;
function burn(address from, uint256 amount) external;
```

### IBCToken (CouponToken)

Floating-yield token with interest accrual. Inherits `IPInterestManagerCT`.

```solidity
function mintBC(address receiverBT, address receiverCT) external returns (uint256 amountBCOut);
function redeemBC(address receiver) external returns (uint256 amountFwOut);
function redeemDueInterestAndRewards(address user, bool redeemInterest, bool redeemRewards)
    external returns (uint256 interestOut, uint256[] memory rewardsOut);
function bcIndexCurrent() external returns (uint256);
function bcIndexStored() external view returns (uint256);
function isExpired() external view returns (bool);
function expiry() external view returns (uint256);
function FW() external view returns (address);
function BT() external view returns (address);
```

### IBCContractFactory

```solidity
function createBCContract(address fw, uint256 expiry) external returns (address BT, address CT);
```

## Router facets

### IPActionSwapBTV3

```solidity
function swapExactBtForFw(address receiver, address market, uint256 exactBtIn, TokenOutput calldata output, LimitOrderData calldata limit)
    external returns (uint256 netFwOut, uint256 netFwFee);

function swapExactFwForBt(address receiver, address market, uint256 exactFwIn, ApproxParams calldata guessBtOut, TokenInput calldata input, LimitOrderData calldata limit)
    external returns (uint256 netBtOut, uint256 netFwFee);
```

### IPActionSwapCTV3

```solidity
function swapExactFwForCt(address receiver, address market, uint256 exactFwIn, TokenInput calldata input, ApproxParams calldata guessCTOut, LimitOrderData calldata limit)
    external returns (uint256 netCtOut, uint256 netFwFee);

function swapExactCtForFw(address receiver, address market, uint256 exactCtIn, TokenOutput calldata output, LimitOrderData calldata limit)
    external returns (uint256 netFwOut, uint256 netFwFee);
```

### IPActionAddRemoveLiqV3

```solidity
function addLiquidityDualFwAndBt(address receiver, address market, TokenInput calldata input, uint256 netBtDesired, uint256 minLpOut)
    external returns (uint256 netLpOut, uint256 netFwUsed, uint256 netBtUsed);

function removeLiquidityDualFwAndBt(address receiver, address market, uint256 netLpToRemove, TokenOutput calldata output, uint256 minBtOut)
    external returns (uint256 netFwOut, uint256 netBtOut);
```

### IPActionMiscV3

```solidity
function mintBcFromFw(address receiver, address CT, uint256 netFwIn, uint256 minBcOut)
    external returns (uint256 netBcOut);

function redeemBcToFw(address receiver, address CT, uint256 netBcIn, TokenOutput calldata output)
    external returns (uint256 netFwOut);

function redeemDueInterestAndRewards(address receiver, address[] calldata CTs, address[] calldata FWs, address[] calldata markets)
    external;

function exitPreExpiry(address receiver, address market, uint256 netBtIn, uint256 netCtIn, uint256 netLpIn, TokenOutput calldata output)
    external returns (uint256 totalFwOut);

function exitPostExpiry(address receiver, address market, uint256 netBtIn, uint256 netCtIn, uint256 netLpIn, TokenOutput calldata output)
    external returns (uint256 totalFwOut);

function multicall(bytes[] calldata data) external payable returns (bytes[] memory results);
```

### IPActionBorrow

```solidity
function borrow(address market, MarketParams calldata marketParams, uint256 amount, uint256 shares, address onBehalf, address receiver)
    external returns (uint256 assetsOut, uint256 sharesOut);

function repay(address market, MarketParams calldata marketParams, uint256 amount, uint256 shares, address onBehalf, bytes calldata data)
    external returns (uint256 assetsRepaid, uint256 sharesRepaid);
```

### IPActionSimple

On-chain approximation variants that avoid the need for off-chain `ApproxParams` computation.

```solidity
function swapExactFwForBtSimple(address receiver, address market, uint256 exactFwIn, uint256 minBtOut)
    external returns (uint256 netBtOut, uint256 netFwFee);

function addLiquiditySingleFwSimple(address receiver, address market, uint256 netFwIn, uint256 minLpOut)
    external returns (uint256 netLpOut);
```

## Shared types (IPAllActionTypeV3)

```solidity
struct TokenInput {
    address tokenIn;
    uint256 netTokenIn;
    address tokenMintFw;
    address firaSwap;
    SwapData swapData;
}

struct TokenOutput {
    address tokenOut;
    uint256 minTokenOut;
    address tokenRedeemFw;
    address firaSwap;
    SwapData swapData;
}

struct ApproxParams {
    uint256 guessMin;
    uint256 guessMax;
    uint256 guessOffchain;
    uint256 maxIteration;
    uint256 eps;
}

struct SwapData {
    SwapType swapType;
    address extRouter;
    bytes extCalldata;
    bool needScale;
}
```

## Utility interfaces

### IRehypothecationModule

```solidity
function rebalance() external;
function phiMin() external view returns (uint256);
function phiMax() external view returns (uint256);
function phiTarget() external view returns (uint256);
```

### ILiquidityInjector

```solidity
function injectLiquidity(uint256 btAmount, uint256 fwAmount) external returns (uint256 lpOut);
function withdrawLiquidity(uint256 lpAmount) external returns (uint256 fwOut, uint256 btOut);
```

### IOracle

```solidity
function price() external view returns (uint256);
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.fira.money/developers/integrations/interfaces.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
