Great job @loso
… especially as the link no longer worked, and you have completed this assignment based on your own research
Apologies for the delay in giving you feedback on this assignment, and also for the inconvenience caused by the link no longer working. It appears as though the website hosting the article has shut down, or something similar has happened. We’ve now found a suitable replacement article, and modified the assignment instructions accordingly. The assignment itself is still the same, but if you would like to read the new article and more comprehensive instructions, this update is now available for you to view on the Academy website.
Feedback on your solution
Well done for realising that the address passed to selfdestruct() needs to be payable
, in order for any remaining ether in the contract to be paid/transferred to this address when selfdestruct() is triggered. Your method, calling destroySmartContract() with a payable address parameter, is perfectly correct. An appropriate address to send these remaining funds to would be the contract owner address. You can do this by passing either msg.sender
, or owner
(inherited from Ownable), to selfdestruct(), which also means destroySmartContract() no longer needs an address parameter.
You can use msg.sender
because, as a result of the onlyOwner modifier, it can only ever be the contract owner address. Also, msg.sender
is already a payable address by default (only before Solidity v0.8) and so doesn’t need to be explicitly converted.
However, if you pass owner
you would need to:
- either define it as a payable address state variable in Ownable;
- or convert it locally within the destroySmartContract() function body, either using a local variable before it is passed to selfdestruct(), or convert the actual argument e.g. 
selfdestruct(payable(owner));
We can also streamline the inheritance structure by having Bank explicitly inherit Destroyable only, because it will inherit Ownable implicitly via Destroyable. This will give you a multi-level inheritance structure.
@Anvar_Xadja is also right about this…
Let me know if you have any questions about any of these points