You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
just wanted to know whether there would be any interest in adding more complex pathing to the router, e.g. ETH-USD-USDC
The idea is to provide an asset amount & a path of assets, e.g. 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc200000000000000000000000000000000000003480xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48 which would return the equivalent amount of USDC for the given amount of WETH.
I've implemented it as a wrapper to the current router contract in my own project:
function getCrossQuote(uint256 inAmount, bytes calldata path) external view returns (uint256) {
uint256 len = path.length;
// getPair will read 40 bytes at a time. To not overrun the bounds,
// we need to stop at len - 20, i.e. at the last full pair.
for (uint256 i = 0; i < len - 20; i += 20) {
(address base, address quote) = BytesLib.getPair(path, i);
inAmount = router.getQuote(inAmount, base, quote);
}
return inAmount;
}
It is especially handy for vault-like contracts where you have to get a token's value in terms of the vault's base asset.
That would also make the CrossAdapter obsolete and spare us the extra deployment overhead.
The text was updated successfully, but these errors were encountered:
Yep, the path pattern is seen in many dex routers. The EPO contracts follow the https://eips.ethereum.org/EIPS/eip-7726 spec for getQuote and getQuotes by extension. So to conform to the interface the path would need to be placed in storage in the router, rather than come as calldata from outside.
Hi,
just wanted to know whether there would be any interest in adding more complex pathing to the router, e.g. ETH-USD-USDC
The idea is to provide an asset amount & a path of assets, e.g.
0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc200000000000000000000000000000000000003480xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48
which would return the equivalent amount of USDC for the given amount of WETH.I've implemented it as a wrapper to the current router contract in my own project:
It is especially handy for vault-like contracts where you have to get a token's value in terms of the vault's base asset.
That would also make the CrossAdapter obsolete and spare us the extra deployment overhead.
The text was updated successfully, but these errors were encountered: