From 46ac5ef201b126737984e3b07e7c8d159a333a5b Mon Sep 17 00:00:00 2001 From: Pablo Maldonado Date: Fri, 2 Feb 2024 11:15:16 +0000 Subject: [PATCH] feat: rename to oval (#8) Signed-off-by: Pablo Maldonado --- .gitmodules | 9 ++++--- README.md | 8 +++--- lib/oev-contracts | 2 +- lib/oval-contracts | 1 + remappings.txt | 1 + script/HoneyPot.s.sol | 10 +++---- src/HoneyPot.sol | 4 +-- ...{HoneyPotOEVShare.sol => HoneyPotOval.sol} | 2 +- test/HoneyPot.sol | 26 +++++++++---------- 9 files changed, 34 insertions(+), 29 deletions(-) create mode 160000 lib/oval-contracts rename src/{HoneyPotOEVShare.sol => HoneyPotOval.sol} (91%) diff --git a/.gitmodules b/.gitmodules index b83ed6d..8693d44 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,9 +1,12 @@ [submodule "lib/forge-std"] path = lib/forge-std url = https://github.com/foundry-rs/forge-std.git -[submodule "lib/oev-contracts"] - path = lib/oev-contracts - url = https://github.com/UMAprotocol/oev-contracts.git [submodule "lib/openzeppelin-contracts"] path = lib/openzeppelin-contracts url = https://github.com/OpenZeppelin/openzeppelin-contracts +[submodule "lib/oval-contracts"] + path = lib/oval-contracts + url = https://github.com/UMAprotocol/oval-contracts +[submodule "lib/oev-contracts"] + path = lib/oev-contracts + url = https://github.com/UMAprotocol/oev-contracts diff --git a/README.md b/README.md index a0c69a3..fdd3685 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,8 @@ -#

OEV Share HoneyPot Demo

+#

Oval HoneyPot Demo

-**This repository is a demonstration of the OEV Share 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.** +**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.** -![Github Actions](https://github.com/UMAprotocol/oev-demo/workflows/CI/badge.svg) +![Github Actions](https://github.com/UMAprotocol/oval-demo/workflows/CI/badge.svg) ## Introduction @@ -21,7 +21,7 @@ forge test` ## Contracts Overview - **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. -- **HoneyPotOEVShare**: Acts as the oracle which retrieves prices from various sources like Chainlink, Chronicle, and Pyth. +- **HoneyPotOval**: Acts as the oracle which retrieves prices from various sources like Chainlink, Chronicle, and Pyth. - **Test Contract**: Sets up the environment, including simulating price changes and testing the mechanisms for creating and emptying the HoneyPot. ## Deploy the Contracts diff --git a/lib/oev-contracts b/lib/oev-contracts index 35d5f7c..bd6b77b 160000 --- a/lib/oev-contracts +++ b/lib/oev-contracts @@ -1 +1 @@ -Subproject commit 35d5f7c0bb4c9dd7884d1a403c9d9b996b0f7fd4 +Subproject commit bd6b77ba41e4c21a63fce6bdd7e87da34a041379 diff --git a/lib/oval-contracts b/lib/oval-contracts new file mode 160000 index 0000000..25afc49 --- /dev/null +++ b/lib/oval-contracts @@ -0,0 +1 @@ +Subproject commit 25afc497af220adbc580b9c4ab04ab2485f3a564 diff --git a/remappings.txt b/remappings.txt index 2053123..e4f5a15 100644 --- a/remappings.txt +++ b/remappings.txt @@ -1,4 +1,5 @@ ds-test/=lib/forge-std/lib/ds-test/src/ forge-std/=lib/forge-std/src/ +oval-contracts/=lib/oval-contracts/src/ oev-contracts/=lib/oev-contracts/src/ @openzeppelin/contracts/=lib/openzeppelin-contracts/contracts/ \ No newline at end of file diff --git a/script/HoneyPot.s.sol b/script/HoneyPot.s.sol index d05bd65..9d7bd55 100644 --- a/script/HoneyPot.s.sol +++ b/script/HoneyPot.s.sol @@ -6,13 +6,13 @@ import "forge-std/Script.sol"; import {ChronicleMedianSourceMock} from "../src/mock/ChronicleMedianSourceMock.sol"; import {IMedian} from "oev-contracts/interfaces/chronicle/IMedian.sol"; -import {HoneyPotOEVShare} from "../src/HoneyPotOEVShare.sol"; +import {HoneyPotOval} from "../src/HoneyPotOval.sol"; import {HoneyPot} from "../src/HoneyPot.sol"; import {HoneyPotDAO} from "../src/HoneyPotDAO.sol"; -import {IAggregatorV3Source} from "oev-contracts/interfaces/chainlink/IAggregatorV3Source.sol"; +import {IAggregatorV3Source} from "oval-contracts/interfaces/chainlink/IAggregatorV3Source.sol"; contract HoneyPotDeploymentScript is Script { - HoneyPotOEVShare oevShare; + HoneyPotOval oval; HoneyPot honeyPot; HoneyPotDAO honeyPotDAO; ChronicleMedianSourceMock chronicleMock; @@ -32,7 +32,7 @@ contract HoneyPotDeploymentScript is Script { // Create mock ChronicleMedianSource and set the latest source data. chronicleMock = new ChronicleMedianSourceMock(); - oevShare = new HoneyPotOEVShare( + oval = new HoneyPotOval( chainlink, address(chronicleMock), pyth, @@ -40,7 +40,7 @@ contract HoneyPotDeploymentScript is Script { 8 ); - honeyPot = new HoneyPot(IAggregatorV3Source(address(oevShare))); + honeyPot = new HoneyPot(IAggregatorV3Source(address(oval))); honeyPotDAO = new HoneyPotDAO(); diff --git a/src/HoneyPot.sol b/src/HoneyPot.sol index 77cbde7..e868d91 100644 --- a/src/HoneyPot.sol +++ b/src/HoneyPot.sol @@ -3,7 +3,7 @@ pragma solidity 0.8.17; import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol"; import {Address} from "@openzeppelin/contracts/utils/Address.sol"; -import {IAggregatorV3Source} from "oev-contracts/interfaces/chainlink/IAggregatorV3Source.sol"; +import {IAggregatorV3Source} from "oval-contracts/interfaces/chainlink/IAggregatorV3Source.sol"; contract HoneyPot is Ownable { struct HoneyPotDetails { @@ -12,7 +12,7 @@ contract HoneyPot is Ownable { } mapping(address => HoneyPotDetails) public honeyPots; - IAggregatorV3Source public oracle; // OEV Share serving as a Chainlink oracle + IAggregatorV3Source public oracle; // Oval serving as a Chainlink oracle event OracleUpdated(address indexed newOracle); event HoneyPotCreated(address indexed creator, int256 liquidationPrice, uint256 initialBalance); diff --git a/src/HoneyPotOEVShare.sol b/src/HoneyPotOval.sol similarity index 91% rename from src/HoneyPotOEVShare.sol rename to src/HoneyPotOval.sol index ff36da1..81feb16 100644 --- a/src/HoneyPotOEVShare.sol +++ b/src/HoneyPotOval.sol @@ -8,7 +8,7 @@ import {IAggregatorV3Source} from "oev-contracts/interfaces/chainlink/IAggregato import {IMedian} from "oev-contracts/interfaces/chronicle/IMedian.sol"; import {IPyth} from "oev-contracts/interfaces/pyth/IPyth.sol"; -contract HoneyPotOEVShare is BaseController, BoundedUnionSourceAdapter, ChainlinkDestinationAdapter { +contract HoneyPotOval is BaseController, BoundedUnionSourceAdapter, ChainlinkDestinationAdapter { constructor( address chainlinkSource, address chronicleSource, diff --git a/test/HoneyPot.sol b/test/HoneyPot.sol index dd9412a..820d817 100644 --- a/test/HoneyPot.sol +++ b/test/HoneyPot.sol @@ -2,11 +2,11 @@ pragma solidity 0.8.17; import {CommonTest} from "./Common.sol"; -import {IAggregatorV3Source} from "oev-contracts/interfaces/chainlink/IAggregatorV3Source.sol"; +import {IAggregatorV3Source} from "oval-contracts/interfaces/chainlink/IAggregatorV3Source.sol"; import {IMedian} from "oev-contracts/interfaces/chronicle/IMedian.sol"; import {IPyth} from "oev-contracts/interfaces/pyth/IPyth.sol"; -import {HoneyPotOEVShare} from "../src/HoneyPotOEVShare.sol"; +import {HoneyPotOval} from "../src/HoneyPotOval.sol"; import {HoneyPot} from "../src/HoneyPot.sol"; import {HoneyPotDAO} from "../src/HoneyPotDAO.sol"; import {ChronicleMedianSourceMock} from "../src/mock/ChronicleMedianSourceMock.sol"; @@ -26,7 +26,7 @@ contract HoneyPotTest is CommonTest { ChronicleMedianSourceMock chronicleMock; - HoneyPotOEVShare oevShare; + HoneyPotOval oval; HoneyPot honeyPot; HoneyPotDAO honeyPotDAO; @@ -35,7 +35,7 @@ contract HoneyPotTest is CommonTest { function setUp() public { vm.createSelectFork("mainnet", 18419040); // Recent block on mainnet - oevShare = new HoneyPotOEVShare( + oval = new HoneyPotOval( address(chainlink), address(chronicle), address(pyth), @@ -43,10 +43,10 @@ contract HoneyPotTest is CommonTest { 8 ); - honeyPot = new HoneyPot(IAggregatorV3Source(address(oevShare))); + honeyPot = new HoneyPot(IAggregatorV3Source(address(oval))); honeyPotDAO = new HoneyPotDAO(); _whitelistOnChronicle(); - oevShare.setUnlocker(address(this), true); + oval.setUnlocker(address(this), true); chronicleMock = new ChronicleMedianSourceMock(); } @@ -54,7 +54,7 @@ contract HoneyPotTest is CommonTest { function _whitelistOnChronicle() internal { vm.startPrank(0xBE8E3e3618f7474F8cB1d074A26afFef007E98FB); // DSPause that is a ward (can add kiss to chronicle) - chronicle.kiss(address(oevShare)); + chronicle.kiss(address(oval)); chronicle.kiss(address(this)); // So that we can read Chronicle directly. vm.stopPrank(); } @@ -96,7 +96,7 @@ contract HoneyPotTest is CommonTest { function testCrackHoneyPot() public { // Create HoneyPot for the caller - (, int256 currentPrice,,,) = oevShare.latestRoundData(); + (, int256 currentPrice,,,) = oval.latestRoundData(); vm.expectEmit(true, true, true, true); emit HoneyPotCreated(address(this), currentPrice, honeyPotBalance); honeyPot.createHoneyPot{value: honeyPotBalance}(); @@ -111,7 +111,7 @@ contract HoneyPotTest is CommonTest { mockChainlinkPriceChange(); // Unlock the latest value - oevShare.unlockLatestValue(); + oval.unlockLatestValue(); uint256 liquidatorBalanceBefore = liquidator.balance; @@ -145,17 +145,17 @@ contract HoneyPotTest is CommonTest { uint256 read = chronicle.read(); chronicleMock.setLatestSourceData(read, age); - HoneyPotOEVShare oevShare2 = new HoneyPotOEVShare( + HoneyPotOval oval2 = new HoneyPotOval( address(chainlink), address(chronicleMock), address(pyth), pythPriceId, 8 ); - oevShare2.setUnlocker(address(this), true); + oval2.setUnlocker(address(this), true); HoneyPot honeyPot2 = new HoneyPot( - IAggregatorV3Source(address(oevShare2)) + IAggregatorV3Source(address(oval2)) ); // Create HoneyPot for the caller @@ -171,7 +171,7 @@ contract HoneyPotTest is CommonTest { chronicleMock.setLatestSourceData((read * 103) / 100, uint32(block.timestamp - 1)); // Unlock the latest value - oevShare2.unlockLatestValue(); + oval2.unlockLatestValue(); uint256 liquidatorBalanceBefore = liquidator.balance;