Security
Last updated
Last updated
These contracts aim to cover common security practices
A pattern that can be used to avoid reentrancy attacks
A modifier that can prevent reentrancy during certain functions
A common emergency response mechanism that can pause functionality while a remediation is pending
Older versions of Solidity didn't have the constructor
keyword
It took the function with EXACTLY the same name as the contract and used that as the constructor
So... if you got the name wrong even a little bit, the constructor wouldn't run and become accessible to anyone
If you send funds then immediately call selfdestruct()
then the contract you call could try to revert and send the funds back, but it can't since you selfdestructed, so it keeps the funds, but doesn't continue with the code past the revert point
If you code your contract badly, this could brick the function (e.g. setting a winner after checking the current balance)
Therefore, use a counter that is part of the function, instead of address(this).balance
so that the code is executed as expected during revert
So instead, use a global balance variable to keep track of the funds, not just the contract balance
Rubixi bug: