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