# Contract Interfaces

This section documents the public and external functions of SIR Protocol's core contracts. It is intended for developers building on top of the protocol — bots, aggregators, frontends, and other integrations.

For deployed contract addresses, see [Deployments](/protocol-overview/deployments.md).

{% hint style="info" %}
The core contracts are deployed on **Ethereum**, **HyperEVM**, and **MegaETH**. Function signatures are nearly identical across chains, but there are meaningful differences noted on each page. Always verify against the deployment you are targeting.
{% endhint %}

## Contract Pages

| Contract                                                                         | Description                                                         |
| -------------------------------------------------------------------------------- | ------------------------------------------------------------------- |
| [Vault](/protocol-overview/smart-contract-interfaces/vault.md)                   | Main entry point for minting and burning APE/TEA tokens             |
| [SIR & Staking](/protocol-overview/smart-contract-interfaces/sir-and-staking.md) | SIR token, staking for dividends, reward claiming, and fee auctions |
| [Price Oracle](/protocol-overview/smart-contract-interfaces/oracle.md)           | TWAP price feed interface                                           |
| [TEA & APE Tokens](/protocol-overview/smart-contract-interfaces/tea-and-ape.md)  | LP token (ERC1155) and leveraged token (ERC20) interfaces           |

## Key Structs

These structs appear throughout the contract interfaces.

### `VaultParameters`

Identifies a specific vault. Used as input to most Vault functions.

```solidity
struct VaultParameters {
    address debtToken;
    address collateralToken;
    int8 leverageTier;       // Range: -2 to +2
}
```

### `Reserves`

Collateral reserves held by a vault, returned by `getReserves()`.

```solidity
struct Reserves {
    uint144 reserveApes;     // Collateral belonging to APE holders
    uint144 reserveLPers;    // Collateral belonging to TEA holders (LPs)
    int64 tickPriceX42;      // Current price in Q21.42 fixed point
}
```

### `VaultState`

On-chain storage representation of a vault's state.

```solidity
struct VaultState {
    uint144 reserve;          // Total reserve (reserveApes + reserveLPers)
    int64 tickPriceSatX42;    // Saturation price in Q21.42 fixed point
    uint48 vaultId;           // Unique vault identifier
}
```

### `Fees`

Fee breakdown returned during mint/burn operations.

```solidity
struct Fees {
    uint144 collateralInOrWithdrawn;   // Net collateral deposited or withdrawn
    uint144 collateralFeeToStakers;    // Fee portion sent to SIR stakers
    uint144 collateralFeeToLPers;      // Fee portion sent to LPers / POL
}
```

### `Auction`

State of a fee auction.

```solidity
struct Auction {
    address bidder;    // Current highest bidder
    uint96 bid;        // Current highest bid amount
    uint40 startTime;  // Auction start timestamp
}
```


---

# Agent Instructions: 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:

```
GET https://docs.sir.trading/protocol-overview/smart-contract-interfaces.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
