-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: shaito suggested fixes implemented, cleaned up repo for future p…
…rojects
- Loading branch information
deo
committed
Nov 30, 2023
1 parent
9cba32f
commit 65faa75
Showing
12 changed files
with
83 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
pragma solidity ^0.8.19; | ||
|
||
import {IKeep3rV2} from '../../interfaces/Swapper/IKeep3rV2.sol'; | ||
import {IWETH} from '../../interfaces/Swapper/IWETH.sol'; | ||
|
||
contract Keeper { | ||
error KeeperNotValid(); | ||
error JobNotReady(); | ||
|
||
uint256 lastWorked; | ||
address keep3r = 0xdc02981c9C062d48a9bD54adBf51b816623dcc6E; | ||
uint256 constant TEN_MINUTES = 600; | ||
|
||
IWETH constant WETH = IWETH(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2); | ||
|
||
modifier validateAndPayKeeper(address _keeper) { | ||
if (!IKeep3rV2(keep3r).isKeeper(_keeper)) revert KeeperNotValid(); | ||
_; | ||
IKeep3rV2(keep3r).directTokenPayment(address(WETH), _keeper, 1e17); | ||
} | ||
|
||
function work() external validateAndPayKeeper(msg.sender) { | ||
if (!workable()) { | ||
revert JobNotReady(); | ||
} | ||
|
||
lastWorked = block.timestamp; | ||
|
||
swap(); | ||
} | ||
|
||
function workable() public view returns (bool _workable) { | ||
return block.timestamp >= lastWorked + TEN_MINUTES; | ||
} | ||
|
||
function swap() public virtual {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
pragma solidity ^0.8.19; | ||
|
||
import {IERC20} from '@openzeppelin/contracts/token/ERC20/IERC20.sol'; | ||
|
||
interface IWETH is IERC20 { | ||
function withdraw(uint256 wad) external; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters