Skip to content

Commit

Permalink
Merge branch 'liskdocs-12-redstone-push' into gh-pages
Browse files Browse the repository at this point in the history
  • Loading branch information
Tschakki committed Nov 25, 2024
2 parents 07c5f36 + a07be3a commit d288830
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 33 deletions.
30 changes: 14 additions & 16 deletions docs/building-on-lisk/using-oracle-data/redstone-push.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ RedStone data feeds are compatible with Chainlink's [AggregatorV3Interface](http

- **Aggregator contract**: An aggregator is a contract that receives periodic data updates from the oracle network.
Aggregators store aggregated data onchain so that consumers can retrieve it and act upon it within the same transaction.
These contracts are already deployed on the Lisk network and can be directly used by Consumers.
These contracts have already been deployed on the Lisk network and can be directly used by consumers.
- **Consumer**: A consumer is an onchain or offchain application that uses Data Feeds.
Consumer contracts use the `AggregatorV3Interface` to call functions on the proxy contract[^1] of the Aggregator to retrieve oracle data.

Expand All @@ -52,7 +52,7 @@ The following Aggregators are available on Lisk Mainnet for RedStone Push:
- [WBTC/USD L2PriceFeedWithoutRounds](https://blockscout.lisk.com/address/0x13da43eA89fB692bdB6666F053FeE70aC61A53cd)
- address: `0x13da43eA89fB692bdB6666F053FeE70aC61A53cd`

In this guide, we will develop a Consumer contract that will request the latest spot prices from the ETH, LSK and USDT data feeds.
In this guide, we will develop a Consumer contract that requests the latest spot prices from the ETH, LSK, and USDT data feeds.

:::note
RedStone Push is only fully available on Lisk Mainnet, so please make sure to deploy your Consumer contract on Lisk Mainnet as well.
Expand All @@ -62,14 +62,14 @@ In case you wish to deploy on Lisk Sepolia Testnet, check the [Tellor](./tellor.

## Import

To use the RedStone data inside your contract, import the [AggregatorV3Interface](https://docs.chain.link/data-feeds/using-data-feeds#solidity) from Chainlink like shown in the example contract below.
To use the RedStone data inside your contract, import the [AggregatorV3Interface](https://docs.chain.link/data-feeds/using-data-feeds#solidity) from Chainlink, as shown in the example contract below.

For every data feed you like to store, create a new constant with type `AggregatorV3Interface`.
Create a new constant with the type `AggregatorV3Interface` for every data feed you want to store.

In the constructor, set the above defined constants to point to the respective data feeds:
Use the `AggregatorV3Interface()` function and pass the address of the respective data feed contract as parameter.
In the constructor, set the above-defined constants to point to the respective data feeds.
Use the `AggregatorV3Interface()` function and pass the address of the respective data feed contract as a parameter.

```solidity
```solidity title="Importing the AggregatorV3Interface"
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.28;
Expand Down Expand Up @@ -116,7 +116,7 @@ To read the data of the price feeds, we define the following functions in the co
- `getRedStoneLSKDataFeedLatestAnswer()`
- `getRedStoneUSDTDataFeedLatestAnswer()`

Inside of the functions, call the [latestRoundData](https://docs.chain.link/data-feeds/api-reference#latestrounddata) on the respective data feeds to receive the latest spot prices for the respective token.
Inside the functions, call the [latestRoundData](https://docs.chain.link/data-feeds/api-reference#latestrounddata) on the respective data feeds to receive the latest spot prices for the respective token.

The `latestRoundData()` function returns the following values:

Expand All @@ -132,17 +132,15 @@ In this example, we will only use `answer` and `updatedAt`.
The `updatedAt` value should be used to make sure that the `answer` is recent enough for your application to use it.
You can compare `updatedAt` to the latest block time (`uint256 currentTime = block.timestamp;`) to ensure you are only using the latest oracle data in your application.

```solidity
:::caution
THIS IS AN EXAMPLE CONTRACT THAT USES UN-AUDITED CODE.
DO NOT USE THIS CODE IN PRODUCTION.
:::

```solidity title="Reading data feeds"
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.28;
/**
* THIS IS AN EXAMPLE CONTRACT THAT USES HARDCODED
* VALUES FOR CLARITY.
* THIS IS AN EXAMPLE CONTRACT THAT USES UN-AUDITED CODE.
* DO NOT USE THIS CODE IN PRODUCTION.
*/
import {AggregatorV3Interface} from "@chainlink/contracts/src/v0.8/shared/interfaces/AggregatorV3Interface.sol";
contract RedStoneDataConsumer {
Expand Down
24 changes: 9 additions & 15 deletions docs/docs-user/exchanges.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,19 @@ Lisk (LSK) is available for trading on various <!-- decentralized and centralize
| **Zonda** | 🟡 Ethereum | [LSK/USDT](https://zondacrypto.com/en/exchange-rate/lisk-price-usdt)<br />[LSK/EUR](https://zondacrypto.com/en/exchange-rate/lisk-price-eur)<br />[LSK/BTC](https://zondacrypto.com/en/exchange-rate/lisk-price-btc)<br />[LSK/PLN](https://zondacrypto.com/en/exchange-rate/lisk-price-pln) |


## Decentralized Exchanges (DEX)

| Name | Supported network[^1] |
| :---------------------------- | :------------------------------------------ |
| [Oku.Trade](https://oku.trade/app/lisk/trade/0xac485391eb2d7d88253a7f1ef18c37f4242d1a24) | 🟢 Lisk |
| [Velodrome](https://velodrome.finance/swap?from=0xac485391eb2d7d88253a7f1ef18c37f4242d1a24&to=0x05d032ac25d322df992303dca074ee7392c117b9&chain0=1135&chain1=1135) | 🟢 Lisk |
| [Uniswap](https://app.uniswap.org/explore/tokens/ethereum/0x6033f7f88332b8db6ad452b7c6d5bb643990ae3f) | 🟡 Ethereum |

[^1]: The LSK token is supported on both the Ethereum L1 and the Lisk L2 blockchains.
The "supported network" field indicates the blockchain being used by the exchange for deposits & withdrawals of LSK.
Please note that using the wrong network/blockchain when depositing funds to an exchange could result in lost funds.

### Coming soon
## Coming soon

| Name | Supported network |
| :----------------------- |:----------------- |
Expand All @@ -67,17 +75,3 @@ Please note that using the wrong network/blockchain when depositing funds to an
| **OkCoin** (OKX Japan) | Lisk |
| **YellowCard** (Africa) | Lisk |

## Decentralized Exchanges (DEX)

| Name | Supported network[^1] |
| :---------------------------- | :------------------------------------------ |
| [Oku.Trade](https://oku.trade/app/lisk/trade/0xac485391eb2d7d88253a7f1ef18c37f4242d1a24) | 🟢 Lisk |
| [Uniswap](https://app.uniswap.org/explore/tokens/ethereum/0x6033f7f88332b8db6ad452b7c6d5bb643990ae3f) | 🟡 Ethereum |

### Coming soon

| Name |
| :---------------------------- |
| **Velodrome** |


4 changes: 2 additions & 2 deletions plugins/generated-bridged-token-adresses-docs.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@ LiskAdresses.forEach(token => {
// For Lisk Mainnet, add Ethereum Mainnet address
if (token.chainId === chainIds[0]) {
result = tokens.find(function(tkn) {
return tkn.symbol === token.symbol && tkn.chainId === 1;
return ((tkn.symbol === token.symbol) || (tkn.symbol + ".e" === token.symbol)) && tkn.chainId === 1;
});
ethAddress = result? result : {address: "Not Found"};
// For Lisk Sepolia, add Ethereum Sepolia address
} else if (token.chainId === chainIds[1]) {
result = tokens.find(function(tkn) {
return tkn.symbol === token.symbol && tkn.chainId === 11155111;
return ((tkn.symbol === token.symbol) || (tkn.symbol + ".e" === token.symbol)) && tkn.chainId === 11155111;
});
ethAddress = result? result : {address: "Not Found"};
} else {
Expand Down

0 comments on commit d288830

Please sign in to comment.