Skip to content

Commit

Permalink
chore: linter
Browse files Browse the repository at this point in the history
  • Loading branch information
Oighty committed Jul 2, 2024
1 parent c1c858e commit 4b3aa13
Show file tree
Hide file tree
Showing 15 changed files with 42 additions and 37 deletions.
4 changes: 2 additions & 2 deletions script/ops/test/FixedPriceBatch-BaseDTL/TestData.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ contract TestData is Script, WithEnvironment {

routingParams.callbackData = abi.encode(
BaseDirectToLiquidity.OnCreateParams({
proceedsUtilisationPercent: 50_00, // 50%
proceedsUtilisationPercent: 5000, // 50%
vestingStart: 0,
vestingExpiry: 0,
recipient: msg.sender,
Expand All @@ -80,7 +80,7 @@ contract TestData is Script, WithEnvironment {

IFixedPriceBatch.AuctionDataParams memory auctionDataParams;
auctionDataParams.price = 2e18; // 2 quote tokens per base token
auctionDataParams.minFillPercent = uint24(10_00); // 10%
auctionDataParams.minFillPercent = uint24(1000); // 10%
bytes memory implParams = abi.encode(auctionDataParams);

uint48 duration = 86_400; // 1 day
Expand Down
2 changes: 1 addition & 1 deletion script/ops/test/FixedPriceBatch/TestData.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ contract TestData is Script, WithEnvironment {

IFixedPriceBatch.AuctionDataParams memory auctionDataParams;
auctionDataParams.price = 1e18; // 1 quote tokens per base token
auctionDataParams.minFillPercent = uint24(10_00); // 10%
auctionDataParams.minFillPercent = uint24(1000); // 10%
bytes memory implParams = abi.encode(auctionDataParams);

uint48 duration = 86_400; // 1 day
Expand Down
2 changes: 1 addition & 1 deletion script/ops/test/TestData.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ contract TestData is Script {

EncryptedMarginalPrice.AuctionDataParams memory auctionDataParams;
auctionDataParams.minPrice = 2e18; // 2 quote tokens per base token
auctionDataParams.minFillPercent = uint24(10_00); // 10%
auctionDataParams.minFillPercent = uint24(1000); // 10%
auctionDataParams.minBidSize = 2e17; // 0.2 quote tokens
auctionDataParams.publicKey = publicKey;
bytes memory implParams = abi.encode(auctionDataParams);
Expand Down
2 changes: 1 addition & 1 deletion src/modules/auctions/batch/FPB.sol
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ contract FixedPriceBatch is BatchAuctionModule, IFixedPriceBatch {
/// This function reverts if:
/// - The parameters cannot be decoded into the correct format
/// - The price is zero
/// - The minimum fill percentage is greater than
/// - The minimum fill percentage is greater than
///
/// @param params_ ABI-encoded data of type `AuctionDataParams`
function _auction(uint96 lotId_, Lot memory lot_, bytes memory params_) internal override {
Expand Down
8 changes: 4 additions & 4 deletions test/AtomicAuctionHouse/AuctionHouseTest.sol
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,13 @@ abstract contract AtomicAuctionHouseTest is Test, Permit2User, WithSalts {
address internal _bidder;
uint256 internal _bidderKey;

uint24 internal constant _CURATOR_MAX_FEE_PERCENT = 1_00;
uint24 internal constant _CURATOR_MAX_FEE_PERCENT = 100;
uint24 internal constant _CURATOR_FEE_PERCENT = 90;
uint24 internal _curatorFeePercentActual;

uint24 internal constant _PROTOCOL_FEE_PERCENT = 1_00;
uint24 internal constant _REFERRER_FEE_PERCENT = 1_05;
uint24 internal constant _REFERRER_MAX_FEE_PERCENT = 10_00;
uint24 internal constant _PROTOCOL_FEE_PERCENT = 100;
uint24 internal constant _REFERRER_FEE_PERCENT = 105;
uint24 internal constant _REFERRER_MAX_FEE_PERCENT = 1000;
uint24 internal _referrerFeePercentActual;

uint24 internal _protocolFeePercentActual;
Expand Down
2 changes: 1 addition & 1 deletion test/AtomicAuctionHouse/cancelAuction.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {AtomicAuctionHouseTest} from "test/AtomicAuctionHouse/AuctionHouseTest.s
contract AtomicCancelAuctionTest is AtomicAuctionHouseTest {
uint256 internal constant _PURCHASE_AMOUNT = 2e18;
uint256 internal constant _PURCHASE_AMOUNT_OUT = 1e18;
uint32 internal constant _PAYOUT_MULTIPLIER = 50_00; // 50%
uint32 internal constant _PAYOUT_MULTIPLIER = 5000; // 50%

bytes internal _purchaseAuctionData = abi.encode("");

Expand Down
4 changes: 2 additions & 2 deletions test/AtomicAuctionHouse/purchase.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {AtomicAuctionHouseTest} from "test/AtomicAuctionHouse/AuctionHouseTest.s

contract AtomicPurchaseTest is AtomicAuctionHouseTest {
uint256 internal constant _AMOUNT_IN = 2e18;
uint256 internal constant _PAYOUT_MULTIPLIER = 50_00; // 50%
uint256 internal constant _PAYOUT_MULTIPLIER = 5000; // 50%

address internal constant _SENDER = address(0x26);

Expand Down Expand Up @@ -314,7 +314,7 @@ contract AtomicPurchaseTest is AtomicAuctionHouseTest {
givenUserHasQuoteTokenBalance(_AMOUNT_IN)
givenUserHasQuoteTokenAllowance(_AMOUNT_IN)
givenFeesAreCalculated(_AMOUNT_IN)
whenPayoutMultiplierIsSet(90_00)
whenPayoutMultiplierIsSet(9000)
givenSellerHasBaseTokenBalance(_amountOut)
givenSellerHasBaseTokenAllowance(_amountOut)
{
Expand Down
8 changes: 4 additions & 4 deletions test/BatchAuctionHouse/AuctionHouseTest.sol
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,13 @@ abstract contract BatchAuctionHouseTest is Test, Permit2User, WithSalts {
address internal _bidder;
uint256 internal _bidderKey;

uint24 internal constant _CURATOR_MAX_FEE_PERCENT = 1_00;
uint24 internal constant _CURATOR_MAX_FEE_PERCENT = 100;
uint24 internal constant _CURATOR_FEE_PERCENT = 90;
uint24 internal _curatorFeePercentActual;

uint24 internal constant _PROTOCOL_FEE_PERCENT = 1_00;
uint24 internal constant _REFERRER_FEE_PERCENT = 1_05;
uint24 internal constant _REFERRER_MAX_FEE_PERCENT = 10_00;
uint24 internal constant _PROTOCOL_FEE_PERCENT = 100;
uint24 internal constant _REFERRER_FEE_PERCENT = 105;
uint24 internal constant _REFERRER_MAX_FEE_PERCENT = 1000;
uint24 internal _referrerFeePercentActual;

uint24 internal _protocolFeePercentActual;
Expand Down
2 changes: 1 addition & 1 deletion test/BatchAuctionHouse/auction.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ contract BatchCreateAuctionTest is BatchAuctionHouseTest {
whenBatchAuctionModuleIsInstalled
givenSellerHasBaseTokenBalance(_LOT_CAPACITY)
givenSellerHasBaseTokenAllowance(_LOT_CAPACITY)
givenMaxReferrerFeeIsSet()
givenMaxReferrerFeeIsSet
givenProtocolFeeIsSet
givenReferrerFee(_REFERRER_MAX_FEE_PERCENT + 1)
{
Expand Down
2 changes: 1 addition & 1 deletion test/BatchAuctionHouse/bid.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,7 @@ contract BatchBidTest is BatchAuctionHouseTest {
givenSellerHasBaseTokenBalance(_LOT_CAPACITY)
givenSellerHasBaseTokenAllowance(_LOT_CAPACITY)
givenMaxReferrerFeeIsSet
givenReferrerFee(1_00)
givenReferrerFee(100)
givenLotIsCreated
givenLotHasStarted
givenUserHasQuoteTokenBalance(_BID_AMOUNT)
Expand Down
7 changes: 4 additions & 3 deletions test/callbacks/liquidity/UniswapV2DTL/onSettle.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -175,13 +175,14 @@ contract UniswapV2DirectToLiquidityOnSettleTest is UniswapV2DirectToLiquidityTes
// Any unspent curator payout is included in the refund
// However, curator payouts are linear to the capacity utilised
// Calculate the percent utilisation
uint96 capacityUtilisationPercent =
100e2 - uint96(FixedPointMathLib.mulDivDown(_refund, 100e2, _LOT_CAPACITY + _curatorPayout));
uint96 capacityUtilisationPercent = 100e2
- uint96(FixedPointMathLib.mulDivDown(_refund, 100e2, _LOT_CAPACITY + _curatorPayout));
_capacityUtilised = _LOT_CAPACITY * capacityUtilisationPercent / 100e2;

// The proceeds utilisation percent scales the quote tokens and base tokens linearly
_quoteTokensToDeposit = _proceeds * _dtlCreateParams.proceedsUtilisationPercent / 100e2;
_baseTokensToDeposit = _capacityUtilised * _dtlCreateParams.proceedsUtilisationPercent / 100e2;
_baseTokensToDeposit =
_capacityUtilised * _dtlCreateParams.proceedsUtilisationPercent / 100e2;
_;
}

Expand Down
13 changes: 7 additions & 6 deletions test/callbacks/liquidity/UniswapV3DTL/onSettle.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -213,13 +213,14 @@ contract UniswapV3DirectToLiquidityOnSettleTest is UniswapV3DirectToLiquidityTes
// Any unspent curator payout is included in the refund
// However, curator payouts are linear to the capacity utilised
// Calculate the percent utilisation
uint96 capacityUtilisationPercent =
100e2 - uint96(FixedPointMathLib.mulDivDown(_refund, 100e2, _LOT_CAPACITY + _curatorPayout));
uint96 capacityUtilisationPercent = 100e2
- uint96(FixedPointMathLib.mulDivDown(_refund, 100e2, _LOT_CAPACITY + _curatorPayout));
_capacityUtilised = _LOT_CAPACITY * capacityUtilisationPercent / 100e2;

// The proceeds utilisation percent scales the quote tokens and base tokens linearly
_quoteTokensToDeposit = _proceeds * _dtlCreateParams.proceedsUtilisationPercent / 100e2;
_baseTokensToDeposit = _capacityUtilised * _dtlCreateParams.proceedsUtilisationPercent / 100e2;
_baseTokensToDeposit =
_capacityUtilised * _dtlCreateParams.proceedsUtilisationPercent / 100e2;

_sqrtPriceX96 = _calculateSqrtPriceX96(_quoteTokensToDeposit, _baseTokensToDeposit);
_;
Expand Down Expand Up @@ -332,7 +333,7 @@ contract UniswapV3DirectToLiquidityOnSettleTest is UniswapV3DirectToLiquidityTes
givenAddressHasQuoteTokenBalance(_dtlAddress, _proceeds)
givenAddressHasBaseTokenBalance(_SELLER, _capacityUtilised)
givenAddressHasBaseTokenAllowance(_SELLER, _dtlAddress, _capacityUtilised)
givenMaxSlippage(81_00) // 81%
givenMaxSlippage(8100) // 81%
{
_performCallback();

Expand Down Expand Up @@ -457,7 +458,7 @@ contract UniswapV3DirectToLiquidityOnSettleTest is UniswapV3DirectToLiquidityTes
setCallbackParameters(_PROCEEDS, _REFUND)
givenPoolHasDepositLowerPrice
givenPoolIsCreatedAndInitialized(_sqrtPriceX96)
givenMaxSlippage(51_00) // 51%
givenMaxSlippage(5100) // 51%
givenAddressHasQuoteTokenBalance(_dtlAddress, _proceeds)
givenAddressHasBaseTokenBalance(_SELLER, _baseTokensToDeposit)
givenAddressHasBaseTokenAllowance(_SELLER, _dtlAddress, _baseTokensToDeposit)
Expand All @@ -479,7 +480,7 @@ contract UniswapV3DirectToLiquidityOnSettleTest is UniswapV3DirectToLiquidityTes
setCallbackParameters(_PROCEEDS, _REFUND)
givenPoolHasDepositHigherPrice
givenPoolIsCreatedAndInitialized(_sqrtPriceX96)
givenMaxSlippage(51_00) // 51%
givenMaxSlippage(5100) // 51%
givenAddressHasQuoteTokenBalance(_dtlAddress, _proceeds)
givenAddressHasBaseTokenBalance(_SELLER, _baseTokensToDeposit)
givenAddressHasBaseTokenAllowance(_SELLER, _dtlAddress, _baseTokensToDeposit)
Expand Down
4 changes: 2 additions & 2 deletions test/modules/Auction/auction.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ contract AuctionTest is Test, Permit2User {
uint8 internal constant _QUOTE_TOKEN_DECIMALS = 18;
uint8 internal constant _BASE_TOKEN_DECIMALS = 18;

uint48 internal constant _REFERRER_FEE = 1_00;
uint48 internal constant _REFERRER_FEE = 100;

function setUp() external {
// Ensure the block timestamp is a sane value
Expand All @@ -51,7 +51,7 @@ contract AuctionTest is Test, Permit2User {

_auctionHouse.installModule(_mockAuctionModule);

_auctionHouse.setFee(_mockAuctionModuleKeycode, IFeeManager.FeeType.MaxReferrer, 10_00);
_auctionHouse.setFee(_mockAuctionModuleKeycode, IFeeManager.FeeType.MaxReferrer, 1000);

_auctionParams = IAuction.AuctionParams({
start: uint48(block.timestamp),
Expand Down
4 changes: 2 additions & 2 deletions test/modules/Auction/cancel.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ contract CancelTest is Test, Permit2User {
address internal constant _SELLER = address(0x1);
address internal constant _PROTOCOL = address(0x2);
uint48 internal constant _DURATION = 1 days;
uint48 internal constant _REFERRER_FEE = 1_00;
uint48 internal constant _REFERRER_FEE = 100;

string internal _infoHash = "";

Expand All @@ -48,7 +48,7 @@ contract CancelTest is Test, Permit2User {

_auctionHouse.installModule(_mockAuctionModule);

_auctionHouse.setFee(_mockAuctionModuleKeycode, IFeeManager.FeeType.MaxReferrer, 10_00);
_auctionHouse.setFee(_mockAuctionModuleKeycode, IFeeManager.FeeType.MaxReferrer, 1000);

_auctionParams = IAuction.AuctionParams({
start: uint48(block.timestamp),
Expand Down
15 changes: 9 additions & 6 deletions test/modules/auctions/FPS/auction.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,9 @@ contract FpsCreateAuctionTest is FpsTest {

function test_capacityInQuote() public givenCapacityInQuote {
// Calculate the expected value
uint256 expectedMaxPayoutInQuote =
Math.mulDivDown(_scaleQuoteTokenAmount(_LOT_CAPACITY), _fpaParams.maxPayoutPercent, 100e2);
uint256 expectedMaxPayoutInQuote = Math.mulDivDown(
_scaleQuoteTokenAmount(_LOT_CAPACITY), _fpaParams.maxPayoutPercent, 100e2
);
uint256 expectedMaxPayout = Math.mulDivDown(
expectedMaxPayoutInQuote, 10 ** _baseTokenDecimals, _scaleQuoteTokenAmount(_PRICE)
);
Expand All @@ -139,8 +140,9 @@ contract FpsCreateAuctionTest is FpsTest {
givenBaseTokenDecimals(13)
{
// Calculate the expected value
uint256 expectedMaxPayoutInQuote =
Math.mulDivDown(_scaleQuoteTokenAmount(_LOT_CAPACITY), _fpaParams.maxPayoutPercent, 100e2);
uint256 expectedMaxPayoutInQuote = Math.mulDivDown(
_scaleQuoteTokenAmount(_LOT_CAPACITY), _fpaParams.maxPayoutPercent, 100e2
);
uint256 expectedMaxPayout = Math.mulDivDown(
expectedMaxPayoutInQuote, 10 ** _baseTokenDecimals, _scaleQuoteTokenAmount(_PRICE)
);
Expand All @@ -167,8 +169,9 @@ contract FpsCreateAuctionTest is FpsTest {
givenBaseTokenDecimals(17)
{
// Calculate the expected value
uint256 expectedMaxPayoutInQuote =
Math.mulDivDown(_scaleQuoteTokenAmount(_LOT_CAPACITY), _fpaParams.maxPayoutPercent, 100e2);
uint256 expectedMaxPayoutInQuote = Math.mulDivDown(
_scaleQuoteTokenAmount(_LOT_CAPACITY), _fpaParams.maxPayoutPercent, 100e2
);
uint256 expectedMaxPayout = Math.mulDivDown(
expectedMaxPayoutInQuote, 10 ** _baseTokenDecimals, _scaleQuoteTokenAmount(_PRICE)
);
Expand Down

0 comments on commit 4b3aa13

Please sign in to comment.