Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Tests
on:
push:
branches:
- main
tags:
- v*
pull_request:

jobs:
Tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20.x'
cache: 'npm'
- name: Install dependencies
run: npm install
- name: Run tests
run: npx hardhat test
19 changes: 11 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@

# Sample Projects Using Tellor Layer <a name="sample"> </a>

<b>The Tellor oracle</b> is a decentralized oracle. The tellor oracle chain, Layer, provides an option for contracts to interact securely with and obtain data from off-chain.

This repository aims to provide an updated version of various examples of sample code that uses Tellor. Note that there are different checks and best practices depending on the specific use case and user profile. The examples specified in this repo are:
This repository provides various examples of sample code that uses Tellor. Note that there are different checks and best practices depending on the specific use case and user profile. The examples specified in this repo are:
- Price feeds
- Slow data (e.g. the CPI thats updated monthly)
- Prediction Markets
- Tellor as a fallback to a centralized oracle
- Reading from another EVM chain
- MVP User
- YOLO User - a baseline oracle user that just verifies the data is valid tellor data

For more in-depth information about Tellor, check out our [documentation](https://docs.tellor.io/tellor/).

Expand Down Expand Up @@ -38,7 +36,6 @@ Using tellor layer is simple:

For more advanced users, if you have further questions or if you want to run a reporter yourself, please head to [docs.tellor.io/layer-docs](https://docs.tellor.io/layer-docs)


#### 3. To run tests:

Hardhat:
Expand All @@ -48,11 +45,17 @@ npx hardhat test
```

#### 4. Deployment:
Hardhat:

First create a .env file corresponding to the .env.example file
### Configure your network

Next update your hardhat.config with the correct network/gas settings.
Configure your network in your hardhat.config with the correct network/gas settings.

### Setup Config Variables
Setup config variables relevant to your setup. The default variables are for `INFURA_API_KEY`, `ETHERSCAN_API_KEY`, `TESTNET_PK`, and `MAINNET_PK`:

```shell
npx hardhat vars set INFURA_API_KEY
```

Then, in scripts/DeploySampleMVPUser.js, change the dataBridgeAddress to correspond to the correct address corresponding to your deployment network [https://docs.tellor.io/tellor/the-basics/contracts-reference](https://docs.tellor.io/tellor/the-basics/contracts-reference). Change the queryId to the correct queryId for the data you want to read. Change the NODE_URL to the correct value for your deployment network.

Expand Down
106 changes: 0 additions & 106 deletions contracts/playground/DataBankPlayground.sol

This file was deleted.

2 changes: 1 addition & 1 deletion contracts/playground/PlaygroundUser.sol
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: MIT
pragma solidity 0.8.19;

import "./interfaces/IDataBankPlayground.sol";
import "usingtellorlayer/contracts/interfaces/IDataBankPlayground.sol";

/**
* @title PlaygroundUser
Expand Down
16 changes: 0 additions & 16 deletions contracts/playground/interfaces/IDataBankPlayground.sol

This file was deleted.

6 changes: 6 additions & 0 deletions contracts/testing/Importer.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

// this file imports any external contractsiles we want hardhat to compile

import "usingtellorlayer/contracts/testing/DataBankPlayground.sol";
5 changes: 1 addition & 4 deletions hardhat.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,7 @@ module.exports = {
runs: 300,
},
},
},
{
version: "0.8.22",
},
}
],
},
networks: {
Expand Down
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
},
"dependencies": {
"dotenv": "^16.5.0",
"usingtellorlayer": "^1.1.0",
"usingtellorlayer": "^1.2.0",
"web3": "^4.13.0"
}
}
57 changes: 0 additions & 57 deletions test/DataBankPlayground.js

This file was deleted.

6 changes: 4 additions & 2 deletions test/PlaygroundUser.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
const { ethers } = require("hardhat");
var assert = require('assert');
const abiCoder = new ethers.AbiCoder();
const DataBankPlaygroundArtifact = require("usingtellorlayer/artifacts/contracts/testing/DataBankPlayground.sol/DataBankPlayground.json");

// encode query data and query id for eth/usd price feed
const ETH_USD_QUERY_DATA_ARGS = abiCoder.encode(["string","string"], ["eth","usd"])
Expand All @@ -14,8 +15,9 @@ describe("DataBankPlayground - Function Tests", function () {
beforeEach(async function () {
// init accounts
accounts = await ethers.getSigners();
// deploy databank
databank = await ethers.deployContract("DataBankPlayground");
// deploy databank from usingtellorlayer
let DataBankPlayground = await ethers.getContractFactory(DataBankPlaygroundArtifact.abi, DataBankPlaygroundArtifact.bytecode);
databank = await DataBankPlayground.deploy();
// deploy user
user = await ethers.deployContract("PlaygroundUser", [databank.target, ETH_USD_QUERY_ID]);
})
Expand Down