v3-core
v3-core copied to clipboard
Explicit type conversion not allowed from "int24" to "uint8".
i am getting same error , how to fix this. KIndly help me
This error is in TickBitmap.sol file
my pragma solidity >=0.5.0; my hardhat.config.ts solidity version: '0.8.17', image: https://user-images.githubusercontent.com/91736262/211527874-8e0aa79b-b25d-4d89-b89e-3b456e448ee8.png
I'm getting the same issue. Using two solidity compilers, 0.7.6 and 0.8.17
Solidity v0.8 disallowed conversions in which there are multiple changes. int24 to uint8 requires change in width and sign. Hence using uint8(uint24(tick % 256)) , would solve the problem.
I got same error in TickBitmap.sol. -Original Code library TickBitmap { function position(int24 tick) private pure returns (int16 wordPos, uint8 bitPos) { wordPos = int16(tick >> 8); bitPos = uint8(tick % 0xFF); }
-Fixed Code library TickBitmap { function position(int24 tick) private pure returns (int16 wordPos, uint8 bitPos) { wordPos = int16(tick >> 8); bitPos = uint8(uint24(tick % 256)); }
Solidity Version: pragma solidity >=0.5.0; Remix Version: pragma solidity >=0.7.6;
This code is currently working fine.