# Smart Contract

Read these [Chainlink ](https://chain.link/tutorials/how-to-read-smart-contract)and [QuickNode](https://www.quicknode.com/guides/ethereum-development/smart-contracts/how-to-interact-with-smart-contracts#interacting-with-smart-contracts-using-etherscan) articles to know how to read and interact with a smart contract.

## Spot TESR

The following smart contracts are currently live:

<table><thead><tr><th width="219">Chain</th><th>Smart Contract Address</th></tr></thead><tbody><tr><td>Sepolia Testnet</td><td><a href="https://sepolia.etherscan.io/address/0xb3710c50a687fe716d6b99eda3288a73cc066cf5#readProxyContract">0xB3710c50A687Fe716D6B99EDa3288a73cC066Cf5</a></td></tr><tr><td>Ethereum Mainnet</td><td><a href="https://etherscan.io/address/0xa1c069c2f77b26a54e9f175fa2eade21c34a94e1#readProxyContract">0xa1c069C2F77B26a54e9F175fA2EADe21c34A94E1</a></td></tr></tbody></table>

{% hint style="info" %}
The above table will be updated as the contract goes live on more blockchains.
{% endhint %}

#### Read Methods

All the relevant methods available to query are summarized below:

| Method                  | Description                                                              |
| ----------------------- | ------------------------------------------------------------------------ |
| `decimals`              | number of decimal points to apply on ESR value                           |
| `ESR_PUBLISH_FREQUENCY` | publish frequency of ESR in seconds                                      |
| `getLatestESR`          | latest ESR published as significant digits                               |
| `getLatestESRDate`      | latest published ESR day as SOD unix timestamp                           |
| `getESRForDate`         | takes UTC unix timestamp as input for any day and returns that day's ESR |
| `getEarliestESRDate`    | earliest published ESR day available for query                           |

## TESR Forwards (DOR)

The following smart contracts are currently live:

<table><thead><tr><th width="219">Chain</th><th>Smart Contract Address</th></tr></thead><tbody><tr><td>Sepolia Testnet</td><td><a href="https://sepolia.etherscan.io/address/0x927894aac9b0f9f8719a421a084de52ea06505d1#readContract">0x927894aAc9B0f9F8719a421A084De52EA06505d1</a></td></tr></tbody></table>

{% hint style="info" %}
The above table will be updated as the contract goes live on more blockchains.
{% endhint %}

#### Read Methods

All the relevant methods available to query are summarized below:

| Method                       | Description                                                                               |
| ---------------------------- | ----------------------------------------------------------------------------------------- |
| `dor`                        | DOR name                                                                                  |
| `decimals`                   | number of decimal points to apply on consensus value                                      |
| `getFirstRoundPublishTime`   | publish time of first consensus round in seconds                                          |
| `getActiveTenors`            | list of current active tenors for this DOR                                                |
| `getActiveTenorsUpdateBlock` | block at which current active tenors were updated                                         |
| `getLatestRound`             | latest published round ID for this DOR                                                    |
| `getLatestRoundPublishTime`  | publish time of latest round ID                                                           |
| `getLatestRoundData`         | latest published consensus round data given an active tenor                               |
| `getRoundDataFromId`         | historical consensus round's data given the round ID and an active tenor as of that round |
