github.com/ethereum-optimism/optimism@v1.7.2/packages/contracts-bedrock/src/periphery/drippie/dripchecks/CheckBalanceLow.sol (about)

     1  // SPDX-License-Identifier: MIT
     2  pragma solidity 0.8.15;
     3  
     4  import { IDripCheck } from "../IDripCheck.sol";
     5  
     6  /// @title CheckBalanceLow
     7  /// @notice DripCheck for checking if an account's balance is below a given threshold.
     8  contract CheckBalanceLow is IDripCheck {
     9      struct Params {
    10          address target;
    11          uint256 threshold;
    12      }
    13  
    14      /// @notice External event used to help client-side tooling encode parameters.
    15      /// @param params Parameters to encode.
    16      event _EventToExposeStructInABI__Params(Params params);
    17  
    18      /// @inheritdoc IDripCheck
    19      function check(bytes memory _params) external view returns (bool execute_) {
    20          Params memory params = abi.decode(_params, (Params));
    21  
    22          // Check target ETH balance is below threshold.
    23          execute_ = params.target.balance < params.threshold;
    24      }
    25  }