# Phoenix Bonds Metrics
## TVL
To calculate the TVL of Phoenix Bonds, you’ll need the bonded LiNEAR amount as well as LiNEAR price.
1. Get bonded LiNEAR amount
Here let’s call the view function with [NEAR CLI](https://docs.near.org/docs/tools/near-cli), you can also call the funciton with [near-api-js](https://docs.near.org/docs/develop/front-end/near-api-js).
```
% NEAR_ENV=mainnet near view phoenix-bonds.near get_summary '{"linear_price": "1"}'
View call: phoenix-bonds.near.get_summary({"linear_price": "1"})
{
owner_id: 'linear.sputnik-dao.near',
linear_balance: '604025253653670592284124906499',
reserve_pool_near_amount: '0',
pending_pool_near_amount: '655825724800000000000000000000',
permanent_pool_near_amount: '0',
treasury_pool_near_amount: '0',
bootstrap_ends_at: 1675148400000,
tau: 300,
accrual_parameter: {
alpha: 380160000,
min_alpha: 8640000,
adjust_interval: 86400000,
adjust_rate: 100,
decreasing: false,
target_mean_length: 1296000000,
current_mean_length: 1102852398
}
}
```
Now we can extract LiNEAR amount from the `linear_balance` field, which is `linear_balance: '604025253653670592284124906499'` in the example response.
Note that the number is of 24 decimals, in order to get the real amount you'll need to divide it by 1e24.
2. Get LiNEAR price
If you already have a source for LiNEAR/USD price, you can skip this step.
Otherwise you need to call `ft_price` of the LiNEAR contract to get LiNEAR/NEAR price:
```
% NEAR_ENV=mainnet near view linear-protocol.near ft_price
View call: linear-protocol.near.ft_price()
'1089137526275022004429076'
```
The returned number is of 24 decimals, which means to get the actual price you'll need to divide it by 1e24. That makes it `1.089137526275022 (1089137526275022004429076 / 10^24)`.
With LiNEAR/NEAR price, we can calculate LiNEAR/USD price by just multipling LiNEAR/NEAR price with NEAR/USD price.
3. Calculate TVL
TVL = Bonded LiNEAR Amount (from step 1) * LiNEAR price (from step 2) * NEAR price in USD
In our example, this will be:
(604025253653670592284124906499 / 1e24) * (1089137526275022004429076 / 1e24) * 2.5 = 1644666.4 USD
Here we assumed NEAR/USD price is $2.5
## Total Supply of $pNEAR
$pNEAR tokens are minted when users claim their bonds, and burnt when users redeem pNEAR for NEAR.
To query the total supply of $pNEAR, call the `ft_total_supply` function.
```
% NEAR_ENV=mainnet near view phoenix-bonds.near ft_total_supply
View call: phoenix-bonds.near.ft_total_supply()
'1115026924901251165061493602436'
```
The decimals of $pNEAR is 24. Therefore, the actual $pNEAR total supply is 1115026924901251165061493602436 / 1e24 = 1,115,026.9249012512 $pNEAR.
## $pNEAR Fungible Token Metadata
In case you’d like to query $pNEAR metadata on-chain, use the following method.
For example, you can find the decimals of $pNEAR from the metadata, which is 24.
```
% NEAR_ENV=mainnet near view phoenix-bonds.near ft_metadata
View call: phoenix-bonds.near.ft_metadata()
{
spec: 'ft-1.0.0',
name: 'Phoenix NEAR',
symbol: 'pNEAR',
icon: "data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='34' height='34' fill='none'%3E%3Cdefs%3E%3CradialGradient id='a' cx='0' cy='0' r='1' gradientTransform='rotate(59.657 1.184 9.1) scale(31.96023)' gradientUnits='userSpaceOnUse'%3E%3Cstop offset='0%25' stop-color='%23FFBB41'/%3E%3Cstop offset='100%25' stop-color='%23CB0001'/%3E%3C/radialGradient%3E%3CradialGradient id='d' cx='0' cy='0' r='1' gradientTransform='rotate(82.875 6.74 14.776) scale(25.29919 28.35151)' gradientUnits='userSpaceOnUse'%3E%3Cstop offset='0%25' stop-color='%23FFDA76'/%3E%3Cstop offset='55.714%25' stop-color='%23C10000'/%3E%3Cstop offset='100%25' stop-color='%23800101'/%3E%3C/radialGradient%3E%3CclipPath id='b'%3E%3Crect width='33.227' height='34' x='.8' rx='0'/%3E%3C/clipPath%3E%3Cmask id='c'%3E%3Ccircle cx='17' cy='17' r='17' fill='%23FFF'/%3E%3C/mask%3E%3C/defs%3E%3Cg style='mix-blend-mode:passthrough'%3E%3Ccircle cx='17' cy='17' r='17' fill='url(%23a)'/%3E%3Cg clip-path='url(%23b)'%3E%3Cg fill-rule='evenodd' mask='url(%23c)'%3E%3Cpath fill='url(%23d)' d='M18.2 8.5c1.3-.7 3.4-1.3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