# Settings Manager

**Initialize**

This function initializes the `PriceManager` contract with the addresses of the Operators contract and the Pyth contract.

<pre class="language-solidity"><code class="lang-solidity"><strong>initialize(address _operators, address _pyth)
</strong></code></pre>

**Set Asset**

This function allows an operator with level 3 to set the information for a specific asset. It takes parameters such as the asset ID, symbol, Pyth ID, price, allowed staleness (in seconds), allowed deviation (in basis points), and maximum leverage.

```solidity
setAsset(
uint256 _assetId, 
string calldata _symbol, 
bytes32 _pythId, 
uint256 _price, 
uint256 _allowedStaleness, 
uint256 _allowedDeviation, 
uint256 _maxLeverage
) external onlyOperator(3)
```

**Set Usd Asset**

This function allows an operator with level 3 to set the information for a USD stablecoin asset. It takes parameters such as the token address, asset ID, symbol, Pyth ID, price, allowed staleness (in seconds), allowed deviation (in basis points), and token decimals.

```solidity
setUsdAsset(
address _tokenAddress, 
uint256 _assetId, 
string calldata _symbol, 
bytes32 _pythId, 
uint256 _price, 
uint256 _allowedStaleness, 
uint256 _allowedDeviation, 
uint256 _tokenDecimals
)
```

**Get Last Price**

This function retrieves the last recorded price of an asset based on its asset ID. It returns the price as a `uint256` value.

```solidity
getLastPrice(uint256 _assetId) public view override returns (uint256)
```

**Token To Usd**

This function converts a given token amount to an equivalent USD amount based on the asset's price and token decimals. It takes the token address and token amount as parameters and returns the equivalent USD amount as a `uint256` value.

```solidity
tokenToUsd(address _token, uint256 _tokenAmount) 
    external view override returns (uint256)
```

**Usd To Token**

This function converts a given USD amount to an equivalent token amount based on the asset's price and token decimals. It takes the token address and USD amount as parameters and returns the equivalent token amount as a `uint256` value.

```solidity
usdToToken(
address _token, 
uint256 _usdAmount
) external view override returns (uint256)
```


---

# 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.vela.exchange/vela-knowledge-base/developers/contract-functions/settings-manager.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.
