Skip to content

Commit

Permalink
feat: implement nct/usd-6 routed pf
Browse files Browse the repository at this point in the history
  • Loading branch information
guidiaz committed Oct 18, 2022
1 parent 62e68d2 commit b13148e
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 0 deletions.
36 changes: 36 additions & 0 deletions contracts/routed/NctUsdPriceFeed.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
// SPDX-License-Identifier: MIT
pragma solidity >=0.7.0 <0.9.0;

import "../WitnetPriceFeedRouted.sol";

contract NctUsdPriceFeed
is
WitnetPriceFeedRouted
{
constructor (IWitnetPriceRouter _witnetPriceRouter)
WitnetPriceFeedRouted(_witnetPriceRouter)
{
require(
router.supportsCurrencyPair(0x4d50c3a654d1a0e2c7fcdcccc4200d1065d8b2500f341cbc8cbbdae281101533),
"NctCeloPriceFeed: router supports no NCT/CELO-6"
);
require(
router.supportsCurrencyPair(0x9ed884be27401b98a6c3e9d830d4288c949712e57a58235927b1a00dcd487073),
"CeloUsdPriceFeed: router supports no CELO/USD-6"
);
pairs = new bytes32[](2);
pairs[0] = 0x4d50c3a654d1a0e2c7fcdcccc4200d1065d8b2500f341cbc8cbbdae281101533;
pairs[1] = 0x9ed884be27401b98a6c3e9d830d4288c949712e57a58235927b1a00dcd487073;
}

/// @dev Derive price from given sources.
/// @param _prices Array of last prices for each one of the currency pairs specified on constructor,
/// in the same order as they were specified.
function _calculate(int256[] memory _prices)
internal pure
override
returns (int256)
{
return (_prices[0] * _prices[1]) / 10 ** 6;
}
}
5 changes: 5 additions & 0 deletions migrations/witnet-queries.json
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,11 @@
"bytecode": "0x0ae60112c5010803123f68747470733a2f2f6170692e74686567726170682e636f6d2f7375626772617068732f6e616d652f6a657373652d736177612f756e69737761702d63656c6f1a2c861877821866646461746182186664706f6f6c8218646b746f6b656e3150726963658218571a000f4240185b22527b227175657279223a227b706f6f6c2869643a5c223078646232343930356231623038306636356465646230616439373861616435633736333633643363365c22297b746f6b656e3150726963657d7d227d1a0d0a0908051205fa3fc000001003220d0a0908051205fa40200000100310c0843d180a20c0843d28333080e497d012",
"path": "witnet/prices/n/NctCeloPrice.js"
},
"NctUsdPrice": {
"base": "NCT",
"quote": "USD",
"decimals": 6
},
"OktUsdtPrice": {
"bytecode": "0x0ab40212490801122e68747470733a2f2f646174612e676174656170692e696f2f617069322f312f7469636b65722f6f6b745f757364741a15841877821864646c6173748218571a000f4240185b12600801123968747470733a2f2f7777772e6f6b65782e636f6d2f6170692f76352f6d61726b65742f7469636b65723f696e737449643d4f4b542d555344541a21861877821861646461746182181800821864646c6173748218571a000f4240185b12670801123e68747470733a2f2f7777772e6d6578632e636f6d2f6f70656e2f6170692f76322f6d61726b65742f7469636b65723f73796d626f6c3d4f4b545f555344541a23871877821861646461746182181800821867646c61737418728218571a000f4240185b1a0d0a0908051205fa3fc000001003220d0a0908051205fa40200000100310c0843d180a20c0843d28333080e497d012",
"base": "OKT",
Expand Down

0 comments on commit b13148e

Please sign in to comment.