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 dd9216d commit 04a52f5
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 32 deletions.
10 changes: 2 additions & 8 deletions script/HoneyPot.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,8 @@ contract HoneyPotDeploymentScript is Script {
function run() external {
vm.startBroadcast();

address chainlink = vm.envOr(
"CHAINLINK_SOURCE",
0x5f4eC3Df9cbd43714FE2740f5E3616155c5b8419
);
address pyth = vm.envOr(
"PYTH_SOURCE",
0x4305FB66699C3B2702D4d05CF36551390A4c69C6
);
address chainlink = vm.envOr("CHAINLINK_SOURCE", 0x5f4eC3Df9cbd43714FE2740f5E3616155c5b8419);
address pyth = vm.envOr("PYTH_SOURCE", 0x4305FB66699C3B2702D4d05CF36551390A4c69C6);

bytes32 defaultId = 0xff61491a931112ddf1bd8147cd1b641375f79f5825126d665480874634fd0ace;
bytes32 pythPriceId = vm.envOr("PYTH_PRICE_ID", bytes32(0));
Expand Down
32 changes: 8 additions & 24 deletions test/HoneyPot.sol
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,10 @@ 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;

ChronicleMedianSourceMock chronicleMock;

Expand Down Expand Up @@ -58,13 +56,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 @@ -90,9 +83,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 @@ -120,9 +111,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 Expand Up @@ -168,10 +157,7 @@ contract HoneyPotTest is CommonTest {
honeyPot2.emptyHoneyPot(address(this));

// Simulate price change
chronicleMock.setLatestSourceData(
(read * 103) / 100,
uint32(block.timestamp - 1)
);
chronicleMock.setLatestSourceData((read * 103) / 100, uint32(block.timestamp - 1));

// Unlock the latest value
oevShare2.unlockLatestValue();
Expand All @@ -183,8 +169,6 @@ contract HoneyPotTest is CommonTest {

uint256 liquidatorBalanceAfter = liquidator.balance;

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

0 comments on commit 04a52f5

Please sign in to comment.