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

     1  // SPDX-License-Identifier: MIT
     2  pragma solidity 0.8.15;
     3  
     4  import { IDripCheck } from "../IDripCheck.sol";
     5  
     6  interface IGelatoTreasury {
     7      function userTokenBalance(address _user, address _token) external view returns (uint256);
     8  }
     9  
    10  /// @title CheckGelatoLow
    11  /// @notice DripCheck for checking if an account's Gelato ETH balance is below some threshold.
    12  contract CheckGelatoLow is IDripCheck {
    13      struct Params {
    14          address treasury;
    15          uint256 threshold;
    16          address recipient;
    17      }
    18  
    19      /// @notice External event used to help client-side tooling encode parameters.
    20      /// @param params Parameters to encode.
    21      event _EventToExposeStructInABI__Params(Params params);
    22  
    23      /// @inheritdoc IDripCheck
    24      function check(bytes memory _params) external view returns (bool execute_) {
    25          Params memory params = abi.decode(_params, (Params));
    26  
    27          // Check GelatoTreasury ETH balance is below threshold.
    28          execute_ = IGelatoTreasury(params.treasury).userTokenBalance(
    29              params.recipient,
    30              // Gelato represents ETH as 0xeeeee....eeeee
    31              0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE
    32          ) < params.threshold;
    33      }
    34  }