Search
⌃K

LibGuard

These functions are intended to prevent reentrancy attacks by ensuring that reentrant calls are not executed when the guarded flag is set. The guarded flag is controlled by these functions to enable or disable the reentrancy guard as needed.

enforcePreGuard():

This function is used to enforce a pre-reentrancy guard. It retrieves the AppStorage instance using LibMagpieAggregator.getStorage() and checks if the guarded flag is set. If the flag is already set, indicating an ongoing reentrant call, it reverts the transaction with a ReentrantCall error. Otherwise, it sets the guarded flag to true.

enforcePostGuard():

This function is used to enforce a post-reentrancy guard. It retrieves the AppStorage instance using LibMagpieAggregator.getStorage() and sets the guarded flag to false.