detection of mined blocks using a data pack

hi its me again im trying to make an rpg game where the player buids his own playthrough with command blocks and more tools that would be provided in the map itself now im trying to detect when a player mines a block of stone or deepslate and if they do it will have a 1% chance to damage them
Continue to help post