that's indeed correct, is the address calling the contract, and can be another contract.
I've understood that exact thing while learning how uniswap v2 router works

Jul 18, 2022, 7:41 PM
you cannot replace msg.sender with an arbitrary address, you must own the address and it's immutable (the address)
otherwise checks like
require(owner == msg.sender) would be vulnerables to these attacks
transfer() function of tokens is a perfect example, just add a
console.log(from,to)
and you will see it changes
even if you start the tx, msg.sender will be the router in one transaction, if you call the function from the contract itself, it's your address
Jul 18, 2022, 8:20 PM

© 2024 Draquery.com All rights reserved.