When attacking target contract, we can create an attack contract which loads the target contract and abuse it.
// SPDX-License-Identifier: MITpragma solidity ^0.8.0;// Define interface for victim contractinterfaceIVictim {// Set the Victim contract functionsfunctionexample1() external;functionexample2(uint) external;}// Define Attack contract to compromise the victim contractcontract Attack { IVictim public victim;constructor(address _victimAddress) {// Initialize Victim contract (interface) victim =IVictim(_victimAddress); }// Create a function to be used for attacking the victim contractfunctionattack() public {victim.example1();victim.example2(1); }}