Updated the onlyOwner checks to use Blockchain.msgSender instead of Blockchain.txOrigin. This ensures that the ownership validation is based on the direct caller of the contract, as it should be, rather than the original transaction initiator.
This change aligns the ownership checks with standard practices in Solidity, where msgSender is used to validate the caller in onlyOwner modifiers.
Solidity Example:
In Solidity, the standard onlyOwner modifier uses msgSender to check the caller, as shown below:
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
This ensures that only the direct caller, not the original initiator, can perform privileged actions. The update to use Blockchain.msgSender follows this logic and strengthens contract security.
Description:
Updated the
onlyOwner
checks to useBlockchain.msgSender
instead ofBlockchain.txOrigin
. This ensures that the ownership validation is based on the direct caller of the contract, as it should be, rather than the original transaction initiator.This change aligns the ownership checks with standard practices in Solidity, where
msgSender
is used to validate the caller inonlyOwner
modifiers.Solidity Example:
In Solidity, the standard
onlyOwner
modifier usesmsgSender
to check the caller, as shown below:This ensures that only the direct caller, not the original initiator, can perform privileged actions. The update to use
Blockchain.msgSender
follows this logic and strengthens contract security.