Commit 0ae1166b authored by Andreas Bigger's avatar Andreas Bigger

Port drippie contracts to triple slash natspec styling

parent 1a8f502f
......@@ -7,12 +7,8 @@ interface IDripCheck {
// possible to easily encode parameters on the client side. Solidity does not support generics
// so it's not possible to do this with explicit typing.
/**
* @notice Checks whether a drip should be executable.
*
* @param _params Encoded parameters for the drip check.
*
* @return Whether the drip should be executed.
*/
function check(bytes memory _params) external view returns (bool);
/// @notice Checks whether a drip should be executable.
/// @param _params Encoded parameters for the drip check.
/// @return execute_ Whether the drip should be executed.
function check(bytes memory _params) external view returns (bool execute_);
}
......@@ -3,30 +3,23 @@ pragma solidity 0.8.15;
import { IDripCheck } from "../IDripCheck.sol";
/**
* @title CheckBalanceHigh
* @notice DripCheck for checking if an account's balance is above a given threshold.
*/
/// @title CheckBalanceHigh
/// @notice DripCheck for checking if an account's balance is above a given threshold.
contract CheckBalanceHigh is IDripCheck {
struct Params {
address target;
uint256 threshold;
}
/**
* @notice External event used to help client-side tooling encode parameters.
*
* @param params Parameters to encode.
*/
/// @notice External event used to help client-side tooling encode parameters.
/// @param params Parameters to encode.
event _EventToExposeStructInABI__Params(Params params);
/**
* @inheritdoc IDripCheck
*/
function check(bytes memory _params) external view returns (bool) {
/// @inheritdoc IDripCheck
function check(bytes memory _params) external view returns (bool execute_) {
Params memory params = abi.decode(_params, (Params));
// Check target balance is above threshold.
return params.target.balance > params.threshold;
execute_ = params.target.balance > params.threshold;
}
}
......@@ -3,30 +3,23 @@ pragma solidity 0.8.15;
import { IDripCheck } from "../IDripCheck.sol";
/**
* @title CheckBalanceLow
* @notice DripCheck for checking if an account's balance is below a given threshold.
*/
/// @title CheckBalanceLow
/// @notice DripCheck for checking if an account's balance is below a given threshold.
contract CheckBalanceLow is IDripCheck {
struct Params {
address target;
uint256 threshold;
}
/**
* @notice External event used to help client-side tooling encode parameters.
*
* @param params Parameters to encode.
*/
/// @notice External event used to help client-side tooling encode parameters.
/// @param params Parameters to encode.
event _EventToExposeStructInABI__Params(Params params);
/**
* @inheritdoc IDripCheck
*/
function check(bytes memory _params) external view returns (bool) {
/// @inheritdoc IDripCheck
function check(bytes memory _params) external view returns (bool execute_) {
Params memory params = abi.decode(_params, (Params));
// Check target ETH balance is below threshold.
return params.target.balance < params.threshold;
execute_ = params.target.balance < params.threshold;
}
}
......@@ -7,10 +7,8 @@ interface IGelatoTreasury {
function userTokenBalance(address _user, address _token) external view returns (uint256);
}
/**
* @title CheckGelatoLow
* @notice DripCheck for checking if an account's Gelato ETH balance is below some threshold.
*/
/// @title CheckGelatoLow
/// @notice DripCheck for checking if an account's Gelato ETH balance is below some threshold.
contract CheckGelatoLow is IDripCheck {
struct Params {
address treasury;
......@@ -18,25 +16,21 @@ contract CheckGelatoLow is IDripCheck {
address recipient;
}
/**
* @notice External event used to help client-side tooling encode parameters.
*
* @param params Parameters to encode.
*/
/// @notice External event used to help client-side tooling encode parameters.
/// @param params Parameters to encode.
event _EventToExposeStructInABI__Params(Params params);
/**
* @inheritdoc IDripCheck
*/
function check(bytes memory _params) external view returns (bool) {
/// @inheritdoc IDripCheck
function check(bytes memory _params) external view returns (bool execute_) {
Params memory params = abi.decode(_params, (Params));
// Check GelatoTreasury ETH balance is below threshold.
return
execute_ =
IGelatoTreasury(params.treasury).userTokenBalance(
params.recipient,
// Gelato represents ETH as 0xeeeee....eeeee
0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE
) < params.threshold;
) <
params.threshold;
}
}
......@@ -3,15 +3,11 @@ pragma solidity 0.8.15;
import { IDripCheck } from "../IDripCheck.sol";
/**
* @title CheckTrue
* @notice DripCheck that always returns true.
*/
/// @title CheckTrue
/// @notice DripCheck that always returns true.
contract CheckTrue is IDripCheck {
/**
* @inheritdoc IDripCheck
*/
function check(bytes memory) external pure returns (bool) {
return true;
/// @inheritdoc IDripCheck
function check(bytes memory) external pure returns (bool execute_) {
execute_ = true;
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment