mottikraus
31 posts


Found this cool little detail about modifiers in Solidity:
The code inside a modifier is copied into every function that uses it.
Let's take this example:
modifier onlyOwner() {
require(msg.sender == owner, "User is not the Owner");
}
function mint() external onlyOwner {}
When the contract is compiled, the bytecode for mint() contains the require statement itself.
The modifier logic is copied directly into the function.
Now think about this, you use onlyOwner in 10 different functions.
That require statement gets duplicated 10 times in the bytecode!
This increases contract size and can even push you closer to the 24KB EVM bytecode limit.
A simple pattern to avoid this is moving the logic into an internal function, like the following:
function _isOwner() internal {
require(msg.sender == owner, "User is not the Owner");
}
modifier onlyOwner() {
_isOwner();
_;
}
Now the modifier only executes a JUMP instruction to _isOwner() instead of copying the entire code block into every function.
The result:
> Smaller bytecode
> Gas efficiency during deployments
> Cleaner, more readable code.

English

@JacobCanfield @BlackRock It's the only address that was funded $10M from Coinbase Prime on 5th January when BlackRock had its seeding. But I agree it's weird to see almost no activity.
English

@mottikraus @BlackRock Looks like a Coibnase Prime hot wallet with no outflows.
English

Anyone know the addresses of @BlackRock ETF for Coinbase custody?
Is that published anywhere?
English

@ItsEpi @MajSmartie @KingMessi12345 @TLazzlo @Rainbow6Game inb4 esea gets implemented and you lose more users to it being a rootkit anti cheat than to the cheating problem itself, or eac but its dogshit
English

@Fatulatti @VentrixCode scheinst ja ein richtig krasser coder zu sein, RainbowSix.exe bei FindWindow

Deutsch

@Fatulatti @VentrixCode komischerweise nie welche bekommen :thinking:
Deutsch

@rewinside @TwoEpicBuddies den yeet dance hat epic richtig verkackt, gönn dir reddit.com/r/FortNiteBR/c…
Deutsch










