Ethernaut Delegation Smart Contract Solution

Hello, I have been having trying to solve the 6th challenge - Delegation from ethernaut. I have found a method to solve the challenge from the console which is to run sendTransaction({from: player, to: contract.address, data: web3.eth.abi.encodeFunctionSignature("pwn()")}).
However, I was wondering how would you go about writing a contract to solve this challenge without using the console or is that completely over the top?

1 Like

Solving it w/ the console requires less work than solving it w/ a contract so I would always opt for the option with less work but you can most def. also solve it w/ a contract. You just need to use abi.encodeWithSignature in your contract.