Skip to content

Commit d1625dc

Browse files
committed
feat: update docs
Signed-off-by: Pablo Maldonado <pablo@umaproject.org>
1 parent 9a801a1 commit d1625dc

File tree

3 files changed

+22
-56
lines changed

3 files changed

+22
-56
lines changed

README.md

Lines changed: 14 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,9 @@
22

33
**This repository is a demonstration of the Oval system and a HoneyPot mechanism. It showcases how a backrunner can liquidate a position, in this particular case, how a HoneyPot can be emptied given a specific price change.**
44

5-
![Github Actions](https://github.com/UMAprotocol/oval-demo/workflows/CI/badge.svg)
6-
75
## Introduction
86

9-
The HoneyPot mechanism is a unique setup where funds are kept in a contract that is designed to be emptied out based on specific criteria, in this case, a change in the price from an oracle.
7+
The HoneyPot is a contract abstracting in a simple way a money market or any other contract that can be liquidated. The HoneyPot is initialized with a specific amount of funds and the Chainlink price at the creation of the pot. The HoneyPot can be subject to liquidation (emptyHoneyPot function) if the Chainlink price feed reports a value different from the initial price at the time of the HoneyPot's creation. The owner of the HoneyPot can reset the funds and the price at any time. It can support one honey per address calling the [`createHoneyPot`](https://github.com/UMAprotocol/oev-demo/blob/master/src/HoneyPot.sol#L31) function.
108

119
## Getting Started
1210

@@ -20,33 +18,27 @@ forge test`
2018

2119
## Contracts Overview
2220

23-
- **HoneyPot**: Represents the honey pot, which can be emptied when a price oracle returns a value different from a pre-defined liquidation price. The honey pot's funds can also be reset by its owner.
24-
- **HoneyPotOval**: Acts as the oracle which retrieves prices from various sources like Chainlink, Chronicle, and Pyth.
25-
- **Test Contract**: Sets up the environment, including simulating price changes and testing the mechanisms for creating and emptying the HoneyPot.
21+
- **HoneyPot**: This represents the honey pot, which can be emptied when the Chainlink price feed reports a value different from the initial price at the time of the honey pot's creation. The funds in the honey pot can also be reset by its owner.
22+
- **ChainlinkOvalImmutable**: Serves as the oracle that retrieves prices from Chainlink. This is the simplest version of Oval that can be used to retrieve prices from Chainlink. It's pulled from the [Oval-Quickstart](https://github.com/UMAprotocol/oval-quickstart) repository.
23+
- **ChainlinkOvalImmutable**: This is a simple example of a contract that can receive the Oval MEV-Share refunds for Oracle auction kickback.
2624

2725
## Deploy the Contracts
2826

29-
Can be run against a fork with anvil:
27+
(Optional) Can be run against a fork with anvil by first running:
3028

3129
```bash
3230
anvil --fork-url https://mainnet.infura.io/v3/<YOUR_KEY>
3331
```
3432

35-
Then:
33+
Run the following command to deploy the contracts:
3634

3735
```bash
38-
export MNEMONIC="test test test test test test test test test test test junk"
39-
export DEPLOYER_WALLET=$(cast wallet address --mnemonic "$MNEMONIC")
40-
export ETH_RPC_URL="http://127.0.0.1:8545"
41-
42-
# The following variables can be skipped if you want to use the default values
43-
export CHAINLINK_SOURCE = "0x5f4eC3Df9cbd43714FE2740f5E3616155c5b8419" // chosen from https://docs.chain.link/docs/reference-contracts
44-
export PYTH_SOURCE = "0x4305FB66699C3B2702D4d05CF36551390A4c69C6" // chosen from https://pyth.network/markets
45-
export PYTH_PRICE_ID = "0xff61491a931112ddf1bd8147cd1b641375f79f5825126d665480874634fd0ace" // chosen from https://pyth.network/markets
46-
47-
forge script script/HoneyPot.s.sol \
48-
--fork-url $ETH_RPC_URL \
49-
--mnemonics "$MNEMONIC" \
50-
--sender $DEPLOYER_WALLET \
51-
--broadcast
36+
export PRIVATE_KEY=0xPUT_YOUR_PRIVATE_KEY_HERE # This account will do the deployment
37+
export SOURCE_ADDRESS=0x5f4ec3df9cbd43714fe2740f5e3616155c5b8419 # example Chainlink ETH/USD
38+
export LOCK_WINDOW=60 # How long each update is blocked for OEV auction to run.
39+
export MAX_TRAVERSAL=4 # How many iterations to look back for historic data.
40+
export UNLOCKER=0xPUT_YOUR_UNLOCKER_ADDRESS_HERE # Your address provided on Discord.
41+
export ETH_RPC_URL=PUT_YOUR_RPC_URL_HERE # Your network or fork RPC Url.
42+
43+
forge script script/HoneyPot.s.sol --rpc-url $ETH_RPC_URL --broadcast
5244
```

script/HoneyPot.s.sol

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,15 @@ contract HoneyPotDeploymentScript is Script {
1414
address chainlink = vm.envAddress("SOURCE_ADDRESS");
1515
uint256 lockWindow = vm.envUint("LOCK_WINDOW");
1616
uint256 maxTraversal = vm.envUint("MAX_TRAVERSAL");
17-
18-
// This script assumes exactly one unlocker is set. If you want to set more than one, you'll need to modify this
19-
// script to have an array of known unlocker addresses.
20-
string memory unlockersString = vm.envString("UNLOCKERS");
17+
address unlocker = vm.envAddress("UNLOCKERS");
2118
address[] memory unlockers = new address[](1);
22-
unlockers[0] = address(uint160(uint256(keccak256(abi.encodePacked(unlockersString)))));
19+
unlockers[0] = unlocker;
20+
21+
console.log("Deploying HoneyPot with the following parameters:");
22+
console.log(" - Chainlink source address: ", chainlink);
23+
console.log(" - Lock window: ", lockWindow);
24+
console.log(" - Max traversal: ", maxTraversal);
25+
console.log(" - Unlocker: ", unlockers[0]);
2326

2427
IAggregatorV3Source source = IAggregatorV3Source(chainlink);
2528
uint8 decimals = IAggregatorV3Source(chainlink).decimals();

src/mock/ChronicleMedianSourceMock.sol

Lines changed: 0 additions & 29 deletions
This file was deleted.

0 commit comments

Comments
 (0)