diff --git a/contracts/helper/ChainlinkEthPriceOracleProxy.sol b/contracts/helper/ChainlinkEthUSDCPriceOracleProxy.sol similarity index 100% rename from contracts/helper/ChainlinkEthPriceOracleProxy.sol rename to contracts/helper/ChainlinkEthUSDCPriceOracleProxy.sol diff --git a/contracts/helper/ChainlinkEthUSDTPriceOracleProxy.sol b/contracts/helper/ChainlinkEthUSDTPriceOracleProxy.sol new file mode 100644 index 0000000..6d27f7a --- /dev/null +++ b/contracts/helper/ChainlinkEthUSDTPriceOracleProxy.sol @@ -0,0 +1,25 @@ +/* + + Copyright 2020 DODO ZOO. + SPDX-License-Identifier: Apache-2.0 + +*/ + +pragma solidity 0.6.9; +pragma experimental ABIEncoderV2; + + +interface IChainlink { + function latestAnswer() external view returns (uint256); +} + + +// for WETH-USDT(decimals=6) price convert + +contract ChainlinkETHUSDTPriceOracleProxy { + address public chainlink = 0xEe9F2375b4bdF6387aa8265dD4FB8F16512A1d46; + + function getPrice() external view returns (uint256) { + return 10**24 / IChainlink(chainlink).latestAnswer(); + } +} diff --git a/contracts/helper/ChainlinkYFIUSDCPriceOracleProxy.sol b/contracts/helper/ChainlinkYFIUSDCPriceOracleProxy.sol new file mode 100644 index 0000000..b2d071d --- /dev/null +++ b/contracts/helper/ChainlinkYFIUSDCPriceOracleProxy.sol @@ -0,0 +1,32 @@ +/* + + Copyright 2020 DODO ZOO. + SPDX-License-Identifier: Apache-2.0 + +*/ + +pragma solidity 0.6.9; +pragma experimental ABIEncoderV2; + +import {SafeMath} from "../lib/SafeMath.sol"; + + +interface IChainlink { + function latestAnswer() external view returns (uint256); +} + + +// for YFI-USDC(decimals=6) price convert + +contract ChainlinkYFIUSDCPriceOracleProxy { + using SafeMath for uint256; + + address public yfiEth = 0x7c5d4F8345e66f68099581Db340cd65B078C41f4; + address public EthUsd = 0x5f4eC3Df9cbd43714FE2740f5E3616155c5b8419; + + function getPrice() external view returns (uint256) { + uint256 yfiEthPrice = IChainlink(yfiEth).latestAnswer(); + uint256 EthUsdPrice = IChainlink(EthUsd).latestAnswer(); + return yfiEthPrice.mul(EthUsdPrice).div(10**20); + } +}