Is there a withdrawal pattern in any of the OpenZeppelin contracts which protects against DOS (Denial of Service) attacks?
I am not sure, maybe not.
What do you mean by a withdrawal pattern and DOS attacks with a smart contract?
Pull over Push Payments (also known as the Withdrawal Pattern)
Navigate to this fund splitter contract on Github.
There are a few key takeaways from this contract.
First, There is a separation of function logic. The split()
function handles the accounting and divides the msg.value
sent with the transaction. Another function, withdraw()
, allows accounts to transfer their balance from the contract to their account.
This pattern is also called the withdrawal pattern. It protects against re-entrancy and denial of service attacks
Please see: Reentrancy After Istanbul and https://docs.openzeppelin.com/contracts/3.x/api/payment#PullPayment
It would protect against re-entrancy.
I assume you mean by denial of service is preventing a user from interacting with the contract as expected. e.g. self destruct, putting in a state that results in reverts. Appropriate testing and auditing should help to reduce this risk.