Fast Khaki Raccoon
Medium
DIAOracleV2SinglePriceOracle::getPriceUSD18
would revert on some tokens like MKR which have name and symbol as bytes
DIAOracleV2SinglePriceOracle::getPriceUSD18
would revert on some tokens like MKR
which has name and symbol set as bytes.
The problem here is the bellow code which assumes that standard ERC20 tokens will have name and symbol at all:
string memory _symbol = IERC20Metadata(_quoteToken).symbol();
When we call the name and symbol of MKR we will get
https://etherscan.io/token/0x9f8f72aa9304c8b593d555f12ef6589cc3a579a2#readContract
0x4d4b520000000000000000000000000000000000000000000000000000000000
as symbol
0x4d616b6572000000000000000000000000000000000000000000000000000000
as name
No response
No response
Contract will not work with some tokens.
DIAOracleV2SinglePriceOracle
's getPriceUSD18
will not work with some tokens, like MKR. Meaning that getPrices
will not work with such tokens (as it's uses getPriceUSD18
down the line ).
No response
Make sure you add the .symbol
or .name
in a try/catch