I've been struggling with this with different methods. As the most straightforward, I tried manually-flattening the code in REMIX, and verifying it on bscscan. Compiler version OK, Runs for optimization 200 OK, Optimization ON... and it always fail.
Then I tried with hardhat, and truffle, with truffle compile and verifying I got a very similar result. I think I have checked all possible options about this and I can't fix it.
I will be gratefull if any mate could give some advice.
BSC Scan testnet output: