If you want to continue using truffle/ganache, then you have to change the solidity version to 0.8.19.
0.8.19
I suggest however to get rid of truffle/ganache since they are deprecated. Try hardhat or forge.