Skip to content

Commit

Permalink
add chainlink aggregator helper contract for subgraph service (#116)
Browse files Browse the repository at this point in the history
  • Loading branch information
thorseldon authored Jul 26, 2023
1 parent 503cef2 commit 751a189
Show file tree
Hide file tree
Showing 12 changed files with 477 additions and 1 deletion.
168 changes: 168 additions & 0 deletions abis/ChainlinkAggregatorHelper.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,168 @@
[
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "previousOwner",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "newOwner",
"type": "address"
}
],
"name": "OwnershipTransferred",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "reserve",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "aggregator",
"type": "address"
}
],
"name": "ReserveAggregatorRemoved",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "reserve",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "aggregator",
"type": "address"
}
],
"name": "ReserveAggregatorUpdated",
"type": "event"
},
{
"inputs": [],
"name": "addressProvider",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "addressProvider_",
"type": "address"
}
],
"name": "initialize",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [],
"name": "owner",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "reserve",
"type": "address"
}
],
"name": "removeReserveAggregator",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [],
"name": "renounceOwnership",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"name": "reserveAggregators",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "newOwner",
"type": "address"
}
],
"name": "transferOwnership",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "reserve",
"type": "address"
},
{
"internalType": "address",
"name": "aggregator",
"type": "address"
}
],
"name": "updateReserveAggregator",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
}
]
18 changes: 18 additions & 0 deletions abis/IIncentivesController.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,22 @@
[
{
"inputs": [
{
"internalType": "contract IScaledBalanceToken[]",
"name": "_assets",
"type": "address[]"
},
{
"internalType": "uint256[]",
"name": "_emissionsPerSecond",
"type": "uint256[]"
}
],
"name": "configureAssets",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
Expand Down
104 changes: 104 additions & 0 deletions abis/NFTOracle.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,44 @@
"name": "AssetAdded",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "mappedAsset",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "originAsset",
"type": "address"
}
],
"name": "AssetMappingAdded",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "mappedAsset",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "originAsset",
"type": "address"
}
],
"name": "AssetMappingRemoved",
"type": "event"
},
{
"anonymous": false,
"inputs": [
Expand Down Expand Up @@ -145,6 +183,25 @@
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "originAsset",
"type": "address"
}
],
"name": "getAssetMapping",
"outputs": [
{
"internalType": "address[]",
"name": "",
"type": "address[]"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
Expand Down Expand Up @@ -307,6 +364,30 @@
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "originAsset",
"type": "address"
},
{
"internalType": "address",
"name": "mappedAsset",
"type": "address"
}
],
"name": "isAssetMapped",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "maxPriceDeviation",
Expand Down Expand Up @@ -467,6 +548,29 @@
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "originAsset",
"type": "address"
},
{
"internalType": "address",
"name": "mappedAsset",
"type": "address"
},
{
"internalType": "bool",
"name": "added",
"type": "bool"
}
],
"name": "setAssetMapping",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
Expand Down
20 changes: 20 additions & 0 deletions contracts/interfaces/IReserveOracle.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// SPDX-License-Identifier: agpl-3.0
pragma solidity 0.8.4;

import {AggregatorV3Interface} from "@chainlink/contracts/src/v0.8/interfaces/AggregatorV3Interface.sol";

/************
@title IReserveOracle interface
@notice Interface for getting Reserve price oracle.*/
interface IReserveOracle {
/* CAUTION: Price uint is ETH based (WEI, 18 decimals) */
/***********
@dev returns the asset price in ETH
*/
function getAssetPrice(address asset) external view returns (uint256);

// get twap price depending on _period
function getTwapPrice(address _priceFeedKey, uint256 _interval) external view returns (uint256);

function priceFeedMap(address _priceFeedKey) external view returns (AggregatorV3Interface);
}
Loading

0 comments on commit 751a189

Please sign in to comment.