Skip to content

Commit

Permalink
lint: forge fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
xenide committed Sep 20, 2024
1 parent 0efae63 commit ffae6c5
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 10 deletions.
7 changes: 3 additions & 4 deletions script/Deploy.s.sol → script/01_Deploy.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,11 @@ import { ReservoirPriceOracle, PriceType } from "src/ReservoirPriceOracle.sol";

contract Deploy is Script {
function run() external {
vm.startBroadcast(address(1));
vm.startBroadcast();
string memory lTestnetRpcUrl = vm.rpcUrl("sepolia");

// uint256 lForkId = vm.createFork(lTestnetRpcUrl);

ReservoirPriceOracle asd = new ReservoirPriceOracle(15 minutes, 200_000, PriceType.CLAMPED_PRICE);
ReservoirPriceOracle lOracle =
new ReservoirPriceOracle(Constants.DEFAULT_TWAP_PERIOD, 200_000, PriceType.CLAMPED_PRICE);

vm.stopBroadcast();
}
Expand Down
3 changes: 2 additions & 1 deletion src/ReservoirPriceOracle.sol
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,8 @@ contract ReservoirPriceOracle is IPriceOracle, Owned(msg.sender), ReentrancyGuar
}

function _calculateReward(uint256 aPrevPrice, uint256 aNewPrice, uint256 aRewardThreshold)
private returns (uint256 rReward)
private
returns (uint256 rReward)
{
// SAFETY: this mul will not overflow as 0 < `aRewardThreshold` <= `Constants.BP_SCALE`, as checked by `setRoute`
uint256 lRewardThresholdWAD;
Expand Down
9 changes: 5 additions & 4 deletions src/libraries/Constants.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,16 @@
pragma solidity ^0.8.0;

library Constants {
///////////////////////////////////////////////////////////////////////////////////////////////
// CONSTANTS //
///////////////////////////////////////////////////////////////////////////////////////////////

uint256 public constant MAX_DEVIATION_THRESHOLD = 0.1e18; // 10%
uint256 public constant MAX_TWAP_PERIOD = 1 hours;
uint256 public constant MAX_ROUTE_LENGTH = 4;
uint256 public constant WAD = 1e18;
uint256 public constant MAX_SUPPORTED_PRICE = type(uint128).max;
uint256 public constant MAX_AMOUNT_IN = type(uint128).max;
uint16 public constant BP_SCALE = 1e4;

// Defaults
uint256 public constant DEFAULT_TWAP_PERIOD = 15 minutes;
uint256 public constant DEFAULT_DEVIATION_THRESHOLD_VOLATILE = 200; // 2%
uint256 public constant DEFAULT_DEVIATION_THRESHOLD_STABLE = 2; // 0.02%
}
2 changes: 1 addition & 1 deletion test/unit/ReservoirPriceOracle.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -692,7 +692,7 @@ contract ReservoirPriceOracleTest is BaseTest {
skip(_oracle.twapPeriod());

// act
uint256 lSwapAmt = 1_000_000;
uint256 lSwapAmt = 1_000_000;
_tokenA.mint(address(lAC), lSwapAmt * 10 ** _tokenA.decimals());
lAC.swap(int256(lSwapAmt * 10 ** _tokenA.decimals()), true, address(this), "");

Expand Down

0 comments on commit ffae6c5

Please sign in to comment.