From e9dc8d4fae9efb5d26f108a96896b9d9b49ccfd4 Mon Sep 17 00:00:00 2001 From: Oighty Date: Thu, 19 Sep 2024 14:06:48 -0500 Subject: [PATCH] chore: lint (new forge fmt) --- script/deploy/Deploy.s.sol | 36 +++++-- script/deploy/DeployBlast.s.sol | 8 +- script/deploy/WithEnvironment.s.sol | 12 ++- script/ops/Batch.s.sol | 8 +- script/ops/lib/BatchScript.sol | 16 ++- script/ops/lib/Surl.sol | 20 +++- script/salts/WithSalts.s.sol | 4 +- .../auctionHouse/AuctionHouseSalts.s.sol | 4 +- .../auctionHouse/AuctionHouseSaltsBlast.s.sol | 4 +- script/salts/test/TestSalts.s.sol | 4 +- src/AtomicCatalogue.sol | 12 ++- src/BatchAuctionHouse.sol | 8 +- src/BatchCatalogue.sol | 8 +- src/bases/AuctionHouse.sol | 24 +++-- src/bases/BaseCallback.sol | 4 +- src/bases/Catalogue.sol | 28 +++-- src/bases/FeeManager.sol | 8 +- src/blast/BlastAuctionHouse.sol | 12 ++- src/blast/modules/BlastGas.sol | 4 +- src/interfaces/IAtomicCatalogue.sol | 8 +- src/interfaces/IAuctionHouse.sol | 8 +- src/interfaces/IBatchAuctionHouse.sol | 4 +- src/interfaces/IBatchCatalogue.sol | 4 +- src/interfaces/ICatalogue.sol | 24 +++-- src/interfaces/IFeeManager.sol | 8 +- src/interfaces/modules/IAtomicAuction.sol | 8 +- src/interfaces/modules/IAuction.sol | 28 +++-- src/interfaces/modules/IBatchAuction.sol | 12 ++- src/interfaces/modules/IDerivative.sol | 12 ++- .../auctions/IEncryptedMarginalPrice.sol | 4 +- .../modules/auctions/IFixedPriceSale.sol | 4 +- src/lib/Callbacks.sol | 8 +- src/lib/ECIES.sol | 8 +- src/lib/ERC6909Metadata.sol | 20 +++- src/lib/MaxPriorityQueue.sol | 24 +++-- src/lib/SVG.sol | 44 ++++++-- src/lib/Uint2Str.sol | 4 +- src/modules/Auction.sol | 68 +++++++++--- src/modules/Derivative.sol | 8 +- src/modules/Keycode.sol | 28 +++-- src/modules/Modules.sol | 32 ++++-- src/modules/auctions/BatchAuctionModule.sol | 24 +++-- src/modules/auctions/atomic/FPS.sol | 16 ++- src/modules/auctions/atomic/GDA.sol | 16 ++- src/modules/auctions/batch/EMP.sol | 36 +++++-- src/modules/auctions/batch/FPB.sol | 28 +++-- src/modules/derivatives/LinearVesting.sol | 20 +++- src/modules/derivatives/LinearVestingCard.sol | 20 +++- test/AtomicAuctionHouse/AuctionHouseTest.sol | 84 +++++++++++---- test/AtomicAuctionHouse/cancelAuction.t.sol | 4 +- test/AtomicAuctionHouse/purchase.t.sol | 12 ++- test/AtomicAuctionHouse/setFee.t.sol | 12 ++- test/AtomicAuctionHouse/setProtocol.t.sol | 4 +- test/AuctionHouse/collectPayment.t.sol | 4 +- test/AuctionHouse/sendPayment.t.sol | 4 +- test/AuctionHouse/sendPayout.t.sol | 4 +- test/BatchAuctionHouse/AuctionHouseTest.sol | 100 +++++++++++++----- test/BatchAuctionHouse/claimBids.t.sol | 8 +- test/BatchAuctionHouse/settle.t.sol | 4 +- test/callbacks/MockCallback.sol | 43 +++++--- test/lib/BidEncoding.t.sol | 4 +- test/lib/ECIES/decrypt.t.sol | 4 +- test/lib/ECIES/encrypt.t.sol | 4 +- test/lib/ECIES/isValid.t.sol | 16 ++- test/lib/mocks/MockFeeOnTransferERC20.sol | 8 +- .../Auction/MockAtomicAuctionModule.sol | 20 +++- .../Auction/MockBatchAuctionModule.sol | 24 +++-- test/modules/Auction/auction.t.sol | 16 ++- test/modules/Auction/cancel.t.sol | 4 +- .../modules/Condenser/MockCondenserModule.sol | 4 +- test/modules/Modules/Keycode.t.sol | 4 +- test/modules/Modules/MockModule.sol | 20 +++- test/modules/Modules/MockWithModules.sol | 8 +- test/modules/auctions/EMP/EMPTest.sol | 64 ++++++++--- test/modules/auctions/EMP/cancelAuction.t.sol | 4 +- test/modules/auctions/EMP/settle.t.sol | 4 +- test/modules/auctions/FPB/FPBTest.sol | 76 +++++++++---- test/modules/auctions/FPB/bid.t.sol | 4 +- test/modules/auctions/FPB/cancelAuction.t.sol | 4 +- test/modules/auctions/FPS/FPSTest.sol | 52 ++++++--- test/modules/auctions/FPS/auction.t.sol | 12 ++- test/modules/auctions/FPS/cancelAuction.t.sol | 4 +- test/modules/auctions/GDA/GDATest.sol | 60 ++++++++--- test/modules/auctions/GDA/auction.t.sol | 17 ++- test/modules/auctions/GDA/cancelAuction.t.sol | 4 +- .../auctions/GDA/maxAmountAccepted.t.sol | 4 +- test/modules/auctions/GDA/maxPayout.t.sol | 4 +- test/modules/auctions/GDA/payoutFor.t.sol | 12 +-- test/modules/auctions/GDA/priceFor.t.sol | 13 +-- test/modules/auctions/GDA/purchase.t.sol | 12 +-- test/modules/derivatives/LinearVesting.t.sol | 24 +++-- .../LinearVestingEMPAIntegration.t.sol | 4 +- .../mocks/MockDerivativeModule.sol | 40 +++++-- 93 files changed, 1169 insertions(+), 420 deletions(-) diff --git a/script/deploy/Deploy.s.sol b/script/deploy/Deploy.s.sol index 95a355040..b520baa14 100644 --- a/script/deploy/Deploy.s.sol +++ b/script/deploy/Deploy.s.sol @@ -220,7 +220,9 @@ contract Deploy is Script, WithEnvironment, WithSalts { if (saveDeployment) _saveDeployment(chain_); } - function _saveDeployment(string memory chain_) internal { + function _saveDeployment( + string memory chain_ + ) internal { // Create the deployments folder if it doesn't exist if (!vm.isDir("./deployments")) { console2.log("Creating deployments directory"); @@ -349,7 +351,9 @@ contract Deploy is Script, WithEnvironment, WithSalts { // ========== CATALOGUE DEPLOYMENTS ========== // - function deployAtomicCatalogue(bytes memory) public virtual returns (address, string memory) { + function deployAtomicCatalogue( + bytes memory + ) public virtual returns (address, string memory) { // No args used console2.log(""); console2.log("Deploying AtomicCatalogue"); @@ -378,7 +382,9 @@ contract Deploy is Script, WithEnvironment, WithSalts { return (address(atomicCatalogue), _PREFIX_DEPLOYMENT_ROOT); } - function deployBatchCatalogue(bytes memory) public virtual returns (address, string memory) { + function deployBatchCatalogue( + bytes memory + ) public virtual returns (address, string memory) { // No args used console2.log(""); console2.log("Deploying BatchCatalogue"); @@ -442,7 +448,9 @@ contract Deploy is Script, WithEnvironment, WithSalts { return (address(amEmp), _PREFIX_AUCTION_MODULES); } - function deployFixedPriceSale(bytes memory) public virtual returns (address, string memory) { + function deployFixedPriceSale( + bytes memory + ) public virtual returns (address, string memory) { // No args used console2.log(""); console2.log("Deploying FixedPriceSale"); @@ -471,7 +479,9 @@ contract Deploy is Script, WithEnvironment, WithSalts { return (address(amFps), _PREFIX_AUCTION_MODULES); } - function deployFixedPriceBatch(bytes memory) public virtual returns (address, string memory) { + function deployFixedPriceBatch( + bytes memory + ) public virtual returns (address, string memory) { // No args used console2.log(""); console2.log("Deploying FixedPriceBatch"); @@ -566,17 +576,23 @@ contract Deploy is Script, WithEnvironment, WithSalts { // ========== HELPER FUNCTIONS ========== // - function _isAtomicAuctionHouse(string memory deploymentName) internal pure returns (bool) { + function _isAtomicAuctionHouse( + string memory deploymentName + ) internal pure returns (bool) { return keccak256(bytes(deploymentName)) == keccak256(_ATOMIC_AUCTION_HOUSE_NAME) || keccak256(bytes(deploymentName)) == keccak256(_BLAST_ATOMIC_AUCTION_HOUSE_NAME); } - function _isBatchAuctionHouse(string memory deploymentName) internal pure returns (bool) { + function _isBatchAuctionHouse( + string memory deploymentName + ) internal pure returns (bool) { return keccak256(bytes(deploymentName)) == keccak256(_BATCH_AUCTION_HOUSE_NAME) || keccak256(bytes(deploymentName)) == keccak256(_BLAST_BATCH_AUCTION_HOUSE_NAME); } - function _isAuctionHouse(string memory deploymentName) internal pure returns (bool) { + function _isAuctionHouse( + string memory deploymentName + ) internal pure returns (bool) { return _isAtomicAuctionHouse(deploymentName) || _isBatchAuctionHouse(deploymentName); } @@ -623,7 +639,9 @@ contract Deploy is Script, WithEnvironment, WithSalts { /// /// @param key_ Key to look for /// @return address Returns the address - function _getAddressNotZero(string memory key_) internal view returns (address) { + function _getAddressNotZero( + string memory key_ + ) internal view returns (address) { // Get from the deployed addresses first address deployedAddress = deployedTo[key_]; diff --git a/script/deploy/DeployBlast.s.sol b/script/deploy/DeployBlast.s.sol index a53686b41..d127173aa 100644 --- a/script/deploy/DeployBlast.s.sol +++ b/script/deploy/DeployBlast.s.sol @@ -124,7 +124,9 @@ contract DeployBlast is Deploy { return (address(amEmp), _PREFIX_AUCTION_MODULES); } - function deployFixedPriceSale(bytes memory) public override returns (address, string memory) { + function deployFixedPriceSale( + bytes memory + ) public override returns (address, string memory) { // No args used console2.log(""); console2.log("Deploying BlastFPS (Fixed Price Sale)"); @@ -152,7 +154,9 @@ contract DeployBlast is Deploy { return (address(amFps), _PREFIX_AUCTION_MODULES); } - function deployFixedPriceBatch(bytes memory) public override returns (address, string memory) { + function deployFixedPriceBatch( + bytes memory + ) public override returns (address, string memory) { // No args used console2.log(""); console2.log("Deploying BlastFPB (Fixed Price Batch)"); diff --git a/script/deploy/WithEnvironment.s.sol b/script/deploy/WithEnvironment.s.sol index 98a572b77..4dd0fc8cc 100644 --- a/script/deploy/WithEnvironment.s.sol +++ b/script/deploy/WithEnvironment.s.sol @@ -11,7 +11,9 @@ abstract contract WithEnvironment is Script { string public chain; string public env; - function _loadEnv(string calldata chain_) internal { + function _loadEnv( + string calldata chain_ + ) internal { chain = chain_; console2.log("Using chain:", chain_); @@ -24,7 +26,9 @@ abstract contract WithEnvironment is Script { /// /// @param key_ The key to look up in the environment file /// @return address The address from the environment file, or the zero address - function _envAddress(string memory key_) internal view returns (address) { + function _envAddress( + string memory key_ + ) internal view returns (address) { console2.log(" Checking in env.json"); string memory fullKey = string.concat(".current.", chain, ".", key_); address addr; @@ -47,7 +51,9 @@ abstract contract WithEnvironment is Script { /// /// @param key_ The key to look up in the environment file /// @return address The address from the environment file - function _envAddressNotZero(string memory key_) internal view returns (address) { + function _envAddressNotZero( + string memory key_ + ) internal view returns (address) { address addr = _envAddress(key_); require( addr != address(0), string.concat("WithEnvironment: key '", key_, "' has zero address") diff --git a/script/ops/Batch.s.sol b/script/ops/Batch.s.sol index 2b8f0a7d8..c1c9654ca 100644 --- a/script/ops/Batch.s.sol +++ b/script/ops/Batch.s.sol @@ -11,7 +11,9 @@ abstract contract Batch is BatchScript { string internal chain; address safe; - modifier isBatch(bool send_) { + modifier isBatch( + bool send_ + ) { // Load environment addresses for chain chain = vm.envString("CHAIN"); env = vm.readFile("./script/env.json"); @@ -26,7 +28,9 @@ abstract contract Batch is BatchScript { executeBatch(safe, send_); } - function envAddress(string memory key) internal view returns (address) { + function envAddress( + string memory key + ) internal view returns (address) { return env.readAddress(string.concat(".", chain, ".", key)); } } diff --git a/script/ops/lib/BatchScript.sol b/script/ops/lib/BatchScript.sol index f91215683..fbf656210 100644 --- a/script/ops/lib/BatchScript.sol +++ b/script/ops/lib/BatchScript.sol @@ -155,7 +155,9 @@ abstract contract BatchScript is Script, DelegatePrank { } // Encodes the stored encoded transactions into a single Multisend transaction - function _createBatch(address safe_) internal returns (Batch memory batch) { + function _createBatch( + address safe_ + ) internal returns (Batch memory batch) { // Set initial batch fields batch.to = SAFE_MULTISEND_ADDRESS; batch.value = 0; @@ -359,7 +361,9 @@ abstract contract BatchScript is Script, DelegatePrank { return payload; } - function _stripSlashQuotes(string memory str_) internal returns (string memory) { + function _stripSlashQuotes( + string memory str_ + ) internal returns (string memory) { // solhint-disable quotes // Remove slash quotes from string string memory command = string.concat( @@ -386,7 +390,9 @@ abstract contract BatchScript is Script, DelegatePrank { return string(res); } - function _getNonce(address safe_) internal returns (uint256) { + function _getNonce( + address safe_ + ) internal returns (uint256) { string memory endpoint = string.concat(SAFE_API_BASE_URL, vm.toString(safe_), "/"); (uint256 status, bytes memory data) = endpoint.get(); if (status == 200) { @@ -397,7 +403,9 @@ abstract contract BatchScript is Script, DelegatePrank { } } - function _getSafeAPIEndpoint(address safe_) internal view returns (string memory) { + function _getSafeAPIEndpoint( + address safe_ + ) internal view returns (string memory) { return string.concat(SAFE_API_BASE_URL, vm.toString(safe_), SAFE_API_MULTISIG_SEND); } diff --git a/script/ops/lib/Surl.sol b/script/ops/lib/Surl.sol index 4459e8e44..8cc58c5c6 100644 --- a/script/ops/lib/Surl.sol +++ b/script/ops/lib/Surl.sol @@ -6,7 +6,9 @@ import {Vm} from "@forge-std-1.9.1/Vm.sol"; library Surl { Vm constant vm = Vm(address(bytes20(uint160(uint256(keccak256("hevm cheat code")))))); - function get(string memory self) internal returns (uint256 status, bytes memory data) { + function get( + string memory self + ) internal returns (uint256 status, bytes memory data) { string[] memory empty = new string[](0); return get(self, empty); } @@ -18,7 +20,9 @@ library Surl { return curl(self, headers, "", "GET"); } - function del(string memory self) internal returns (uint256 status, bytes memory data) { + function del( + string memory self + ) internal returns (uint256 status, bytes memory data) { string[] memory empty = new string[](0); return curl(self, empty, "", "DELETE"); } @@ -39,7 +43,9 @@ library Surl { return curl(self, headers, body, "DELETE"); } - function patch(string memory self) internal returns (uint256 status, bytes memory data) { + function patch( + string memory self + ) internal returns (uint256 status, bytes memory data) { string[] memory empty = new string[](0); return curl(self, empty, "", "PATCH"); } @@ -60,7 +66,9 @@ library Surl { return curl(self, headers, body, "PATCH"); } - function post(string memory self) internal returns (uint256 status, bytes memory data) { + function post( + string memory self + ) internal returns (uint256 status, bytes memory data) { string[] memory empty = new string[](0); return curl(self, empty, "", "POST"); } @@ -81,7 +89,9 @@ library Surl { return curl(self, headers, body, "POST"); } - function put(string memory self) internal returns (uint256 status, bytes memory data) { + function put( + string memory self + ) internal returns (uint256 status, bytes memory data) { string[] memory empty = new string[](0); return curl(self, empty, "", "PUT"); } diff --git a/script/salts/WithSalts.s.sol b/script/salts/WithSalts.s.sol index f03c0b2af..2f5035f2b 100644 --- a/script/salts/WithSalts.s.sol +++ b/script/salts/WithSalts.s.sol @@ -16,7 +16,9 @@ contract WithSalts is Script { return string.concat("./", _BYTECODE_DIR); } - function _getBytecodePath(string memory name_) internal pure returns (string memory) { + function _getBytecodePath( + string memory name_ + ) internal pure returns (string memory) { return string.concat(_getBytecodeDirectory(), "/", name_, ".bin"); } diff --git a/script/salts/auctionHouse/AuctionHouseSalts.s.sol b/script/salts/auctionHouse/AuctionHouseSalts.s.sol index 03fe81eb7..446debc56 100644 --- a/script/salts/auctionHouse/AuctionHouseSalts.s.sol +++ b/script/salts/auctionHouse/AuctionHouseSalts.s.sol @@ -14,7 +14,9 @@ contract AuctionHouseSalts is Script, WithEnvironment, WithSalts { address internal _envPermit2; address internal _envProtocol; - function _setUp(string calldata chain_) internal { + function _setUp( + string calldata chain_ + ) internal { _loadEnv(chain_); _createBytecodeDirectory(); diff --git a/script/salts/auctionHouse/AuctionHouseSaltsBlast.s.sol b/script/salts/auctionHouse/AuctionHouseSaltsBlast.s.sol index 6c4135b43..252defd69 100644 --- a/script/salts/auctionHouse/AuctionHouseSaltsBlast.s.sol +++ b/script/salts/auctionHouse/AuctionHouseSaltsBlast.s.sol @@ -17,7 +17,9 @@ contract AuctionHouseSaltsBlast is Script, WithEnvironment, WithSalts { address internal _envWeth; address internal _envUsdb; - function _setUp(string calldata chain_) internal { + function _setUp( + string calldata chain_ + ) internal { _loadEnv(chain_); // Cache required variables diff --git a/script/salts/test/TestSalts.s.sol b/script/salts/test/TestSalts.s.sol index c12717c3b..533296aac 100644 --- a/script/salts/test/TestSalts.s.sol +++ b/script/salts/test/TestSalts.s.sol @@ -15,7 +15,9 @@ import {TestConstants} from "../../../test/Constants.sol"; contract TestSalts is Script, WithEnvironment, Permit2User, WithSalts, TestConstants { string internal constant _MOCK_CALLBACK = "MockCallback"; - function _setUp(string calldata chain_) internal { + function _setUp( + string calldata chain_ + ) internal { _loadEnv(chain_); _createBytecodeDirectory(); } diff --git a/src/AtomicCatalogue.sol b/src/AtomicCatalogue.sol index f04dfbb38..d28e54fe9 100644 --- a/src/AtomicCatalogue.sol +++ b/src/AtomicCatalogue.sol @@ -14,7 +14,9 @@ import {Catalogue} from "./bases/Catalogue.sol"; contract AtomicCatalogue is IAtomicCatalogue, Catalogue { // ========== CONSTRUCTOR ========== // - constructor(address auctionHouse_) Catalogue(auctionHouse_) {} + constructor( + address auctionHouse_ + ) Catalogue(auctionHouse_) {} // ========== ATOMIC AUCTION ========== // @@ -49,7 +51,9 @@ contract AtomicCatalogue is IAtomicCatalogue, Catalogue { } /// @inheritdoc IAtomicCatalogue - function maxPayout(uint96 lotId_) external view returns (uint256) { + function maxPayout( + uint96 lotId_ + ) external view returns (uint256) { IAtomicAuction module = IAtomicAuction(address(IAuctionHouse(auctionHouse).getAuctionModuleForId(lotId_))); @@ -60,7 +64,9 @@ contract AtomicCatalogue is IAtomicCatalogue, Catalogue { } /// @inheritdoc IAtomicCatalogue - function maxAmountAccepted(uint96 lotId_) external view returns (uint256) { + function maxAmountAccepted( + uint96 lotId_ + ) external view returns (uint256) { IAtomicAuction module = IAtomicAuction(address(IAuctionHouse(auctionHouse).getAuctionModuleForId(lotId_))); diff --git a/src/BatchAuctionHouse.sol b/src/BatchAuctionHouse.sol index fc2b4f823..4386d4c83 100644 --- a/src/BatchAuctionHouse.sol +++ b/src/BatchAuctionHouse.sol @@ -476,7 +476,9 @@ contract BatchAuctionHouse is IBatchAuctionHouse, AuctionHouse { /// Note that this function will not revert if the `onCancel` callback reverts. /// /// @param lotId_ The lot ID to abort - function abort(uint96 lotId_) external override nonReentrant { + function abort( + uint96 lotId_ + ) external override nonReentrant { // Validation _isLotValid(lotId_); @@ -525,7 +527,9 @@ contract BatchAuctionHouse is IBatchAuctionHouse, AuctionHouse { // ========== INTERNAL FUNCTIONS ========== // - function getBatchModuleForId(uint96 lotId_) public view returns (BatchAuctionModule) { + function getBatchModuleForId( + uint96 lotId_ + ) public view returns (BatchAuctionModule) { return BatchAuctionModule(address(_getAuctionModuleForId(lotId_))); } } diff --git a/src/BatchCatalogue.sol b/src/BatchCatalogue.sol index b188ed920..0dddc0f76 100644 --- a/src/BatchCatalogue.sol +++ b/src/BatchCatalogue.sol @@ -13,12 +13,16 @@ import {Catalogue} from "./bases/Catalogue.sol"; contract BatchCatalogue is IBatchCatalogue, Catalogue { // ========== CONSTRUCTOR ========== // - constructor(address auctionHouse_) Catalogue(auctionHouse_) {} + constructor( + address auctionHouse_ + ) Catalogue(auctionHouse_) {} // ========== RETRIEVING BIDS ========== // /// @inheritdoc IBatchCatalogue - function getNumBids(uint96 lotId_) external view returns (uint256) { + function getNumBids( + uint96 lotId_ + ) external view returns (uint256) { IBatchAuction module = IBatchAuction(address(IAuctionHouse(auctionHouse).getAuctionModuleForId(lotId_))); diff --git a/src/bases/AuctionHouse.sol b/src/bases/AuctionHouse.sol index 6831c89c2..1ab5009ed 100644 --- a/src/bases/AuctionHouse.sol +++ b/src/bases/AuctionHouse.sol @@ -288,7 +288,9 @@ abstract contract AuctionHouse is IAuctionHouse, WithModules, ReentrancyGuard, F /// @dev The function reverts if: /// - The lot ID is invalid /// - The module for the auction type is not installed - function getAuctionModuleForId(uint96 lotId_) external view override returns (IAuction) { + function getAuctionModuleForId( + uint96 lotId_ + ) external view override returns (IAuction) { _isLotValid(lotId_); return _getAuctionModuleForId(lotId_); @@ -298,7 +300,9 @@ abstract contract AuctionHouse is IAuctionHouse, WithModules, ReentrancyGuard, F /// @dev The function reverts if: /// - The lot ID is invalid /// - The module for the derivative type is not installed - function getDerivativeModuleForId(uint96 lotId_) external view override returns (IDerivative) { + function getDerivativeModuleForId( + uint96 lotId_ + ) external view override returns (IDerivative) { _isLotValid(lotId_); return _getDerivativeModuleForId(lotId_); @@ -312,7 +316,9 @@ abstract contract AuctionHouse is IAuctionHouse, WithModules, ReentrancyGuard, F /// /// @param lotId_ ID of the auction lot /// @return AuctionModule - function _getAuctionModuleForId(uint96 lotId_) internal view returns (AuctionModule) { + function _getAuctionModuleForId( + uint96 lotId_ + ) internal view returns (AuctionModule) { // Load module, will revert if not installed return AuctionModule(_getModuleIfInstalled(lotRouting[lotId_].auctionReference)); } @@ -323,7 +329,9 @@ abstract contract AuctionHouse is IAuctionHouse, WithModules, ReentrancyGuard, F /// /// @param lotId_ ID of the auction lot /// @return DerivativeModule - function _getDerivativeModuleForId(uint96 lotId_) internal view returns (DerivativeModule) { + function _getDerivativeModuleForId( + uint96 lotId_ + ) internal view returns (DerivativeModule) { // Load module, will revert if not installed. Also reverts if no derivative is specified. return DerivativeModule(_getModuleIfInstalled(lotRouting[lotId_].derivativeReference)); } @@ -361,7 +369,9 @@ abstract contract AuctionHouse is IAuctionHouse, WithModules, ReentrancyGuard, F /// @dev Reverts if the lot ID is invalid /// /// @param lotId_ ID of the auction lot - function _isLotValid(uint96 lotId_) internal view { + function _isLotValid( + uint96 lotId_ + ) internal view { if (lotId_ >= lotCounter) revert InvalidLotId(lotId_); } @@ -455,7 +465,9 @@ abstract contract AuctionHouse is IAuctionHouse, WithModules, ReentrancyGuard, F /// @inheritdoc IFeeManager /// @dev Implemented in this contract as it required access to the `onlyOwner` modifier - function setProtocol(address protocol_) external override onlyOwner { + function setProtocol( + address protocol_ + ) external override onlyOwner { _protocol = protocol_; } diff --git a/src/bases/BaseCallback.sol b/src/bases/BaseCallback.sol index d885718ee..486f0530c 100644 --- a/src/bases/BaseCallback.sol +++ b/src/bases/BaseCallback.sol @@ -42,7 +42,9 @@ abstract contract BaseCallback is ICallback { _; } - modifier onlyRegisteredLot(uint96 lotId_) { + modifier onlyRegisteredLot( + uint96 lotId_ + ) { if (!lotIdRegistered[lotId_]) revert Callback_NotAuthorized(); _; } diff --git a/src/bases/Catalogue.sol b/src/bases/Catalogue.sol index b5e325381..ad45e8a60 100644 --- a/src/bases/Catalogue.sol +++ b/src/bases/Catalogue.sol @@ -24,14 +24,18 @@ abstract contract Catalogue is ICatalogue { // ========== CONSTRUCTOR ========== // - constructor(address auctionHouse_) { + constructor( + address auctionHouse_ + ) { auctionHouse = auctionHouse_; } // ========== AUCTION INFORMATION ========== // /// @inheritdoc ICatalogue - function getRouting(uint96 lotId_) public view returns (IAuctionHouse.Routing memory) { + function getRouting( + uint96 lotId_ + ) public view returns (IAuctionHouse.Routing memory) { ( address seller, address baseToken, @@ -58,7 +62,9 @@ abstract contract Catalogue is ICatalogue { } /// @inheritdoc ICatalogue - function getFeeData(uint96 lotId_) public view returns (IAuctionHouse.FeeData memory) { + function getFeeData( + uint96 lotId_ + ) public view returns (IAuctionHouse.FeeData memory) { ( address curator, bool curated, @@ -77,7 +83,9 @@ abstract contract Catalogue is ICatalogue { } /// @inheritdoc ICatalogue - function isLive(uint96 lotId_) public view returns (bool) { + function isLive( + uint96 lotId_ + ) public view returns (bool) { IAuction module = IAuctionHouse(auctionHouse).getAuctionModuleForId(lotId_); // Get isLive from module @@ -85,7 +93,9 @@ abstract contract Catalogue is ICatalogue { } /// @inheritdoc ICatalogue - function isUpcoming(uint96 lotId_) public view returns (bool) { + function isUpcoming( + uint96 lotId_ + ) public view returns (bool) { IAuction module = IAuctionHouse(auctionHouse).getAuctionModuleForId(lotId_); // Get isUpcoming from module @@ -93,7 +103,9 @@ abstract contract Catalogue is ICatalogue { } /// @inheritdoc ICatalogue - function hasEnded(uint96 lotId_) external view returns (bool) { + function hasEnded( + uint96 lotId_ + ) external view returns (bool) { IAuction module = IAuctionHouse(auctionHouse).getAuctionModuleForId(lotId_); // Get hasEnded from module @@ -101,7 +113,9 @@ abstract contract Catalogue is ICatalogue { } /// @inheritdoc ICatalogue - function remainingCapacity(uint96 lotId_) external view returns (uint256) { + function remainingCapacity( + uint96 lotId_ + ) external view returns (uint256) { IAuction module = IAuctionHouse(auctionHouse).getAuctionModuleForId(lotId_); // Get remaining capacity from module diff --git a/src/bases/FeeManager.sol b/src/bases/FeeManager.sol index 3153a468d..928189502 100644 --- a/src/bases/FeeManager.sol +++ b/src/bases/FeeManager.sol @@ -34,7 +34,9 @@ abstract contract FeeManager is IFeeManager, ReentrancyGuard { // ========== CONSTRUCTOR ========== // - constructor(address protocol_) { + constructor( + address protocol_ + ) { _protocol = protocol_; } @@ -111,7 +113,9 @@ abstract contract FeeManager is IFeeManager, ReentrancyGuard { /// @inheritdoc IFeeManager /// @dev This function reverts if: /// - re-entrancy is detected - function claimRewards(address token_) external nonReentrant { + function claimRewards( + address token_ + ) external nonReentrant { ERC20 token = ERC20(token_); uint256 amount = rewards[msg.sender][token]; rewards[msg.sender][token] = 0; diff --git a/src/blast/BlastAuctionHouse.sol b/src/blast/BlastAuctionHouse.sol index bc9a5c841..14e81c82a 100644 --- a/src/blast/BlastAuctionHouse.sol +++ b/src/blast/BlastAuctionHouse.sol @@ -21,12 +21,16 @@ interface IBlast { interface IERC20Rebasing { // changes the yield mode of the caller and update the balance // to reflect the configuration - function configure(YieldMode) external returns (uint256); + function configure( + YieldMode + ) external returns (uint256); // "claimable" yield mode accounts can call this this claim their yield // to another address function claim(address recipient, uint256 amount) external returns (uint256); // read the claimable amount for an account - function getClaimableAmount(address account) external view returns (uint256); + function getClaimableAmount( + address account + ) external view returns (uint256); } abstract contract BlastAuctionHouse is AuctionHouse { @@ -68,7 +72,9 @@ abstract contract BlastAuctionHouse is AuctionHouse { _BLAST.claimMaxGas(address(this), _protocol); } - function claimModuleGas(Veecode reference_) external { + function claimModuleGas( + Veecode reference_ + ) external { // Claim the gas consumed by the module, send to protocol _BLAST.claimMaxGas(address(_getModuleIfInstalled(reference_)), _protocol); } diff --git a/src/blast/modules/BlastGas.sol b/src/blast/modules/BlastGas.sol index abd235930..7c1fddc8d 100644 --- a/src/blast/modules/BlastGas.sol +++ b/src/blast/modules/BlastGas.sol @@ -4,7 +4,9 @@ pragma solidity 0.8.19; interface IBlast { function configureClaimableGas() external; - function configureGovernor(address governor_) external; + function configureGovernor( + address governor_ + ) external; } abstract contract BlastGas { diff --git a/src/interfaces/IAtomicCatalogue.sol b/src/interfaces/IAtomicCatalogue.sol index ccc32811c..d405ac139 100644 --- a/src/interfaces/IAtomicCatalogue.sol +++ b/src/interfaces/IAtomicCatalogue.sol @@ -24,11 +24,15 @@ interface IAtomicCatalogue is ICatalogue { /// /// @param lotId_ ID of the auction lot /// @return payout The maximum amount of baseToken (in native decimals) that can be received by the buyer - function maxPayout(uint96 lotId_) external view returns (uint256 payout); + function maxPayout( + uint96 lotId_ + ) external view returns (uint256 payout); /// @notice Returns the max amount accepted for a given lot /// /// @param lotId_ ID of the auction lot /// @return maxAmount The maximum amount of quoteToken (in native decimals) that can be accepted by the auction - function maxAmountAccepted(uint96 lotId_) external view returns (uint256 maxAmount); + function maxAmountAccepted( + uint96 lotId_ + ) external view returns (uint256 maxAmount); } diff --git a/src/interfaces/IAuctionHouse.sol b/src/interfaces/IAuctionHouse.sol index e0c1eed17..458cbda88 100644 --- a/src/interfaces/IAuctionHouse.sol +++ b/src/interfaces/IAuctionHouse.sol @@ -200,12 +200,16 @@ interface IAuctionHouse { /// /// @param lotId_ ID of the auction lot /// @return module The auction module - function getAuctionModuleForId(uint96 lotId_) external view returns (IAuction module); + function getAuctionModuleForId( + uint96 lotId_ + ) external view returns (IAuction module); /// @notice Gets the derivative module for a given lot ID /// @dev Will revert if the lot does not have a derivative module /// /// @param lotId_ ID of the auction lot /// @return module The derivative module - function getDerivativeModuleForId(uint96 lotId_) external view returns (IDerivative module); + function getDerivativeModuleForId( + uint96 lotId_ + ) external view returns (IDerivative module); } diff --git a/src/interfaces/IBatchAuctionHouse.sol b/src/interfaces/IBatchAuctionHouse.sol index 338d5b8d0..f831473e1 100644 --- a/src/interfaces/IBatchAuctionHouse.sol +++ b/src/interfaces/IBatchAuctionHouse.sol @@ -97,5 +97,7 @@ interface IBatchAuctionHouse is IAuctionHouse { /// 3. Refund the seller /// /// @param lotId_ The lot id - function abort(uint96 lotId_) external; + function abort( + uint96 lotId_ + ) external; } diff --git a/src/interfaces/IBatchCatalogue.sol b/src/interfaces/IBatchCatalogue.sol index 95a2f1320..e9dc6ad01 100644 --- a/src/interfaces/IBatchCatalogue.sol +++ b/src/interfaces/IBatchCatalogue.sol @@ -11,7 +11,9 @@ interface IBatchCatalogue is ICatalogue { /// /// @param lotId_ The lot ID /// @return numBids The number of bids - function getNumBids(uint96 lotId_) external view returns (uint256 numBids); + function getNumBids( + uint96 lotId_ + ) external view returns (uint256 numBids); /// @notice Get the bid IDs from the given index /// diff --git a/src/interfaces/ICatalogue.sol b/src/interfaces/ICatalogue.sol index 6b6371a2e..e8649f504 100644 --- a/src/interfaces/ICatalogue.sol +++ b/src/interfaces/ICatalogue.sol @@ -24,27 +24,39 @@ interface ICatalogue { /// - The lot ID is invalid /// /// @param lotId_ ID of the auction lot - function getRouting(uint96 lotId_) external view returns (IAuctionHouse.Routing memory); + function getRouting( + uint96 lotId_ + ) external view returns (IAuctionHouse.Routing memory); /// @notice Gets the fee data for a given lot ID /// @dev The function reverts if: /// - The lot ID is invalid /// /// @param lotId_ ID of the auction lot - function getFeeData(uint96 lotId_) external view returns (IAuctionHouse.FeeData memory); + function getFeeData( + uint96 lotId_ + ) external view returns (IAuctionHouse.FeeData memory); /// @notice Is the auction currently accepting bids or purchases? /// @dev Auctions that have been created, but not yet started will return false - function isLive(uint96 lotId_) external view returns (bool); + function isLive( + uint96 lotId_ + ) external view returns (bool); /// @notice Is the auction upcoming? (i.e. has not started yet) - function isUpcoming(uint96 lotId_) external view returns (bool); + function isUpcoming( + uint96 lotId_ + ) external view returns (bool); /// @notice Has the auction ended? (i.e. reached its conclusion and no more bids/purchases can be made) - function hasEnded(uint96 lotId_) external view returns (bool); + function hasEnded( + uint96 lotId_ + ) external view returns (bool); /// @notice Capacity remaining for the auction. May be in quote or base tokens, depending on what is allowed for the auction type - function remainingCapacity(uint96 lotId_) external view returns (uint256); + function remainingCapacity( + uint96 lotId_ + ) external view returns (uint256); // ========== RETRIEVING AUCTIONS ========== // diff --git a/src/interfaces/IFeeManager.sol b/src/interfaces/IFeeManager.sol index 802cd46ae..c67215e2c 100644 --- a/src/interfaces/IFeeManager.sol +++ b/src/interfaces/IFeeManager.sol @@ -87,7 +87,9 @@ interface IFeeManager { /// @notice Claims the rewards for a specific token and the sender /// /// @param token_ Token to claim rewards for - function claimRewards(address token_) external; + function claimRewards( + address token_ + ) external; /// @notice Gets the rewards for a specific recipient and token /// @@ -113,7 +115,9 @@ interface IFeeManager { /// @dev Access controlled: only owner /// /// @param protocol_ Address of the protocol - function setProtocol(address protocol_) external; + function setProtocol( + address protocol_ + ) external; /// @notice Gets the protocol address function getProtocol() external view returns (address); diff --git a/src/interfaces/modules/IAtomicAuction.sol b/src/interfaces/modules/IAtomicAuction.sol index 7a0f59b96..dd768ea3d 100644 --- a/src/interfaces/modules/IAtomicAuction.sol +++ b/src/interfaces/modules/IAtomicAuction.sol @@ -47,11 +47,15 @@ interface IAtomicAuction is IAuction { /// /// @param lotId_ ID of the auction lot /// @return payout The maximum amount of baseToken (in native decimals) that can be received by the buyer - function maxPayout(uint96 lotId_) external view returns (uint256 payout); + function maxPayout( + uint96 lotId_ + ) external view returns (uint256 payout); /// @notice Returns the max amount accepted for a given lot /// /// @param lotId_ ID of the auction lot /// @return maxAmount The maximum amount of quoteToken (in native decimals) that can be accepted by the auction - function maxAmountAccepted(uint96 lotId_) external view returns (uint256 maxAmount); + function maxAmountAccepted( + uint96 lotId_ + ) external view returns (uint256 maxAmount); } diff --git a/src/interfaces/modules/IAuction.sol b/src/interfaces/modules/IAuction.sol index 304ae6df9..9a25f99f1 100644 --- a/src/interfaces/modules/IAuction.sol +++ b/src/interfaces/modules/IAuction.sol @@ -120,7 +120,9 @@ interface IAuction { /// - Update the lot data /// /// @param lotId_ The lot id - function cancelAuction(uint96 lotId_) external; + function cancelAuction( + uint96 lotId_ + ) external; // ========== AUCTION INFORMATION ========== // @@ -131,7 +133,9 @@ interface IAuction { /// /// @param lotId_ The lot id /// @return bool Whether or not the lot is active - function isLive(uint96 lotId_) external view returns (bool); + function isLive( + uint96 lotId_ + ) external view returns (bool); /// @notice Returns whether the auction is upcoming /// @dev The implementing function should handle the following: @@ -140,7 +144,9 @@ interface IAuction { /// /// @param lotId_ The lot id /// @return bool Whether or not the lot is upcoming - function isUpcoming(uint96 lotId_) external view returns (bool); + function isUpcoming( + uint96 lotId_ + ) external view returns (bool); /// @notice Returns whether the auction has ended /// @dev The implementing function should handle the following: @@ -149,7 +155,9 @@ interface IAuction { /// /// @param lotId_ The lot id /// @return bool Whether or not the lot is active - function hasEnded(uint96 lotId_) external view returns (bool); + function hasEnded( + uint96 lotId_ + ) external view returns (bool); /// @notice Get the remaining capacity of a lot /// @dev The implementing function should handle the following: @@ -157,7 +165,9 @@ interface IAuction { /// /// @param lotId_ The lot id /// @return uint96 The remaining capacity of the lot - function remainingCapacity(uint96 lotId_) external view returns (uint256); + function remainingCapacity( + uint96 lotId_ + ) external view returns (uint256); /// @notice Get whether or not the capacity is in quote tokens /// @dev The implementing function should handle the following: @@ -166,12 +176,16 @@ interface IAuction { /// /// @param lotId_ The lot id /// @return bool Whether or not the capacity is in quote tokens - function capacityInQuote(uint96 lotId_) external view returns (bool); + function capacityInQuote( + uint96 lotId_ + ) external view returns (bool); /// @notice Get the lot data for a given lot ID /// /// @param lotId_ The lot ID - function getLot(uint96 lotId_) external view returns (Lot memory); + function getLot( + uint96 lotId_ + ) external view returns (Lot memory); /// @notice Get the auction type function auctionType() external view returns (AuctionType); diff --git a/src/interfaces/modules/IBatchAuction.sol b/src/interfaces/modules/IBatchAuction.sol index d566f06b7..33ba8d8f0 100644 --- a/src/interfaces/modules/IBatchAuction.sol +++ b/src/interfaces/modules/IBatchAuction.sol @@ -42,7 +42,9 @@ interface IBatchAuction is IAuction { /// @dev Stored during settlement /// /// @param lotId The lot ID - function lotAuctionOutput(uint96 lotId) external view returns (bytes memory); + function lotAuctionOutput( + uint96 lotId + ) external view returns (bytes memory); // ========== BATCH OPERATIONS ========== // @@ -129,7 +131,9 @@ interface IBatchAuction is IAuction { /// - Set the auction in a state that allows bidders to claim refunds /// /// @param lotId_ The lot id - function abort(uint96 lotId_) external; + function abort( + uint96 lotId_ + ) external; // ========== VIEW FUNCTIONS ========== // @@ -137,7 +141,9 @@ interface IBatchAuction is IAuction { /// /// @param lotId_ The lot ID /// @return numBids The number of bids - function getNumBids(uint96 lotId_) external view returns (uint256 numBids); + function getNumBids( + uint96 lotId_ + ) external view returns (uint256 numBids); /// @notice Get the bid IDs from the given index /// diff --git a/src/interfaces/modules/IDerivative.sol b/src/interfaces/modules/IDerivative.sol index 32f880a01..e40066c4b 100644 --- a/src/interfaces/modules/IDerivative.sol +++ b/src/interfaces/modules/IDerivative.sol @@ -103,7 +103,9 @@ interface IDerivative { /// @notice Redeem all available derivative tokens for underlying collateral /// /// @param tokenId_ The ID of the derivative token to redeem - function redeemMax(uint256 tokenId_) external; + function redeemMax( + uint256 tokenId_ + ) external; /// @notice Redeem derivative tokens for underlying collateral /// @@ -137,7 +139,9 @@ interface IDerivative { /// @notice Access controlled: only callable by the derivative issuer via the auction house. /// /// @param tokenId_ The ID of the derivative token to reclaim - function reclaim(uint256 tokenId_) external; + function reclaim( + uint256 tokenId_ + ) external; /// @notice Transforms an existing derivative issued by this contract into something else. Derivative is burned and collateral sent to the auction house. /// @notice Access controlled: only callable by the auction house. @@ -187,5 +191,7 @@ interface IDerivative { /// /// @param tokenId The ID of the derivative token /// @return tokenData The metadata for the derivative token - function getTokenMetadata(uint256 tokenId) external view returns (Token memory tokenData); + function getTokenMetadata( + uint256 tokenId + ) external view returns (Token memory tokenData); } diff --git a/src/interfaces/modules/auctions/IEncryptedMarginalPrice.sol b/src/interfaces/modules/auctions/IEncryptedMarginalPrice.sol index 35b5c0483..1ada69212 100644 --- a/src/interfaces/modules/auctions/IEncryptedMarginalPrice.sol +++ b/src/interfaces/modules/auctions/IEncryptedMarginalPrice.sol @@ -177,7 +177,9 @@ interface IEncryptedMarginalPrice { /// /// @param lotId_ The lot ID /// @return numBids The number of decrypted bids remaining in the queue - function getNumBidsInQueue(uint96 lotId_) external view returns (uint256 numBids); + function getNumBidsInQueue( + uint96 lotId_ + ) external view returns (uint256 numBids); // ========== AUCTION INFORMATION ========== // diff --git a/src/interfaces/modules/auctions/IFixedPriceSale.sol b/src/interfaces/modules/auctions/IFixedPriceSale.sol index 1679cf0e1..845b84d67 100644 --- a/src/interfaces/modules/auctions/IFixedPriceSale.sol +++ b/src/interfaces/modules/auctions/IFixedPriceSale.sol @@ -43,5 +43,7 @@ interface IFixedPriceSale { /// @param lotId The lot ID /// @return price The fixed price of the lot /// @return maxPayout The maximum payout per purchase, in terms of the base token - function auctionData(uint96 lotId) external view returns (uint256 price, uint256 maxPayout); + function auctionData( + uint96 lotId + ) external view returns (uint256 price, uint256 maxPayout); } diff --git a/src/lib/Callbacks.sol b/src/lib/Callbacks.sol index f091c40c3..446fda4fd 100644 --- a/src/lib/Callbacks.sol +++ b/src/lib/Callbacks.sol @@ -69,7 +69,9 @@ library Callbacks { /// @notice Ensures that the callbacks contract includes at least one of the required flags and more if sending/receiving tokens /// @param callbacks The callbacks contract to verify - function isValidCallbacksAddress(ICallback callbacks) internal pure returns (bool) { + function isValidCallbacksAddress( + ICallback callbacks + ) internal pure returns (bool) { // Ensure that if the contract is expected to send base tokens, then it implements atleast onCreate and onCurate OR onPurchase (atomic auctions may not be prefunded). if ( callbacks.hasPermission(SEND_BASE_TOKENS_FLAG) @@ -227,7 +229,9 @@ library Callbacks { } /// @notice bubble up revert if present. Else throw FailedCallback error - function _revert(bytes memory result) private pure { + function _revert( + bytes memory result + ) private pure { if (result.length > 0) { assembly { revert(add(0x20, result), mload(result)) diff --git a/src/lib/ECIES.sol b/src/lib/ECIES.sol index 8d239add8..2ae90d829 100644 --- a/src/lib/ECIES.sol +++ b/src/lib/ECIES.sol @@ -131,7 +131,9 @@ library ECIES { /// @notice Checks whether a point is on the alt_bn128 curve. /// @param p - The point to check (consists of x and y coordinates). - function isOnBn128(Point memory p) internal pure returns (bool) { + function isOnBn128( + Point memory p + ) internal pure returns (bool) { // check if the provided point is on the bn128 curve y**2 = x**3 + 3, which has generator point (1, 2) return _fieldmul(p.y, p.y) == _fieldadd(_fieldmul(p.x, _fieldmul(p.x, p.x)), 3); } @@ -143,7 +145,9 @@ library ECIES { /// 3. Not the point at infinity (0, 0) /// 4. The x coordinate is less than the field modulus /// 5. The y coordinate is less than the field modulus - function isValid(Point memory p) internal pure returns (bool) { + function isValid( + Point memory p + ) internal pure returns (bool) { return isOnBn128(p) && !(p.x == 1 && p.y == 2) && !(p.x == 0 && p.y == 0) && (p.x < FIELD_MODULUS) && (p.y < FIELD_MODULUS); } diff --git a/src/lib/ERC6909Metadata.sol b/src/lib/ERC6909Metadata.sol index 3d83cd01c..35a92fe1b 100644 --- a/src/lib/ERC6909Metadata.sol +++ b/src/lib/ERC6909Metadata.sol @@ -6,29 +6,39 @@ abstract contract ERC6909Metadata { /// /// @param tokenId_ The ID of the token /// @return string The name of the token - function name(uint256 tokenId_) public view virtual returns (string memory); + function name( + uint256 tokenId_ + ) public view virtual returns (string memory); /// @notice Returns the symbol of the token /// /// @param tokenId_ The ID of the token /// @return string The symbol of the token - function symbol(uint256 tokenId_) public view virtual returns (string memory); + function symbol( + uint256 tokenId_ + ) public view virtual returns (string memory); /// @notice Returns the number of decimals used by the token /// /// @param tokenId_ The ID of the token /// @return uint8 The number of decimals used by the token - function decimals(uint256 tokenId_) public view virtual returns (uint8); + function decimals( + uint256 tokenId_ + ) public view virtual returns (uint8); /// @notice Returns the URI of the token /// /// @param tokenId_ The ID of the token /// @return string The URI of the token - function tokenURI(uint256 tokenId_) public view virtual returns (string memory); + function tokenURI( + uint256 tokenId_ + ) public view virtual returns (string memory); /// @notice Returns the total supply of the token /// /// @param tokenId_ The ID of the token /// @return uint256 The total supply of the token - function totalSupply(uint256 tokenId_) public view virtual returns (uint256); + function totalSupply( + uint256 tokenId_ + ) public view virtual returns (uint256); } diff --git a/src/lib/MaxPriorityQueue.sol b/src/lib/MaxPriorityQueue.sol index 9d73ba255..6ea257f06 100644 --- a/src/lib/MaxPriorityQueue.sol +++ b/src/lib/MaxPriorityQueue.sol @@ -12,7 +12,9 @@ library BidEncoding { return bytes32(abi.encodePacked(bidId, amountIn, minAmountOut)); } - function decode(bytes32 data) internal pure returns (uint64, uint96, uint96) { + function decode( + bytes32 data + ) internal pure returns (uint64, uint96, uint96) { uint64 bidId = uint64(uint256(data >> 192)); uint96 amountIn = uint96(uint256(data >> 96)); uint96 minAmountOut = uint96(uint256(data)); @@ -60,7 +62,9 @@ library MaxPriorityQueue { // ========== INITIALIZE ========== // - function initialize(Queue storage self) internal { + function initialize( + Queue storage self + ) internal { self.nextBid[QUEUE_START] = QUEUE_END; } @@ -117,7 +121,9 @@ library MaxPriorityQueue { // ========== REMOVAL ========== // /// @notice Remove the max bid from the queue and return it. - function delMax(Queue storage self) internal returns (uint64, uint96, uint96) { + function delMax( + Queue storage self + ) internal returns (uint64, uint96, uint96) { // Get the max bid bytes32 maxKey = self.nextBid[QUEUE_START]; require(maxKey != QUEUE_END, "queue is empty"); @@ -136,7 +142,9 @@ library MaxPriorityQueue { // ========== INSPECTION ========== // /// @notice Return the max bid from the queue without removing it. - function getMax(Queue storage self) internal view returns (uint64, uint96, uint96) { + function getMax( + Queue storage self + ) internal view returns (uint64, uint96, uint96) { return self.nextBid[QUEUE_START].decode(); } @@ -146,12 +154,16 @@ library MaxPriorityQueue { } /// @notice Return the number of bids in the queue. - function getNumBids(Queue storage self) internal view returns (uint256) { + function getNumBids( + Queue storage self + ) internal view returns (uint256) { return self.numBids; } /// @notice Return true if the queue is empty. - function isEmpty(Queue storage self) internal view returns (bool) { + function isEmpty( + Queue storage self + ) internal view returns (bool) { return self.numBids == 0; } } diff --git a/src/lib/SVG.sol b/src/lib/SVG.sol index 417bfe947..91fd99ade 100644 --- a/src/lib/SVG.sol +++ b/src/lib/SVG.sol @@ -17,22 +17,30 @@ library utils { } // formats getting a css variable - function getCssVar(string memory _key) internal pure returns (string memory) { + function getCssVar( + string memory _key + ) internal pure returns (string memory) { return string.concat("var(--", _key, ")"); } // formats getting a def URL - function getDefURL(string memory _id) internal pure returns (string memory) { + function getDefURL( + string memory _id + ) internal pure returns (string memory) { return string.concat("url(#", _id, ")"); } // formats rgba white with a specified opacity / alpha - function white_a(uint256 _a) internal pure returns (string memory) { + function white_a( + uint256 _a + ) internal pure returns (string memory) { return rgba(255, 255, 255, _a); } // formats rgba black with a specified opacity / alpha - function black_a(uint256 _a) internal pure returns (string memory) { + function black_a( + uint256 _a + ) internal pure returns (string memory) { return rgba(0, 0, 0, _a); } @@ -63,7 +71,9 @@ library utils { } // returns the length of a string in characters - function utfStringLength(string memory _str) internal pure returns (uint256 length) { + function utfStringLength( + string memory _str + ) internal pure returns (uint256 length) { uint256 i = 0; bytes memory string_rep = bytes(_str); @@ -87,7 +97,9 @@ library utils { } // converts an unsigned integer to a string - function uint2str(uint256 _i) internal pure returns (string memory _uintAsString) { + function uint2str( + uint256 _i + ) internal pure returns (string memory _uintAsString) { if (_i == 0) { return "0"; } @@ -149,7 +161,9 @@ library svg { return el("circle", _props, _children); } - function circle(string memory _props) internal pure returns (string memory) { + function circle( + string memory _props + ) internal pure returns (string memory) { return el("circle", _props); } @@ -160,7 +174,9 @@ library svg { return el("ellipse", _props, _children); } - function ellipse(string memory _props) internal pure returns (string memory) { + function ellipse( + string memory _props + ) internal pure returns (string memory) { return el("ellipse", _props); } @@ -171,7 +187,9 @@ library svg { return el("rect", _props, _children); } - function rect(string memory _props) internal pure returns (string memory) { + function rect( + string memory _props + ) internal pure returns (string memory) { return el("rect", _props); } @@ -182,7 +200,9 @@ library svg { return el("filter", _props, _children); } - function cdata(string memory _content) internal pure returns (string memory) { + function cdata( + string memory _content + ) internal pure returns (string memory) { return string.concat(""); } @@ -218,7 +238,9 @@ library svg { ); } - function animateTransform(string memory _props) internal pure returns (string memory) { + function animateTransform( + string memory _props + ) internal pure returns (string memory) { return el("animateTransform", _props); } diff --git a/src/lib/Uint2Str.sol b/src/lib/Uint2Str.sol index a28d399d5..66bdc774a 100644 --- a/src/lib/Uint2Str.sol +++ b/src/lib/Uint2Str.sol @@ -4,7 +4,9 @@ pragma solidity ^0.8; // Some fancy math to convert a uint into a string, courtesy of Provable Things. // Updated to work with solc 0.8.0. // https://github.com/provable-things/ethereum-api/blob/master/provableAPI_0.6.sol -function uint2str(uint256 _i) pure returns (string memory) { +function uint2str( + uint256 _i +) pure returns (string memory) { if (_i == 0) { return "0"; } diff --git a/src/modules/Auction.sol b/src/modules/Auction.sol index 72f5f888c..3d56bb8fe 100644 --- a/src/modules/Auction.sol +++ b/src/modules/Auction.sol @@ -19,7 +19,9 @@ abstract contract AuctionModule is IAuction, Module { // ========== CONSTRUCTOR ========== // - constructor(address auctionHouse_) Module(auctionHouse_) {} + constructor( + address auctionHouse_ + ) Module(auctionHouse_) {} /// @inheritdoc Module function TYPE() public pure override returns (Type) { @@ -95,7 +97,9 @@ abstract contract AuctionModule is IAuction, Module { /// - the lot has concluded /// /// @param lotId_ The lot id - function cancelAuction(uint96 lotId_) external virtual override onlyInternal { + function cancelAuction( + uint96 lotId_ + ) external virtual override onlyInternal { // Validation _revertIfLotInvalid(lotId_); _revertIfLotConcluded(lotId_); @@ -114,7 +118,9 @@ abstract contract AuctionModule is IAuction, Module { /// @dev Auction modules should override this to perform any additional logic /// /// @param lotId_ The lot ID - function _cancelAuction(uint96 lotId_) internal virtual; + function _cancelAuction( + uint96 lotId_ + ) internal virtual; // ========== AUCTION INFORMATION ========== // @@ -126,7 +132,9 @@ abstract contract AuctionModule is IAuction, Module { /// /// @param lotId_ The lot ID /// @return bool Whether or not the lot is active - function isLive(uint96 lotId_) public view override returns (bool) { + function isLive( + uint96 lotId_ + ) public view override returns (bool) { return ( lotData[lotId_].capacity != 0 && uint48(block.timestamp) < lotData[lotId_].conclusion && uint48(block.timestamp) >= lotData[lotId_].start @@ -134,7 +142,9 @@ abstract contract AuctionModule is IAuction, Module { } /// @inheritdoc IAuction - function isUpcoming(uint96 lotId_) public view override returns (bool) { + function isUpcoming( + uint96 lotId_ + ) public view override returns (bool) { return ( lotData[lotId_].capacity != 0 && uint48(block.timestamp) < lotData[lotId_].conclusion && uint48(block.timestamp) < lotData[lotId_].start @@ -142,23 +152,31 @@ abstract contract AuctionModule is IAuction, Module { } /// @inheritdoc IAuction - function hasEnded(uint96 lotId_) public view override returns (bool) { + function hasEnded( + uint96 lotId_ + ) public view override returns (bool) { return uint48(block.timestamp) >= lotData[lotId_].conclusion || lotData[lotId_].capacity == 0; } /// @inheritdoc IAuction - function remainingCapacity(uint96 lotId_) external view override returns (uint256) { + function remainingCapacity( + uint96 lotId_ + ) external view override returns (uint256) { return lotData[lotId_].capacity; } /// @inheritdoc IAuction - function capacityInQuote(uint96 lotId_) external view override returns (bool) { + function capacityInQuote( + uint96 lotId_ + ) external view override returns (bool) { return lotData[lotId_].capacityInQuote; } /// @inheritdoc IAuction - function getLot(uint96 lotId_) external view override returns (Lot memory) { + function getLot( + uint96 lotId_ + ) external view override returns (Lot memory) { return lotData[lotId_]; } @@ -167,7 +185,9 @@ abstract contract AuctionModule is IAuction, Module { /// @notice Set the minimum auction duration /// @dev This function must be called by the parent AuctionHouse, and /// can be called by governance using `execOnModule`. - function setMinAuctionDuration(uint48 duration_) external onlyParent { + function setMinAuctionDuration( + uint48 duration_ + ) external onlyParent { minAuctionDuration = duration_; } @@ -178,25 +198,33 @@ abstract contract AuctionModule is IAuction, Module { /// Inheriting contracts can override this to implement custom logic /// /// @param lotId_ The lot ID - function _revertIfLotInvalid(uint96 lotId_) internal view virtual { + function _revertIfLotInvalid( + uint96 lotId_ + ) internal view virtual { if (lotData[lotId_].start == 0) revert Auction_InvalidLotId(lotId_); } /// @notice Checks that the lot represented by `lotId_` has not started /// @dev Should revert if the lot has not started - function _revertIfBeforeLotStart(uint96 lotId_) internal view virtual { + function _revertIfBeforeLotStart( + uint96 lotId_ + ) internal view virtual { if (uint48(block.timestamp) < lotData[lotId_].start) revert Auction_LotNotActive(lotId_); } /// @notice Checks that the lot represented by `lotId_` has started /// @dev Should revert if the lot has started - function _revertIfLotStarted(uint96 lotId_) internal view virtual { + function _revertIfLotStarted( + uint96 lotId_ + ) internal view virtual { if (uint48(block.timestamp) >= lotData[lotId_].start) revert Auction_LotActive(lotId_); } /// @notice Checks that the lot represented by `lotId_` has not concluded /// @dev Should revert if the lot has not concluded - function _revertIfBeforeLotConcluded(uint96 lotId_) internal view virtual { + function _revertIfBeforeLotConcluded( + uint96 lotId_ + ) internal view virtual { if (uint48(block.timestamp) < lotData[lotId_].conclusion && lotData[lotId_].capacity > 0) { revert Auction_LotNotConcluded(lotId_); } @@ -204,7 +232,9 @@ abstract contract AuctionModule is IAuction, Module { /// @notice Checks that the lot represented by `lotId_` has not concluded /// @dev Should revert if the lot has concluded - function _revertIfLotConcluded(uint96 lotId_) internal view virtual { + function _revertIfLotConcluded( + uint96 lotId_ + ) internal view virtual { // Beyond the conclusion time if (uint48(block.timestamp) >= lotData[lotId_].conclusion) { revert Auction_LotNotActive(lotId_); @@ -219,7 +249,9 @@ abstract contract AuctionModule is IAuction, Module { /// Inheriting contracts can override this to implement custom logic /// /// @param lotId_ The lot ID - function _revertIfLotInactive(uint96 lotId_) internal view virtual { + function _revertIfLotInactive( + uint96 lotId_ + ) internal view virtual { if (!isLive(lotId_)) revert Auction_LotNotActive(lotId_); } @@ -228,7 +260,9 @@ abstract contract AuctionModule is IAuction, Module { /// Inheriting contracts can override this to implement custom logic /// /// @param lotId_ The lot ID - function _revertIfLotActive(uint96 lotId_) internal view virtual { + function _revertIfLotActive( + uint96 lotId_ + ) internal view virtual { if (isLive(lotId_)) revert Auction_LotActive(lotId_); } } diff --git a/src/modules/Derivative.sol b/src/modules/Derivative.sol index 5a4c2e420..6d782bb2e 100644 --- a/src/modules/Derivative.sol +++ b/src/modules/Derivative.sol @@ -18,14 +18,18 @@ abstract contract DerivativeModule is IDerivative, ERC6909, ERC6909Metadata, Mod // ========== DERIVATIVE INFORMATION ========== // /// @inheritdoc IDerivative - function getTokenMetadata(uint256 tokenId) external view virtual returns (Token memory) { + function getTokenMetadata( + uint256 tokenId + ) external view virtual returns (Token memory) { return tokenMetadata[tokenId]; } // ========== ERC6909 TOKEN SUPPLY EXTENSION ========== // /// @inheritdoc ERC6909Metadata - function totalSupply(uint256 tokenId) public view virtual override returns (uint256) { + function totalSupply( + uint256 tokenId + ) public view virtual override returns (uint256) { return tokenMetadata[tokenId].supply; } } diff --git a/src/modules/Keycode.sol b/src/modules/Keycode.sol index 6082e6935..7761b091a 100644 --- a/src/modules/Keycode.sol +++ b/src/modules/Keycode.sol @@ -13,11 +13,15 @@ type Veecode is bytes7; error InvalidVeecode(Veecode veecode_); -function toKeycode(bytes5 keycode_) pure returns (Keycode) { +function toKeycode( + bytes5 keycode_ +) pure returns (Keycode) { return Keycode.wrap(keycode_); } -function fromKeycode(Keycode keycode_) pure returns (bytes5) { +function fromKeycode( + Keycode keycode_ +) pure returns (bytes5) { return Keycode.unwrap(keycode_); } @@ -32,16 +36,22 @@ function wrapVeecode(Keycode keycode_, uint8 version_) pure returns (Veecode) { } // solhint-disable-next-line func-visibility -function toVeecode(bytes7 veecode_) pure returns (Veecode) { +function toVeecode( + bytes7 veecode_ +) pure returns (Veecode) { return Veecode.wrap(veecode_); } // solhint-disable-next-line func-visibility -function fromVeecode(Veecode veecode_) pure returns (bytes7) { +function fromVeecode( + Veecode veecode_ +) pure returns (bytes7) { return Veecode.unwrap(veecode_); } -function unwrapVeecode(Veecode veecode_) pure returns (Keycode, uint8) { +function unwrapVeecode( + Veecode veecode_ +) pure returns (Keycode, uint8) { bytes7 unwrapped = Veecode.unwrap(veecode_); // Get the version from the first 2 bytes @@ -57,13 +67,17 @@ function unwrapVeecode(Veecode veecode_) pure returns (Keycode, uint8) { return (keycode, version); } -function keycodeFromVeecode(Veecode veecode_) pure returns (Keycode) { +function keycodeFromVeecode( + Veecode veecode_ +) pure returns (Keycode) { (Keycode keycode,) = unwrapVeecode(veecode_); return keycode; } // solhint-disable-next-line func-visibility -function ensureValidVeecode(Veecode veecode_) pure { +function ensureValidVeecode( + Veecode veecode_ +) pure { bytes7 unwrapped = Veecode.unwrap(veecode_); for (uint256 i; i < 7;) { bytes1 char = unwrapped[i]; diff --git a/src/modules/Modules.sol b/src/modules/Modules.sol index bd94dd6aa..0c156a09e 100644 --- a/src/modules/Modules.sol +++ b/src/modules/Modules.sol @@ -24,7 +24,9 @@ abstract contract WithModules is Owned { // ========= CONSTRUCTOR ========= // - constructor(address owner_) Owned(owner_) {} + constructor( + address owner_ + ) Owned(owner_) {} // ========= STRUCTS ========= // @@ -64,7 +66,9 @@ abstract contract WithModules is Owned { /// @dev - The module version is not one greater than the latest version /// /// @param newModule_ The new module - function installModule(Module newModule_) external onlyOwner { + function installModule( + Module newModule_ + ) external onlyOwner { // Validate new module is a contract, has correct parent, and has valid Keycode _ensureContract(address(newModule_)); Veecode veecode = newModule_.VEECODE(); @@ -92,7 +96,9 @@ abstract contract WithModules is Owned { emit ModuleInstalled(keycode, version, address(newModule_)); } - function _ensureContract(address target_) internal view { + function _ensureContract( + address target_ + ) internal view { if (target_.code.length == 0) revert TargetNotAContract(target_); } @@ -107,7 +113,9 @@ abstract contract WithModules is Owned { /// @dev - The module is already sunset /// /// @param keycode_ The module keycode - function sunsetModule(Keycode keycode_) external onlyOwner { + function sunsetModule( + Keycode keycode_ + ) external onlyOwner { // Check that the module is installed if (!_moduleIsInstalled(keycode_)) revert ModuleNotInstalled(keycode_, 0); @@ -125,7 +133,9 @@ abstract contract WithModules is Owned { /// /// @param keycode_ The module keycode /// @return True if the module is installed, false otherwise - function _moduleIsInstalled(Keycode keycode_) internal view returns (bool) { + function _moduleIsInstalled( + Keycode keycode_ + ) internal view returns (bool) { // Any module that has been installed will have a latest version greater than 0 // We can check not equal here to save gas return getModuleStatus[keycode_].latestVersion != uint8(0); @@ -138,7 +148,9 @@ abstract contract WithModules is Owned { /// /// @param keycode_ The module keycode /// @return The address of the latest version of the module - function _getLatestModuleIfActive(Keycode keycode_) internal view returns (address) { + function _getLatestModuleIfActive( + Keycode keycode_ + ) internal view returns (address) { // Check that the module is installed ModStatus memory status = getModuleStatus[keycode_]; if (status.latestVersion == uint8(0)) revert ModuleNotInstalled(keycode_, 0); @@ -184,7 +196,9 @@ abstract contract WithModules is Owned { /// /// @param veecode_ The module Veecode /// @return The address of the module - function _getModuleIfInstalled(Veecode veecode_) internal view returns (address) { + function _getModuleIfInstalled( + Veecode veecode_ + ) internal view returns (address) { // In this case, it's simpler to check that the stored address is not zero Module mod = getModuleForVeecode[veecode_]; if (address(mod) == address(0)) { @@ -259,7 +273,9 @@ abstract contract Module { // ========= CONSTRUCTOR ========= // - constructor(address parent_) { + constructor( + address parent_ + ) { if (parent_ == address(0)) revert Module_InvalidParent(parent_); PARENT = parent_; diff --git a/src/modules/auctions/BatchAuctionModule.sol b/src/modules/auctions/BatchAuctionModule.sol index b0e438c7f..6349617ee 100644 --- a/src/modules/auctions/BatchAuctionModule.sol +++ b/src/modules/auctions/BatchAuctionModule.sol @@ -244,7 +244,9 @@ abstract contract BatchAuctionModule is IBatchAuction, AuctionModule { /// - The lot has not concluded /// - The lot is in the dedicated settle period /// - The lot is settled (after which it cannot be aborted) - function abort(uint96 lotId_) external virtual override onlyInternal { + function abort( + uint96 lotId_ + ) external virtual override onlyInternal { // Standard validation _revertIfLotInvalid(lotId_); _revertIfBeforeLotConcluded(lotId_); @@ -261,11 +263,15 @@ abstract contract BatchAuctionModule is IBatchAuction, AuctionModule { /// - Updating auction-specific data /// /// @param lotId_ The lot ID - function _abort(uint96 lotId_) internal virtual; + function _abort( + uint96 lotId_ + ) internal virtual; // ========== ADMIN CONFIGURATION ========== // - function setDedicatedSettlePeriod(uint48 period_) external onlyParent { + function setDedicatedSettlePeriod( + uint48 period_ + ) external onlyParent { // Dedicated settle period cannot be more than 7 days if (period_ > 7 days) revert Auction_InvalidParams(); @@ -279,14 +285,18 @@ abstract contract BatchAuctionModule is IBatchAuction, AuctionModule { /// Inheriting contracts must override this to implement custom logic /// /// @param lotId_ The lot ID - function _revertIfLotSettled(uint96 lotId_) internal view virtual; + function _revertIfLotSettled( + uint96 lotId_ + ) internal view virtual; /// @notice Checks that the lot represented by `lotId_` is settled /// @dev Should revert if the lot is not settled /// Inheriting contracts must override this to implement custom logic /// /// @param lotId_ The lot ID - function _revertIfLotNotSettled(uint96 lotId_) internal view virtual; + function _revertIfLotNotSettled( + uint96 lotId_ + ) internal view virtual; /// @notice Checks that the lot and bid combination is valid /// @dev Should revert if the bid is invalid @@ -317,7 +327,9 @@ abstract contract BatchAuctionModule is IBatchAuction, AuctionModule { /// @param bidId_ The bid ID function _revertIfBidClaimed(uint96 lotId_, uint64 bidId_) internal view virtual; - function _revertIfDedicatedSettlePeriod(uint96 lotId_) internal view { + function _revertIfDedicatedSettlePeriod( + uint96 lotId_ + ) internal view { // Auction must not be in the dedicated settle period uint48 conclusion = lotData[lotId_].conclusion; if ( diff --git a/src/modules/auctions/atomic/FPS.sol b/src/modules/auctions/atomic/FPS.sol index 0fbaf27a5..242a21502 100644 --- a/src/modules/auctions/atomic/FPS.sol +++ b/src/modules/auctions/atomic/FPS.sol @@ -24,7 +24,9 @@ contract FixedPriceSale is AtomicAuctionModule, IFixedPriceSale { // ========== SETUP ========== // - constructor(address auctionHouse_) AuctionModule(auctionHouse_) { + constructor( + address auctionHouse_ + ) AuctionModule(auctionHouse_) { // Set the minimum auction duration to 1 day initially minAuctionDuration = 1 days; } @@ -80,7 +82,9 @@ contract FixedPriceSale is AtomicAuctionModule, IFixedPriceSale { /// - The lot ID has been validated /// - The caller has been authorized /// - The auction has not concluded - function _cancelAuction(uint96 lotId_) internal pure override {} + function _cancelAuction( + uint96 lotId_ + ) internal pure override {} // ========== PURCHASE ========== // @@ -134,12 +138,16 @@ contract FixedPriceSale is AtomicAuctionModule, IFixedPriceSale { } /// @inheritdoc IAtomicAuction - function maxPayout(uint96 lotId_) public view override returns (uint256) { + function maxPayout( + uint96 lotId_ + ) public view override returns (uint256) { return auctionData[lotId_].maxPayout; } /// @inheritdoc IAtomicAuction - function maxAmountAccepted(uint96 lotId_) public view override returns (uint256) { + function maxAmountAccepted( + uint96 lotId_ + ) public view override returns (uint256) { return Math.mulDivUp( auctionData[lotId_].maxPayout, auctionData[lotId_].price, diff --git a/src/modules/auctions/atomic/GDA.sol b/src/modules/auctions/atomic/GDA.sol index 478591522..81de2f4ad 100644 --- a/src/modules/auctions/atomic/GDA.sol +++ b/src/modules/auctions/atomic/GDA.sol @@ -100,7 +100,9 @@ contract GradualDutchAuction is IGradualDutchAuction, AtomicAuctionModule { // ========== SETUP ========== // - constructor(address auctionHouse_) AuctionModule(auctionHouse_) { + constructor( + address auctionHouse_ + ) AuctionModule(auctionHouse_) { // Initially setting the minimum GDA duration to 1 hour minAuctionDuration = 1 hours; } @@ -270,7 +272,9 @@ contract GradualDutchAuction is IGradualDutchAuction, AtomicAuctionModule { } // Do not need to do anything extra here - function _cancelAuction(uint96 lotId_) internal override {} + function _cancelAuction( + uint96 lotId_ + ) internal override {} // ========== PURCHASE ========== // @@ -563,7 +567,9 @@ contract GradualDutchAuction is IGradualDutchAuction, AtomicAuctionModule { return (payout.intoUint256().mulDiv(10 ** lot.baseTokenDecimals, uUNIT), secondsOfEmissions); } - function maxPayout(uint96 lotId_) external view override returns (uint256) { + function maxPayout( + uint96 lotId_ + ) external view override returns (uint256) { // Lot ID must be valid _revertIfLotInvalid(lotId_); @@ -571,7 +577,9 @@ contract GradualDutchAuction is IGradualDutchAuction, AtomicAuctionModule { return lotData[lotId_].capacity; } - function maxAmountAccepted(uint96 lotId_) public view override returns (uint256) { + function maxAmountAccepted( + uint96 lotId_ + ) public view override returns (uint256) { // The max amount accepted is the price to purchase the remaining capacity of the lot // This function checks if the lot ID is valid return priceFor(lotId_, lotData[lotId_].capacity); diff --git a/src/modules/auctions/batch/EMP.sol b/src/modules/auctions/batch/EMP.sol index 2a17255a7..3378fbc9f 100644 --- a/src/modules/auctions/batch/EMP.sol +++ b/src/modules/auctions/batch/EMP.sol @@ -88,7 +88,9 @@ contract EncryptedMarginalPrice is BatchAuctionModule, IEncryptedMarginalPrice { // ========== SETUP ========== // - constructor(address auctionHouse_) AuctionModule(auctionHouse_) { + constructor( + address auctionHouse_ + ) AuctionModule(auctionHouse_) { // Set the minimum auction duration to 1 day initially minAuctionDuration = 1 days; @@ -165,7 +167,9 @@ contract EncryptedMarginalPrice is BatchAuctionModule, IEncryptedMarginalPrice { /// /// This function reverts if: /// - The auction is active or has not concluded - function _cancelAuction(uint96 lotId_) internal override { + function _cancelAuction( + uint96 lotId_ + ) internal override { // Validation // Batch auctions cannot be cancelled once started, otherwise the seller could cancel the auction after bids have been submitted _revertIfLotActive(lotId_); @@ -579,7 +583,9 @@ contract EncryptedMarginalPrice is BatchAuctionModule, IEncryptedMarginalPrice { } /// @inheritdoc IEncryptedMarginalPrice - function getNumBidsInQueue(uint96 lotId_) external view override returns (uint256) { + function getNumBidsInQueue( + uint96 lotId_ + ) external view override returns (uint256) { return decryptedBids[lotId_].getNumBids(); } @@ -865,7 +871,9 @@ contract EncryptedMarginalPrice is BatchAuctionModule, IEncryptedMarginalPrice { /// /// This function reverts if: /// - None - function _abort(uint96 lotId_) internal override { + function _abort( + uint96 lotId_ + ) internal override { // Set the auction status to settled auctionData[lotId_].status = LotStatus.Settled; @@ -921,7 +929,9 @@ contract EncryptedMarginalPrice is BatchAuctionModule, IEncryptedMarginalPrice { /// @inheritdoc IBatchAuction /// @dev This function reverts if: /// - The lot ID is invalid - function getNumBids(uint96 lotId_) external view override returns (uint256) { + function getNumBids( + uint96 lotId_ + ) external view override returns (uint256) { _revertIfLotInvalid(lotId_); return auctionData[lotId_].bidIds.length; @@ -1040,7 +1050,9 @@ contract EncryptedMarginalPrice is BatchAuctionModule, IEncryptedMarginalPrice { // ========== VALIDATION ========== // /// @inheritdoc AuctionModule - function _revertIfLotActive(uint96 lotId_) internal view override { + function _revertIfLotActive( + uint96 lotId_ + ) internal view override { if ( auctionData[lotId_].status == LotStatus.Created && lotData[lotId_].start <= block.timestamp @@ -1049,7 +1061,9 @@ contract EncryptedMarginalPrice is BatchAuctionModule, IEncryptedMarginalPrice { } /// @notice Reverts if the private key has been submitted for the lot - function _revertIfKeySubmitted(uint96 lotId_) internal view { + function _revertIfKeySubmitted( + uint96 lotId_ + ) internal view { // Private key must not have been submitted yet if (auctionData[lotId_].privateKey != 0) { revert Auction_WrongState(lotId_); @@ -1057,7 +1071,9 @@ contract EncryptedMarginalPrice is BatchAuctionModule, IEncryptedMarginalPrice { } /// @inheritdoc BatchAuctionModule - function _revertIfLotSettled(uint96 lotId_) internal view override { + function _revertIfLotSettled( + uint96 lotId_ + ) internal view override { // Auction must not be settled if (auctionData[lotId_].status == LotStatus.Settled) { revert Auction_WrongState(lotId_); @@ -1065,7 +1081,9 @@ contract EncryptedMarginalPrice is BatchAuctionModule, IEncryptedMarginalPrice { } /// @inheritdoc BatchAuctionModule - function _revertIfLotNotSettled(uint96 lotId_) internal view override { + function _revertIfLotNotSettled( + uint96 lotId_ + ) internal view override { // Auction must be settled if (auctionData[lotId_].status != LotStatus.Settled) { revert Auction_WrongState(lotId_); diff --git a/src/modules/auctions/batch/FPB.sol b/src/modules/auctions/batch/FPB.sol index 9a2b6e7f3..ced95861a 100644 --- a/src/modules/auctions/batch/FPB.sol +++ b/src/modules/auctions/batch/FPB.sol @@ -34,7 +34,9 @@ contract FixedPriceBatch is BatchAuctionModule, IFixedPriceBatch { // ========== SETUP ========== // - constructor(address auctionHouse_) AuctionModule(auctionHouse_) { + constructor( + address auctionHouse_ + ) AuctionModule(auctionHouse_) { // Set the minimum auction duration to 1 day initially minAuctionDuration = 1 days; @@ -92,7 +94,9 @@ contract FixedPriceBatch is BatchAuctionModule, IFixedPriceBatch { /// /// This function reverts if: /// - The auction is active or has not concluded - function _cancelAuction(uint96 lotId_) internal override { + function _cancelAuction( + uint96 lotId_ + ) internal override { // Validation // Batch auctions cannot be cancelled once started, otherwise the seller could cancel the auction after bids have been submitted _revertIfLotActive(lotId_); @@ -339,7 +343,9 @@ contract FixedPriceBatch is BatchAuctionModule, IFixedPriceBatch { /// /// This function reverts if: /// - None - function _abort(uint96 lotId_) internal override { + function _abort( + uint96 lotId_ + ) internal override { // Set the auction status to settled _auctionData[lotId_].status = LotStatus.Settled; @@ -391,7 +397,9 @@ contract FixedPriceBatch is BatchAuctionModule, IFixedPriceBatch { /// @inheritdoc IBatchAuction /// @dev This function is not implemented in fixed price batch since bid IDs are not stored in an array /// A proxy is using the nextBidId to determine how many bids have been submitted, but this doesn't consider refunds - function getNumBids(uint96) external view override returns (uint256) {} + function getNumBids( + uint96 + ) external view override returns (uint256) {} /// @inheritdoc IBatchAuction /// @dev This function is not implemented in fixed price batch since bid IDs are not stored in an array @@ -467,7 +475,9 @@ contract FixedPriceBatch is BatchAuctionModule, IFixedPriceBatch { // ========== VALIDATION ========== // /// @inheritdoc AuctionModule - function _revertIfLotActive(uint96 lotId_) internal view override { + function _revertIfLotActive( + uint96 lotId_ + ) internal view override { if ( _auctionData[lotId_].status == LotStatus.Created && lotData[lotId_].start <= block.timestamp @@ -476,7 +486,9 @@ contract FixedPriceBatch is BatchAuctionModule, IFixedPriceBatch { } /// @inheritdoc BatchAuctionModule - function _revertIfLotSettled(uint96 lotId_) internal view override { + function _revertIfLotSettled( + uint96 lotId_ + ) internal view override { // Auction must not be settled if (_auctionData[lotId_].status == LotStatus.Settled) { revert Auction_WrongState(lotId_); @@ -484,7 +496,9 @@ contract FixedPriceBatch is BatchAuctionModule, IFixedPriceBatch { } /// @inheritdoc BatchAuctionModule - function _revertIfLotNotSettled(uint96 lotId_) internal view override { + function _revertIfLotNotSettled( + uint96 lotId_ + ) internal view override { // Auction must be settled if (_auctionData[lotId_].status != LotStatus.Settled) { revert Auction_WrongState(lotId_); diff --git a/src/modules/derivatives/LinearVesting.sol b/src/modules/derivatives/LinearVesting.sol index 726d29cb7..d9e593536 100644 --- a/src/modules/derivatives/LinearVesting.sol +++ b/src/modules/derivatives/LinearVesting.sol @@ -44,7 +44,9 @@ contract LinearVesting is DerivativeModule, ILinearVesting, LinearVestingCard { // ========== MODULE SETUP ========== // - constructor(address parent_) Module(parent_) LinearVestingCard() { + constructor( + address parent_ + ) Module(parent_) LinearVestingCard() { // Deploy the clone implementation _IMPLEMENTATION = address(new SoulboundCloneERC20()); } @@ -61,12 +63,16 @@ contract LinearVesting is DerivativeModule, ILinearVesting, LinearVestingCard { // ========== MODIFIERS ========== // - modifier onlyValidTokenId(uint256 tokenId_) { + modifier onlyValidTokenId( + uint256 tokenId_ + ) { if (tokenMetadata[tokenId_].exists == false) revert InvalidParams(); _; } - modifier onlyDeployedWrapped(uint256 tokenId_) { + modifier onlyDeployedWrapped( + uint256 tokenId_ + ) { if (tokenMetadata[tokenId_].wrapped == address(0)) { revert InvalidParams(); } @@ -291,7 +297,9 @@ contract LinearVesting is DerivativeModule, ILinearVesting, LinearVestingCard { } /// @inheritdoc IDerivative - function redeemMax(uint256 tokenId_) external virtual override onlyValidTokenId(tokenId_) { + function redeemMax( + uint256 tokenId_ + ) external virtual override onlyValidTokenId(tokenId_) { // Determine the redeemable amount uint256 redeemableAmount = redeemable(msg.sender, tokenId_); @@ -386,7 +394,9 @@ contract LinearVesting is DerivativeModule, ILinearVesting, LinearVestingCard { /// @inheritdoc IDerivative /// @dev Not implemented - function reclaim(uint256) external virtual override { + function reclaim( + uint256 + ) external virtual override { revert IDerivative.Derivative_NotImplemented(); } diff --git a/src/modules/derivatives/LinearVestingCard.sol b/src/modules/derivatives/LinearVestingCard.sol index c7956d241..27c6698ba 100644 --- a/src/modules/derivatives/LinearVestingCard.sol +++ b/src/modules/derivatives/LinearVestingCard.sol @@ -43,7 +43,9 @@ contract LinearVestingCard { // ========== ATTRIBUTES ========== // - function _attributes(Info memory tokenInfo) internal pure returns (string memory) { + function _attributes( + Info memory tokenInfo + ) internal pure returns (string memory) { return string.concat( '[{"trait_type":"Token ID","value":"', Strings.toString(tokenInfo.tokenId), @@ -67,7 +69,9 @@ contract LinearVestingCard { } // ========== RENDERER ========== // - function _render(Info memory tokenInfo) internal view returns (string memory) { + function _render( + Info memory tokenInfo + ) internal view returns (string memory) { return string.concat( '', svg.el( @@ -98,7 +102,9 @@ contract LinearVestingCard { // ========== COMPONENTS ========== // - function _title(string memory symbol) internal pure returns (string memory) { + function _title( + string memory symbol + ) internal pure returns (string memory) { return string.concat( svg.text(string.concat('x="145" y="40" font-size="20" ', _TEXT_STYLE), "Linear Vesting"), svg.text(string.concat('x="145" y="100" font-size="56" ', _TEXT_STYLE), symbol) @@ -121,7 +127,9 @@ contract LinearVestingCard { ); } - function _identifier(uint256 tokenId) internal view returns (string memory) { + function _identifier( + uint256 tokenId + ) internal view returns (string memory) { return string.concat( svg.text(string.concat('x="145" y="460" font-size="10" ', _TEXT_STYLE), _addrString), svg.text( @@ -197,7 +205,9 @@ contract LinearVestingCard { ); } - function _animateLine(uint256 len) internal pure returns (string memory) { + function _animateLine( + uint256 len + ) internal pure returns (string memory) { return svg.rect( string.concat( 'x="62" y="161" width="12" height="8" fill="url(#blueGreenGradient)" rx="4" ry="4"' diff --git a/test/AtomicAuctionHouse/AuctionHouseTest.sol b/test/AtomicAuctionHouse/AuctionHouseTest.sol index 479e16598..e5f9b702b 100644 --- a/test/AtomicAuctionHouse/AuctionHouseTest.sol +++ b/test/AtomicAuctionHouse/AuctionHouseTest.sol @@ -149,17 +149,23 @@ abstract contract AtomicAuctionHouseTest is Test, Permit2User, WithSalts, TestSa // ===== Helper Functions ===== // - function _scaleQuoteTokenAmount(uint256 amount_) internal view returns (uint256) { + function _scaleQuoteTokenAmount( + uint256 amount_ + ) internal view returns (uint256) { return FixedPointMathLib.mulDivDown(amount_, 10 ** _quoteToken.decimals(), _BASE_SCALE); } - function _scaleBaseTokenAmount(uint256 amount_) internal view returns (uint256) { + function _scaleBaseTokenAmount( + uint256 amount_ + ) internal view returns (uint256) { return FixedPointMathLib.mulDivDown(amount_, 10 ** _baseToken.decimals(), _BASE_SCALE); } // ===== Modifiers ===== // - function _setBaseTokenDecimals(uint8 decimals_) internal { + function _setBaseTokenDecimals( + uint8 decimals_ + ) internal { _baseToken = new MockFeeOnTransferERC20("Base Token", "BASE", decimals_); uint256 lotCapacity = _scaleBaseTokenAmount(_LOT_CAPACITY); @@ -171,19 +177,25 @@ abstract contract AtomicAuctionHouseTest is Test, Permit2User, WithSalts, TestSa _auctionParams.capacity = lotCapacity; } - modifier givenBaseTokenHasDecimals(uint8 decimals_) { + modifier givenBaseTokenHasDecimals( + uint8 decimals_ + ) { _setBaseTokenDecimals(decimals_); _; } - function _setQuoteTokenDecimals(uint8 decimals_) internal { + function _setQuoteTokenDecimals( + uint8 decimals_ + ) internal { _quoteToken = new MockFeeOnTransferERC20("Quote Token", "QUOTE", decimals_); // Update routing params _routingParams.quoteToken = address(_quoteToken); } - modifier givenQuoteTokenHasDecimals(uint8 decimals_) { + modifier givenQuoteTokenHasDecimals( + uint8 decimals_ + ) { _setQuoteTokenDecimals(decimals_); _; } @@ -295,7 +307,9 @@ abstract contract AtomicAuctionHouseTest is Test, Permit2User, WithSalts, TestSa _; } - modifier whenPermit2ApprovalIsProvided(uint256 amount_) { + modifier whenPermit2ApprovalIsProvided( + uint256 amount_ + ) { // Approve the Permit2 contract to spend the quote token vm.prank(_bidder); _quoteToken.approve(_permit2Address, type(uint256).max); @@ -322,22 +336,30 @@ abstract contract AtomicAuctionHouseTest is Test, Permit2User, WithSalts, TestSa _quoteToken.approve(address(_auctionHouse), amount_); } - modifier givenUserHasQuoteTokenBalance(uint256 amount_) { + modifier givenUserHasQuoteTokenBalance( + uint256 amount_ + ) { _sendUserQuoteTokenBalance(_bidder, amount_); _; } - modifier givenUserHasQuoteTokenAllowance(uint256 amount_) { + modifier givenUserHasQuoteTokenAllowance( + uint256 amount_ + ) { _approveUserQuoteTokenAllowance(_bidder, amount_); _; } - modifier givenSellerHasBaseTokenBalance(uint256 amount_) { + modifier givenSellerHasBaseTokenBalance( + uint256 amount_ + ) { _baseToken.mint(_SELLER, amount_); _; } - modifier givenSellerHasBaseTokenAllowance(uint256 amount_) { + modifier givenSellerHasBaseTokenAllowance( + uint256 amount_ + ) { vm.prank(_SELLER); _baseToken.approve(address(_auctionHouse), amount_); _; @@ -378,12 +400,16 @@ abstract contract AtomicAuctionHouseTest is Test, Permit2User, WithSalts, TestSa _; } - modifier givenCallbackHasBaseTokenBalance(uint256 amount_) { + modifier givenCallbackHasBaseTokenBalance( + uint256 amount_ + ) { _baseToken.mint(address(_callback), amount_); _; } - modifier givenCallbackHasBaseTokenAllowance(uint256 amount_) { + modifier givenCallbackHasBaseTokenAllowance( + uint256 amount_ + ) { vm.prank(address(_callback)); _baseToken.approve(address(_auctionHouse), amount_); _; @@ -464,7 +490,9 @@ abstract contract AtomicAuctionHouseTest is Test, Permit2User, WithSalts, TestSa _; } - function _setMaxReferrerFee(uint24 fee_) internal { + function _setMaxReferrerFee( + uint24 fee_ + ) internal { vm.prank(_OWNER); _auctionHouse.setFee(_auctionModuleKeycode, IFeeManager.FeeType.MaxReferrer, fee_); _maxReferrerFeePercentActual = fee_; @@ -475,12 +503,16 @@ abstract contract AtomicAuctionHouseTest is Test, Permit2User, WithSalts, TestSa _; } - function _setReferrerFee(uint24 fee_) internal { + function _setReferrerFee( + uint24 fee_ + ) internal { _referrerFeePercentActual = fee_; _routingParams.referrerFee = fee_; } - modifier givenReferrerFee(uint24 fee_) { + modifier givenReferrerFee( + uint24 fee_ + ) { _setReferrerFee(fee_); _; } @@ -490,7 +522,9 @@ abstract contract AtomicAuctionHouseTest is Test, Permit2User, WithSalts, TestSa _; } - function _setCuratorFee(uint24 fee_) internal { + function _setCuratorFee( + uint24 fee_ + ) internal { vm.prank(_CURATOR); _auctionHouse.setCuratorFee(_auctionModuleKeycode, fee_); _curatorFeePercentActual = fee_; @@ -509,7 +543,9 @@ abstract contract AtomicAuctionHouseTest is Test, Permit2User, WithSalts, TestSa _; } - function _setProtocolFee(uint24 fee_) internal { + function _setProtocolFee( + uint24 fee_ + ) internal { vm.prank(_OWNER); _auctionHouse.setFee(_auctionModuleKeycode, IFeeManager.FeeType.Protocol, fee_); _protocolFeePercentActual = fee_; @@ -522,7 +558,9 @@ abstract contract AtomicAuctionHouseTest is Test, Permit2User, WithSalts, TestSa // ===== Helpers ===== // - function _getLotRouting(uint96 lotId_) internal view returns (IAuctionHouse.Routing memory) { + function _getLotRouting( + uint96 lotId_ + ) internal view returns (IAuctionHouse.Routing memory) { ( address seller_, address baseToken_, @@ -548,7 +586,9 @@ abstract contract AtomicAuctionHouseTest is Test, Permit2User, WithSalts, TestSa }); } - function _getLotFees(uint96 lotId_) internal view returns (IAuctionHouse.FeeData memory) { + function _getLotFees( + uint96 lotId_ + ) internal view returns (IAuctionHouse.FeeData memory) { ( address curator_, bool curated_, @@ -566,7 +606,9 @@ abstract contract AtomicAuctionHouseTest is Test, Permit2User, WithSalts, TestSa }); } - function _getLotData(uint96 lotId_) internal view returns (IAuction.Lot memory) { + function _getLotData( + uint96 lotId_ + ) internal view returns (IAuction.Lot memory) { return _auctionModule.getLot(lotId_); } } diff --git a/test/AtomicAuctionHouse/cancelAuction.t.sol b/test/AtomicAuctionHouse/cancelAuction.t.sol index cb0dcbee4..bcf8614bc 100644 --- a/test/AtomicAuctionHouse/cancelAuction.t.sol +++ b/test/AtomicAuctionHouse/cancelAuction.t.sol @@ -14,7 +14,9 @@ contract AtomicCancelAuctionTest is AtomicAuctionHouseTest { bytes internal _purchaseAuctionData = abi.encode(""); - modifier givenPayoutMultiplier(uint256 multiplier_) { + modifier givenPayoutMultiplier( + uint256 multiplier_ + ) { _atomicAuctionModule.setPayoutMultiplier(_lotId, multiplier_); _; } diff --git a/test/AtomicAuctionHouse/purchase.t.sol b/test/AtomicAuctionHouse/purchase.t.sol index af3c7465d..588d5f93b 100644 --- a/test/AtomicAuctionHouse/purchase.t.sol +++ b/test/AtomicAuctionHouse/purchase.t.sol @@ -49,7 +49,9 @@ contract AtomicPurchaseTest is AtomicAuctionHouseTest { _; } - modifier whenPayoutMultiplierIsSet(uint256 multiplier_) { + modifier whenPayoutMultiplierIsSet( + uint256 multiplier_ + ) { _atomicAuctionModule.setPayoutMultiplier(_lotId, multiplier_); uint256 amountInLessFees = _scaleQuoteTokenAmount(_AMOUNT_IN) @@ -79,13 +81,17 @@ contract AtomicPurchaseTest is AtomicAuctionHouseTest { _; } - modifier givenFeesAreCalculated(uint256 amountIn_) { + modifier givenFeesAreCalculated( + uint256 amountIn_ + ) { _expectedReferrerFeesAllocated = (amountIn_ * _referrerFeePercentActual) / 100e2; _expectedProtocolFeesAllocated = (amountIn_ * _protocolFeePercentActual) / 100e2; _; } - modifier givenFeesAreCalculatedNoReferrer(uint256 amountIn_) { + modifier givenFeesAreCalculatedNoReferrer( + uint256 amountIn_ + ) { _expectedReferrerFeesAllocated = 0; _expectedProtocolFeesAllocated = (amountIn_ * (_protocolFeePercentActual + _referrerFeePercentActual)) / 100e2; diff --git a/test/AtomicAuctionHouse/setFee.t.sol b/test/AtomicAuctionHouse/setFee.t.sol index 2b1868319..18f9d5116 100644 --- a/test/AtomicAuctionHouse/setFee.t.sol +++ b/test/AtomicAuctionHouse/setFee.t.sol @@ -68,7 +68,9 @@ contract AtomicSetFeeTest is Test, Permit2User { _auctionHouse.setFee(_auctionKeycode, IFeeManager.FeeType.Protocol, _MAX_FEE + 1); } - function test_protocolFee(uint48 fee_) public { + function test_protocolFee( + uint48 fee_ + ) public { uint48 fee = uint48(bound(fee_, 0, _MAX_FEE)); vm.prank(_OWNER); @@ -82,7 +84,9 @@ contract AtomicSetFeeTest is Test, Permit2User { assertEq(maxCuratorFee, 0); } - function test_maxReferrerFee(uint48 fee_) public { + function test_maxReferrerFee( + uint48 fee_ + ) public { uint48 fee = uint48(bound(fee_, 0, _MAX_FEE)); vm.prank(_OWNER); @@ -96,7 +100,9 @@ contract AtomicSetFeeTest is Test, Permit2User { assertEq(maxCuratorFee, 0); } - function test_curatorFee(uint48 fee_) public { + function test_curatorFee( + uint48 fee_ + ) public { uint48 fee = uint48(bound(fee_, 0, _MAX_FEE)); vm.prank(_OWNER); diff --git a/test/AtomicAuctionHouse/setProtocol.t.sol b/test/AtomicAuctionHouse/setProtocol.t.sol index ba81d493c..bf8806880 100644 --- a/test/AtomicAuctionHouse/setProtocol.t.sol +++ b/test/AtomicAuctionHouse/setProtocol.t.sol @@ -17,7 +17,9 @@ contract AtomicSetProtocolTest is AtomicAuctionHouseTest { // ===== Modifiers ===== // - modifier givenProtocolAddressIsSet(address protocol_) { + modifier givenProtocolAddressIsSet( + address protocol_ + ) { vm.prank(_OWNER); _auctionHouse.setProtocol(protocol_); _; diff --git a/test/AuctionHouse/collectPayment.t.sol b/test/AuctionHouse/collectPayment.t.sol index 671ab29ed..4eb3e4c9e 100644 --- a/test/AuctionHouse/collectPayment.t.sol +++ b/test/AuctionHouse/collectPayment.t.sol @@ -45,7 +45,9 @@ contract CollectPaymentTest is Test, Permit2User { _user = vm.addr(_userKey); } - modifier givenUserHasBalance(uint256 amount_) { + modifier givenUserHasBalance( + uint256 amount_ + ) { _quoteToken.mint(_user, amount_); _; } diff --git a/test/AuctionHouse/sendPayment.t.sol b/test/AuctionHouse/sendPayment.t.sol index 603ab59c4..4af2a14e1 100644 --- a/test/AuctionHouse/sendPayment.t.sol +++ b/test/AuctionHouse/sendPayment.t.sol @@ -71,7 +71,9 @@ contract SendPaymentTest is Test, Permit2User, WithSalts { _; } - modifier givenRouterHasBalance(uint256 amount_) { + modifier givenRouterHasBalance( + uint256 amount_ + ) { _quoteToken.mint(address(_auctionHouse), amount_); _; } diff --git a/test/AuctionHouse/sendPayout.t.sol b/test/AuctionHouse/sendPayout.t.sol index d22587766..737bc0585 100644 --- a/test/AuctionHouse/sendPayout.t.sol +++ b/test/AuctionHouse/sendPayout.t.sol @@ -102,7 +102,9 @@ contract SendPayoutTest is Test, Permit2User { _; } - modifier givenAuctionHouseHasBalance(uint256 amount_) { + modifier givenAuctionHouseHasBalance( + uint256 amount_ + ) { _payoutToken.mint(address(_auctionHouse), amount_); _; } diff --git a/test/BatchAuctionHouse/AuctionHouseTest.sol b/test/BatchAuctionHouse/AuctionHouseTest.sol index 6552921f6..170616ebb 100644 --- a/test/BatchAuctionHouse/AuctionHouseTest.sol +++ b/test/BatchAuctionHouse/AuctionHouseTest.sol @@ -150,11 +150,15 @@ abstract contract BatchAuctionHouseTest is Test, Permit2User, WithSalts, TestSal // ===== Helper Functions ===== // - function _scaleQuoteTokenAmount(uint256 amount_) internal view returns (uint256) { + function _scaleQuoteTokenAmount( + uint256 amount_ + ) internal view returns (uint256) { return FixedPointMathLib.mulDivDown(amount_, 10 ** _quoteToken.decimals(), _BASE_SCALE); } - function _scaleBaseTokenAmount(uint256 amount_) internal view returns (uint256) { + function _scaleBaseTokenAmount( + uint256 amount_ + ) internal view returns (uint256) { return FixedPointMathLib.mulDivDown(amount_, 10 ** _baseToken.decimals(), _BASE_SCALE); } @@ -186,12 +190,16 @@ abstract contract BatchAuctionHouseTest is Test, Permit2User, WithSalts, TestSal // ===== Modifiers ===== // - modifier givenLotHasCapacity(uint96 capacity_) { + modifier givenLotHasCapacity( + uint96 capacity_ + ) { _auctionParams.capacity = capacity_; _; } - function _setBaseTokenDecimals(uint8 decimals_) internal { + function _setBaseTokenDecimals( + uint8 decimals_ + ) internal { _baseToken = new MockFeeOnTransferERC20("Base Token", "BASE", decimals_); uint256 lotCapacity = _scaleBaseTokenAmount(_LOT_CAPACITY); @@ -203,19 +211,25 @@ abstract contract BatchAuctionHouseTest is Test, Permit2User, WithSalts, TestSal _auctionParams.capacity = lotCapacity; } - modifier givenBaseTokenHasDecimals(uint8 decimals_) { + modifier givenBaseTokenHasDecimals( + uint8 decimals_ + ) { _setBaseTokenDecimals(decimals_); _; } - function _setQuoteTokenDecimals(uint8 decimals_) internal { + function _setQuoteTokenDecimals( + uint8 decimals_ + ) internal { _quoteToken = new MockFeeOnTransferERC20("Quote Token", "QUOTE", decimals_); // Update routing params _routingParams.quoteToken = address(_quoteToken); } - modifier givenQuoteTokenHasDecimals(uint8 decimals_) { + modifier givenQuoteTokenHasDecimals( + uint8 decimals_ + ) { _setQuoteTokenDecimals(decimals_); _; } @@ -346,7 +360,9 @@ abstract contract BatchAuctionHouseTest is Test, Permit2User, WithSalts, TestSal _; } - modifier whenPermit2ApprovalIsProvided(uint256 amount_) { + modifier whenPermit2ApprovalIsProvided( + uint256 amount_ + ) { // Approve the Permit2 contract to spend the quote token vm.prank(_bidder); _quoteToken.approve(_permit2Address, type(uint256).max); @@ -373,22 +389,30 @@ abstract contract BatchAuctionHouseTest is Test, Permit2User, WithSalts, TestSal _quoteToken.approve(address(_auctionHouse), amount_); } - modifier givenUserHasQuoteTokenBalance(uint256 amount_) { + modifier givenUserHasQuoteTokenBalance( + uint256 amount_ + ) { _sendUserQuoteTokenBalance(_bidder, amount_); _; } - modifier givenUserHasQuoteTokenAllowance(uint256 amount_) { + modifier givenUserHasQuoteTokenAllowance( + uint256 amount_ + ) { _approveUserQuoteTokenAllowance(_bidder, amount_); _; } - modifier givenSellerHasBaseTokenBalance(uint256 amount_) { + modifier givenSellerHasBaseTokenBalance( + uint256 amount_ + ) { _baseToken.mint(_SELLER, amount_); _; } - modifier givenSellerHasBaseTokenAllowance(uint256 amount_) { + modifier givenSellerHasBaseTokenAllowance( + uint256 amount_ + ) { vm.prank(_SELLER); _baseToken.approve(address(_auctionHouse), amount_); _; @@ -429,12 +453,16 @@ abstract contract BatchAuctionHouseTest is Test, Permit2User, WithSalts, TestSal _; } - modifier givenCallbackHasBaseTokenBalance(uint256 amount_) { + modifier givenCallbackHasBaseTokenBalance( + uint256 amount_ + ) { _baseToken.mint(address(_callback), amount_); _; } - modifier givenCallbackHasBaseTokenAllowance(uint256 amount_) { + modifier givenCallbackHasBaseTokenAllowance( + uint256 amount_ + ) { vm.prank(address(_callback)); _baseToken.approve(address(_auctionHouse), amount_); _; @@ -517,7 +545,9 @@ abstract contract BatchAuctionHouseTest is Test, Permit2User, WithSalts, TestSal _; } - function _setMaxReferrerFee(uint24 fee_) internal { + function _setMaxReferrerFee( + uint24 fee_ + ) internal { vm.prank(_OWNER); _auctionHouse.setFee(_auctionModuleKeycode, IFeeManager.FeeType.MaxReferrer, fee_); _maxReferrerFeePercentActual = fee_; @@ -528,12 +558,16 @@ abstract contract BatchAuctionHouseTest is Test, Permit2User, WithSalts, TestSal _; } - function _setReferrerFee(uint24 fee_) internal { + function _setReferrerFee( + uint24 fee_ + ) internal { _referrerFeePercentActual = fee_; _routingParams.referrerFee = fee_; } - modifier givenReferrerFee(uint24 fee_) { + modifier givenReferrerFee( + uint24 fee_ + ) { _setReferrerFee(fee_); _; } @@ -543,7 +577,9 @@ abstract contract BatchAuctionHouseTest is Test, Permit2User, WithSalts, TestSal _; } - function _setCuratorFee(uint24 fee_) internal { + function _setCuratorFee( + uint24 fee_ + ) internal { vm.prank(_CURATOR); _auctionHouse.setCuratorFee(_auctionModuleKeycode, fee_); _curatorFeePercentActual = fee_; @@ -562,7 +598,9 @@ abstract contract BatchAuctionHouseTest is Test, Permit2User, WithSalts, TestSal _; } - function _setProtocolFee(uint24 fee_) internal { + function _setProtocolFee( + uint24 fee_ + ) internal { vm.prank(_OWNER); _auctionHouse.setFee(_auctionModuleKeycode, IFeeManager.FeeType.Protocol, fee_); _protocolFeePercentActual = fee_; @@ -573,7 +611,9 @@ abstract contract BatchAuctionHouseTest is Test, Permit2User, WithSalts, TestSal _; } - modifier givenBidIsClaimed(uint64 bidId_) { + modifier givenBidIsClaimed( + uint64 bidId_ + ) { uint64[] memory bids = new uint64[](1); bids[0] = bidId_; @@ -587,7 +627,9 @@ abstract contract BatchAuctionHouseTest is Test, Permit2User, WithSalts, TestSal _; } - modifier givenRecipientIsOnBaseTokenBlacklist(address recipient_) { + modifier givenRecipientIsOnBaseTokenBlacklist( + address recipient_ + ) { _baseToken.setBlacklist(recipient_, true); _; } @@ -597,14 +639,18 @@ abstract contract BatchAuctionHouseTest is Test, Permit2User, WithSalts, TestSal _; } - modifier givenRecipientIsOnQuoteTokenBlacklist(address recipient_) { + modifier givenRecipientIsOnQuoteTokenBlacklist( + address recipient_ + ) { _quoteToken.setBlacklist(recipient_, true); _; } // ===== Helpers ===== // - function _getLotRouting(uint96 lotId_) internal view returns (IAuctionHouse.Routing memory) { + function _getLotRouting( + uint96 lotId_ + ) internal view returns (IAuctionHouse.Routing memory) { ( address seller_, address baseToken_, @@ -630,7 +676,9 @@ abstract contract BatchAuctionHouseTest is Test, Permit2User, WithSalts, TestSal }); } - function _getLotFees(uint96 lotId_) internal view returns (IAuctionHouse.FeeData memory) { + function _getLotFees( + uint96 lotId_ + ) internal view returns (IAuctionHouse.FeeData memory) { ( address curator_, bool curated_, @@ -648,7 +696,9 @@ abstract contract BatchAuctionHouseTest is Test, Permit2User, WithSalts, TestSal }); } - function _getLotData(uint96 lotId_) internal view returns (IAuction.Lot memory) { + function _getLotData( + uint96 lotId_ + ) internal view returns (IAuction.Lot memory) { return _auctionModule.getLot(lotId_); } } diff --git a/test/BatchAuctionHouse/claimBids.t.sol b/test/BatchAuctionHouse/claimBids.t.sol index 8536cc546..a3461c4d4 100644 --- a/test/BatchAuctionHouse/claimBids.t.sol +++ b/test/BatchAuctionHouse/claimBids.t.sol @@ -257,12 +257,16 @@ contract BatchClaimBidsTest is BatchAuctionHouseTest { _; } - modifier givenBidderTwoHasQuoteTokenBalance(uint256 amount_) { + modifier givenBidderTwoHasQuoteTokenBalance( + uint256 amount_ + ) { _quoteToken.mint(_BIDDER_TWO, amount_); _; } - modifier givenBidderTwoHasQuoteTokenAllowance(uint256 amount_) { + modifier givenBidderTwoHasQuoteTokenAllowance( + uint256 amount_ + ) { vm.prank(_BIDDER_TWO); _quoteToken.approve(address(_auctionHouse), amount_); _; diff --git a/test/BatchAuctionHouse/settle.t.sol b/test/BatchAuctionHouse/settle.t.sol index 1c6b8d9d2..d79a92307 100644 --- a/test/BatchAuctionHouse/settle.t.sol +++ b/test/BatchAuctionHouse/settle.t.sol @@ -314,7 +314,9 @@ contract BatchSettleTest is BatchAuctionHouseTest { _; } - modifier givenAuctionHouseHasQuoteTokenBalance(uint256 amount_) { + modifier givenAuctionHouseHasQuoteTokenBalance( + uint256 amount_ + ) { _quoteToken.mint(address(_auctionHouse), amount_); _; } diff --git a/test/callbacks/MockCallback.sol b/test/callbacks/MockCallback.sol index 8cc282189..1cda4931b 100644 --- a/test/callbacks/MockCallback.sol +++ b/test/callbacks/MockCallback.sol @@ -120,8 +120,7 @@ contract MockCallback is BaseCallback { if (prefunded_) { // Do nothing, as tokens have already been transferred - } - else { + } else { if (onPurchaseMultiplier > 0) { payout_ = uint96(uint256(payout_) * onPurchaseMultiplier / 100e2); } @@ -159,43 +158,63 @@ contract MockCallback is BaseCallback { lotSettled[lotId_] = true; } - function setOnCreateReverts(bool reverts_) external { + function setOnCreateReverts( + bool reverts_ + ) external { onCreateReverts = reverts_; } - function setOnCancelReverts(bool reverts_) external { + function setOnCancelReverts( + bool reverts_ + ) external { onCancelReverts = reverts_; } - function setOnCurateReverts(bool reverts_) external { + function setOnCurateReverts( + bool reverts_ + ) external { onCurateReverts = reverts_; } - function setOnPurchaseReverts(bool reverts_) external { + function setOnPurchaseReverts( + bool reverts_ + ) external { onPurchaseReverts = reverts_; } - function setOnBidReverts(bool reverts_) external { + function setOnBidReverts( + bool reverts_ + ) external { onBidReverts = reverts_; } - function setOnSettleReverts(bool reverts_) external { + function setOnSettleReverts( + bool reverts_ + ) external { onSettleReverts = reverts_; } - function setOnCreateMultiplier(uint48 multiplier_) external { + function setOnCreateMultiplier( + uint48 multiplier_ + ) external { onCreateMultiplier = multiplier_; } - function setOnCurateMultiplier(uint48 multiplier_) external { + function setOnCurateMultiplier( + uint48 multiplier_ + ) external { onCurateMultiplier = multiplier_; } - function setOnPurchaseMultiplier(uint48 multiplier_) external { + function setOnPurchaseMultiplier( + uint48 multiplier_ + ) external { onPurchaseMultiplier = multiplier_; } - function setAllowlistEnabled(bool enabled_) external { + function setAllowlistEnabled( + bool enabled_ + ) external { allowlistEnabled = enabled_; } diff --git a/test/lib/BidEncoding.t.sol b/test/lib/BidEncoding.t.sol index 8230ec5a3..881da743f 100644 --- a/test/lib/BidEncoding.t.sol +++ b/test/lib/BidEncoding.t.sol @@ -34,7 +34,9 @@ contract BidEncodingTest is Test { // ========== decode ========== // - function testFuzz_decode(bytes32 key) public { + function testFuzz_decode( + bytes32 key + ) public { (uint64 bidId, uint96 amountIn, uint96 amountOut) = key.decode(); uint64 eId = uint64(uint256(key >> 192)); diff --git a/test/lib/ECIES/decrypt.t.sol b/test/lib/ECIES/decrypt.t.sol index db265703b..4ca035965 100644 --- a/test/lib/ECIES/decrypt.t.sol +++ b/test/lib/ECIES/decrypt.t.sol @@ -33,7 +33,9 @@ contract ECIESDecryptTest is Test { ECIES.decrypt(ciphertext, ciphertextPubKey, recipientPrivateKey, salt); } - function testRevert_privateKeyTooLarge(uint256 privateKey_) public { + function testRevert_privateKeyTooLarge( + uint256 privateKey_ + ) public { vm.assume(privateKey_ >= ECIES.GROUP_ORDER); // Setup encryption parameters diff --git a/test/lib/ECIES/encrypt.t.sol b/test/lib/ECIES/encrypt.t.sol index 49da37227..179ed8649 100644 --- a/test/lib/ECIES/encrypt.t.sol +++ b/test/lib/ECIES/encrypt.t.sol @@ -33,7 +33,9 @@ contract ECIESEncryptTest is Test { ECIES.encrypt(message, recipientPubKey, privateKey, salt); } - function testRevert_privateKeyTooLarge(uint256 privateKey_) public { + function testRevert_privateKeyTooLarge( + uint256 privateKey_ + ) public { vm.assume(privateKey_ >= ECIES.GROUP_ORDER); // Setup encryption parameters diff --git a/test/lib/ECIES/isValid.t.sol b/test/lib/ECIES/isValid.t.sol index 728e1142f..3cc913ad4 100644 --- a/test/lib/ECIES/isValid.t.sol +++ b/test/lib/ECIES/isValid.t.sol @@ -59,22 +59,30 @@ contract ECIESisValidTest is Test { _; } - modifier whenXLessThanFieldModulus(uint256 x) { + modifier whenXLessThanFieldModulus( + uint256 x + ) { if (x >= FIELD_MODULUS) return; _; } - modifier whenYLessThanFieldModulus(uint256 y) { + modifier whenYLessThanFieldModulus( + uint256 y + ) { if (y >= FIELD_MODULUS) return; _; } - modifier whenXGreaterThanOrEqualToFieldModulus(uint256 x) { + modifier whenXGreaterThanOrEqualToFieldModulus( + uint256 x + ) { if (x < FIELD_MODULUS) return; _; } - modifier whenYGreaterThanOrEqualToFieldModulus(uint256 y) { + modifier whenYGreaterThanOrEqualToFieldModulus( + uint256 y + ) { if (y < FIELD_MODULUS) return; _; } diff --git a/test/lib/mocks/MockFeeOnTransferERC20.sol b/test/lib/mocks/MockFeeOnTransferERC20.sol index d57153894..6789d01e6 100644 --- a/test/lib/mocks/MockFeeOnTransferERC20.sol +++ b/test/lib/mocks/MockFeeOnTransferERC20.sol @@ -15,11 +15,15 @@ contract MockFeeOnTransferERC20 is MockERC20 { uint8 decimals_ ) MockERC20(name_, symbol_, decimals_) {} - function setTransferFee(uint256 transferFee_) external { + function setTransferFee( + uint256 transferFee_ + ) external { transferFee = transferFee_; } - function setRevertOnZero(bool revertOnZero_) external { + function setRevertOnZero( + bool revertOnZero_ + ) external { revertOnZero = revertOnZero_; } diff --git a/test/modules/Auction/MockAtomicAuctionModule.sol b/test/modules/Auction/MockAtomicAuctionModule.sol index 368a5b2d1..086d88243 100644 --- a/test/modules/Auction/MockAtomicAuctionModule.sol +++ b/test/modules/Auction/MockAtomicAuctionModule.sol @@ -18,7 +18,9 @@ contract MockAtomicAuctionModule is AtomicAuctionModule { mapping(uint96 lotId => bool isCancelled) public cancelled; - constructor(address _owner) AuctionModule(_owner) { + constructor( + address _owner + ) AuctionModule(_owner) { minAuctionDuration = 1 days; } @@ -28,7 +30,9 @@ contract MockAtomicAuctionModule is AtomicAuctionModule { function _auction(uint96, Lot memory, bytes memory) internal virtual override {} - function _cancelAuction(uint96 id_) internal override { + function _cancelAuction( + uint96 id_ + ) internal override { cancelled[id_] = true; } @@ -64,7 +68,9 @@ contract MockAtomicAuctionModule is AtomicAuctionModule { payoutData[lotId_] = multiplier_; } - function setPurchaseReverts(bool reverts_) external virtual { + function setPurchaseReverts( + bool reverts_ + ) external virtual { purchaseReverts = reverts_; } @@ -72,7 +78,11 @@ contract MockAtomicAuctionModule is AtomicAuctionModule { function priceFor(uint96 lotId_, uint256 payout_) external view override returns (uint256) {} - function maxPayout(uint96 lotId_) external view override returns (uint256) {} + function maxPayout( + uint96 lotId_ + ) external view override returns (uint256) {} - function maxAmountAccepted(uint96 lotId_) external view override returns (uint256) {} + function maxAmountAccepted( + uint96 lotId_ + ) external view override returns (uint256) {} } diff --git a/test/modules/Auction/MockBatchAuctionModule.sol b/test/modules/Auction/MockBatchAuctionModule.sol index 2f8ef5aa7..18840d055 100644 --- a/test/modules/Auction/MockBatchAuctionModule.sol +++ b/test/modules/Auction/MockBatchAuctionModule.sol @@ -49,7 +49,9 @@ contract MockBatchAuctionModule is BatchAuctionModule { mapping(uint96 => bool) public settlementFinished; - constructor(address _owner) AuctionModule(_owner) { + constructor( + address _owner + ) AuctionModule(_owner) { minAuctionDuration = 1 days; dedicatedSettlePeriod = 1 days; } @@ -60,7 +62,9 @@ contract MockBatchAuctionModule is BatchAuctionModule { function _auction(uint96, Lot memory, bytes memory) internal virtual override {} - function _cancelAuction(uint96 id_) internal override {} + function _cancelAuction( + uint96 id_ + ) internal override {} function _bid( uint96 lotId_, @@ -175,7 +179,9 @@ contract MockBatchAuctionModule is BatchAuctionModule { return (lotData[lotId_].purchased, lotData[lotId_].sold, settlementFinished[lotId_], ""); } - function _abort(uint96 lotId_) internal override { + function _abort( + uint96 lotId_ + ) internal override { // Update status lotStatus[lotId_] = LotStatus.Settled; } @@ -209,21 +215,27 @@ contract MockBatchAuctionModule is BatchAuctionModule { } } - function _revertIfLotSettled(uint96 lotId_) internal view virtual override { + function _revertIfLotSettled( + uint96 lotId_ + ) internal view virtual override { // Check that the lot has not been settled if (lotStatus[lotId_] == LotStatus.Settled) { revert IAuction.Auction_LotNotActive(lotId_); } } - function _revertIfLotNotSettled(uint96 lotId_) internal view virtual override { + function _revertIfLotNotSettled( + uint96 lotId_ + ) internal view virtual override { // Check that the lot has been settled if (lotStatus[lotId_] != LotStatus.Settled) { revert IAuction.Auction_InvalidParams(); } } - function getNumBids(uint96) external view override returns (uint256) { + function getNumBids( + uint96 + ) external view override returns (uint256) { return bidIds.length; } diff --git a/test/modules/Auction/auction.t.sol b/test/modules/Auction/auction.t.sol index b9722c7ad..4bcbd8024 100644 --- a/test/modules/Auction/auction.t.sol +++ b/test/modules/Auction/auction.t.sol @@ -83,7 +83,9 @@ contract AuctionTest is Test, Permit2User { // [X] creates the auction lot with a custom duration // [X] creates the auction lot when the start time is in the future - function testReverts_whenStartTimeIsInThePast(uint48 timestamp_) external { + function testReverts_whenStartTimeIsInThePast( + uint48 timestamp_ + ) external { console2.log("block.timestamp", block.timestamp); uint48 start = uint48(bound(timestamp_, 1, block.timestamp - 1)); @@ -99,7 +101,9 @@ contract AuctionTest is Test, Permit2User { _auctionHouse.auction(_routingParams, _auctionParams, _infoHash); } - function testReverts_whenDurationIsLessThanMinimum(uint48 duration_) external { + function testReverts_whenDurationIsLessThanMinimum( + uint48 duration_ + ) external { uint48 duration = uint48(bound(duration_, 0, _mockAuctionModule.minAuctionDuration() - 1)); // Update auction params @@ -151,7 +155,9 @@ contract AuctionTest is Test, Permit2User { assertEq(lot.conclusion, lot.start + _auctionParams.duration); } - function test_success_withCustomDuration(uint48 duration_) external { + function test_success_withCustomDuration( + uint48 duration_ + ) external { uint48 duration = uint48(bound(duration_, _mockAuctionModule.minAuctionDuration(), 1 days)); // Update auction params @@ -164,7 +170,9 @@ contract AuctionTest is Test, Permit2User { assertEq(lot.conclusion, lot.start + _auctionParams.duration); } - function test_success_withFutureStartTime(uint48 timestamp_) external { + function test_success_withFutureStartTime( + uint48 timestamp_ + ) external { uint48 start = uint48(bound(timestamp_, block.timestamp + 1, block.timestamp + 1 days)); // Update auction params diff --git a/test/modules/Auction/cancel.t.sol b/test/modules/Auction/cancel.t.sol index aac435d7b..961d925ce 100644 --- a/test/modules/Auction/cancel.t.sol +++ b/test/modules/Auction/cancel.t.sol @@ -113,7 +113,9 @@ contract CancelTest is Test, Permit2User { _mockAuctionModule.cancelAuction(_lotId); } - function testReverts_conclusion(uint48 conclusionElapsed_) external whenLotIsCreated { + function testReverts_conclusion( + uint48 conclusionElapsed_ + ) external whenLotIsCreated { uint48 conclusionElapsed = uint48(bound(conclusionElapsed_, 0, 1 days)); // Warp to the conclusion diff --git a/test/modules/Condenser/MockCondenserModule.sol b/test/modules/Condenser/MockCondenserModule.sol index 005f498d0..8335c5b4f 100644 --- a/test/modules/Condenser/MockCondenserModule.sol +++ b/test/modules/Condenser/MockCondenserModule.sol @@ -11,7 +11,9 @@ import {MockDerivativeModule} from "../derivatives/mocks/MockDerivativeModule.so import {CondenserModule} from "../../../src/modules/Condenser.sol"; contract MockCondenserModule is CondenserModule { - constructor(address _owner) Module(_owner) {} + constructor( + address _owner + ) Module(_owner) {} function VEECODE() public pure virtual override returns (Veecode) { return wrapVeecode(toKeycode("COND"), 1); diff --git a/test/modules/Modules/Keycode.t.sol b/test/modules/Modules/Keycode.t.sol index 3a85c114d..d7040b6e1 100644 --- a/test/modules/Modules/Keycode.t.sol +++ b/test/modules/Modules/Keycode.t.sol @@ -120,7 +120,9 @@ contract KeycodeTest is Test { ensureValidVeecode(t1Veecode); } - function testRevert_ensureValidVeecode_invalidVersion(uint8 version_) external { + function testRevert_ensureValidVeecode_invalidVersion( + uint8 version_ + ) external { // Restrict the version to outside of 0-99 vm.assume(!(version_ >= 0 && version_ <= 99)); diff --git a/test/modules/Modules/MockModule.sol b/test/modules/Modules/MockModule.sol index 4c145daa0..04f04363e 100644 --- a/test/modules/Modules/MockModule.sol +++ b/test/modules/Modules/MockModule.sol @@ -5,7 +5,9 @@ pragma solidity 0.8.19; import {Module, Veecode, toKeycode, wrapVeecode} from "../../../src/modules/Modules.sol"; contract MockModuleV1 is Module { - constructor(address _owner) Module(_owner) {} + constructor( + address _owner + ) Module(_owner) {} function VEECODE() public pure override returns (Veecode) { return wrapVeecode(toKeycode("MOCK"), 1); @@ -23,7 +25,9 @@ contract MockModuleV1 is Module { } contract MockModuleV2 is Module { - constructor(address _owner) Module(_owner) {} + constructor( + address _owner + ) Module(_owner) {} function VEECODE() public pure override returns (Veecode) { return wrapVeecode(toKeycode("MOCK"), 2); @@ -31,7 +35,9 @@ contract MockModuleV2 is Module { } contract MockModuleV3 is Module { - constructor(address _owner) Module(_owner) {} + constructor( + address _owner + ) Module(_owner) {} function VEECODE() public pure override returns (Veecode) { return wrapVeecode(toKeycode("MOCK"), 3); @@ -39,7 +45,9 @@ contract MockModuleV3 is Module { } contract MockModuleV0 is Module { - constructor(address _owner) Module(_owner) {} + constructor( + address _owner + ) Module(_owner) {} function VEECODE() public pure override returns (Veecode) { return wrapVeecode(toKeycode("MOCK"), 0); @@ -47,7 +55,9 @@ contract MockModuleV0 is Module { } contract MockInvalidModule is Module { - constructor(address _owner) Module(_owner) {} + constructor( + address _owner + ) Module(_owner) {} function VEECODE() public pure override returns (Veecode) { return wrapVeecode(toKeycode("INVA_"), 100); diff --git a/test/modules/Modules/MockWithModules.sol b/test/modules/Modules/MockWithModules.sol index a22f6a034..fac45a010 100644 --- a/test/modules/Modules/MockWithModules.sol +++ b/test/modules/Modules/MockWithModules.sol @@ -7,9 +7,13 @@ import {WithModules, Veecode} from "../../../src/modules/Modules.sol"; import {MockModuleV1} from "./MockModule.sol"; contract MockWithModules is WithModules { - constructor(address _owner) WithModules(_owner) {} + constructor( + address _owner + ) WithModules(_owner) {} - function callProhibited(Veecode veecode_) external view returns (bool) { + function callProhibited( + Veecode veecode_ + ) external view returns (bool) { MockModuleV1 module = MockModuleV1(_getModuleIfInstalled(veecode_)); return module.prohibited(); diff --git a/test/modules/auctions/EMP/EMPTest.sol b/test/modules/auctions/EMP/EMPTest.sol index 872e8047a..cabc79930 100644 --- a/test/modules/auctions/EMP/EMPTest.sol +++ b/test/modules/auctions/EMP/EMPTest.sol @@ -85,7 +85,9 @@ abstract contract EmpTest is Test, Permit2User { // ======== Modifiers ======== // - function _setQuoteTokenDecimals(uint8 decimals_) internal { + function _setQuoteTokenDecimals( + uint8 decimals_ + ) internal { _quoteTokenDecimals = decimals_; _auctionDataParams.minPrice = _scaleQuoteTokenAmount(_MIN_PRICE); @@ -94,28 +96,38 @@ abstract contract EmpTest is Test, Permit2User { _auctionParams.implParams = abi.encode(_auctionDataParams); } - modifier givenQuoteTokenDecimals(uint8 decimals_) { + modifier givenQuoteTokenDecimals( + uint8 decimals_ + ) { _setQuoteTokenDecimals(decimals_); _; } - function _setBaseTokenDecimals(uint8 decimals_) internal { + function _setBaseTokenDecimals( + uint8 decimals_ + ) internal { _baseTokenDecimals = decimals_; _auctionParams.capacity = _scaleBaseTokenAmount(_LOT_CAPACITY); } - modifier givenBaseTokenDecimals(uint8 decimals_) { + modifier givenBaseTokenDecimals( + uint8 decimals_ + ) { _setBaseTokenDecimals(decimals_); _; } - modifier givenLotCapacity(uint256 capacity_) { + modifier givenLotCapacity( + uint256 capacity_ + ) { _auctionParams.capacity = capacity_; _; } - modifier givenMinimumPrice(uint256 price_) { + modifier givenMinimumPrice( + uint256 price_ + ) { _auctionDataParams.minPrice = price_; _auctionParams.implParams = abi.encode(_auctionDataParams); @@ -123,24 +135,32 @@ abstract contract EmpTest is Test, Permit2User { _; } - modifier givenStartTimestamp(uint48 start_) { + modifier givenStartTimestamp( + uint48 start_ + ) { _auctionParams.start = start_; _; } - modifier givenDuration(uint48 duration_) { + modifier givenDuration( + uint48 duration_ + ) { _auctionParams.duration = duration_; _; } - modifier givenMinimumFillPercentage(uint24 percentage_) { + modifier givenMinimumFillPercentage( + uint24 percentage_ + ) { _auctionDataParams.minFillPercent = percentage_; _auctionParams.implParams = abi.encode(_auctionDataParams); _; } - modifier givenMinimumBidSize(uint256 amount_) { + modifier givenMinimumBidSize( + uint256 amount_ + ) { _auctionDataParams.minBidSize = amount_; _auctionParams.implParams = abi.encode(_auctionDataParams); @@ -174,7 +194,9 @@ abstract contract EmpTest is Test, Permit2User { _; } - function _formatBid(uint256 amountOut_) internal pure returns (uint256) { + function _formatBid( + uint256 amountOut_ + ) internal pure returns (uint256) { uint256 formattedAmountOut; { uint128 subtracted; @@ -258,7 +280,9 @@ abstract contract EmpTest is Test, Permit2User { _; } - modifier givenBidIsRefunded(uint64 bidId_) { + modifier givenBidIsRefunded( + uint64 bidId_ + ) { // Find bid index // Get number of bids from module @@ -283,7 +307,9 @@ abstract contract EmpTest is Test, Permit2User { _; } - modifier givenBidIsClaimed(uint64 bidId_) { + modifier givenBidIsClaimed( + uint64 bidId_ + ) { uint64[] memory bidIds = new uint64[](1); bidIds[0] = bidId_; @@ -367,11 +393,15 @@ abstract contract EmpTest is Test, Permit2User { // ======== Internal Functions ======== // - function _scaleQuoteTokenAmount(uint256 amount_) internal view returns (uint256) { + function _scaleQuoteTokenAmount( + uint256 amount_ + ) internal view returns (uint256) { return Math.fullMulDiv(amount_, 10 ** _quoteTokenDecimals, _BASE_SCALE); } - function _scaleBaseTokenAmount(uint256 amount_) internal view returns (uint256) { + function _scaleBaseTokenAmount( + uint256 amount_ + ) internal view returns (uint256) { return Math.fullMulDiv(amount_, 10 ** _baseTokenDecimals, _BASE_SCALE); } @@ -406,7 +436,9 @@ abstract contract EmpTest is Test, Permit2User { }); } - function _getAuctionLot(uint96 lotId_) internal view returns (IAuction.Lot memory) { + function _getAuctionLot( + uint96 lotId_ + ) internal view returns (IAuction.Lot memory) { return _module.getLot(lotId_); } diff --git a/test/modules/auctions/EMP/cancelAuction.t.sol b/test/modules/auctions/EMP/cancelAuction.t.sol index a84890b4a..28886be43 100644 --- a/test/modules/auctions/EMP/cancelAuction.t.sol +++ b/test/modules/auctions/EMP/cancelAuction.t.sol @@ -44,7 +44,9 @@ contract EmpCancelAuctionTest is EmpTest { _cancelAuctionLot(); } - function test_auctionConcluded_reverts(uint48 conclusionElapsed_) public givenLotIsCreated { + function test_auctionConcluded_reverts( + uint48 conclusionElapsed_ + ) public givenLotIsCreated { uint48 conclusionElapsed = uint48(bound(conclusionElapsed_, 0, 1 days)); // Warp to the conclusion diff --git a/test/modules/auctions/EMP/settle.t.sol b/test/modules/auctions/EMP/settle.t.sol index b6cd76c37..484befddc 100644 --- a/test/modules/auctions/EMP/settle.t.sol +++ b/test/modules/auctions/EMP/settle.t.sol @@ -1072,7 +1072,9 @@ contract EmpSettleTest is EmpTest { _; } - function _setSettlementComplete(bool complete_) internal { + function _setSettlementComplete( + bool complete_ + ) internal { _expectedSettlementComplete = complete_; } diff --git a/test/modules/auctions/FPB/FPBTest.sol b/test/modules/auctions/FPB/FPBTest.sol index 3727843a2..415b528a1 100644 --- a/test/modules/auctions/FPB/FPBTest.sol +++ b/test/modules/auctions/FPB/FPBTest.sol @@ -61,7 +61,9 @@ abstract contract FpbTest is Test, Permit2User { // ========== MODIFIERS ========== // - function _setQuoteTokenDecimals(uint8 decimals_) internal { + function _setQuoteTokenDecimals( + uint8 decimals_ + ) internal { _quoteTokenDecimals = decimals_; _fpbParams.price = _scaleQuoteTokenAmount(_PRICE); @@ -73,12 +75,16 @@ abstract contract FpbTest is Test, Permit2User { } } - modifier givenQuoteTokenDecimals(uint8 decimals_) { + modifier givenQuoteTokenDecimals( + uint8 decimals_ + ) { _setQuoteTokenDecimals(decimals_); _; } - function _setBaseTokenDecimals(uint8 decimals_) internal { + function _setBaseTokenDecimals( + uint8 decimals_ + ) internal { _baseTokenDecimals = decimals_; if (!_auctionParams.capacityInQuote) { @@ -86,26 +92,36 @@ abstract contract FpbTest is Test, Permit2User { } } - modifier givenBaseTokenDecimals(uint8 decimals_) { + modifier givenBaseTokenDecimals( + uint8 decimals_ + ) { _setBaseTokenDecimals(decimals_); _; } - function _setCapacity(uint256 capacity_) internal { + function _setCapacity( + uint256 capacity_ + ) internal { _auctionParams.capacity = capacity_; } - modifier givenLotCapacity(uint256 capacity_) { + modifier givenLotCapacity( + uint256 capacity_ + ) { _setCapacity(capacity_); _; } - modifier givenStartTimestamp(uint48 start_) { + modifier givenStartTimestamp( + uint48 start_ + ) { _auctionParams.start = start_; _; } - modifier givenDuration(uint48 duration_) { + modifier givenDuration( + uint48 duration_ + ) { _auctionParams.duration = duration_; _; } @@ -120,22 +136,30 @@ abstract contract FpbTest is Test, Permit2User { _; } - function _setPrice(uint256 price_) internal { + function _setPrice( + uint256 price_ + ) internal { _fpbParams.price = price_; _auctionParams.implParams = abi.encode(_fpbParams); } - modifier givenPrice(uint256 price_) { + modifier givenPrice( + uint256 price_ + ) { _setPrice(price_); _; } - function _setMinFillPercent(uint24 minFillPercent_) internal { + function _setMinFillPercent( + uint24 minFillPercent_ + ) internal { _fpbParams.minFillPercent = minFillPercent_; _auctionParams.implParams = abi.encode(_fpbParams); } - modifier givenMinFillPercent(uint24 minFillPercent_) { + modifier givenMinFillPercent( + uint24 minFillPercent_ + ) { _setMinFillPercent(minFillPercent_); _; } @@ -168,12 +192,16 @@ abstract contract FpbTest is Test, Permit2User { _; } - function _createBid(uint256 amount_) internal { + function _createBid( + uint256 amount_ + ) internal { vm.prank(address(_auctionHouse)); _module.bid(_lotId, _BIDDER, _REFERRER, amount_, abi.encode("")); } - modifier givenBidIsCreated(uint256 amount_) { + modifier givenBidIsCreated( + uint256 amount_ + ) { _createBid(amount_); _; } @@ -208,12 +236,16 @@ abstract contract FpbTest is Test, Permit2User { _; } - function _refundBid(uint64 bidId_) internal returns (uint256 refundAmount) { + function _refundBid( + uint64 bidId_ + ) internal returns (uint256 refundAmount) { vm.prank(address(_auctionHouse)); return _module.refundBid(_lotId, bidId_, 0, _BIDDER); } - modifier givenBidIsRefunded(uint64 bidId_) { + modifier givenBidIsRefunded( + uint64 bidId_ + ) { _refundBid(bidId_); _; } @@ -228,7 +260,9 @@ abstract contract FpbTest is Test, Permit2User { return _module.claimBids(_lotId, bidIds); } - modifier givenBidIsClaimed(uint64 bidId_) { + modifier givenBidIsClaimed( + uint64 bidId_ + ) { uint64[] memory bidIds = new uint64[](1); bidIds[0] = bidId_; @@ -239,11 +273,15 @@ abstract contract FpbTest is Test, Permit2User { // ======== Internal Functions ======== // - function _scaleQuoteTokenAmount(uint256 amount_) internal view returns (uint256) { + function _scaleQuoteTokenAmount( + uint256 amount_ + ) internal view returns (uint256) { return Math.mulDivDown(amount_, 10 ** _quoteTokenDecimals, _BASE_SCALE); } - function _scaleBaseTokenAmount(uint256 amount_) internal view returns (uint256) { + function _scaleBaseTokenAmount( + uint256 amount_ + ) internal view returns (uint256) { return Math.mulDivDown(amount_, 10 ** _baseTokenDecimals, _BASE_SCALE); } } diff --git a/test/modules/auctions/FPB/bid.t.sol b/test/modules/auctions/FPB/bid.t.sol index f4943e9bf..9369f5e1f 100644 --- a/test/modules/auctions/FPB/bid.t.sol +++ b/test/modules/auctions/FPB/bid.t.sol @@ -528,7 +528,9 @@ contract FpbBidTest is FpbTest { ); } - function test_partialFill_auctionPriceFuzz(uint256 price_) public { + function test_partialFill_auctionPriceFuzz( + uint256 price_ + ) public { // Given that the capacity is set, there is a maximum value to the price before the bidAmount hits uint96 // 11e18 * price / 1e18 <= type(uint96).max // price <= type(uint96).max / 10e18 diff --git a/test/modules/auctions/FPB/cancelAuction.t.sol b/test/modules/auctions/FPB/cancelAuction.t.sol index ea91d5b16..8ad00054a 100644 --- a/test/modules/auctions/FPB/cancelAuction.t.sol +++ b/test/modules/auctions/FPB/cancelAuction.t.sol @@ -42,7 +42,9 @@ contract FpbCancelAuctionTest is FpbTest { _cancelAuctionLot(); } - function test_auctionConcluded_reverts(uint48 conclusionElapsed_) public givenLotIsCreated { + function test_auctionConcluded_reverts( + uint48 conclusionElapsed_ + ) public givenLotIsCreated { uint48 conclusionElapsed = uint48(bound(conclusionElapsed_, 0, 1 days)); // Warp to the conclusion diff --git a/test/modules/auctions/FPS/FPSTest.sol b/test/modules/auctions/FPS/FPSTest.sol index c201d6875..106e18726 100644 --- a/test/modules/auctions/FPS/FPSTest.sol +++ b/test/modules/auctions/FPS/FPSTest.sol @@ -62,7 +62,9 @@ abstract contract FpsTest is Test, Permit2User { // ========== MODIFIERS ========== // - function _setQuoteTokenDecimals(uint8 decimals_) internal { + function _setQuoteTokenDecimals( + uint8 decimals_ + ) internal { _quoteTokenDecimals = decimals_; _fpaParams.price = _scaleQuoteTokenAmount(_PRICE); @@ -74,12 +76,16 @@ abstract contract FpsTest is Test, Permit2User { } } - modifier givenQuoteTokenDecimals(uint8 decimals_) { + modifier givenQuoteTokenDecimals( + uint8 decimals_ + ) { _setQuoteTokenDecimals(decimals_); _; } - function _setBaseTokenDecimals(uint8 decimals_) internal { + function _setBaseTokenDecimals( + uint8 decimals_ + ) internal { _baseTokenDecimals = decimals_; if (!_auctionParams.capacityInQuote) { @@ -87,22 +93,30 @@ abstract contract FpsTest is Test, Permit2User { } } - modifier givenBaseTokenDecimals(uint8 decimals_) { + modifier givenBaseTokenDecimals( + uint8 decimals_ + ) { _setBaseTokenDecimals(decimals_); _; } - modifier givenLotCapacity(uint256 capacity_) { + modifier givenLotCapacity( + uint256 capacity_ + ) { _auctionParams.capacity = capacity_; _; } - modifier givenStartTimestamp(uint48 start_) { + modifier givenStartTimestamp( + uint48 start_ + ) { _auctionParams.start = start_; _; } - modifier givenDuration(uint48 duration_) { + modifier givenDuration( + uint48 duration_ + ) { _auctionParams.duration = duration_; _; } @@ -122,18 +136,24 @@ abstract contract FpsTest is Test, Permit2User { _; } - modifier givenPrice(uint256 price_) { + modifier givenPrice( + uint256 price_ + ) { _fpaParams.price = price_; _auctionParams.implParams = abi.encode(_fpaParams); _; } - function _setMaxPayout(uint24 maxPayout_) internal { + function _setMaxPayout( + uint24 maxPayout_ + ) internal { _fpaParams.maxPayoutPercent = maxPayout_; _auctionParams.implParams = abi.encode(_fpaParams); } - modifier givenMaxPayout(uint24 maxPayout_) { + modifier givenMaxPayout( + uint24 maxPayout_ + ) { _setMaxPayout(maxPayout_); _; } @@ -177,15 +197,21 @@ abstract contract FpsTest is Test, Permit2User { // ======== Internal Functions ======== // - function _scaleQuoteTokenAmount(uint256 amount_) internal view returns (uint256) { + function _scaleQuoteTokenAmount( + uint256 amount_ + ) internal view returns (uint256) { return Math.mulDivDown(amount_, 10 ** _quoteTokenDecimals, _BASE_SCALE); } - function _scaleBaseTokenAmount(uint256 amount_) internal view returns (uint256) { + function _scaleBaseTokenAmount( + uint256 amount_ + ) internal view returns (uint256) { return Math.mulDivDown(amount_, 10 ** _baseTokenDecimals, _BASE_SCALE); } - function _getAuctionLot(uint96 lotId_) internal view returns (IAuction.Lot memory) { + function _getAuctionLot( + uint96 lotId_ + ) internal view returns (IAuction.Lot memory) { return _module.getLot(lotId_); } diff --git a/test/modules/auctions/FPS/auction.t.sol b/test/modules/auctions/FPS/auction.t.sol index 84771e550..9818db714 100644 --- a/test/modules/auctions/FPS/auction.t.sol +++ b/test/modules/auctions/FPS/auction.t.sol @@ -71,7 +71,9 @@ contract FpsCreateAuctionTest is FpsTest { _createAuctionLot(); } - function test_maxPayoutPercentIsLessThanMinimum_reverts(uint24 maxPayout_) public { + function test_maxPayoutPercentIsLessThanMinimum_reverts( + uint24 maxPayout_ + ) public { uint24 maxPayout = uint24(bound(maxPayout_, 0, 1e2 - 1)); _setMaxPayout(maxPayout); @@ -83,7 +85,9 @@ contract FpsCreateAuctionTest is FpsTest { _createAuctionLot(); } - function test_maxPayoutPercentIsGreaterThanMaximum_reverts(uint24 maxPayout_) public { + function test_maxPayoutPercentIsGreaterThanMaximum_reverts( + uint24 maxPayout_ + ) public { uint24 maxPayout = uint24(bound(maxPayout_, 100e2 + 1, type(uint24).max)); _setMaxPayout(maxPayout); @@ -95,7 +99,9 @@ contract FpsCreateAuctionTest is FpsTest { _createAuctionLot(); } - function test_maxPayoutPercent_fuzz(uint24 maxPayout_) public { + function test_maxPayoutPercent_fuzz( + uint24 maxPayout_ + ) public { uint24 maxPayout = uint24(bound(maxPayout_, 1e2, 100e2)); _setMaxPayout(maxPayout); diff --git a/test/modules/auctions/FPS/cancelAuction.t.sol b/test/modules/auctions/FPS/cancelAuction.t.sol index 4596decf1..1405e22e8 100644 --- a/test/modules/auctions/FPS/cancelAuction.t.sol +++ b/test/modules/auctions/FPS/cancelAuction.t.sol @@ -37,7 +37,9 @@ contract FpsCancelAuctionTest is FpsTest { _cancelAuctionLot(); } - function test_auctionConcluded_reverts(uint48 conclusionElapsed_) public givenLotIsCreated { + function test_auctionConcluded_reverts( + uint48 conclusionElapsed_ + ) public givenLotIsCreated { uint48 conclusionElapsed = uint48(bound(conclusionElapsed_, 0, 1 days)); // Warp to the conclusion diff --git a/test/modules/auctions/GDA/GDATest.sol b/test/modules/auctions/GDA/GDATest.sol index 38c484d9f..f1a3fac71 100644 --- a/test/modules/auctions/GDA/GDATest.sol +++ b/test/modules/auctions/GDA/GDATest.sol @@ -72,7 +72,9 @@ abstract contract GdaTest is Test, Permit2User { // ========== MODIFIERS ========== // - function _setQuoteTokenDecimals(uint8 decimals_) internal { + function _setQuoteTokenDecimals( + uint8 decimals_ + ) internal { _quoteTokenDecimals = decimals_; _gdaParams.equilibriumPrice = _scaleQuoteTokenAmount(_INITIAL_PRICE); @@ -81,33 +83,45 @@ abstract contract GdaTest is Test, Permit2User { _auctionParams.implParams = abi.encode(_gdaParams); } - modifier givenQuoteTokenDecimals(uint8 decimals_) { + modifier givenQuoteTokenDecimals( + uint8 decimals_ + ) { _setQuoteTokenDecimals(decimals_); _; } - function _setBaseTokenDecimals(uint8 decimals_) internal { + function _setBaseTokenDecimals( + uint8 decimals_ + ) internal { _baseTokenDecimals = decimals_; _auctionParams.capacity = _scaleBaseTokenAmount(_LOT_CAPACITY); } - modifier givenBaseTokenDecimals(uint8 decimals_) { + modifier givenBaseTokenDecimals( + uint8 decimals_ + ) { _setBaseTokenDecimals(decimals_); _; } - modifier givenLotCapacity(uint256 capacity_) { + modifier givenLotCapacity( + uint256 capacity_ + ) { _auctionParams.capacity = capacity_; _; } - modifier givenStartTimestamp(uint48 start_) { + modifier givenStartTimestamp( + uint48 start_ + ) { _auctionParams.start = start_; _; } - modifier givenDuration(uint48 duration_) { + modifier givenDuration( + uint48 duration_ + ) { _auctionParams.duration = duration_; _; } @@ -127,19 +141,25 @@ abstract contract GdaTest is Test, Permit2User { _; } - modifier givenEquilibriumPrice(uint128 price_) { + modifier givenEquilibriumPrice( + uint128 price_ + ) { _gdaParams.equilibriumPrice = uint256(price_); _auctionParams.implParams = abi.encode(_gdaParams); _; } - modifier givenMinPrice(uint128 minPrice_) { + modifier givenMinPrice( + uint128 minPrice_ + ) { _gdaParams.minimumPrice = uint256(minPrice_); _auctionParams.implParams = abi.encode(_gdaParams); _; } - modifier givenMinIsHalfPrice(uint128 price_) { + modifier givenMinIsHalfPrice( + uint128 price_ + ) { _gdaParams.minimumPrice = (uint256(price_) / 2) + (price_ % 2 == 0 ? 0 : 1); _auctionParams.implParams = abi.encode(_gdaParams); _; @@ -187,13 +207,17 @@ abstract contract GdaTest is Test, Permit2User { _; } - modifier givenDecayTarget(uint256 decayTarget_) { + modifier givenDecayTarget( + uint256 decayTarget_ + ) { _gdaParams.decayTarget = decayTarget_; _auctionParams.implParams = abi.encode(_gdaParams); _; } - modifier givenDecayPeriod(uint256 decayPeriod_) { + modifier givenDecayPeriod( + uint256 decayPeriod_ + ) { _gdaParams.decayPeriod = decayPeriod_; _auctionParams.implParams = abi.encode(_gdaParams); _; @@ -235,15 +259,21 @@ abstract contract GdaTest is Test, Permit2User { // ======== Internal Functions ======== // - function _scaleQuoteTokenAmount(uint256 amount_) internal view returns (uint256) { + function _scaleQuoteTokenAmount( + uint256 amount_ + ) internal view returns (uint256) { return amount_.mulDiv(10 ** _quoteTokenDecimals, _BASE_SCALE); } - function _scaleBaseTokenAmount(uint256 amount_) internal view returns (uint256) { + function _scaleBaseTokenAmount( + uint256 amount_ + ) internal view returns (uint256) { return amount_.mulDiv(10 ** _baseTokenDecimals, _BASE_SCALE); } - function _getAuctionLot(uint96 lotId_) internal view returns (IAuction.Lot memory) { + function _getAuctionLot( + uint96 lotId_ + ) internal view returns (IAuction.Lot memory) { return _module.getLot(lotId_); } diff --git a/test/modules/auctions/GDA/auction.t.sol b/test/modules/auctions/GDA/auction.t.sol index 3c2d23699..225417adf 100644 --- a/test/modules/auctions/GDA/auction.t.sol +++ b/test/modules/auctions/GDA/auction.t.sol @@ -6,14 +6,7 @@ import {IAuction} from "../../../../src/interfaces/modules/IAuction.sol"; import {IGradualDutchAuction} from "../../../../src/interfaces/modules/auctions/IGradualDutchAuction.sol"; -import { - UD60x18, - ud, - convert, - UNIT, - uUNIT, - EXP_MAX_INPUT -} from "prb-math-4.0-axis/UD60x18.sol"; +import {UD60x18, ud, convert, UNIT, uUNIT, EXP_MAX_INPUT} from "prb-math-4.0-axis/UD60x18.sol"; import "prb-math-4.0-axis/Common.sol" as PRBMath; import {GdaTest} from "./GDATest.sol"; @@ -102,7 +95,9 @@ contract GdaCreateAuctionTest is GdaTest { _createAuctionLot(); } - function test_equilibriumPriceGreaterThanMax_reverts(uint256 price_) public { + function test_equilibriumPriceGreaterThanMax_reverts( + uint256 price_ + ) public { vm.assume(price_ > type(uint128).max); _gdaParams.equilibriumPrice = price_; _auctionParams.implParams = abi.encode(_gdaParams); @@ -138,7 +133,9 @@ contract GdaCreateAuctionTest is GdaTest { _createAuctionLot(); } - function test_capacityGreaterThanMax_reverts(uint256 capacity_) public { + function test_capacityGreaterThanMax_reverts( + uint256 capacity_ + ) public { vm.assume(capacity_ > type(uint128).max); _auctionParams.capacity = capacity_; diff --git a/test/modules/auctions/GDA/cancelAuction.t.sol b/test/modules/auctions/GDA/cancelAuction.t.sol index 47fdc51be..e85633c8a 100644 --- a/test/modules/auctions/GDA/cancelAuction.t.sol +++ b/test/modules/auctions/GDA/cancelAuction.t.sol @@ -37,7 +37,9 @@ contract GdaCancelAuctionTest is GdaTest { _cancelAuctionLot(); } - function test_auctionConcluded_reverts(uint48 conclusionElapsed_) public givenLotIsCreated { + function test_auctionConcluded_reverts( + uint48 conclusionElapsed_ + ) public givenLotIsCreated { uint48 conclusionElapsed = uint48(bound(conclusionElapsed_, 0, 1 days)); // Warp to the conclusion diff --git a/test/modules/auctions/GDA/maxAmountAccepted.t.sol b/test/modules/auctions/GDA/maxAmountAccepted.t.sol index 08cec560c..297ea556f 100644 --- a/test/modules/auctions/GDA/maxAmountAccepted.t.sol +++ b/test/modules/auctions/GDA/maxAmountAccepted.t.sol @@ -14,7 +14,9 @@ contract GdaMaxAmountAcceptedTest is GdaTest { // [X] it reverts // [X] it returns the price for the remaining capacity of the lot - function testFuzz_lotIdInvalid_reverts(uint96 lotId_) public { + function testFuzz_lotIdInvalid_reverts( + uint96 lotId_ + ) public { // No lots have been created so all lots are invalid bytes memory err = abi.encodeWithSelector(IAuction.Auction_InvalidLotId.selector, lotId_); vm.expectRevert(err); diff --git a/test/modules/auctions/GDA/maxPayout.t.sol b/test/modules/auctions/GDA/maxPayout.t.sol index 76dc4c5d4..41f86a71b 100644 --- a/test/modules/auctions/GDA/maxPayout.t.sol +++ b/test/modules/auctions/GDA/maxPayout.t.sol @@ -13,7 +13,9 @@ contract GdaMaxPayoutTest is GdaTest { // [X] it reverts // [X] it returns the remaining capacity of the lot - function testFuzz_lotIdInvalid_reverts(uint96 lotId_) public { + function testFuzz_lotIdInvalid_reverts( + uint96 lotId_ + ) public { // No lots have been created so all lots are invalid bytes memory err = abi.encodeWithSelector(IAuction.Auction_InvalidLotId.selector, lotId_); vm.expectRevert(err); diff --git a/test/modules/auctions/GDA/payoutFor.t.sol b/test/modules/auctions/GDA/payoutFor.t.sol index 3c3d588f2..645902a6d 100644 --- a/test/modules/auctions/GDA/payoutFor.t.sol +++ b/test/modules/auctions/GDA/payoutFor.t.sol @@ -7,13 +7,7 @@ import {IGradualDutchAuction} from "../../../../src/interfaces/modules/auctions/IGradualDutchAuction.sol"; import { - UD60x18, - ud, - convert, - UNIT, - uUNIT, - ZERO, - EXP_MAX_INPUT + UD60x18, ud, convert, UNIT, uUNIT, ZERO, EXP_MAX_INPUT } from "prb-math-4.0-axis/UD60x18.sol"; import "prb-math-4.0-axis/Common.sol" as PRBMath; @@ -45,7 +39,9 @@ contract GdaPayoutForTest is GdaTest { // [X] it does not overflow // TODO can we fuzz this better? - function testFuzz_lotIdInvalid_reverts(uint96 lotId_) public { + function testFuzz_lotIdInvalid_reverts( + uint96 lotId_ + ) public { // No lots have been created so all lots are invalid bytes memory err = abi.encodeWithSelector(IAuction.Auction_InvalidLotId.selector, lotId_); vm.expectRevert(err); diff --git a/test/modules/auctions/GDA/priceFor.t.sol b/test/modules/auctions/GDA/priceFor.t.sol index 5588188cd..c63f01859 100644 --- a/test/modules/auctions/GDA/priceFor.t.sol +++ b/test/modules/auctions/GDA/priceFor.t.sol @@ -6,14 +6,7 @@ import {IAuction} from "../../../../src/interfaces/modules/IAuction.sol"; import {IGradualDutchAuction} from "../../../../src/interfaces/modules/auctions/IGradualDutchAuction.sol"; -import { - UD60x18, - ud, - convert, - UNIT, - uUNIT, - EXP_MAX_INPUT -} from "prb-math-4.0-axis/UD60x18.sol"; +import {UD60x18, ud, convert, UNIT, uUNIT, EXP_MAX_INPUT} from "prb-math-4.0-axis/UD60x18.sol"; import "prb-math-4.0-axis/Common.sol" as PRBMath; import {GdaTest} from "./GDATest.sol"; @@ -43,7 +36,9 @@ contract GdaPriceForTest is GdaTest { // TODO can we fuzz this better? maybe use some external calculations to compare the values? // Otherwise, we're just recreating the same calculations here and not really validating anything - function testFuzz_lotIdInvalid_reverts(uint96 lotId_) public { + function testFuzz_lotIdInvalid_reverts( + uint96 lotId_ + ) public { // No lots have been created so all lots are invalid bytes memory err = abi.encodeWithSelector(IAuction.Auction_InvalidLotId.selector, lotId_); vm.expectRevert(err); diff --git a/test/modules/auctions/GDA/purchase.t.sol b/test/modules/auctions/GDA/purchase.t.sol index 0e010da9d..c5444e177 100644 --- a/test/modules/auctions/GDA/purchase.t.sol +++ b/test/modules/auctions/GDA/purchase.t.sol @@ -7,13 +7,7 @@ import {IGradualDutchAuction} from "../../../../src/interfaces/modules/auctions/IGradualDutchAuction.sol"; import { - UD60x18, - ud, - convert, - UNIT, - uUNIT, - ZERO, - EXP_MAX_INPUT + UD60x18, ud, convert, UNIT, uUNIT, ZERO, EXP_MAX_INPUT } from "prb-math-4.0-axis/UD60x18.sol"; import "prb-math-4.0-axis/Common.sol" as PRBMath; @@ -26,7 +20,9 @@ contract GdaPurchaseTest is GdaTest { uint256 internal _purchaseAmount = 5e18; uint256 internal _purchaseAmountOut; - modifier setPurchaseAmount(uint256 amount) { + modifier setPurchaseAmount( + uint256 amount + ) { _purchaseAmount = amount; _; } diff --git a/test/modules/derivatives/LinearVesting.t.sol b/test/modules/derivatives/LinearVesting.t.sol index 6d3adebe2..ba4e0e137 100644 --- a/test/modules/derivatives/LinearVesting.t.sol +++ b/test/modules/derivatives/LinearVesting.t.sol @@ -162,7 +162,9 @@ contract LinearVestingTest is Test, Permit2User { _; } - modifier givenParentHasUnderlyingTokenBalance(uint256 balance_) { + modifier givenParentHasUnderlyingTokenBalance( + uint256 balance_ + ) { _underlyingToken.mint(address(_auctionHouse), balance_); vm.prank(address(_auctionHouse)); @@ -203,7 +205,9 @@ contract LinearVestingTest is Test, Permit2User { ); } - modifier givenAliceHasDerivativeTokens(uint256 amount_) { + modifier givenAliceHasDerivativeTokens( + uint256 amount_ + ) { _mintDerivativeTokens(_ALICE, amount_); _; } @@ -221,7 +225,9 @@ contract LinearVestingTest is Test, Permit2User { _linearVesting.mint(recipient_, _underlyingTokenAddress, _vestingParamsBytes, amount_, true); } - modifier givenAliceHasWrappedDerivativeTokens(uint256 amount_) { + modifier givenAliceHasWrappedDerivativeTokens( + uint256 amount_ + ) { _mintWrappedDerivativeTokens(_ALICE, amount_); _; } @@ -1720,7 +1726,9 @@ contract LinearVestingTest is Test, Permit2User { assertEq(SoulboundCloneERC20(_derivativeWrappedAddress).totalSupply(), 0); } - function test_redeemMax(uint48 elapsed_) public givenWrappedDerivativeIsDeployed { + function test_redeemMax( + uint48 elapsed_ + ) public givenWrappedDerivativeIsDeployed { // Mint both wrapped and unwrapped _mintDerivativeTokens(_ALICE, _AMOUNT); _mintWrappedDerivativeTokens(_ALICE, _AMOUNT); @@ -2418,7 +2426,9 @@ contract LinearVestingTest is Test, Permit2User { assertEq(balance, 0); } - function test_balanceOf(uint256 amount_) public givenWrappedDerivativeIsDeployed { + function test_balanceOf( + uint256 amount_ + ) public givenWrappedDerivativeIsDeployed { uint256 amount = bound(amount_, 0, _AMOUNT); // Mint @@ -2433,7 +2443,9 @@ contract LinearVestingTest is Test, Permit2User { assertEq(balance, amount); } - function test_balanceOf_wrapped(uint256 amount_) public givenWrappedDerivativeIsDeployed { + function test_balanceOf_wrapped( + uint256 amount_ + ) public givenWrappedDerivativeIsDeployed { uint256 amount = bound(amount_, 0, _AMOUNT); // Mint diff --git a/test/modules/derivatives/LinearVestingEMPAIntegration.t.sol b/test/modules/derivatives/LinearVestingEMPAIntegration.t.sol index c1882ece4..436a17a7f 100644 --- a/test/modules/derivatives/LinearVestingEMPAIntegration.t.sol +++ b/test/modules/derivatives/LinearVestingEMPAIntegration.t.sol @@ -84,7 +84,9 @@ contract LinearVestingEMPAIntegrationTest is BatchAuctionHouseTest { _; } - function _formatBid(uint256 amountOut_) internal pure returns (uint256) { + function _formatBid( + uint256 amountOut_ + ) internal pure returns (uint256) { uint256 formattedAmountOut; { uint128 subtracted; diff --git a/test/modules/derivatives/mocks/MockDerivativeModule.sol b/test/modules/derivatives/mocks/MockDerivativeModule.sol index 729394cc1..4358785bb 100644 --- a/test/modules/derivatives/mocks/MockDerivativeModule.sol +++ b/test/modules/derivatives/mocks/MockDerivativeModule.sol @@ -30,7 +30,9 @@ contract MockDerivativeModule is DerivativeModule { uint256 multiplier; } - constructor(address _owner) Module(_owner) { + constructor( + address _owner + ) Module(_owner) { derivativeToken = new MockERC6909(); } @@ -113,7 +115,9 @@ contract MockDerivativeModule is DerivativeModule { function exercise(uint256 tokenId_, uint256 amount) external virtual override {} - function reclaim(uint256 tokenId_) external virtual override {} + function reclaim( + uint256 tokenId_ + ) external virtual override {} function transform( uint256 tokenId_, @@ -141,11 +145,15 @@ contract MockDerivativeModule is DerivativeModule { return true; } - function setValidateFails(bool validateFails_) external { + function setValidateFails( + bool validateFails_ + ) external { _validateFails = validateFails_; } - function setWrappedImplementation(MockWrappedDerivative implementation_) external { + function setWrappedImplementation( + MockWrappedDerivative implementation_ + ) external { _wrappedImplementation = implementation_; } @@ -200,20 +208,32 @@ contract MockDerivativeModule is DerivativeModule { return (tokenId, token.wrapped); } - function redeemMax(uint256 tokenId_) external virtual override {} + function redeemMax( + uint256 tokenId_ + ) external virtual override {} function redeemable( address owner_, uint256 tokenId_ ) external view virtual override returns (uint256) {} - function name(uint256 tokenId_) public view virtual override returns (string memory) {} + function name( + uint256 tokenId_ + ) public view virtual override returns (string memory) {} - function symbol(uint256 tokenId_) public view virtual override returns (string memory) {} + function symbol( + uint256 tokenId_ + ) public view virtual override returns (string memory) {} - function decimals(uint256 tokenId_) public view virtual override returns (uint8) {} + function decimals( + uint256 tokenId_ + ) public view virtual override returns (uint8) {} - function tokenURI(uint256 tokenId_) public view virtual override returns (string memory) {} + function tokenURI( + uint256 tokenId_ + ) public view virtual override returns (string memory) {} - function totalSupply(uint256 tokenId_) public view virtual override returns (uint256) {} + function totalSupply( + uint256 tokenId_ + ) public view virtual override returns (uint256) {} }