pub fn reentrancy_guard() 
Expand description

Reverts if the reentrancy pattern is detected in the contract in which this is called.

Additional Information

Not needed if the Checks-Effects-Interactions (CEI) pattern is followed (as prompted by the
compiler).

Caution: While this can protect against both single-function reentrancy and cross-function
reentrancy attacks, it WILL NOT PREVENT a cross-contract reentrancy attack.

Examples

use sway_libs::reentrancy::reentrancy_guard;

fn foo() {
    reentrancy_guard();
    // Do critical stuff here
}