If an address swaps ETH for my_token, I wanna reward them with free my_tokens (calculated as a % of the transaction). Would it be possible to implement it in the solidity code or are there any built-in solutions on uniswap, pancakeswap etc.
This is how it is usually done with liquidity mining.
One of the most well-known contracts for such liquidity mining is MasterCher from Sushiswap.
I suggest