MIP63: Maker Keeper Network implementation for the Chainlink Automation Network.
Maintains Maker protocol by poking oracles, liquidating vaults, managing the autoline, managing D3Ms, etc.
DssCronKeeper.sol
DssVestTopUp
DssVestTopUp.sol
graph TD
A(Chainlink Automation Network) -->|calls upkeep| B(KeeperRegistry)
B -->|checks and performs upkeep| C(DssCronKeeper)
C -->|triggers refund| D(DssVestTopUp)
C -->|runs jobs| E(DssCron)
D -->|withdraws DAI| F(NetworkPaymentAdapter)
D -->|checks upkeep balance / add funds| B
D -->|swaps DAI for LINK| H(Uniswap Router)
D -->|checks price for swap|I(Chainlink Price Feeds)
Clone the repo and install all dependencies.
git clone git@github.com:hackbg/chainlink-makerdao-automation.git
cd chainlink-makerdao-automation
git submodule init
git submodule update
npm install
Copy the .env.example
to .env
file and make sure you've set all of the following.
Name | Description |
---|---|
RPC_URL |
URL of a node |
PRIVATE_KEY |
Controls which account Hardhat uses |
ETHERSCAN_API_KEY |
Required to verify contract code on Etherscan |
DssCronKeeper
contractName | Description |
---|---|
SEQUENCER |
Address of Sequencer |
NETWORK_NAME |
Short name from the Sequencer network registry |
DssVestTopUp
contractName | Description |
---|---|
UPKEEP_ID |
Unique identifier of the registered upkeep for DssCronKeeper |
KEEPER_REGISTRY_V2_1 |
Address of KeeperRegistry V2.1 |
DAI_TOKEN |
Address of DAI token |
LINK_TOKEN |
Address of LINK token |
NETWORK_PAYMENT_ADAPTER |
Address of NetworkPaymentAdapter for the keeper network |
DAI_USD_PRICE_FEED |
Chainlink price feed for the DAI / USD pair |
LINK_USD_PRICE_FEED |
Chainlink price feed for the LINK / USD pair |
SWAP_ROUTER_V3 |
Address of Uniswap V3 Router |
SLIPPAGE_TOLERANCE_BPS |
Price slippage tolerance in basis points. Learn more here. |
UNISWAP_PATH |
Uniswap V3 path for swapping DAI for LINK. Example: DAI, 500, WETH, 3000, LINK . Learn more here. |
Name | Description |
---|---|
AUTOMATION_REGISTRAR_V2_1 |
Address of Automation Registrar V2.1 contract |
EOA_WITH_LINK |
Address of the Externally Owned Account (EOA) with at least 50 LINK balance before the block specified when running the tests on a fork. |
UNISWAP_V3_FACTORY |
Uniswap V3 Factory address |
NONFUNGIBLE_POSITION_MANAGER |
Uniswap V3 Nonfungible Position Manager address |
VOW |
Address of Vow |
Note: Example contract addresses are for Ethereum mainnet.
Run unit tests on the local Hardhat network.
npm test
For end-to-end testing.
npm run test:e2e
DssVestCronKeeper.sol
to a network configured in Hardhat config.npx hardhat run scripts/deploy_keeper.ts --network <network>
Note: After successful deployment, the contract must be registered as new upkeep to start performing pending jobs.
DssVestTopUp.sol
by running the following.npx hardhat run scripts/deploy_topup.ts --network <network>
DssCronKeeper
upkeep, call setUpkeepRefunder(address)
and pass the address of the deployed DssVestTopUp
contract.