Skip to content

feat: add oracle price conditions (Chainlink + Pyth) #65

Open
minhtr09 wants to merge 4 commits into
mainfrom
conditional-swap-oracle
Open

feat: add oracle price conditions (Chainlink + Pyth) #65
minhtr09 wants to merge 4 commits into
mainfrom
conditional-swap-oracle

Conversation

@minhtr09

@minhtr09 minhtr09 commented Jun 19, 2026

Copy link
Copy Markdown
Collaborator

No description provided.

@minhtr09 minhtr09 force-pushed the conditional-swap-oracle branch from 25c4647 to d26d596 Compare June 19, 2026 08:13
Comment thread src/libraries/OracleLib.sol Outdated
Comment thread src/libraries/OracleLib.sol Outdated
Comment thread src/libraries/OracleLib.sol Outdated
Comment thread src/hooks/swap/KSConditionalSwapHook.sol Outdated
Comment thread src/libraries/OracleLib.sol Outdated
Comment thread src/libraries/OracleLib.sol Outdated
Comment thread src/libraries/OracleLib.sol Outdated
Comment on lines +123 to +125
priceIn = _usdPrice(config.oracleIn, maxStaleness);
priceOut = _usdPrice(config.oracleOut, maxStaleness);
ratio = _ratio(priceIn, priceOut, tokenIn, tokenOut);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What if we only single oracle, right between tokenIn and tokenOut?

@thepluck thepluck Jun 24, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This mostly happens if we use oracles other than Pyth and Chainlink. There are actually a few feeds for LSTs, LRTs, but the number is very small.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think we could support both. USD-quoted prices are better if we want to support a broad range of tokens, while direct oracles could be used for LST and LRT cases

@minhtr09 minhtr09 requested review from qcuong98 and thepluck June 25, 2026 08:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants