btc-vision / btc-runtime

Assemblyscript btc runtime
MIT License
5 stars 4 forks source link

Refactor onlyOwner checks from `Blockchain.txOrigin` to `Blockchain.msgSender` for accurate ownership verification #36

Closed impredmet closed 1 month ago

impredmet commented 1 month ago

Description:

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.