# Weighted Asset Rate

Weighted asset rate represents the **average price of the assets backing satUSD**.

It calculates a **debtTokenMinted-weighted average rate** across all supported backing assets. In other words, it shows the overall price level of the asset pool supporting satUSD.

### How It Works

The function iterates through all supported assets and applies the following rules:

* Only supported assets are included
* Only assets with `debtTokenMinted > 0` are counted
* Each asset is weighted by its `debtTokenMinted`
* If an asset does not use an oracle, its price is treated as $1
* If an asset uses an oracle, the on-chain price is fetched and validated against `minPrice` and `maxPrice`

Formula:

```
Weighted Asset Rate = Σ(asset price × debtTokenMinted) / Σ(debtTokenMinted)
```

### Contract Integration

Protocols, vaults, or monitoring contracts can call `getWeightedAssetRate()` to read the **debtTokenMinted-weighted average price of the assets backing satUSD**.

#### Contract Addresses

Contracts can integrate with the `NexusYieldManagerFacet` through the **SatoshiXApp contract address on each chain**.

For deployed addresses, please refer to the **Deployed Contract** page and use the corresponding **SatoshiXApp** address for that chain.

For example, to read the value on Ethereum, use the **Ethereum SatoshiXApp** address shown on that page:

{% content-ref url="../deployed-contracts/ethereum" %}
[ethereum](https://docs.river.inc/outro/deployed-contracts/ethereum)
{% endcontent-ref %}

#### Interface

```solidity
interface INexusYieldManagerFacet {
    function getWeightedAssetRate() external returns (uint256);
}
```

#### Return Value

`getWeightedAssetRate()` returns a `uint256` scaled by `1e18`.

This means:

* `1e18` = $1.00
* `1.02e18` = $1.02
* `0.98e18` = $0.98

#### Failure Cases

The call may revert in the following cases:

* `NoActiveAssets()` if no asset currently contributes weight
* `InvalidPrice(uint256 price)` if an oracle price is outside the allowed range
