new oracle
This commit is contained in:
30
contracts/helper/BandBNBBUSDPriceOracleProxy.sol
Normal file
30
contracts/helper/BandBNBBUSDPriceOracleProxy.sol
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
/*
|
||||||
|
|
||||||
|
Copyright 2020 DODO ZOO.
|
||||||
|
SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
pragma solidity 0.6.9;
|
||||||
|
pragma experimental ABIEncoderV2;
|
||||||
|
|
||||||
|
|
||||||
|
interface IBandOracleAggregator {
|
||||||
|
function getReferenceData(string memory base, string memory quote)
|
||||||
|
external
|
||||||
|
view
|
||||||
|
returns (uint256);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
contract BandBNBBUSDPriceOracleProxy {
|
||||||
|
IBandOracleAggregator public aggregator;
|
||||||
|
|
||||||
|
constructor(IBandOracleAggregator _aggregator) public {
|
||||||
|
aggregator = _aggregator;
|
||||||
|
}
|
||||||
|
|
||||||
|
function getPrice() public view returns (uint256) {
|
||||||
|
return aggregator.getReferenceData("BNB", "USD");
|
||||||
|
}
|
||||||
|
}
|
||||||
22
contracts/helper/ConstOracle.sol
Normal file
22
contracts/helper/ConstOracle.sol
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
/*
|
||||||
|
|
||||||
|
Copyright 2020 DODO ZOO.
|
||||||
|
SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
pragma solidity 0.6.9;
|
||||||
|
pragma experimental ABIEncoderV2;
|
||||||
|
|
||||||
|
|
||||||
|
contract ConstOracle {
|
||||||
|
uint256 public tokenPrice;
|
||||||
|
|
||||||
|
constructor(uint256 _price) public {
|
||||||
|
tokenPrice = _price;
|
||||||
|
}
|
||||||
|
|
||||||
|
function getPrice() external view returns (uint256) {
|
||||||
|
return tokenPrice;
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user