Integrating Uniswap v3 oracle (solidity 0.7.6) with prb-math (solidity 0.8.x) #104
-
I am building a project that uses the prb-math library (solidity version 0.8.4) and uniswap v3 interface (solidity 0.7.6). However, I am running into a problem where I can't use the most recent compiler version 0.8.x with the uniswap v3 contracts. Is there a known way to integrate the uniswap v3 oracle with newer solidity versions? Thank you in advance. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
Hi @partylikeits1983, thanks for posting this question. The answer depends upon a few things. First, if you are trying to import both the PRBMath contract and the Uniswap V3 contract in the same contract, that simply cannot work, because PRBMath works strictly with Solidity v0.8 and above, while Uniswap V3 works strictly with Solidity v0.7.6. In this case, the only solution would be to manually rewrite the Uniswap contract to use Solidity v0.8 (by carefully following the v0.8.0 breaking changes guide). But, if that is not what you want to do, and you can keep the two contracts separate, then you may be able to compile both contracts. For example, with Hardhat you can enable multiple compilers. |
Beta Was this translation helpful? Give feedback.
Hi @partylikeits1983, thanks for posting this question.
The answer depends upon a few things.
First, if you are trying to import both the PRBMath contract and the Uniswap V3 contract in the same contract, that simply cannot work, because PRBMath works strictly with Solidity v0.8 and above, while Uniswap V3 works strictly with Solidity v0.7.6. In this case, the only solution would be to manually rewrite the Uniswap contract to use Solidity v0.8 (by carefully following the v0.8.0 breaking changes guide).
But, if that is not what you want to do, and you can keep the two contracts separate, then you may be able to compile both contracts. For example, with Hardhat you can enable multiple compi…