> For the complete documentation index, see [llms.txt](https://gnosza.gitbook.io/token-price-oracle/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://gnosza.gitbook.io/token-price-oracle/developer/smart-contracts/tickerpricestorage.md).

# TickerPriceStorage

The TickerPriceStorage contract's purpose is to act as on-chain storage & oracle for use by external contracts. The set function is the only public facing one and can be initiated by anybody.

<figure><img src="https://3820821826-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fp1AG2kVgPxoINkE4ESqB%2Fuploads%2FkRb0z6ANVtam9Sxxmxsi%2FScreenshot%202023-12-15%20at%2019.37.37.png?alt=media&amp;token=7b08af59-4760-4143-bf8f-0a4034b05a6f" alt=""><figcaption></figcaption></figure>

## The Smart Contract API

### ITickerPriceStorage <a href="#itickerpricestorage" id="itickerpricestorage"></a>

#### TickerPriceUpdated <a href="#tickerpriceupdated" id="tickerpriceupdated"></a>

```solidity
event TickerPriceUpdated(string ticker, uint256 newPrice)
```

#### set <a href="#set" id="set"></a>

```solidity
function set(string ticker, uint256 price) external
```

Function for updating the price of a token in the contract's storage represented in USD

*The price delta has to be larger than 2% of the current storage price and less than 20% of the Chainlink price in order for it to be successfully updated*

**Parameters**

| Name   | Type    | Description                                                   |
| ------ | ------- | ------------------------------------------------------------- |
| ticker | string  | - The ticker symbol of the token whose price is being updated |
| price  | uint256 | - The new price for the given ticker                          |

**📅 Events**

* Emits a `TickerPriceUpdated` event
