UniswapPriceOracle
Introduction
DeFiPIE protocol uses UniswapPriceOracle to get time-weighted average prices from Uniswap v2 or other DEX (clones Uniswap v2).
Every time the user interacts with a pool, the protocol gets the current price from Uniswap and averages it with the previously stored price, thereby achieving the Time-weighted average price effect, which in turn protects the protocol from price manipulation through flash loans.
Update price by pToken
Updating the price of an asset by the pToken address.
UniswapPriceOracle
pToken
: pToken address.RETURN
: 0 on success, otherwise an Error code.
Solidity
Web3 1.0
Update price by an asset.
Updating the price of an asset by the asset address.
UniswapPriceOracle
asset
: asset address.RETURN
: 0 on success, otherwise an Error code.
Solidity
Web3 1.0
Get asset price in ETH
Get an average asset price in ETH with 18 decimals of precision.
UniswapPriceOracle
asset
: asset address.RETURN
: asset price.
Solidity
Web3 1.0
Get asset price in USD
Get an average asset price in USD with 18 decimals of precision.
UniswapPriceOracle
asset
: asset address.RETURN
: asset price.
Solidity
Web3 1.0
Last updated