Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/2.2.1 #66

Merged
merged 8 commits into from
May 13, 2024
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
15 changes: 14 additions & 1 deletion abis/WitnetPriceFeeds.json
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@
"anonymous": false,
"inputs": [
{
"indexed": true,
"indexed": false,
"internalType": "uint256",
"name": "id",
"type": "uint256"
Expand Down Expand Up @@ -518,6 +518,19 @@
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "footprint",
"outputs": [
{
"internalType": "bytes4",
"name": "",
"type": "bytes4"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
Expand Down
16 changes: 13 additions & 3 deletions configs.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@ def load_version():
package = json.load(open("package.json"))
return package.get("name") + " v" + package.get("version")

# Load price feeds configuration parameters from file
def load_price_feeds_config(path, network_name):
chain_name = network_name.split('.')[0]
def load_dfe_config(path):
try:
if path.startswith("http"):
http = urllib3.PoolManager(timeout=3.0)
Expand All @@ -18,4 +16,16 @@ def load_price_feeds_config(path, network_name):
except Exception as ex:
print(f"Fatal exception when trying to read triggering conditions from {path}:\n=> {ex}")
exit(1)
return config

def get_network_config(config, network_name):
chain_name = network_name.split('.')[0]
return config.get("chains").get(chain_name).get("networks").get(network_name)

def get_currency_symbol(config, currency):
return config.get("currencies").get(currency, "")

def get_price_feed_config(config, network_name, caption, param, default):
network_config = get_network_config(config, network_name)
value = network_config.get('feeds', {}).get(caption, {}).get(param, None) or config['conditions'].get(caption, {}).get(param, None) or config['conditions']['default'].get(param, default)
return value
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
{
"name": "witnet-price-feeds-poller",
"version": "2.2.0",
"version": "2.2.1",
"description": "",
"main": "",
"repository": "https://github.com/witnet/witnet-price-feeds-poller/tree/2.2.x",
"license": "MIT",
"private": false,
"scripts": {},
"dependencies": {
"witnet-toolkit": "^2.0.5"
"witnet-toolkit": "^2.0.6"
},
"devDependencies": {
"@babel/cli": "^7.5.5",
Expand Down
155 changes: 128 additions & 27 deletions price_feeds_config.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
{
"abi": "./src/abi/WitnetPriceRouter.json",
"contracts": {
"legacy": {
"abi": "./src/abi/WitnetPriceRouter.json"
},
"2.0": {
"abi": "./src/abi/WitnetPriceFeeds.json",
"address": "0x1111AbA2164AcdC6D291b08DfB374280035E1111",
"pollingPeriod": 120000
}
},
"chains": {
"avalanche": {
"name": "Avalanche",
Expand Down Expand Up @@ -48,6 +57,21 @@
}
}
},
"base": {
"name": "Base",
"networks": {
"base.sepolia": {
"blockExplorer": "https://base-sepolia.blockscout.com/{address}",
"name": "Base ETH/L2 Sepolia",
"version": "2.0",
"feeds": {
"Price-WIT/USDT-6": {
"minSecsBetweenUpdates": 300
}
}
}
}
},
"boba": {
"networks": {
"boba.mainnet": {
Expand Down Expand Up @@ -404,31 +428,6 @@
}
}
},
"optimism": {
"networks": {
"optimism.sepolia": {
"address": "",
"blockExplorer": "https://sepolia.etherscan.io/address/{address}",
"color": "#ff5599",
"name": "Optimism Sepolia",
"pollingPeriod": 1500000,
"feeds": {
"Price-ETH/USD-6": {
"label": "$",
"deviationPercentage": 1.0,
"maxSecsBetweenUpdates": 500,
"minSecsBetweenUpdates": 300
},
"Price-OP/USDT-6": {
"label": "₮",
"deviationPercentage": 1.0,
"maxSecsBetweenUpdates": 900,
"minSecsBetweenUpdates": 300
}
}
}
}
},
"ethereum": {
"networks": {
"ethereum.sepolia": {
Expand Down Expand Up @@ -652,6 +651,27 @@
}
}
},
"optimism": {
"name": "Optimism",
"networks": {
"optimism.sepolia": {
"blockExplorer": "https://sepolia-optimism.etherscan.io/address/{address}",
"name": "Optimism ETH/L2 Sepolia",
"version": "2.0",
"feeds": {
"Price-WIT/USDT-6": {
"maxSecsBetweenUpdates": 900
}
}
},
"optimism.mainnet": {
"blockExplorer": "https://optimistic.etherscan.io/address/{address}",
"mainnet": true,
"name": "Optimism ETH/L2 Mainnet",
"version": "2.0"
}
}
},
"polygon": {
"networks": {
"polygon.goerli": {
Expand Down Expand Up @@ -798,5 +818,86 @@
}
}
}
}
},
"currencies": {
"EUR": "€",
"KRW": "₩",
"USD": "$",
"USDC": "$",
"USDT": "₮"
},
"conditions": {
"default": {
"deviationPercentage": 3.5,
"maxSecsBetweenUpdates": 86400,
"minSecsBetweenUpdates": 3600
},
"Price-CFX/USDT-6": {
"deviationPercentage": 1.0,
"maxSecsBetweenUpdates": 3600,
"minSecsBetweenUpdates": 300
},
"Price-DAI/USD-6": {
"deviationPercentage": 0.1,
"minSecsBetweenUpdates": 900
},
"Price-FRAX/USDT-6": {
"deviationPercentage": 0.25
},
"Price-GLINT/USDC-6": {
"deviationPercentage": 1.0
},
"Price-GLMR/USDT-6": {
"deviationPercentage": 1.0
},
"Price-HT/USDT-6": {
"deviationPercentage": 3.5
},
"Price-KAVA/USDT-6": {
"deviationPercentage": 0.5
},
"Price-KCS/USDT-6": {
"deviationPercentage": 0.5,
"maxSecsBetweenUpdates": 3600,
"minSecsBetweenUpdates": 3600
},
"Price-MJT/KCS-9": {
"deviationPercentage": 0.5
},
"Price-MOVR/USDT-6": {
"deviationPercentage": 1.0
},
"Price-OKT/USDT-6": {
"deviationPercentage": 0.5,
"maxSecsBetweenUpdates": 3600,
"minSecsBetweenUpdates": 300
},
"Price-OP/USDT-6": {
"deviationPercentage": 2.0
},
"Price-SAX/USDT-6": {
"deviationPercentage": 0.5
},
"Price-STELLA/USDT-6": {
"deviationPercentage": 1.0
},
"Price-SYS/USDT-6": {
"deviationPercentage": 1.0
},
"Price-TUSD/USDT-6": {
"deviationPercentage": 0.25,
"minSecsBetweenUpdates": 900
},
"Price-USDC/USD-6": {
"deviationPercentage": 0.1,
"minSecsBetweenUpdates": 900
},
"Price-USDT/USD-6": {
"deviationPercentage": 0.1,
"minSecsBetweenUpdates": 900
},
"Price-WIT/USDT-6": {
"deviationPercentage": 1.0
}
}
}
Loading
Loading