Skip to content

Commit

Permalink
fix: pendle serializer
Browse files Browse the repository at this point in the history
  • Loading branch information
doomsower committed Dec 19, 2024
1 parent a8cb071 commit 3393dfe
Showing 1 changed file with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,15 @@ contract PendleTWAPPTPriceFeedSerializer is IStateSerializerLegacy {
function serialize(address priceFeed) external view override returns (bytes memory) {
PendleTWAPPTPriceFeed pf = PendleTWAPPTPriceFeed(priceFeed);

return abi.encode(pf.market(), pf.sy(), pf.yt(), pf.expiry(), pf.twapWindow(), pf.priceToSy());
// some already deployed price feeds like 0x9A39068aba808c15A9aAAf04fb58cC6B0E734DC1
// don't have priceToSy() function
bool priceToSy;
try pf.priceToSy() returns (bool _priceToSy) {
priceToSy = _priceToSy;
} catch {
priceToSy = false;
}

return abi.encode(pf.market(), pf.sy(), pf.yt(), pf.expiry(), pf.twapWindow(), priceToSy);
}
}

0 comments on commit 3393dfe

Please sign in to comment.