Skip to content

Commit

Permalink
Feature/96-chainlink-price (#130)
Browse files Browse the repository at this point in the history
* smart contract added

* env updated

* Save current progress on price feed

* getCurrentPrice in progress

* listenToAmountChange() is working

* code clean

* getCurrentPriceOfNativeToken added

* priceInUsd is working

* setUpPriceCurrentPrice improved

* priceInUsdEnabled added

* saving progress

* cleaning code progress

* setUpPriceCurrentPrice fixed

* tokenConversionRate added in the receipt

* code cleaning

* tokenConversionRate added

* payment receipt is clean

* PaymentRequestMakerComponent improvement

* Pay on USD conversion is working

* Before code cleaning

* Enum added

* todo done

* package updated

* apollo updated
  • Loading branch information
etsraphael authored Jul 8, 2023
1 parent 263f48a commit 018f703
Show file tree
Hide file tree
Showing 46 changed files with 1,098 additions and 327 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
[
{
"inputs": [],
"name": "decimals",
"outputs": [
{
"internalType": "uint8",
"name": "",
"type": "uint8"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "description",
"outputs": [
{
"internalType": "string",
"name": "",
"type": "string"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint80",
"name": "_roundId",
"type": "uint80"
}
],
"name": "getRoundData",
"outputs": [
{
"internalType": "uint80",
"name": "roundId",
"type": "uint80"
},
{
"internalType": "int256",
"name": "answer",
"type": "int256"
},
{
"internalType": "uint256",
"name": "startedAt",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "updatedAt",
"type": "uint256"
},
{
"internalType": "uint80",
"name": "answeredInRound",
"type": "uint80"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "latestRoundData",
"outputs": [
{
"internalType": "uint80",
"name": "roundId",
"type": "uint80"
},
{
"internalType": "int256",
"name": "answer",
"type": "int256"
},
{
"internalType": "uint256",
"name": "startedAt",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "updatedAt",
"type": "uint256"
},
{
"internalType": "uint80",
"name": "answeredInRound",
"type": "uint80"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "version",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
}
]
41 changes: 41 additions & 0 deletions SmartContracts/abi/contracts/PriceFeed.sol/DataConsumerV3.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
[
{
"inputs": [
{
"internalType": "address",
"name": "aggregator",
"type": "address"
}
],
"name": "getLatestDataFrom",
"outputs": [
{
"internalType": "uint80",
"name": "roundId",
"type": "uint80"
},
{
"internalType": "int256",
"name": "answer",
"type": "int256"
},
{
"internalType": "uint256",
"name": "startedAt",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "updatedAt",
"type": "uint256"
},
{
"internalType": "uint80",
"name": "answeredInRound",
"type": "uint80"
}
],
"stateMutability": "view",
"type": "function"
}
]
20 changes: 20 additions & 0 deletions SmartContracts/contracts/PriceFeed.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.7;

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

contract DataConsumerV3 {
/**
* Returns the latest answer from the specified aggregator.
*/
function getLatestDataFrom(
address aggregator
)
public
view
returns (uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound)
{
AggregatorV3Interface dataFeed = AggregatorV3Interface(aggregator);
return dataFeed.latestRoundData();
}
}
Loading

0 comments on commit 018f703

Please sign in to comment.