Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
N
nebula
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
exchain
nebula
Commits
0ae1166b
Commit
0ae1166b
authored
Jul 20, 2023
by
Andreas Bigger
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Port drippie contracts to triple slash natspec styling
parent
1a8f502f
Changes
6
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
88 additions
and
153 deletions
+88
-153
Drippie.sol
...contracts-bedrock/contracts/periphery/drippie/Drippie.sol
+56
-93
IDripCheck.sol
...tracts-bedrock/contracts/periphery/drippie/IDripCheck.sol
+4
-8
CheckBalanceHigh.sol
...ntracts/periphery/drippie/dripchecks/CheckBalanceHigh.sol
+7
-14
CheckBalanceLow.sol
...ontracts/periphery/drippie/dripchecks/CheckBalanceLow.sol
+7
-14
CheckGelatoLow.sol
...contracts/periphery/drippie/dripchecks/CheckGelatoLow.sol
+9
-15
CheckTrue.sol
...rock/contracts/periphery/drippie/dripchecks/CheckTrue.sol
+5
-9
No files found.
packages/contracts-bedrock/contracts/periphery/drippie/Drippie.sol
View file @
0ae1166b
This diff is collapsed.
Click to expand it.
packages/contracts-bedrock/contracts/periphery/drippie/IDripCheck.sol
View file @
0ae1166b
...
@@ -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);
}
}
packages/contracts-bedrock/contracts/periphery/drippie/dripchecks/CheckBalanceHigh.sol
View file @
0ae1166b
...
@@ -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;
}
}
}
}
packages/contracts-bedrock/contracts/periphery/drippie/dripchecks/CheckBalanceLow.sol
View file @
0ae1166b
...
@@ -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;
}
}
}
}
packages/contracts-bedrock/contracts/periphery/drippie/dripchecks/CheckGelatoLow.sol
View file @
0ae1166b
...
@@ -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;
}
}
}
}
packages/contracts-bedrock/contracts/periphery/drippie/dripchecks/CheckTrue.sol
View file @
0ae1166b
...
@@ -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;
}
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment