Skip to content

Commit

Permalink
refactor: format
Browse files Browse the repository at this point in the history
Signed-off-by: Pablo Maldonado <[email protected]>
  • Loading branch information
md0x committed Oct 27, 2023
1 parent 1432154 commit f9a7564
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 32 deletions.
18 changes: 3 additions & 15 deletions src/mock/ChronicleMedianSourceAdapterMock.sol
Original file line number Diff line number Diff line change
Expand Up @@ -4,29 +4,17 @@ pragma solidity 0.8.17;
import {ChronicleMedianSourceAdapter} from "oev-contracts/adapters/source-adapters/ChronicleMedianSourceAdapter.sol";
import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol";

contract ChronicleMedianSourceAdapterMock is
Ownable,
ChronicleMedianSourceAdapter
{
contract ChronicleMedianSourceAdapterMock is Ownable, ChronicleMedianSourceAdapter {
constructor() ChronicleMedianSourceAdapter(address(0)) {}

uint256 public value;
uint256 public age;

function getLatestSourceData()
public
view
virtual
override
returns (int256, uint256)
{
function getLatestSourceData() public view virtual override returns (int256, uint256) {
return (SafeCast.toInt256(value), age);
}

function setLatestSourceData(
uint256 _value,
uint256 _age
) public onlyOwner {
function setLatestSourceData(uint256 _value, uint256 _age) public onlyOwner {
value = _value;
age = _age;
}
Expand Down
25 changes: 8 additions & 17 deletions test/HoneyPot.sol
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ contract HoneyPotTest is CommonTest {
event ReceivedEther(address sender, uint256 amount);
event DrainedEther(address to, uint256 amount);

IAggregatorV3Source chainlink =
IAggregatorV3Source(0x5f4eC3Df9cbd43714FE2740f5E3616155c5b8419);
IAggregatorV3Source chainlink = IAggregatorV3Source(0x5f4eC3Df9cbd43714FE2740f5E3616155c5b8419);
IMedian chronicle = IMedian(0x64DE91F5A373Cd4c28de3600cB34C7C6cE410C85);
IPyth pyth = IPyth(0x4305FB66699C3B2702D4d05CF36551390A4c69C6);
bytes32 pythPriceId =
0xff61491a931112ddf1bd8147cd1b641375f79f5825126d665480874634fd0ace;
bytes32 pythPriceId = 0xff61491a931112ddf1bd8147cd1b641375f79f5825126d665480874634fd0ace;

ChronicleMedianSourceAdapterMock chronicleMock = new ChronicleMedianSourceAdapterMock();

HoneyPotOEVShare oevShare;
HoneyPot honeyPot;
Expand Down Expand Up @@ -55,13 +55,8 @@ contract HoneyPotTest is CommonTest {
}

function mockChainlinkPriceChange() public {
(
uint80 roundId,
int256 answer,
uint256 startedAt,
uint256 updatedAt,
uint80 answeredInRound
) = chainlink.latestRoundData();
(uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound) =
chainlink.latestRoundData();
vm.mockCall(
address(chainlink),
abi.encodeWithSelector(chainlink.latestRoundData.selector),
Expand All @@ -87,9 +82,7 @@ contract HoneyPotTest is CommonTest {

// Reset HoneyPot for the caller
honeyPot.resetPot();
(, uint256 testhoneyPotBalanceReset) = honeyPot.honeyPots(
address(this)
);
(, uint256 testhoneyPotBalanceReset) = honeyPot.honeyPots(address(this));
assertTrue(testhoneyPotBalanceReset == 0);
assertTrue(address(this).balance == balanceBefore);
}
Expand Down Expand Up @@ -117,9 +110,7 @@ contract HoneyPotTest is CommonTest {

uint256 liquidatorBalanceAfter = liquidator.balance;

assertTrue(
liquidatorBalanceAfter == liquidatorBalanceBefore + honeyPotBalance
);
assertTrue(liquidatorBalanceAfter == liquidatorBalanceBefore + honeyPotBalance);

// Create HoneyPot can be called again
honeyPot.createHoneyPot{value: honeyPotBalance}();
Expand Down

0 comments on commit f9a7564

Please sign in to comment.