Created
October 11, 2021 21:13
-
-
Save rgottleber/c621e68cc936078e595e5a8879493ae6 to your computer and use it in GitHub Desktop.
Solidity modifier vs function
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
just_modifier.sol | |
968 length | |
MyContract (484 bytes) | |
Deployment costs: 90541 gas | |
608060405234801561001057600080fd5b506101c4806100206000396000f3fe608060405234801561001057600080fd5b50600436106101375760003560e01c806398e9a73d116100b8578063c3f902021161007c578063c3f902021461013c578063c9ff79aa1461013c578063df2025dc1461013c578063e6e0ae361461013c578063e70255931461013c578063ebd25c8f1461013c57600080fd5b806398e9a73d1461013c5780639942ec6f1461013c578063aa66aa631461013c578063aaf05f3d1461013c578063c27fc3051461013c57600080fd5b80636d4975a2116100ff5780636d4975a21461013c5780637c396b831461013c5780638da5cb5b146101465780638dc714ba1461013c578063920f5c731461013c57600080fd5b806324a75cfd1461013c5780633b88f6c21461013c5780633c9d377d1461013c57806340bcff2a1461013c5780635fb435921461013c575b600080fd5b610144610175565b005b600054610159906001600160a01b031681565b6040516001600160a01b03909116815260200160405180910390f35b6000546001600160a01b0316331461018c57600080fd5b56fea264697066735822122075be568f28bfc828da662bbfbd86eef234a773f9810037dc5dbb9a7b5bf10da664736f6c63430008090033 | |
function_modifier.sol | |
984 length | |
MyContract (492 bytes) | |
Deployment costs: 92141 gas. | |
608060405234801561001057600080fd5b506101cc806100206000396000f3fe608060405234801561001057600080fd5b50600436106101375760003560e01c806398e9a73d116100b8578063c3f902021161007c578063c3f902021461013c578063c9ff79aa1461013c578063df2025dc1461013c578063e6e0ae361461013c578063e70255931461013c578063ebd25c8f1461013c57600080fd5b806398e9a73d1461013c5780639942ec6f1461013c578063aa66aa631461013c578063aaf05f3d1461013c578063c27fc3051461013c57600080fd5b80636d4975a2116100ff5780636d4975a21461013c5780637c396b831461013c5780638da5cb5b146101465780638dc714ba1461013c578063920f5c731461013c57600080fd5b806324a75cfd1461013c5780633b88f6c21461013c5780633c9d377d1461013c57806340bcff2a1461013c5780635fb435921461013c575b600080fd5b610144610175565b005b600054610159906001600160a01b031681565b6040516001600160a01b03909116815260200160405180910390f35b61017d61017f565b565b6000546001600160a01b0316331461017d57600080fdfea26469706673582212207f52212a3d4f9462802cda10d70b00966a8f4995a981334c8513fb60ae3734d164736f6c63430008090033 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// SPDX-License-Identifier: MIT | |
pragma solidity ^0.8.0; | |
contract MyContract { | |
address public owner; | |
function _onlyOwner() private view{ | |
require(msg.sender == owner); | |
} | |
modifier onlyOwner() { | |
_onlyOwner(); | |
_; | |
} | |
function f1() external onlyOwner { | |
// Do Something | |
} | |
function f2() external onlyOwner { | |
// Do Something | |
} | |
function f3() external onlyOwner { | |
// Do Something | |
} | |
function f4() external onlyOwner { | |
// Do Something | |
} | |
function f5() external onlyOwner { | |
// Do Something | |
} | |
function f6() external onlyOwner { | |
// Do Something | |
} | |
function f7() external onlyOwner { | |
// Do Something | |
} | |
function f8() external onlyOwner { | |
// Do Something | |
} | |
function f9() external onlyOwner { | |
// Do Something | |
} | |
function f10() external onlyOwner { | |
// Do Something | |
} | |
function f11() external onlyOwner { | |
// Do Something | |
} | |
function f12() external onlyOwner { | |
// Do Something | |
} | |
function f13() external onlyOwner { | |
// Do Something | |
}function f14() external onlyOwner { | |
// Do Something | |
} | |
function f15() external onlyOwner { | |
// Do Something | |
} | |
function f16() external onlyOwner { | |
// Do Something | |
} | |
function f17() external onlyOwner { | |
// Do Something | |
} | |
function f18() external onlyOwner { | |
// Do Something | |
} | |
function f19() external onlyOwner { | |
// Do Something | |
} | |
function f20() external onlyOwner { | |
// Do Something | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// SPDX-License-Identifier: MIT | |
pragma solidity ^0.8.0; | |
contract MyContract { | |
address public owner; | |
modifier onlyOwner() { | |
require(msg.sender == owner); | |
_; | |
} | |
function f1() external onlyOwner { | |
// Do Something | |
} | |
function f2() external onlyOwner { | |
// Do Something | |
} | |
function f3() external onlyOwner { | |
// Do Something | |
} | |
function f4() external onlyOwner { | |
// Do Something | |
} | |
function f5() external onlyOwner { | |
// Do Something | |
} | |
function f6() external onlyOwner { | |
// Do Something | |
} | |
function f7() external onlyOwner { | |
// Do Something | |
} | |
function f8() external onlyOwner { | |
// Do Something | |
} | |
function f9() external onlyOwner { | |
// Do Something | |
} | |
function f10() external onlyOwner { | |
// Do Something | |
} | |
function f11() external onlyOwner { | |
// Do Something | |
} | |
function f12() external onlyOwner { | |
// Do Something | |
} | |
function f13() external onlyOwner { | |
// Do Something | |
}function f14() external onlyOwner { | |
// Do Something | |
} | |
function f15() external onlyOwner { | |
// Do Something | |
} | |
function f16() external onlyOwner { | |
// Do Something | |
} | |
function f17() external onlyOwner { | |
// Do Something | |
} | |
function f18() external onlyOwner { | |
// Do Something | |
} | |
function f19() external onlyOwner { | |
// Do Something | |
} | |
function f20() external onlyOwner { | |
// Do Something | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment