Boost _ Folks Finance 33454 - [Smart Contract - Low] unsafe casting will lead to break of PythNode O
Description
Brief/Intro
Vulnerability Details
function process(bytes memory parameters) internal view returns (NodeOutput.Data memory nodeOutput) {
(address pythAddress, bytes32 priceFeedId, bool useEma) = abi.decode(parameters, (address, bytes32, bool));
/// @dev using unsafe methods to avoid reverting, so this accepts old data
IPyth pyth = IPyth(pythAddress);
PythStructs.Price memory pythData = useEma
? pyth.getEmaPriceUnsafe(priceFeedId)
: pyth.getPriceUnsafe(priceFeedId);
/// @dev adjust the price to 18 d.p., exponent is a int32 so it could be negative or positive
int256 factor = PRECISION + pythData.expo;
uint256 price = factor > 0
? pythData.price.toUint256() * (10 ** factor.toUint256())
: pythData.price.toUint256() / (10 ** factor.toUint256());
return NodeOutput.Data(price, pythData.publishTime, NodeDefinition.NodeType.PYTH, 0, 0);
}Impact Details
References
Proof of concept
Proof of Concept
PreviousBoost _ Folks Finance 33443 - [Smart Contract - Low] StalenessCircuitBreakerNode checks if the lastNextBoost _ Folks Finance 33526 - [Smart Contract - Insight] Need to check returnAdapterId
Last updated
Was this helpful?