From f44fe73855c92ca2f3d7458f338e1bbc5582721e Mon Sep 17 00:00:00 2001 From: Oighty Date: Wed, 6 Nov 2024 12:09:43 -0600 Subject: [PATCH 01/21] deploy: origin to berachain bartio --- deployments/.berachain-bartio-1730915333.json | 7 +++++++ script/env.json | 20 +++++++++++++++++++ 2 files changed, 27 insertions(+) create mode 100644 deployments/.berachain-bartio-1730915333.json diff --git a/deployments/.berachain-bartio-1730915333.json b/deployments/.berachain-bartio-1730915333.json new file mode 100644 index 00000000..2f61e26d --- /dev/null +++ b/deployments/.berachain-bartio-1730915333.json @@ -0,0 +1,7 @@ +{ +"deployments.BatchAuctionHouse": "0xBA0000c28179CE533233a943d432eddD154E62A3", +"deployments.BatchCatalogue": "0x37886d0667c16f41F73F6586f087166Ae3CF1155", +"deployments.auctionModules.EncryptedMarginalPrice": "0x2C7aE1A3989f17a6d9935382bDe7F1b021055083", +"deployments.auctionModules.FixedPriceBatch": "0x8Db46375e73545226E99b5e8cBfe2794ac835D38", +"deployments.derivativeModules.BatchLinearVesting": "0xD55227c0C37C97Fa2619a9C7F658C173883C1E2a" +} diff --git a/script/env.json b/script/env.json index eb78d79d..da725c3f 100644 --- a/script/env.json +++ b/script/env.json @@ -80,6 +80,26 @@ } } }, + "berachain-bartio": { + "constants": { + "axis": { + "OWNER": "0xB47C8e4bEb28af80eDe5E5bF474927b110Ef2c0e", + "PERMIT2": "0x000000000022D473030F116dDEE9F6B43aC78BA3", + "PROTOCOL": "0xB47C8e4bEb28af80eDe5E5bF474927b110Ef2c0e" + } + }, + "deployments": { + "BatchAuctionHouse": "0xBA0000c28179CE533233a943d432eddD154E62A3", + "BatchCatalogue": "0x37886d0667c16f41F73F6586f087166Ae3CF1155", + "auctionModules": { + "EncryptedMarginalPrice": "0x2C7aE1A3989f17a6d9935382bDe7F1b021055083", + "FixedPriceBatch": "0x8Db46375e73545226E99b5e8cBfe2794ac835D38" + }, + "derivativeModules": { + "BatchLinearVesting": "0xD55227c0C37C97Fa2619a9C7F658C173883C1E2a" + } + } + }, "blast": { "constants": { "axis": { From 1c6613c626f2fa3ac51ffebdfb9091fa5ee1ab5d Mon Sep 17 00:00:00 2001 From: Oighty Date: Wed, 6 Nov 2024 13:02:54 -0600 Subject: [PATCH 02/21] chore: rename deployment file with version --- deployments/.berachain-bartio-1730915333.json | 7 ------- deployments/.berachain-bartio-v1.0.1.json | 7 +++++++ 2 files changed, 7 insertions(+), 7 deletions(-) delete mode 100644 deployments/.berachain-bartio-1730915333.json create mode 100644 deployments/.berachain-bartio-v1.0.1.json diff --git a/deployments/.berachain-bartio-1730915333.json b/deployments/.berachain-bartio-1730915333.json deleted file mode 100644 index 2f61e26d..00000000 --- a/deployments/.berachain-bartio-1730915333.json +++ /dev/null @@ -1,7 +0,0 @@ -{ -"deployments.BatchAuctionHouse": "0xBA0000c28179CE533233a943d432eddD154E62A3", -"deployments.BatchCatalogue": "0x37886d0667c16f41F73F6586f087166Ae3CF1155", -"deployments.auctionModules.EncryptedMarginalPrice": "0x2C7aE1A3989f17a6d9935382bDe7F1b021055083", -"deployments.auctionModules.FixedPriceBatch": "0x8Db46375e73545226E99b5e8cBfe2794ac835D38", -"deployments.derivativeModules.BatchLinearVesting": "0xD55227c0C37C97Fa2619a9C7F658C173883C1E2a" -} diff --git a/deployments/.berachain-bartio-v1.0.1.json b/deployments/.berachain-bartio-v1.0.1.json new file mode 100644 index 00000000..4dea1327 --- /dev/null +++ b/deployments/.berachain-bartio-v1.0.1.json @@ -0,0 +1,7 @@ +{ + "deployments.BatchAuctionHouse": "0xBA0000c28179CE533233a943d432eddD154E62A3", + "deployments.BatchCatalogue": "0x37886d0667c16f41F73F6586f087166Ae3CF1155", + "deployments.auctionModules.EncryptedMarginalPrice": "0x2C7aE1A3989f17a6d9935382bDe7F1b021055083", + "deployments.auctionModules.FixedPriceBatch": "0x8Db46375e73545226E99b5e8cBfe2794ac835D38", + "deployments.derivativeModules.BatchLinearVesting": "0xD55227c0C37C97Fa2619a9C7F658C173883C1E2a" +} From c39f9f8107241441cb62fca8d8fe7c99ab6e75b4 Mon Sep 17 00:00:00 2001 From: Oighty Date: Wed, 6 Nov 2024 13:03:36 -0600 Subject: [PATCH 03/21] chore: lint --- 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/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/derivatives/LinearVesting.t.sol | 24 +++-- .../LinearVestingEMPAIntegration.t.sol | 4 +- .../mocks/MockDerivativeModule.sol | 40 +++++-- 84 files changed, 1084 insertions(+), 363 deletions(-) diff --git a/script/deploy/Deploy.s.sol b/script/deploy/Deploy.s.sol index 95a35504..b520baa1 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 a53686b4..d127173a 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 98a572b7..4dd0fc8c 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 2b8f0a7d..c1c9654c 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 f9121568..fbf65621 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 4459e8e4..8cc58c5c 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 f03c0b2a..2f5035f2 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 03fe81eb..446debc5 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 6c4135b4..252defd6 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 c12717c3..533296aa 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 f04dfbb3..d28e54fe 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 fc2b4f82..4386d4c8 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 b188ed92..0dddc0f7 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 6831c89c..1ab5009e 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 d885718e..486f0530 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 b5e32538..ad45e8a6 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 3153a468..92818950 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 bc9a5c84..14e81c82 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 abd23593..7c1fddc8 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 ccc32811..d405ac13 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 e0c1eed1..458cbda8 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 338d5b8d..f831473e 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 95a2f132..e9dc6ad0 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 6b6371a2..e8649f50 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 802cd46a..c67215e2 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 7a0f59b9..dd768ea3 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 304ae6df..9a25f99f 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 d566f06b..33ba8d8f 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 32f880a0..e40066c4 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 35b5c048..1ada6921 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 1679cf0e..845b84d6 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 f091c40c..446fda4f 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 8d239add..2ae90d82 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 3d83cd01..35a92fe1 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 9d73ba25..6ea257f0 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 417bfe94..91fd99ad 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 a28d399d..66bdc774 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 72f5f888..3d56bb8f 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 5a4c2e42..6d782bb2 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 6082e693..7761b091 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 bd94dd6a..0c156a09 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 b0e438c7..6349617e 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 0fbaf27a..242a2150 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/batch/EMP.sol b/src/modules/auctions/batch/EMP.sol index 2a17255a..3378fbc9 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 9a2b6e7f..ced95861 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 726d29cb..d9e59353 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 c7956d24..27c6698b 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 94156315..64731e66 100644 --- a/test/AtomicAuctionHouse/AuctionHouseTest.sol +++ b/test/AtomicAuctionHouse/AuctionHouseTest.sol @@ -149,17 +149,23 @@ abstract contract AtomicAuctionHouseTest is Test, Permit2User, WithSalts { // ===== 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 { _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 { _; } - 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 { _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 { _; } - 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 { _; } - 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 { _; } - 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 { _; } - 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 { _; } - 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 { // ===== 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 { }); } - 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 { }); } - 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 cb0dcbee..bcf8614b 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 af3c7465..588d5f93 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 2b186831..18f9d511 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 ba81d493..bf880688 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 671ab29e..4eb3e4c9 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 603ab59c..4af2a14e 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 d2258776..737bc058 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 8c4daa3b..628ffcaf 100644 --- a/test/BatchAuctionHouse/AuctionHouseTest.sol +++ b/test/BatchAuctionHouse/AuctionHouseTest.sol @@ -150,11 +150,15 @@ abstract contract BatchAuctionHouseTest is Test, Permit2User, WithSalts { // ===== 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 { // ===== 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 { _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 { _; } - 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 { _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 { _; } - 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 { _; } - 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 { _; } - 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 { _; } - 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 { _; } - 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 { _; } - 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 { _; } - modifier givenRecipientIsOnBaseTokenBlacklist(address recipient_) { + modifier givenRecipientIsOnBaseTokenBlacklist( + address recipient_ + ) { _baseToken.setBlacklist(recipient_, true); _; } @@ -597,14 +639,18 @@ abstract contract BatchAuctionHouseTest is Test, Permit2User, WithSalts { _; } - 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 { }); } - 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 { }); } - 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 8536cc54..a3461c4d 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 1c6b8d9d..d79a9230 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 8cc28218..1cda4931 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 8230ec5a..881da743 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 db265703..4ca03596 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 49da3722..179ed864 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 728e1142..3cc913ad 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 d5715389..6789d01e 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 368a5b2d..086d8824 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 2f8ef5aa..18840d05 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 b9722c7a..4bcbd802 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 aac435d7..961d925c 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 005f498d..8335c5b4 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 3a85c114..d7040b6e 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 4c145daa..04f04363 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 a22f6a03..fac45a01 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 872e8047..cabc7993 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 a84890b4..28886be4 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 b6cd76c3..484befdd 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 3727843a..415b528a 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 f4943e9b..9369f5e1 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 ea91d5b1..8ad00054 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 c201d687..106e1872 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 84771e55..9818db71 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 4596decf..1405e22e 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/derivatives/LinearVesting.t.sol b/test/modules/derivatives/LinearVesting.t.sol index 6d3adebe..ba4e0e13 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 c1882ece..436a17a7 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 729394cc..4358785b 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) {} } From 458c8594021ce577e45daf107d70231b296fa6f7 Mon Sep 17 00:00:00 2001 From: Oighty Date: Tue, 19 Nov 2024 12:45:28 -0600 Subject: [PATCH 04/21] chore: fix soldeer dependencies and bump solmate version --- foundry.toml | 8 ++-- remappings.txt | 6 +-- script/salts/salts.json | 36 ++++++++--------- soldeer.lock | 39 ++++++++++--------- src/AtomicAuctionHouse.sol | 2 +- src/BatchAuctionHouse.sol | 2 +- src/bases/AuctionHouse.sol | 4 +- src/bases/FeeManager.sol | 6 +-- src/lib/Transfer.sol | 4 +- src/modules/Derivative.sol | 2 +- src/modules/Modules.sol | 2 +- src/modules/auctions/atomic/FPS.sol | 2 +- src/modules/derivatives/CliffVesting.sol | 2 +- src/modules/derivatives/LinearVesting.sol | 6 +-- .../derivatives/SoulboundCloneERC20.sol | 2 +- test/AtomicAuctionHouse/AuctionHouseTest.sol | 2 +- test/AtomicAuctionHouse/auction.t.sol | 2 +- test/AuctionHouse/MockAuctionHouse.sol | 2 +- test/AuctionHouse/sendPayout.t.sol | 2 +- test/AuctionHouse/setCondenser.t.sol | 2 +- test/BatchAuctionHouse/AuctionHouseTest.sol | 2 +- test/BatchAuctionHouse/auction.t.sol | 2 +- test/callbacks/MockCallback.sol | 2 +- test/lib/mocks/MockFeeOnTransferERC20.sol | 2 +- test/lib/mocks/MockWrappedDerivative.sol | 4 +- test/modules/Auction/auction.t.sol | 2 +- test/modules/Auction/cancel.t.sol | 2 +- test/modules/auctions/EMP/settle.t.sol | 2 +- test/modules/auctions/FPB/FPBTest.sol | 2 +- test/modules/auctions/FPS/FPSTest.sol | 2 +- test/modules/auctions/FPS/auction.t.sol | 2 +- test/modules/auctions/FPS/purchase.t.sol | 2 +- test/modules/derivatives/LinearVesting.t.sol | 2 +- .../derivatives/SoulboundCloneERC20.t.sol | 2 +- .../mocks/MockDerivativeModule.sol | 6 +-- 35 files changed, 86 insertions(+), 83 deletions(-) diff --git a/foundry.toml b/foundry.toml index aac35063..7549be42 100644 --- a/foundry.toml +++ b/foundry.toml @@ -26,8 +26,8 @@ ignore = [ # See more config options https://github.com/foundry-rs/foundry/blob/master/crates/config/README.md#all-options [dependencies] -forge-std = { version = "1.9.1" } -solmate = { version = "6.7.0", url = "git@github.com:transmissions11/solmate.git", commit = "c892309933b25c03d32b1b0d674df7ae292ba925" } -solady = { version = "0.0.124" } -"@openzeppelin-contracts" = { version = "4.9.2" } +forge-std = "1.9.1" +solmate = "6.8.0" +solady = "0.0.124" +"@openzeppelin-contracts" = "4.9.2" clones-with-immutable-args = { version = "1.1.1", git = "git@github.com:wighawag/clones-with-immutable-args.git", rev = "f5ca191afea933d50a36d101009b5644dc28bc99" } diff --git a/remappings.txt b/remappings.txt index 03efc5cb..507bdc46 100644 --- a/remappings.txt +++ b/remappings.txt @@ -1,5 +1,5 @@ +@clones-with-immutable-args-1.1.1=dependencies/clones-with-immutable-args-1.1.1/src @forge-std-1.9.1=dependencies/forge-std-1.9.1/src -@solmate-6.7.0=dependencies/solmate-6.7.0/src -@solady-0.0.124=dependencies/solady-0.0.124/src @openzeppelin-contracts-4.9.2=dependencies/@openzeppelin-contracts-4.9.2 -@clones-with-immutable-args-1.1.1=dependencies/clones-with-immutable-args-1.1.1/src \ No newline at end of file +@solady-0.0.124=dependencies/solady-0.0.124/src +@solmate-6.8.0=dependencies/solmate-6.8.0/src diff --git a/script/salts/salts.json b/script/salts/salts.json index e4f1e49e..8fa0f9ce 100644 --- a/script/salts/salts.json +++ b/script/salts/salts.json @@ -24,23 +24,23 @@ "0xf877dc218ee7538ffb3ad6f8fd1b4694cbb6f38d9e0b7a4d9a19ace3c24830a2": "0xad2a1f39589d55fd4fb667bda19d168106901d33100bb9c50fc57b1735024bcd" }, "Test_MockCallback": { - "0x01841051d995f193994d87cc5321c5e0b180a226c6f951ab3f5c56176924b0cf": "0x9d8de47a5460a81aef092c4b61c9f2a9fd0f54c97274e392a9555e9d2d1e1710", - "0x06cf9ff7a063a7fc1e0b4a7d18212b17834e88a6b3fc550a62877f0cd405d85b": "0xd2ec65ab90d963102d6e7874beb98a42784a34417675e47bddcf503c6858b987", - "0x17606ccfd3f57516c9b03d3b81affabde9c64a206e808373b8aa36aff4b002c9": "0x97c30d3b95ed3817655f5868ba43c8cce64028f596c46779cef1beb6d6e4d407", - "0x26ced0c667f25d41c7eca6f22e6ca7ac8973443efef73c5f71f64118d3b5b711": "0x201969779bdc1d837056538c70f34c0aeb1d5df46ec1ad12826fed468ece068d", - "0x319a3731827c0a9841ca032b6f68775ccb2c0ceaf5528e914b42454a8e92eca6": "0xe14afdc6ad14fa8237e00a115bfa70f729d4cb63b566b55e184ca3248ad718bc", - "0x321e36c7755f0c0174dafae1f53661efcb802b8643e0793992713d73f9e85bb4": "0x7107f71a5f167cc15d36d5f4efeac4deaa9289e4b02a989ecd37c8308e26710d", - "0x3aadf72f8d2c5f6f7c74f7657d125aab00a19bf0a608b5738368d440ee6d6cd8": "0x4a5d9cdb5916177c82a0930839a2442ebad34b7ec15f61d91e2f348ac0eaa8d6", - "0x48a666de441ed423f11614aa6c0867bd32a9d77bfec36a5d8a31ce6d1781c381": "0xf2fe90d36d281706b431835743fc3d86606cf79b7597052e9a026f1ae7a2e3d4", - "0x6981e018db3125d14ca54c7c658ac16aa032b4739d01992b3e3ec1c42c857f7e": "0xbf6b3b727d6134587a377f175b9df1585f0e0eccc2bf3af7c6b20656a018668e", - "0x7091f552e5e92800b15a36997ca6294118351724cc7c58fa249405580eed1dae": "0x13b315f0f8c481fed5bb27bf913a2b642eefd230d8da1a86bc60af04f7f9b25d", - "0x772fc41a79c386cec03e58c6cfdef24eaa74628d1419d83965d76e5ac2bd9621": "0xacfca0ddb3de0d280ea48d2e78223aba782a0207b3c2056c0d3c867b0b084e52", - "0x7aff7199ffe5a50443a1dbe43fd6ad7791c7837003c5e57c5b630e6b9092491b": "0x3108223651eaa1fd79433ba0c9c932c31c1707a2149b59e81e6a6c65a1eafd0a", - "0x9a071a61820d44365b51755858759fbdb78a29feb70bac5f02ede7ad71622219": "0x1fb685cccf345205bb1917b2a3305428c26f629ab8fff078a9f6d99c898816ef", - "0xc247e7a2a55fbcd8c361ec133eb9a696af8ae510b454d9e42b314cbb5dcf37d1": "0xd7293cb870687d2f863dfe79892931908c7a76d20e9fec96358349a8787a2e96", - "0xc88879b36b5bc9b856491ea74b98eb1c7b8158933c11faafeecaf40ceb79e800": "0x1b433833ae2acfa6790776c2bdb7da39cc50a0106393da7264306ac132b29dc0", - "0xca89e73f7a2c70d2af4bc7384f4911ae1b1e7cec1f16a46d566adfcedbd5bb83": "0xebb91f13f82d8855e1ffedeb8ac8f35f4d4ece7ebbaa4fc27802403a908c2d36", - "0xd641570f656540d0a9c13bbb9feb07c10bbc3997ecfcb2e2a76753a55c1f10b1": "0x5488d2fad36f14ae33fe5c251756ea699a7f4fcd10a4519ffb65d532e54b8fa5", - "0xe2ebb96968e3cb4a4b3425e3f012c052293c38c0ebec9112ec26b6f345c1fe48": "0x64fabcd82cc78669e55741bdf0fde6bf1e60ffbed5f3345b6e93dd86b77cbe36" + "0x122b7366cd1ef2d5b4e5301e1905912ec0fe8b73e77aee436d38421a86d15313": "0x0a9151c7b46dc91425f2a34eb6b2fb33ee191550a9165830ae27877b3f4ca221", + "0x31839cd002be9d58c711006d802d11286e56601f846dda258f2e3a3d6312e9d5": "0x413ec56e5cda12c513a637af386dc614c6d8d4cd3332147aa3c1e8a384357a78", + "0x3906ecd77f3b4704ca6c6d5a06ecf7039c68312b200ade661f6d2a28098049e1": "0xe9927b53dc310098994a46e7f6c2cd5104b776f99b91115eece80ec5f8acebe8", + "0x525f9fb7cb93f53509d24ec2f82f9d832e21209c45978e2e315915d6ff8c6a7f": "0xe900d098e9a5d9bb11ba2a3667b6b1eeae83814fe553bb76e514cf5b3fa7a2ac", + "0x54a5ad7b0937b5a5876975ca86a146047356b10210457afbbe77c13e6f5dd954": "0x8c917d14c4e8991eb770603f76c7a2ee6ec9938465f1b8e3c4bc144066179dac", + "0x6205fbf29817ca90fa2498c5b1187af9359d49f9386e35ba328382bcaa131cc3": "0x360e652e5304ee51b6e45d13472e12154037096162a58739e9407aae45926f01", + "0x678385a33025444b4cc1bb4114e4f2b91518f7b62874b3dc9c42cc273c353cb9": "0x55c1bb8e1768f6374b0d715192f3a4623af7018e5c4ccfae641766ff58ef6f53", + "0x780f4d36b46e5c008598b23b91a1a33d3a6d9a009ab4e7d1ec6c4fd0b96ae27e": "0x2e795045262fbbed80e54de0ee9a59506de844b46ffdcbf2fbfe6d2cb7bf6247", + "0x7dceb7e223c0a4949e5e2af68c3896c5549e9d942a7c0a2f82de4b4f1048467f": "0x384c9eafa40ee73af86d2d4fafdfd1ee31e06696f2c23a0c1d18b0e8785b6ce1", + "0x7fdc727348e9937fdf4d1ce371e33669ccd01a66514298047926c8cf38059721": "0x67567fd2ac4f9e05bda2cd306f73bb75aec8f0ce6ea6a60f00665b3ba7440b62", + "0x804b4adedbf071a753a22b7f14d78b78c9417097e5826cae690132d4b0d1598b": "0x8bb2239f825595560b0a31bb2bf07b18cd578df9dfb500b00c386eac3fd8b609", + "0x97c630af696c3e707d37a9df6f374aa2de8cbad3b57d70fd716c420aff85ee21": "0x32dbea5832194b7fa3c189f428b3abd9be5dc93d536c7799e7dbe122f0b9da89", + "0xb7e994be576e566138244c31d8ed1a61a2c2326f7850970f250734441540ba47": "0x3c1a8efebca923e4a1cdc651c554d06a3548e7929d0c7971866bf59b7d6571b3", + "0xb8efc6c465a7b9a95be1d788850dc2fc5372dc35032c8128b1ffec136000ed33": "0xb31bd2f0dada0bf7ceae9b37708c9329967684b9b73b7cc4a99027477b46b132", + "0xbc04d3cb883befcd89fc74569e56a84bf7adb63ae3864cbd1c11314d21c1355a": "0x4783fc51f9862eb57357966692ae70dd540e68ea0848903b77500534194b7f1c", + "0xc0c056f15966bf95b1fe024d064fdf5dc1ff953912a563bc162ff480bb29829d": "0x2eaeb172f8893ca0778cc5470e73f871ffc45825607e7fc37e15db3c369898a8", + "0xc51d6c63ad7dee6c11da98be8f32ac5ca7df37533c82928856a61da22d2e15dd": "0x19ce56b3efb04248482e4368f2063c9ea6f0ca1cedaced0737fa06ece52c43e1", + "0xdf57220126314faa7501d1bf9080691a765b85dcd73ddbc413ad43a5981beb82": "0x4be72c05d6c702b486af22bf4f9a29e0c0c466b036fee37355e9e7fb7c67b66d" } } diff --git a/soldeer.lock b/soldeer.lock index a6863b27..0b6369e8 100644 --- a/soldeer.lock +++ b/soldeer.lock @@ -1,30 +1,33 @@ +[[dependencies]] +name = "@openzeppelin-contracts" +version = "4.9.2" +url = "https://soldeer-revisions.s3.amazonaws.com/@openzeppelin-contracts/4_9_2_22-01-2024_13:13:52_contracts.zip" +checksum = "0f4450671798ea5659e6391876a3cf443ca50a696d9b556ac622ec7660bce306" +integrity = "f69bd90f264280204b2a1172a02a2d20f3611f5993a61e5215647bec696a8420" + +[[dependencies]] +name = "clones-with-immutable-args" +version = "1.1.1" +git = "git@github.com:wighawag/clones-with-immutable-args.git" +rev = "f5ca191afea933d50a36d101009b5644dc28bc99" [[dependencies]] name = "forge-std" version = "1.9.1" -source = "https://soldeer-revisions.s3.amazonaws.com/forge-std/v1_9_1_03-07-2024_14:44:59_forge-std-v1.9.1.zip" +url = "https://soldeer-revisions.s3.amazonaws.com/forge-std/v1_9_1_03-07-2024_14:44:59_forge-std-v1.9.1.zip" checksum = "110b35ad3604d91a919c521c71206c18cd07b29c750bd90b5cbbaf37288c9636" - -[[dependencies]] -name = "solmate" -version = "6.7.0" -source = "git@github.com:transmissions11/solmate.git" -checksum = "97bdb2003b70382996a79a406813f76417b1cf90" +integrity = "389f8bfe6b6aad01915b1e38e6d4839f8189e8d4792b42be4e10d0a96a358e3f" [[dependencies]] name = "solady" version = "0.0.124" -source = "https://soldeer-revisions.s3.amazonaws.com/solady/0_0_124_22-01-2024_13:28:04_solady.zip" +url = "https://soldeer-revisions.s3.amazonaws.com/solady/0_0_124_22-01-2024_13:28:04_solady.zip" checksum = "9342385eaad08f9bb5408be0b41b241dd2b974c001f7da8c3b1ac552b52ce16b" +integrity = "29d93e52694d8e858cf5a737257f4a6f21aefccaf803174fd00b9d686172ab27" [[dependencies]] -name = "@openzeppelin-contracts" -version = "4.9.2" -source = "https://soldeer-revisions.s3.amazonaws.com/@openzeppelin-contracts/4_9_2_22-01-2024_13:13:52_contracts.zip" -checksum = "0f4450671798ea5659e6391876a3cf443ca50a696d9b556ac622ec7660bce306" - -[[dependencies]] -name = "clones-with-immutable-args" -version = "1.1.1" -source = "git@github.com:wighawag/clones-with-immutable-args.git" -checksum = "f5ca191afea933d50a36d101009b5644dc28bc99" +name = "solmate" +version = "6.8.0" +url = "https://soldeer-revisions.s3.amazonaws.com/solmate/6_8_0_29-10-2024_19:01:45_solmate.zip" +checksum = "e3ec0f0182cb3bbedecf8a0bcc39897266534a795ec732b2b03dafa285d78a5b" +integrity = "a22e5a352de0231f671ee8adf5667bbe83c50012670083987bd1099a69feb429" diff --git a/src/AtomicAuctionHouse.sol b/src/AtomicAuctionHouse.sol index c1b29faf..797b3c72 100644 --- a/src/AtomicAuctionHouse.sol +++ b/src/AtomicAuctionHouse.sol @@ -7,7 +7,7 @@ import {IAtomicAuctionHouse} from "./interfaces/IAtomicAuctionHouse.sol"; import {ICallback} from "./interfaces/ICallback.sol"; // External libraries -import {ERC20} from "@solmate-6.7.0/tokens/ERC20.sol"; +import {ERC20} from "@solmate-6.8.0/tokens/ERC20.sol"; // Internal libaries import {Transfer} from "./lib/Transfer.sol"; diff --git a/src/BatchAuctionHouse.sol b/src/BatchAuctionHouse.sol index 4386d4c8..a7f44631 100644 --- a/src/BatchAuctionHouse.sol +++ b/src/BatchAuctionHouse.sol @@ -12,7 +12,7 @@ import {Transfer} from "./lib/Transfer.sol"; import {Callbacks} from "./lib/Callbacks.sol"; // External libraries -import {ERC20} from "@solmate-6.7.0/tokens/ERC20.sol"; +import {ERC20} from "@solmate-6.8.0/tokens/ERC20.sol"; // Auctions import {AuctionHouse} from "./bases/AuctionHouse.sol"; diff --git a/src/bases/AuctionHouse.sol b/src/bases/AuctionHouse.sol index 1ab5009e..d108152f 100644 --- a/src/bases/AuctionHouse.sol +++ b/src/bases/AuctionHouse.sol @@ -13,8 +13,8 @@ import {Transfer} from "../lib/Transfer.sol"; import {Callbacks} from "../lib/Callbacks.sol"; // External libraries -import {ERC20} from "@solmate-6.7.0/tokens/ERC20.sol"; -import {ReentrancyGuard} from "@solmate-6.7.0/utils/ReentrancyGuard.sol"; +import {ERC20} from "@solmate-6.8.0/tokens/ERC20.sol"; +import {ReentrancyGuard} from "@solmate-6.8.0/utils/ReentrancyGuard.sol"; // Internal dependencies import { diff --git a/src/bases/FeeManager.sol b/src/bases/FeeManager.sol index 92818950..1344bd7c 100644 --- a/src/bases/FeeManager.sol +++ b/src/bases/FeeManager.sol @@ -8,9 +8,9 @@ import {IFeeManager} from "../interfaces/IFeeManager.sol"; import {Transfer} from "../lib/Transfer.sol"; // External libraries -import {ERC20} from "@solmate-6.7.0/tokens/ERC20.sol"; -import {ReentrancyGuard} from "@solmate-6.7.0/utils/ReentrancyGuard.sol"; -import {FixedPointMathLib as Math} from "@solmate-6.7.0/utils/FixedPointMathLib.sol"; +import {ERC20} from "@solmate-6.8.0/tokens/ERC20.sol"; +import {ReentrancyGuard} from "@solmate-6.8.0/utils/ReentrancyGuard.sol"; +import {FixedPointMathLib as Math} from "@solmate-6.8.0/utils/FixedPointMathLib.sol"; import {Keycode} from "../modules/Keycode.sol"; diff --git a/src/lib/Transfer.sol b/src/lib/Transfer.sol index e5b252a9..0d6c52e6 100644 --- a/src/lib/Transfer.sol +++ b/src/lib/Transfer.sol @@ -1,8 +1,8 @@ // SPDX-License-Identifier: AGPL-3.0-or-later pragma solidity 0.8.19; -import {ERC20} from "@solmate-6.7.0/tokens/ERC20.sol"; -import {SafeTransferLib} from "@solmate-6.7.0/utils/SafeTransferLib.sol"; +import {ERC20} from "@solmate-6.8.0/tokens/ERC20.sol"; +import {SafeTransferLib} from "@solmate-6.8.0/utils/SafeTransferLib.sol"; import {IPermit2} from "./permit2/interfaces/IPermit2.sol"; library Transfer { diff --git a/src/modules/Derivative.sol b/src/modules/Derivative.sol index 6d782bb2..06183ce5 100644 --- a/src/modules/Derivative.sol +++ b/src/modules/Derivative.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: BSL-1.1 pragma solidity 0.8.19; -import {ERC6909} from "@solmate-6.7.0/tokens/ERC6909.sol"; +import {ERC6909} from "@solmate-6.8.0/tokens/ERC6909.sol"; import {ERC6909Metadata} from "../lib/ERC6909Metadata.sol"; import {Module} from "./Modules.sol"; import {IDerivative} from "../interfaces/modules/IDerivative.sol"; diff --git a/src/modules/Modules.sol b/src/modules/Modules.sol index 0c156a09..0914d0f0 100644 --- a/src/modules/Modules.sol +++ b/src/modules/Modules.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: AGPL-3.0-or-later pragma solidity 0.8.19; -import {Owned} from "@solmate-6.7.0/auth/Owned.sol"; +import {Owned} from "@solmate-6.8.0/auth/Owned.sol"; import "./Keycode.sol"; /// @notice Abstract contract that provides functionality for installing and interacting with modules. diff --git a/src/modules/auctions/atomic/FPS.sol b/src/modules/auctions/atomic/FPS.sol index 242a2150..9af47114 100644 --- a/src/modules/auctions/atomic/FPS.sol +++ b/src/modules/auctions/atomic/FPS.sol @@ -12,7 +12,7 @@ import {Veecode, toVeecode} from "../../Modules.sol"; import {AtomicAuctionModule} from "../AtomicAuctionModule.sol"; // External libraries -import {FixedPointMathLib as Math} from "@solmate-6.7.0/utils/FixedPointMathLib.sol"; +import {FixedPointMathLib as Math} from "@solmate-6.8.0/utils/FixedPointMathLib.sol"; /// @title FixedPriceSale /// @notice A module for creating fixed price sale (atomic) auctions diff --git a/src/modules/derivatives/CliffVesting.sol b/src/modules/derivatives/CliffVesting.sol index 8252cb95..73711d3f 100644 --- a/src/modules/derivatives/CliffVesting.sol +++ b/src/modules/derivatives/CliffVesting.sol @@ -2,7 +2,7 @@ pragma solidity 0.8.19; // import {ClonesWithImmutableArgs} from "@clones-with-immutable-args-1.1.1/ClonesWithImmutableArgs.sol"; -// import {ERC20} from "@solmate-6.7.0/tokens/ERC20.sol"; +// import {ERC20} from "@solmate-6.8.0/tokens/ERC20.sol"; // import "./Derivative.sol"; // // TODO this only uses the ERC20 clones, need to convert to ERC6909 with optional ERC20 via wrapping the ERC6909 diff --git a/src/modules/derivatives/LinearVesting.sol b/src/modules/derivatives/LinearVesting.sol index d9e59353..ce6c1b17 100644 --- a/src/modules/derivatives/LinearVesting.sol +++ b/src/modules/derivatives/LinearVesting.sol @@ -1,11 +1,11 @@ // SPDX-License-Identifier: BSL-1.1 pragma solidity 0.8.19; -import {ERC20} from "@solmate-6.7.0/tokens/ERC20.sol"; -import {SafeTransferLib} from "@solmate-6.7.0/utils/SafeTransferLib.sol"; +import {ERC20} from "@solmate-6.8.0/tokens/ERC20.sol"; +import {SafeTransferLib} from "@solmate-6.8.0/utils/SafeTransferLib.sol"; import {ClonesWithImmutableArgs} from "@clones-with-immutable-args-1.1.1/ClonesWithImmutableArgs.sol"; -import {FixedPointMathLib} from "@solmate-6.7.0/utils/FixedPointMathLib.sol"; +import {FixedPointMathLib} from "@solmate-6.8.0/utils/FixedPointMathLib.sol"; import {Base64} from "@openzeppelin-contracts-4.9.2/utils/Base64.sol"; import {Timestamp} from "../../lib/Timestamp.sol"; diff --git a/src/modules/derivatives/SoulboundCloneERC20.sol b/src/modules/derivatives/SoulboundCloneERC20.sol index b531927e..aff9f424 100644 --- a/src/modules/derivatives/SoulboundCloneERC20.sol +++ b/src/modules/derivatives/SoulboundCloneERC20.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: BSL-1.1 pragma solidity 0.8.19; -import {ERC20} from "@solmate-6.7.0/tokens/ERC20.sol"; +import {ERC20} from "@solmate-6.8.0/tokens/ERC20.sol"; import {CloneERC20} from "../../lib/clones/CloneERC20.sol"; diff --git a/test/AtomicAuctionHouse/AuctionHouseTest.sol b/test/AtomicAuctionHouse/AuctionHouseTest.sol index 64731e66..73914b79 100644 --- a/test/AtomicAuctionHouse/AuctionHouseTest.sol +++ b/test/AtomicAuctionHouse/AuctionHouseTest.sol @@ -14,7 +14,7 @@ import {Transfer} from "../../src/lib/Transfer.sol"; // External libraries import {Test} from "@forge-std-1.9.1/Test.sol"; -import {FixedPointMathLib} from "@solmate-6.7.0/utils/FixedPointMathLib.sol"; +import {FixedPointMathLib} from "@solmate-6.8.0/utils/FixedPointMathLib.sol"; // Mocks import {MockAtomicAuctionModule} from "../modules/Auction/MockAtomicAuctionModule.sol"; diff --git a/test/AtomicAuctionHouse/auction.t.sol b/test/AtomicAuctionHouse/auction.t.sol index 304099ca..c47cb3ac 100644 --- a/test/AtomicAuctionHouse/auction.t.sol +++ b/test/AtomicAuctionHouse/auction.t.sol @@ -5,7 +5,7 @@ pragma solidity 0.8.19; import {AtomicAuctionHouseTest} from "./AuctionHouseTest.sol"; // Mocks -import {MockERC20} from "@solmate-6.7.0/test/utils/mocks/MockERC20.sol"; +import {MockERC20} from "@solmate-6.8.0/test/utils/mocks/MockERC20.sol"; import {MockBatchAuctionModule} from "../modules/Auction/MockBatchAuctionModule.sol"; import {IAuctionHouse} from "../../src/interfaces/IAuctionHouse.sol"; diff --git a/test/AuctionHouse/MockAuctionHouse.sol b/test/AuctionHouse/MockAuctionHouse.sol index a0549a79..f2a7d7fb 100644 --- a/test/AuctionHouse/MockAuctionHouse.sol +++ b/test/AuctionHouse/MockAuctionHouse.sol @@ -4,7 +4,7 @@ pragma solidity 0.8.19; import {IAuction} from "../../src/interfaces/modules/IAuction.sol"; import {IAuctionHouse} from "../../src/interfaces/IAuctionHouse.sol"; -import {ERC20} from "@solmate-6.7.0/tokens/ERC20.sol"; +import {ERC20} from "@solmate-6.8.0/tokens/ERC20.sol"; import {Transfer} from "../../src/lib/Transfer.sol"; import {AuctionHouse} from "../../src/bases/AuctionHouse.sol"; diff --git a/test/AuctionHouse/sendPayout.t.sol b/test/AuctionHouse/sendPayout.t.sol index 737bc058..5b406d7f 100644 --- a/test/AuctionHouse/sendPayout.t.sol +++ b/test/AuctionHouse/sendPayout.t.sol @@ -12,7 +12,7 @@ import {MockFeeOnTransferERC20} from "../lib/mocks/MockFeeOnTransferERC20.sol"; import {Permit2User} from "../lib/permit2/Permit2User.sol"; import {MockWrappedDerivative} from "../lib/mocks/MockWrappedDerivative.sol"; -import {ERC20} from "@solmate-6.7.0/tokens/ERC20.sol"; +import {ERC20} from "@solmate-6.8.0/tokens/ERC20.sol"; import {ICallback} from "../../src/interfaces/ICallback.sol"; import {IAuctionHouse} from "../../src/interfaces/IAuctionHouse.sol"; diff --git a/test/AuctionHouse/setCondenser.t.sol b/test/AuctionHouse/setCondenser.t.sol index e0777e24..db16659d 100644 --- a/test/AuctionHouse/setCondenser.t.sol +++ b/test/AuctionHouse/setCondenser.t.sol @@ -5,7 +5,7 @@ pragma solidity 0.8.19; import {Test} from "@forge-std-1.9.1/Test.sol"; // Mocks -import {MockERC20} from "@solmate-6.7.0/test/utils/mocks/MockERC20.sol"; +import {MockERC20} from "@solmate-6.8.0/test/utils/mocks/MockERC20.sol"; import {MockAuctionHouse} from "./MockAuctionHouse.sol"; import {MockAtomicAuctionModule} from "../modules/Auction/MockAtomicAuctionModule.sol"; import {MockDerivativeModule} from "../modules/derivatives/mocks/MockDerivativeModule.sol"; diff --git a/test/BatchAuctionHouse/AuctionHouseTest.sol b/test/BatchAuctionHouse/AuctionHouseTest.sol index 628ffcaf..001502bc 100644 --- a/test/BatchAuctionHouse/AuctionHouseTest.sol +++ b/test/BatchAuctionHouse/AuctionHouseTest.sol @@ -14,7 +14,7 @@ import {Transfer} from "../../src/lib/Transfer.sol"; // External libraries import {Test} from "@forge-std-1.9.1/Test.sol"; -import {FixedPointMathLib} from "@solmate-6.7.0/utils/FixedPointMathLib.sol"; +import {FixedPointMathLib} from "@solmate-6.8.0/utils/FixedPointMathLib.sol"; // Mocks import {MockBatchAuctionModule} from "../modules/Auction/MockBatchAuctionModule.sol"; diff --git a/test/BatchAuctionHouse/auction.t.sol b/test/BatchAuctionHouse/auction.t.sol index e5c35165..453bd5a4 100644 --- a/test/BatchAuctionHouse/auction.t.sol +++ b/test/BatchAuctionHouse/auction.t.sol @@ -7,7 +7,7 @@ import {Transfer} from "../../src/lib/Transfer.sol"; // Mocks import {MockAtomicAuctionModule} from "../modules/Auction/MockAtomicAuctionModule.sol"; -import {MockERC20} from "@solmate-6.7.0/test/utils/mocks/MockERC20.sol"; +import {MockERC20} from "@solmate-6.8.0/test/utils/mocks/MockERC20.sol"; import {IAuction} from "../../src/interfaces/modules/IAuction.sol"; import {IAuctionHouse} from "../../src/interfaces/IAuctionHouse.sol"; diff --git a/test/callbacks/MockCallback.sol b/test/callbacks/MockCallback.sol index 1cda4931..29f6c0ba 100644 --- a/test/callbacks/MockCallback.sol +++ b/test/callbacks/MockCallback.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: UNLICENSED pragma solidity 0.8.19; -import {ERC20} from "@solmate-6.7.0/tokens/ERC20.sol"; +import {ERC20} from "@solmate-6.8.0/tokens/ERC20.sol"; import {BaseCallback} from "../../src/bases/BaseCallback.sol"; import {Callbacks} from "../../src/lib/Callbacks.sol"; diff --git a/test/lib/mocks/MockFeeOnTransferERC20.sol b/test/lib/mocks/MockFeeOnTransferERC20.sol index 6789d01e..46af4737 100644 --- a/test/lib/mocks/MockFeeOnTransferERC20.sol +++ b/test/lib/mocks/MockFeeOnTransferERC20.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: UNLICENSED pragma solidity 0.8.19; -import {MockERC20} from "@solmate-6.7.0/test/utils/mocks/MockERC20.sol"; +import {MockERC20} from "@solmate-6.8.0/test/utils/mocks/MockERC20.sol"; contract MockFeeOnTransferERC20 is MockERC20 { uint256 public transferFee; diff --git a/test/lib/mocks/MockWrappedDerivative.sol b/test/lib/mocks/MockWrappedDerivative.sol index 6e59ee41..61f89d32 100644 --- a/test/lib/mocks/MockWrappedDerivative.sol +++ b/test/lib/mocks/MockWrappedDerivative.sol @@ -1,8 +1,8 @@ // SPDX-License-Identifier: UNLICENSED pragma solidity 0.8.19; -import {ERC20} from "@solmate-6.7.0/tokens/ERC20.sol"; -import {ERC6909} from "@solmate-6.7.0/tokens/ERC6909.sol"; +import {ERC20} from "@solmate-6.8.0/tokens/ERC20.sol"; +import {ERC6909} from "@solmate-6.8.0/tokens/ERC6909.sol"; import {Clone} from "@clones-with-immutable-args-1.1.1/Clone.sol"; diff --git a/test/modules/Auction/auction.t.sol b/test/modules/Auction/auction.t.sol index 4bcbd802..e30b08cf 100644 --- a/test/modules/Auction/auction.t.sol +++ b/test/modules/Auction/auction.t.sol @@ -6,7 +6,7 @@ import {Test} from "@forge-std-1.9.1/Test.sol"; import {console2} from "@forge-std-1.9.1/console2.sol"; // Mocks -import {MockERC20} from "@solmate-6.7.0/test/utils/mocks/MockERC20.sol"; +import {MockERC20} from "@solmate-6.8.0/test/utils/mocks/MockERC20.sol"; import {MockAtomicAuctionModule} from "./MockAtomicAuctionModule.sol"; import {Permit2User} from "../../lib/permit2/Permit2User.sol"; diff --git a/test/modules/Auction/cancel.t.sol b/test/modules/Auction/cancel.t.sol index 961d925c..9ae67a22 100644 --- a/test/modules/Auction/cancel.t.sol +++ b/test/modules/Auction/cancel.t.sol @@ -5,7 +5,7 @@ pragma solidity 0.8.19; import {Test} from "@forge-std-1.9.1/Test.sol"; // Mocks -import {MockERC20} from "@solmate-6.7.0/test/utils/mocks/MockERC20.sol"; +import {MockERC20} from "@solmate-6.8.0/test/utils/mocks/MockERC20.sol"; import {MockAtomicAuctionModule} from "./MockAtomicAuctionModule.sol"; import {Permit2User} from "../../lib/permit2/Permit2User.sol"; diff --git a/test/modules/auctions/EMP/settle.t.sol b/test/modules/auctions/EMP/settle.t.sol index 484befdd..949f4ec1 100644 --- a/test/modules/auctions/EMP/settle.t.sol +++ b/test/modules/auctions/EMP/settle.t.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: UNLICENSED pragma solidity 0.8.19; -import {FixedPointMathLib as Math} from "@solmate-6.7.0/utils/FixedPointMathLib.sol"; +import {FixedPointMathLib as Math} from "@solmate-6.8.0/utils/FixedPointMathLib.sol"; import {Module} from "../../../../src/modules/Modules.sol"; import {IAuction} from "../../../../src/interfaces/modules/IAuction.sol"; diff --git a/test/modules/auctions/FPB/FPBTest.sol b/test/modules/auctions/FPB/FPBTest.sol index 415b528a..a45d4f1c 100644 --- a/test/modules/auctions/FPB/FPBTest.sol +++ b/test/modules/auctions/FPB/FPBTest.sol @@ -3,7 +3,7 @@ pragma solidity 0.8.19; // Libraries import {Test} from "@forge-std-1.9.1/Test.sol"; -import {FixedPointMathLib as Math} from "@solmate-6.7.0/utils/FixedPointMathLib.sol"; +import {FixedPointMathLib as Math} from "@solmate-6.8.0/utils/FixedPointMathLib.sol"; // Mocks import {Permit2User} from "../../../lib/permit2/Permit2User.sol"; diff --git a/test/modules/auctions/FPS/FPSTest.sol b/test/modules/auctions/FPS/FPSTest.sol index 106e1872..11ab0be0 100644 --- a/test/modules/auctions/FPS/FPSTest.sol +++ b/test/modules/auctions/FPS/FPSTest.sol @@ -3,7 +3,7 @@ pragma solidity 0.8.19; // Libraries import {Test} from "@forge-std-1.9.1/Test.sol"; -import {FixedPointMathLib as Math} from "@solmate-6.7.0/utils/FixedPointMathLib.sol"; +import {FixedPointMathLib as Math} from "@solmate-6.8.0/utils/FixedPointMathLib.sol"; // Mocks import {Permit2User} from "../../../lib/permit2/Permit2User.sol"; diff --git a/test/modules/auctions/FPS/auction.t.sol b/test/modules/auctions/FPS/auction.t.sol index 9818db71..dec039a4 100644 --- a/test/modules/auctions/FPS/auction.t.sol +++ b/test/modules/auctions/FPS/auction.t.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: UNLICENSED pragma solidity 0.8.19; -import {FixedPointMathLib as Math} from "@solmate-6.7.0/utils/FixedPointMathLib.sol"; +import {FixedPointMathLib as Math} from "@solmate-6.8.0/utils/FixedPointMathLib.sol"; import {Module} from "../../../../src/modules/Modules.sol"; import {IAuction} from "../../../../src/interfaces/modules/IAuction.sol"; diff --git a/test/modules/auctions/FPS/purchase.t.sol b/test/modules/auctions/FPS/purchase.t.sol index e850aee5..24db825e 100644 --- a/test/modules/auctions/FPS/purchase.t.sol +++ b/test/modules/auctions/FPS/purchase.t.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: UNLICENSED pragma solidity 0.8.19; -import {FixedPointMathLib as Math} from "@solmate-6.7.0/utils/FixedPointMathLib.sol"; +import {FixedPointMathLib as Math} from "@solmate-6.8.0/utils/FixedPointMathLib.sol"; import {Module} from "../../../../src/modules/Modules.sol"; import {IAuction} from "../../../../src/interfaces/modules/IAuction.sol"; diff --git a/test/modules/derivatives/LinearVesting.t.sol b/test/modules/derivatives/LinearVesting.t.sol index ba4e0e13..5348a840 100644 --- a/test/modules/derivatives/LinearVesting.t.sol +++ b/test/modules/derivatives/LinearVesting.t.sol @@ -4,7 +4,7 @@ pragma solidity 0.8.19; // Libraries import {Test} from "@forge-std-1.9.1/Test.sol"; import {console2} from "@forge-std-1.9.1/console2.sol"; -import {FixedPointMathLib} from "@solmate-6.7.0/utils/FixedPointMathLib.sol"; +import {FixedPointMathLib} from "@solmate-6.8.0/utils/FixedPointMathLib.sol"; import {Permit2User} from "../../lib/permit2/Permit2User.sol"; import {StringHelper} from "../../lib/String.sol"; diff --git a/test/modules/derivatives/SoulboundCloneERC20.t.sol b/test/modules/derivatives/SoulboundCloneERC20.t.sol index 79af6319..2d2d4acd 100644 --- a/test/modules/derivatives/SoulboundCloneERC20.t.sol +++ b/test/modules/derivatives/SoulboundCloneERC20.t.sol @@ -5,7 +5,7 @@ pragma solidity 0.8.19; import {Test} from "@forge-std-1.9.1/Test.sol"; import {ClonesWithImmutableArgs} from "@clones-with-immutable-args-1.1.1/ClonesWithImmutableArgs.sol"; -import {MockERC20} from "@solmate-6.7.0/test/utils/mocks/MockERC20.sol"; +import {MockERC20} from "@solmate-6.8.0/test/utils/mocks/MockERC20.sol"; import {StringHelper} from "../../lib/String.sol"; import {SoulboundCloneERC20} from "../../../src/modules/derivatives/SoulboundCloneERC20.sol"; diff --git a/test/modules/derivatives/mocks/MockDerivativeModule.sol b/test/modules/derivatives/mocks/MockDerivativeModule.sol index 4358785b..dd6b06ea 100644 --- a/test/modules/derivatives/mocks/MockDerivativeModule.sol +++ b/test/modules/derivatives/mocks/MockDerivativeModule.sol @@ -3,8 +3,8 @@ pragma solidity 0.8.19; import {ClonesWithImmutableArgs} from "@clones-with-immutable-args-1.1.1/ClonesWithImmutableArgs.sol"; -import {SafeTransferLib} from "@solmate-6.7.0/utils/SafeTransferLib.sol"; -import {ERC20} from "@solmate-6.7.0/tokens/ERC20.sol"; +import {SafeTransferLib} from "@solmate-6.8.0/utils/SafeTransferLib.sol"; +import {ERC20} from "@solmate-6.8.0/tokens/ERC20.sol"; // Modules import {Module, Veecode, toKeycode, wrapVeecode} from "../../../../src/modules/Modules.sol"; @@ -12,7 +12,7 @@ import {Module, Veecode, toKeycode, wrapVeecode} from "../../../../src/modules/M // Auctions import {DerivativeModule} from "../../../../src/modules/Derivative.sol"; -import {MockERC6909} from "@solmate-6.7.0/test/utils/mocks/MockERC6909.sol"; +import {MockERC6909} from "@solmate-6.8.0/test/utils/mocks/MockERC6909.sol"; import {MockWrappedDerivative} from "../../../lib/mocks/MockWrappedDerivative.sol"; contract MockDerivativeModule is DerivativeModule { From c8e03f45c61d7e4c0492fe8f899dca85216ea0a6 Mon Sep 17 00:00:00 2001 From: Oighty Date: Tue, 26 Nov 2024 21:39:55 -0600 Subject: [PATCH 05/21] deploy: batch auction house mainnet --- deployments/.mainnet-v1.0.1.json | 6 ++++++ script/deploy/sequences/fixed-batch.json | 12 ++++++++++++ script/env.json | 13 ++++++++++++- script/salts/salts.json | 2 ++ 4 files changed, 32 insertions(+), 1 deletion(-) create mode 100644 deployments/.mainnet-v1.0.1.json diff --git a/deployments/.mainnet-v1.0.1.json b/deployments/.mainnet-v1.0.1.json new file mode 100644 index 00000000..6220f877 --- /dev/null +++ b/deployments/.mainnet-v1.0.1.json @@ -0,0 +1,6 @@ +{ +"deployments.BatchAuctionHouse": "0xBA000020Fed3cf3bF473f09Ca0A72Ba123e20926", +"deployments.BatchCatalogue": "0xD33e5cC03ad1C8F73cc57053f8a749ac76F14988", +"deployments.auctionModules.FixedPriceBatch": "0xC891eC53b389edc1ebC38305B2D400c9E47A33Db", +"deployments.derivativeModules.BatchLinearVesting": "0x605A7105CA51FD5F107258362f52d8269eeA851A" +} diff --git a/script/deploy/sequences/fixed-batch.json b/script/deploy/sequences/fixed-batch.json index 5b5f07a2..c32ab0d0 100644 --- a/script/deploy/sequences/fixed-batch.json +++ b/script/deploy/sequences/fixed-batch.json @@ -1,7 +1,19 @@ { "sequence": [ + { + "name": "BatchAuctionHouse" + }, + { + "name": "BatchCatalogue" + }, { "name": "FixedPriceBatch", + "installBatchAuctionHouse": true, + "maxReferrerFee": 1000, + "maxCuratorFee": 1000 + }, + { + "name": "BatchLinearVesting", "installBatchAuctionHouse": true } ] diff --git a/script/env.json b/script/env.json index da725c3f..f0670383 100644 --- a/script/env.json +++ b/script/env.json @@ -155,7 +155,18 @@ "axis": { "OWNER": "0xB47C8e4bEb28af80eDe5E5bF474927b110Ef2c0e", "PERMIT2": "0x000000000022D473030F116dDEE9F6B43aC78BA3", - "PROTOCOL": "0xB47C8e4bEb28af80eDe5E5bF474927b110Ef2c0e" + "PROTOCOL": "0x007F3eD580c754A9495881b066e9FC98e406c214" + } + }, + "deployments": { + "BatchAuctionHouse": "0xBA000020Fed3cf3bF473f09Ca0A72Ba123e20926", + "BatchCatalogue": "0xD33e5cC03ad1C8F73cc57053f8a749ac76F14988", + "auctionModules": { + "EncryptedMarginalPrice": "0x0000000000000000000000000000000000000000", + "FixedPriceBatch": "0xC891eC53b389edc1ebC38305B2D400c9E47A33Db" + }, + "derivativeModules": { + "BatchLinearVesting": "0x605A7105CA51FD5F107258362f52d8269eeA851A" } } }, diff --git a/script/salts/salts.json b/script/salts/salts.json index e4f1e49e..7889902b 100644 --- a/script/salts/salts.json +++ b/script/salts/salts.json @@ -4,7 +4,9 @@ }, "BatchAuctionHouse": { "0x1d8b7b9cfbd8610a556d5e2e85dcdb25a17d6b5407574aef07970a86e4b0e2c3": "0x06374b73456c869d550c6cb45aff40113752ac3c4dd8efb8185b6da5c898aa82", + "0x338aa33d128442ed702dafeeb23c4f9b2e26e640deefe754dc51983ed8c76aed": "0xf509875cb56d491d6692ba3c6d81794c77f842245c036ffb4eb561ff00dcf27e", "0x4c4d86f9737bd18dab3f6dc74d2f5c610b7169459c90a457e0e126ed42ae3bba": "0xbe4a9dc1b73685497c6104df59c2a3d2c1c5039bd48b1b25e9c0a029f3744311", + "0x6d17f21ad1db4ff3649431f0e693cbf4a3e564389ee57d0b4f3e27fa3dc2bd68": "0xc69c9730f0ecd8b51cbe816d85c2ff802e07634c93d7429a42ef1d70e1c0de2d", "0x8097ce38781d66ff63d0519cb3cead1cbf16f61fb2985844629780698a23469e": "0xa79b0aafdc5de217c20fe5b743a3101249487bea09cfedc2127f7fd567e5273c", "0x926c218dfa94c5d70f80d1833ea9d4c6d581119f856d69e8fcc7e62c69773f4f": "0xb009513c506ae5ea1fd7caa71183203e72a2e197a17ac82f9797621fd7e4fa17", "0x94fdecb32eed6bfe3d3326333a6cb9ca15d60ab30e8f7e250652e2c06833777e": "0x33f782cd8738641381432408693996edb682d0dc75723f2d0895b0c0c6022f58", From 6284d09b43da92abd95bb128065e5fcd95c3488d Mon Sep 17 00:00:00 2001 From: Oighty Date: Mon, 2 Dec 2024 12:16:41 -0600 Subject: [PATCH 06/21] fix: prevent overfill on fpb auction --- src/modules/auctions/batch/FPB.sol | 3 +- test/modules/auctions/FPB/settle.t.sol | 57 ++++++++++++++++++++++++++ 2 files changed, 59 insertions(+), 1 deletion(-) diff --git a/src/modules/auctions/batch/FPB.sol b/src/modules/auctions/batch/FPB.sol index ced95861..075b6f8d 100644 --- a/src/modules/auctions/batch/FPB.sol +++ b/src/modules/auctions/batch/FPB.sol @@ -122,7 +122,8 @@ contract FixedPriceBatch is BatchAuctionModule, IFixedPriceBatch { // Refund will be within the bounds of uint96 // bidAmount is uint96, excess < fullFill, so bidAmount * excess / fullFill < bidAmount < uint96 max - uint96 refund = uint96(Math.fullMulDiv(bidAmount_, excess, fullFill)); + // We round up here to avoid over filling the auction, which has downstream effects + uint96 refund = uint96(Math.fullMulDivUp(bidAmount_, excess, fullFill)); uint256 payout = fullFill - excess; return (PartialFill({bidId: bidId_, refund: refund, payout: payout})); diff --git a/test/modules/auctions/FPB/settle.t.sol b/test/modules/auctions/FPB/settle.t.sol index 77150118..e70fec71 100644 --- a/test/modules/auctions/FPB/settle.t.sol +++ b/test/modules/auctions/FPB/settle.t.sol @@ -219,4 +219,61 @@ contract FpbSettleTest is FpbTest { console2.log("settlementCleared final ==> ", auctionDataFinal.settlementCleared); assert(auctionDataFinal.settlementCleared); } + + // Added due to scenario encountered in the wild + function test_settle_lowPrice_doesNotBrick() + public + givenPrice(15_120_710_000_000) + givenMinFillPercent(100e2) + givenLotCapacity(1_000_000e18) + givenLotIsCreated + givenLotHasStarted + { + // Overbid + vm.prank(address(_auctionHouse)); + _module.bid(_lotId, _BIDDER, _REFERRER, 15_120_710_000_000_000_001, abi.encode("")); + + // Settle the auction + vm.prank(address(_auctionHouse)); + (uint256 totalIn, uint256 totalOut, uint256 capacity,,) = _module.settle(_lotId, 0); + + // Ensure the total out is not more than the capacity + console2.log("totalOut ==> ", totalOut); + console2.log("capacity ==> ", capacity); + console2.log("totalIn ==> ", totalIn); + + assertLe(totalOut, capacity); + assertLe(totalIn, 15_120_710_000_000_000_000); + } + + function testFuzz_settle_partialFill_doesNotBrick( + uint96 price_, + uint96 capacity_, + uint96 amount_ + ) public givenMinFillPercent(100e2) { + // Don't test really low values + // We limit the inputs to uint96 to avoid very high values + vm.assume(price_ > 1e6); + vm.assume(capacity_ > 1e6); + vm.assume(amount_ > uint256(price_) * uint256(capacity_) / 1e18); + + _setPrice(uint256(price_)); + _setCapacity(uint256(capacity_)); + _createAuctionLot(); + _startLot(); + + // Overbid + vm.prank(address(_auctionHouse)); + _module.bid(_lotId, _BIDDER, _REFERRER, amount_, abi.encode("")); + + // Settle the auction + vm.prank(address(_auctionHouse)); + (, uint256 totalOut, uint256 capacity,,) = _module.settle(_lotId, 0); + + // Ensure the total out is not more than the capacity + console2.log("totalOut ==> ", totalOut); + console2.log("capacity ==> ", capacity); + + assertLe(totalOut, capacity); + } } From 739b28b62afe203697e1c1d5df2c22a2d952b3e6 Mon Sep 17 00:00:00 2001 From: Oighty Date: Mon, 2 Dec 2024 13:26:46 -0600 Subject: [PATCH 07/21] chore: bump the FBPA version --- src/modules/auctions/batch/FPB.sol | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/auctions/batch/FPB.sol b/src/modules/auctions/batch/FPB.sol index 075b6f8d..c6d0087b 100644 --- a/src/modules/auctions/batch/FPB.sol +++ b/src/modules/auctions/batch/FPB.sol @@ -46,7 +46,7 @@ contract FixedPriceBatch is BatchAuctionModule, IFixedPriceBatch { /// @inheritdoc Module function VEECODE() public pure override returns (Veecode) { - return toVeecode("01FPBA"); + return toVeecode("02FPBA"); } // ========== AUCTION ========== // From 2a0eb52a61893eb357e29d6d1939fd9279613599 Mon Sep 17 00:00:00 2001 From: Oighty Date: Mon, 2 Dec 2024 13:29:01 -0600 Subject: [PATCH 08/21] deploy: FPB v2 to L2s and testnets --- CHANGELOG.md | 4 ++ deployments/.arbitrum-one-v1.0.2.json | 3 ++ deployments/.arbitrum-sepolia-v1.0.2.json | 3 ++ deployments/.base-sepolia-v1.0.2.json | 3 ++ deployments/.base-v1.0.2.json | 3 ++ deployments/.berachain-bartio-v1.0.2.json | 3 ++ deployments/.blast-sepolia-v1.0.2.json | 3 ++ deployments/.blast-v1.0.2.json | 3 ++ deployments/.mainnet-v1.0.1.json | 8 ++-- deployments/.mode-sepolia-v1.0.2.json | 3 ++ deployments/.mode-v1.0.2.json | 3 ++ .../deploy/sequences/fixed-batch-module.json | 8 ++++ script/env.json | 18 ++++----- soldeer.lock | 39 +++++++++---------- 14 files changed, 70 insertions(+), 34 deletions(-) create mode 100644 deployments/.arbitrum-one-v1.0.2.json create mode 100644 deployments/.arbitrum-sepolia-v1.0.2.json create mode 100644 deployments/.base-sepolia-v1.0.2.json create mode 100644 deployments/.base-v1.0.2.json create mode 100644 deployments/.berachain-bartio-v1.0.2.json create mode 100644 deployments/.blast-sepolia-v1.0.2.json create mode 100644 deployments/.blast-v1.0.2.json create mode 100644 deployments/.mode-sepolia-v1.0.2.json create mode 100644 deployments/.mode-v1.0.2.json create mode 100644 script/deploy/sequences/fixed-batch-module.json diff --git a/CHANGELOG.md b/CHANGELOG.md index a8535cba..1c2c5694 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +## 1.0.2 + +- Fixed a bug in the Fixed Price Batch module that could result in an underflow when an auction was settled + ## 1.0.1 - Seller can now be a referrer to an auction and earn the referrer fee. This allows them to effectively not pay a fee when they direct traffic to their own auction diff --git a/deployments/.arbitrum-one-v1.0.2.json b/deployments/.arbitrum-one-v1.0.2.json new file mode 100644 index 00000000..2702ff3e --- /dev/null +++ b/deployments/.arbitrum-one-v1.0.2.json @@ -0,0 +1,3 @@ +{ + "deployments.auctionModules.FixedPriceBatch": "0xB1e9E16a40321Fe06Cfd797619C345c143D11Aa7" +} diff --git a/deployments/.arbitrum-sepolia-v1.0.2.json b/deployments/.arbitrum-sepolia-v1.0.2.json new file mode 100644 index 00000000..88bbe686 --- /dev/null +++ b/deployments/.arbitrum-sepolia-v1.0.2.json @@ -0,0 +1,3 @@ +{ + "deployments.auctionModules.FixedPriceBatch": "0x43ce692c6C538C76eFeA6f495AdA280B60a7ceCA" +} diff --git a/deployments/.base-sepolia-v1.0.2.json b/deployments/.base-sepolia-v1.0.2.json new file mode 100644 index 00000000..c4fbbc4f --- /dev/null +++ b/deployments/.base-sepolia-v1.0.2.json @@ -0,0 +1,3 @@ +{ + "deployments.auctionModules.FixedPriceBatch": "0xd13d64dD95F3DB8d1B3E1E65a1ef3F952ee1FC73" +} diff --git a/deployments/.base-v1.0.2.json b/deployments/.base-v1.0.2.json new file mode 100644 index 00000000..7e4f0ce7 --- /dev/null +++ b/deployments/.base-v1.0.2.json @@ -0,0 +1,3 @@ +{ + "deployments.auctionModules.FixedPriceBatch": "0xc83Cbb79072CE3341f25326C6a3ad0Cefe36AfdD" +} diff --git a/deployments/.berachain-bartio-v1.0.2.json b/deployments/.berachain-bartio-v1.0.2.json new file mode 100644 index 00000000..a8a80377 --- /dev/null +++ b/deployments/.berachain-bartio-v1.0.2.json @@ -0,0 +1,3 @@ +{ + "deployments.auctionModules.FixedPriceBatch": "0x68a8d91d9936b5Ef8b65f516F8a5AAB6c7b1E43e" +} diff --git a/deployments/.blast-sepolia-v1.0.2.json b/deployments/.blast-sepolia-v1.0.2.json new file mode 100644 index 00000000..af4b711e --- /dev/null +++ b/deployments/.blast-sepolia-v1.0.2.json @@ -0,0 +1,3 @@ +{ + "deployments.auctionModules.FixedPriceBatch": "0x527Bec0Ed0660c7fc4Dcf64b741eb4CfCDEA1615" +} diff --git a/deployments/.blast-v1.0.2.json b/deployments/.blast-v1.0.2.json new file mode 100644 index 00000000..f3920547 --- /dev/null +++ b/deployments/.blast-v1.0.2.json @@ -0,0 +1,3 @@ +{ + "deployments.auctionModules.FixedPriceBatch": "0xCaAE490470305a9d6f58b026cdD36cc747F8F0b9" +} diff --git a/deployments/.mainnet-v1.0.1.json b/deployments/.mainnet-v1.0.1.json index 6220f877..5b59bdee 100644 --- a/deployments/.mainnet-v1.0.1.json +++ b/deployments/.mainnet-v1.0.1.json @@ -1,6 +1,6 @@ { -"deployments.BatchAuctionHouse": "0xBA000020Fed3cf3bF473f09Ca0A72Ba123e20926", -"deployments.BatchCatalogue": "0xD33e5cC03ad1C8F73cc57053f8a749ac76F14988", -"deployments.auctionModules.FixedPriceBatch": "0xC891eC53b389edc1ebC38305B2D400c9E47A33Db", -"deployments.derivativeModules.BatchLinearVesting": "0x605A7105CA51FD5F107258362f52d8269eeA851A" + "deployments.BatchAuctionHouse": "0xBA000020Fed3cf3bF473f09Ca0A72Ba123e20926", + "deployments.BatchCatalogue": "0xD33e5cC03ad1C8F73cc57053f8a749ac76F14988", + "deployments.auctionModules.FixedPriceBatch": "0xC891eC53b389edc1ebC38305B2D400c9E47A33Db", + "deployments.derivativeModules.BatchLinearVesting": "0x605A7105CA51FD5F107258362f52d8269eeA851A" } diff --git a/deployments/.mode-sepolia-v1.0.2.json b/deployments/.mode-sepolia-v1.0.2.json new file mode 100644 index 00000000..38bb2be3 --- /dev/null +++ b/deployments/.mode-sepolia-v1.0.2.json @@ -0,0 +1,3 @@ +{ + "deployments.auctionModules.FixedPriceBatch": "0xa9458b5C26810F4bE972d9fB50147e5E2395dC3E" +} diff --git a/deployments/.mode-v1.0.2.json b/deployments/.mode-v1.0.2.json new file mode 100644 index 00000000..a0210d08 --- /dev/null +++ b/deployments/.mode-v1.0.2.json @@ -0,0 +1,3 @@ +{ + "deployments.auctionModules.FixedPriceBatch": "0x4044d6dE91FB3049A9eBA24e4299d0d7ec7E53a3" +} diff --git a/script/deploy/sequences/fixed-batch-module.json b/script/deploy/sequences/fixed-batch-module.json new file mode 100644 index 00000000..5b5f07a2 --- /dev/null +++ b/script/deploy/sequences/fixed-batch-module.json @@ -0,0 +1,8 @@ +{ + "sequence": [ + { + "name": "FixedPriceBatch", + "installBatchAuctionHouse": true + } + ] +} diff --git a/script/env.json b/script/env.json index f0670383..842a17bd 100644 --- a/script/env.json +++ b/script/env.json @@ -13,7 +13,7 @@ "BatchCatalogue": "0xA17fC2B153222bdC549AE22Af5AcA7aC773979Fc", "auctionModules": { "EncryptedMarginalPrice": "0xA06A0A5D22E31D8d19c49FFd65c8FC37477077e2", - "FixedPriceBatch": "0xA74E9a7726b084968a314bE71D60646AA6805109" + "FixedPriceBatch": "0xB1e9E16a40321Fe06Cfd797619C345c143D11Aa7" }, "derivativeModules": { "BatchLinearVesting": "0xCaAE490470305a9d6f58b026cdD36cc747F8F0b9" @@ -33,7 +33,7 @@ "BatchCatalogue": "0xBC1a6e1327c0CdA84Bc6feC65f99cdfCA976DD97", "auctionModules": { "EncryptedMarginalPrice": "0x9099dd8Db39B8aD5D31d9865F013F1d2278c3506", - "FixedPriceBatch": "0x4E2DE4DB0DB1D28B0751B9D0A6b6db222E64Fd43" + "FixedPriceBatch": "0x43ce692c6C538C76eFeA6f495AdA280B60a7ceCA" }, "derivativeModules": { "BatchLinearVesting": "0x14726B9D69d4Fb957e4F3C736bda029Fd96e1FFb" @@ -53,7 +53,7 @@ "BatchCatalogue": "0x2B63Aa737a1AD617A6d6894698Abd043F95cCecb", "auctionModules": { "EncryptedMarginalPrice": "0x408fB738592232372069B592022F03BF3a241613", - "FixedPriceBatch": "0xB4d895191fEE12aa5147D057fcFe720f7c0Dc76C" + "FixedPriceBatch": "0xc83Cbb79072CE3341f25326C6a3ad0Cefe36AfdD" }, "derivativeModules": { "BatchLinearVesting": "0x5C439EAa3F039Bac9Bf1ea4Eb6121d5767C63864" @@ -73,7 +73,7 @@ "BatchCatalogue": "0x97145edD2F06ADF1d91CB9Aa5eb52D842a3f5c54", "auctionModules": { "EncryptedMarginalPrice": "0xf0a4d1f805312438ea146E5df873bD8d64D9dBe4", - "FixedPriceBatch": "0xDF09C4de6B937a1C555052e15Ad6F3EE673618Ae" + "FixedPriceBatch": "0xd13d64dD95F3DB8d1B3E1E65a1ef3F952ee1FC73" }, "derivativeModules": { "BatchLinearVesting": "0x909F26919989167d051312fBB0a1Df4CD93Bf70b" @@ -93,7 +93,7 @@ "BatchCatalogue": "0x37886d0667c16f41F73F6586f087166Ae3CF1155", "auctionModules": { "EncryptedMarginalPrice": "0x2C7aE1A3989f17a6d9935382bDe7F1b021055083", - "FixedPriceBatch": "0x8Db46375e73545226E99b5e8cBfe2794ac835D38" + "FixedPriceBatch": "0x68a8d91d9936b5Ef8b65f516F8a5AAB6c7b1E43e" }, "derivativeModules": { "BatchLinearVesting": "0xD55227c0C37C97Fa2619a9C7F658C173883C1E2a" @@ -118,7 +118,7 @@ "BatchCatalogue": "0xBFfBef6f8a0Ef38121716860E2Ff824c018a467d", "auctionModules": { "EncryptedMarginalPrice": "0x16D5Aab9d35f8B3ac7BD086eEDcCe5343682D5F0", - "FixedPriceBatch": "0x37886d0667c16f41F73F6586f087166Ae3CF1155" + "FixedPriceBatch": "0xCaAE490470305a9d6f58b026cdD36cc747F8F0b9" }, "derivativeModules": { "BatchLinearVesting": "0x5998a28a71e6BDc2b592c14e3517212391782db0" @@ -143,7 +143,7 @@ "BatchCatalogue": "0x26e5Fd9ea25a5719D4EbA3b1966dd4864c48e517", "auctionModules": { "EncryptedMarginalPrice": "0x1043ef1f242e3FC5E90fd67Bb5a1B1356b102b39", - "FixedPriceBatch": "0x562456ca4Cc0Bc964D383aCDe53ED04A15880149" + "FixedPriceBatch": "0x527Bec0Ed0660c7fc4Dcf64b741eb4CfCDEA1615" }, "derivativeModules": { "BatchLinearVesting": "0x9011aC431f91Fd92437cBfdAE30a4ee4b76fEE1F" @@ -223,7 +223,7 @@ "BatchCatalogue": "0x8Db46375e73545226E99b5e8cBfe2794ac835D38", "auctionModules": { "EncryptedMarginalPrice": "0xA17fC2B153222bdC549AE22Af5AcA7aC773979Fc", - "FixedPriceBatch": "0x0599DA010907835037A0beC4525Dc5D600e790EB" + "FixedPriceBatch": "0x4044d6dE91FB3049A9eBA24e4299d0d7ec7E53a3" }, "derivativeModules": { "BatchLinearVesting": "0xc20918b09dE9708d2A7997dfFc3c5ACB34d4a15b" @@ -243,7 +243,7 @@ "BatchCatalogue": "0x2eF571199c0BA4923FCf18cB802e302C0aF544Ef", "auctionModules": { "EncryptedMarginalPrice": "0xD6F9425776eE91b7181a16256768fAB9aB8B20a4", - "FixedPriceBatch": "0xfF5f4fF1b91178b66eDE0E0e2697861F362c29c0" + "FixedPriceBatch": "0xa9458b5C26810F4bE972d9fB50147e5E2395dC3E" }, "derivativeModules": { "BatchLinearVesting": "0xE8546C3f5d5dB707081ffAfDB5416d808758D120" diff --git a/soldeer.lock b/soldeer.lock index 0b6369e8..070185c9 100644 --- a/soldeer.lock +++ b/soldeer.lock @@ -1,33 +1,30 @@ -[[dependencies]] -name = "@openzeppelin-contracts" -version = "4.9.2" -url = "https://soldeer-revisions.s3.amazonaws.com/@openzeppelin-contracts/4_9_2_22-01-2024_13:13:52_contracts.zip" -checksum = "0f4450671798ea5659e6391876a3cf443ca50a696d9b556ac622ec7660bce306" -integrity = "f69bd90f264280204b2a1172a02a2d20f3611f5993a61e5215647bec696a8420" - -[[dependencies]] -name = "clones-with-immutable-args" -version = "1.1.1" -git = "git@github.com:wighawag/clones-with-immutable-args.git" -rev = "f5ca191afea933d50a36d101009b5644dc28bc99" [[dependencies]] name = "forge-std" version = "1.9.1" -url = "https://soldeer-revisions.s3.amazonaws.com/forge-std/v1_9_1_03-07-2024_14:44:59_forge-std-v1.9.1.zip" +source = "https://soldeer-revisions.s3.amazonaws.com/forge-std/v1_9_1_03-07-2024_14:44:59_forge-std-v1.9.1.zip" checksum = "110b35ad3604d91a919c521c71206c18cd07b29c750bd90b5cbbaf37288c9636" -integrity = "389f8bfe6b6aad01915b1e38e6d4839f8189e8d4792b42be4e10d0a96a358e3f" + +[[dependencies]] +name = "solmate" +version = "6.8.0" +source = "https://soldeer-revisions.s3.amazonaws.com/solmate/6_8_0_29-10-2024_19:01:45_solmate.zip" +checksum = "e3ec0f0182cb3bbedecf8a0bcc39897266534a795ec732b2b03dafa285d78a5b" [[dependencies]] name = "solady" version = "0.0.124" -url = "https://soldeer-revisions.s3.amazonaws.com/solady/0_0_124_22-01-2024_13:28:04_solady.zip" +source = "https://soldeer-revisions.s3.amazonaws.com/solady/0_0_124_22-01-2024_13:28:04_solady.zip" checksum = "9342385eaad08f9bb5408be0b41b241dd2b974c001f7da8c3b1ac552b52ce16b" -integrity = "29d93e52694d8e858cf5a737257f4a6f21aefccaf803174fd00b9d686172ab27" [[dependencies]] -name = "solmate" -version = "6.8.0" -url = "https://soldeer-revisions.s3.amazonaws.com/solmate/6_8_0_29-10-2024_19:01:45_solmate.zip" -checksum = "e3ec0f0182cb3bbedecf8a0bcc39897266534a795ec732b2b03dafa285d78a5b" -integrity = "a22e5a352de0231f671ee8adf5667bbe83c50012670083987bd1099a69feb429" +name = "@openzeppelin-contracts" +version = "4.9.2" +source = "https://soldeer-revisions.s3.amazonaws.com/@openzeppelin-contracts/4_9_2_22-01-2024_13:13:52_contracts.zip" +checksum = "0f4450671798ea5659e6391876a3cf443ca50a696d9b556ac622ec7660bce306" + +[[dependencies]] +name = "clones-with-immutable-args" +version = "1.1.1" +source = "git@github.com:wighawag/clones-with-immutable-args.git" +checksum = "f5ca191afea933d50a36d101009b5644dc28bc99" From a7d956b0a170dcb732ddf2df9db41e32532f76e9 Mon Sep 17 00:00:00 2001 From: Oighty Date: Wed, 4 Dec 2024 09:46:40 -0600 Subject: [PATCH 09/21] fix: partial fill payout rounding in FPB --- src/modules/auctions/batch/FPB.sol | 4 +- test/modules/auctions/FPB/claimBids.t.sol | 63 +++++++++++++++++++++++ 2 files changed, 66 insertions(+), 1 deletion(-) diff --git a/src/modules/auctions/batch/FPB.sol b/src/modules/auctions/batch/FPB.sol index c6d0087b..6b64c28b 100644 --- a/src/modules/auctions/batch/FPB.sol +++ b/src/modules/auctions/batch/FPB.sol @@ -124,7 +124,9 @@ contract FixedPriceBatch is BatchAuctionModule, IFixedPriceBatch { // bidAmount is uint96, excess < fullFill, so bidAmount * excess / fullFill < bidAmount < uint96 max // We round up here to avoid over filling the auction, which has downstream effects uint96 refund = uint96(Math.fullMulDivUp(bidAmount_, excess, fullFill)); - uint256 payout = fullFill - excess; + // Calculate the payout for the bid amount minus the refund + // We do this again instead of using the fullFill - excess to avoid rounding errors + uint256 payout = Math.fullMulDiv(bidAmount_ - refund, baseScale_, price_); return (PartialFill({bidId: bidId_, refund: refund, payout: payout})); } diff --git a/test/modules/auctions/FPB/claimBids.t.sol b/test/modules/auctions/FPB/claimBids.t.sol index c4f48565..2e037c1e 100644 --- a/test/modules/auctions/FPB/claimBids.t.sol +++ b/test/modules/auctions/FPB/claimBids.t.sol @@ -287,4 +287,67 @@ contract FpbClaimBidsTest is FpbTest { IFixedPriceBatch.Bid memory bidDataTwo = _module.getBid(_lotId, 2); assertEq(uint8(bidDataTwo.status), uint8(IFixedPriceBatch.BidStatus.Claimed), "status"); } + + // bug encountered in prod + function test_partialFill_roundingError() + public + givenPrice(15_120_710_000_000) + givenMinFillPercent(100e2) + givenLotCapacity(1_000_000e18) + givenLotIsCreated + givenLotHasStarted + { + // Auction parameters + // Capacity: 1,000,000 FLAPPY + // Price: 0.00001512071 ETH/FLAPPY + // Expected Proceeds: 15.12071 ETH + + // Observed results with complete fill: + // Tokens Sold: 999999.999999999999933865 FLAPPY + // Proceeds: 15.120709999999999999 ETH + // The reason these values are lower is that we introduced rounding behavior + // so that the refund on a partial fill would be slightly larger to not oversell + // the auction. If oversold, settle bricks so we round up the refund to prevent this. + + // However, the partial fill payout ended up being too high and caused an error + // when that user went to claim their bid. This is because a refund of 0.000000000000066135 FLAPPY + // was sent from the auction house back to the callback on settlement since the sold value was + // less than the capacity. Thus, the auction house did not have enough capacity to pay out all + // of the successful bids at that point (it was 0.000000000000066105 FLAPPY short). + + // To recreate this, we submit two bids. The first is for all the capacity that was expended before + // the partial bid was placed, and the second bid is the same as the observed partial bid. + + // The partial bid was for 0.3 ETH and they received: + // Filled: 0.083710000000000000 ETH + // Refund: 0.216290000000000001 ETH + // Payout: 5,536.11569827078225824 FLAPPY + + // The first bid should then be for 15.12071 - 0.08371 ETH = 15.037 ETH + vm.prank(address(_auctionHouse)); + uint64 id1 = + _module.bid(_lotId, _BIDDER, _REFERRER, 15_037_000_000_000_000_000, abi.encode("")); + + // The second bid should be for 0.3 ETH + vm.prank(address(_auctionHouse)); + uint64 id2 = _module.bid(_lotId, _BIDDER, _REFERRER, 3e17, abi.encode("")); + + // Settle the auction + vm.prank(address(_auctionHouse)); + (uint256 totalIn, uint256 totalOut,, bool finished,) = _module.settle(_lotId, 2); + + // Check that the auction is settled and the results are what we expect + assertEq(totalIn, 15_120_709_999_999_999_999); + assertEq(totalOut, 999_999_999_999_999_999_933_865); + assertTrue(finished); + + // Assert that the total out is equal to the capacity minus the refund sent to the seller + assertEq(totalOut, 1_000_000e18 - 66_135); + + // Validate that the bid claims add up to less than or equal the total out + IBatchAuction.BidClaim memory bidClaim1 = _module.getBidClaim(_lotId, id1); + IBatchAuction.BidClaim memory bidClaim2 = _module.getBidClaim(_lotId, id2); + + assertLe(bidClaim1.payout + bidClaim2.payout, totalOut); + } } From d3b9d311c1d25c49a882479e0e458b2e159f0a84 Mon Sep 17 00:00:00 2001 From: Oighty Date: Fri, 6 Dec 2024 10:59:49 -0600 Subject: [PATCH 10/21] test: add fuzz test for FPB fix --- test/modules/auctions/FPB/FPBTest.sol | 1 + test/modules/auctions/FPB/claimBids.t.sol | 62 +++++++++++++++++++++++ 2 files changed, 63 insertions(+) diff --git a/test/modules/auctions/FPB/FPBTest.sol b/test/modules/auctions/FPB/FPBTest.sol index a45d4f1c..e8cc03fe 100644 --- a/test/modules/auctions/FPB/FPBTest.sol +++ b/test/modules/auctions/FPB/FPBTest.sol @@ -26,6 +26,7 @@ abstract contract FpbTest is Test, Permit2User { uint48 internal constant _DURATION = 1 days; uint24 internal constant _MIN_FILL_PERCENT = 50e2; // 50% uint256 internal constant _PRICE = 2e18; + uint24 internal constant _ONE_HUNDRED_PERCENT = 100e2; BatchAuctionHouse internal _auctionHouse; FixedPriceBatch internal _module; diff --git a/test/modules/auctions/FPB/claimBids.t.sol b/test/modules/auctions/FPB/claimBids.t.sol index 2e037c1e..386bd126 100644 --- a/test/modules/auctions/FPB/claimBids.t.sol +++ b/test/modules/auctions/FPB/claimBids.t.sol @@ -7,6 +7,7 @@ import {IBatchAuction} from "../../../../src/interfaces/modules/IBatchAuction.so import {IFixedPriceBatch} from "../../../../src/interfaces/modules/auctions/IFixedPriceBatch.sol"; import {FpbTest} from "./FPBTest.sol"; +import {console2} from "@forge-std-1.9.1/console2.sol"; contract FpbClaimBidsTest is FpbTest { // [X] when the caller is not the parent @@ -350,4 +351,65 @@ contract FpbClaimBidsTest is FpbTest { assertLe(bidClaim1.payout + bidClaim2.payout, totalOut); } + + function testFuzz_partialFill_roundingError( + uint96 price_, + uint24 percentRemaining_, + uint96 amount_ + ) public givenMinFillPercent(100e2) { + // Assume the price is less than 1e27 and greater than 1e9 (+/- 9 decimals) + // Use uint96 to get fewer rejections since it's max is close to 1e27 (~8e28) + vm.assume(price_ >= 1e9 && price_ <= 1e27); + + _setPrice(uint256(price_)); + + // Create a lot + _createAuctionLot(); + + // Start the lot + _startLot(); + + // Set the percent remaining as something less than 100% + uint256 percentRemaining = uint256(percentRemaining_) % _ONE_HUNDRED_PERCENT; + vm.assume(percentRemaining > 0); + + console2.log("percentRemaining", percentRemaining); + console2.log("price", price_); + console2.log("amount", amount_); + + // Calculate the first bid amount as a percentage of the total amount + uint256 capacityInQuote = (_auctionParams.capacity * price_) / _BASE_SCALE; + console2.log("capacityInQuote", capacityInQuote); + uint256 firstBidAmount = + capacityInQuote * (_ONE_HUNDRED_PERCENT - percentRemaining) / _ONE_HUNDRED_PERCENT; + uint256 remaining = capacityInQuote - firstBidAmount; + uint256 secondBidAmount = amount_ < remaining ? remaining + 1 : amount_; + + console2.log("firstBidAmount", firstBidAmount); + console2.log("secondBidAmount", secondBidAmount); + + // Submit the first bid, auction should not be filled completely + vm.prank(address(_auctionHouse)); + uint64 id1 = _module.bid(_lotId, _BIDDER, _REFERRER, firstBidAmount, abi.encode("")); + + // Submit the second bid, auction should be filled completely and this bid should be a partial fill + vm.prank(address(_auctionHouse)); + uint64 id2 = _module.bid(_lotId, _BIDDER, _REFERRER, secondBidAmount, abi.encode("")); + + // Settle the auction + vm.prank(address(_auctionHouse)); + (uint256 totalIn, uint256 totalOut,, bool finished,) = _module.settle(_lotId, 2); + + // Check that the auction is settled and the results are what we expect + // assertLe(totalIn, capacityInQuote, "totalIn"); This isn't necessarily required, we can handle a slightly higher totalIn + assertLe(totalOut, _auctionParams.capacity, "totalOut"); + assertTrue(finished, "finished"); + + // Validate that the bid claims add up to less than or equal the total out + IBatchAuction.BidClaim memory bidClaim1 = _module.getBidClaim(_lotId, id1); + IBatchAuction.BidClaim memory bidClaim2 = _module.getBidClaim(_lotId, id2); + + assertLe(bidClaim1.payout + bidClaim2.payout, totalOut); + assertGe(bidClaim1.paid + bidClaim2.paid - bidClaim2.refund, totalIn); + } } From 684fe5d23ee8752ccd00019054e1a897c63004fc Mon Sep 17 00:00:00 2001 From: Oighty Date: Fri, 13 Dec 2024 14:00:58 -0600 Subject: [PATCH 11/21] chore: bump FPB version to 3 --- src/modules/auctions/batch/FPB.sol | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/auctions/batch/FPB.sol b/src/modules/auctions/batch/FPB.sol index 6b64c28b..5b4c3477 100644 --- a/src/modules/auctions/batch/FPB.sol +++ b/src/modules/auctions/batch/FPB.sol @@ -46,7 +46,7 @@ contract FixedPriceBatch is BatchAuctionModule, IFixedPriceBatch { /// @inheritdoc Module function VEECODE() public pure override returns (Veecode) { - return toVeecode("02FPBA"); + return toVeecode("03FPBA"); } // ========== AUCTION ========== // From 273191995ba8d9aadaee1241b9473559c43b37c3 Mon Sep 17 00:00:00 2001 From: Oighty Date: Fri, 13 Dec 2024 14:05:19 -0600 Subject: [PATCH 12/21] chore: FPB v2 deploy --- deployments/.mainnet-v1.0.2.json | 3 +++ script/deploy/sequences/fixed-batch-module.json | 2 +- script/env.json | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) create mode 100644 deployments/.mainnet-v1.0.2.json diff --git a/deployments/.mainnet-v1.0.2.json b/deployments/.mainnet-v1.0.2.json new file mode 100644 index 00000000..e787240e --- /dev/null +++ b/deployments/.mainnet-v1.0.2.json @@ -0,0 +1,3 @@ +{ +"deployments.auctionModules.FixedPriceBatch": "0xaC9957282BeA578f371078ddc4cD12A135B105d6" +} diff --git a/script/deploy/sequences/fixed-batch-module.json b/script/deploy/sequences/fixed-batch-module.json index 5b5f07a2..4f0c59db 100644 --- a/script/deploy/sequences/fixed-batch-module.json +++ b/script/deploy/sequences/fixed-batch-module.json @@ -2,7 +2,7 @@ "sequence": [ { "name": "FixedPriceBatch", - "installBatchAuctionHouse": true + "installBatchAuctionHouse": false } ] } diff --git a/script/env.json b/script/env.json index 842a17bd..1aa683ba 100644 --- a/script/env.json +++ b/script/env.json @@ -163,7 +163,7 @@ "BatchCatalogue": "0xD33e5cC03ad1C8F73cc57053f8a749ac76F14988", "auctionModules": { "EncryptedMarginalPrice": "0x0000000000000000000000000000000000000000", - "FixedPriceBatch": "0xC891eC53b389edc1ebC38305B2D400c9E47A33Db" + "FixedPriceBatch": "0xaC9957282BeA578f371078ddc4cD12A135B105d6" }, "derivativeModules": { "BatchLinearVesting": "0x605A7105CA51FD5F107258362f52d8269eeA851A" From 769e781f9953f42429e6b562d0bd6e05cdf415f0 Mon Sep 17 00:00:00 2001 From: Oighty Date: Fri, 13 Dec 2024 14:07:23 -0600 Subject: [PATCH 13/21] chore: update changelog --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1c2c5694..4798ae37 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +## 1.0.3 + +- Fixed a bug in the Fixed Price Batch module calculating the payout of a partially filled bid. This was introduced in v1.0.2 when the underflow bug was fixed. + ## 1.0.2 - Fixed a bug in the Fixed Price Batch module that could result in an underflow when an auction was settled From 39e353844f2dcc90e3241578a2167159897a2afe Mon Sep 17 00:00:00 2001 From: Oighty Date: Fri, 13 Dec 2024 14:29:39 -0600 Subject: [PATCH 14/21] deploy: FPBA v3 to all chains --- deployments/.arbitrum-one-v1.0.3.json | 3 +++ deployments/.arbitrum-sepolia-v1.0.3.json | 3 +++ deployments/.base-sepolia-v1.0.3.json | 3 +++ deployments/.base-v1.0.3.json | 3 +++ deployments/.berachain-bartio-v1.0.3.json | 3 +++ deployments/.blast-sepolia-v1.0.3.json | 3 +++ deployments/.blast-v1.0.3.json | 3 +++ deployments/.mainnet-v1.0.3.json | 3 +++ deployments/.mode-sepolia-v1.0.3.json | 3 +++ deployments/.mode-v1.0.3.json | 3 +++ script/env.json | 20 ++++++++++---------- 11 files changed, 40 insertions(+), 10 deletions(-) create mode 100644 deployments/.arbitrum-one-v1.0.3.json create mode 100644 deployments/.arbitrum-sepolia-v1.0.3.json create mode 100644 deployments/.base-sepolia-v1.0.3.json create mode 100644 deployments/.base-v1.0.3.json create mode 100644 deployments/.berachain-bartio-v1.0.3.json create mode 100644 deployments/.blast-sepolia-v1.0.3.json create mode 100644 deployments/.blast-v1.0.3.json create mode 100644 deployments/.mainnet-v1.0.3.json create mode 100644 deployments/.mode-sepolia-v1.0.3.json create mode 100644 deployments/.mode-v1.0.3.json diff --git a/deployments/.arbitrum-one-v1.0.3.json b/deployments/.arbitrum-one-v1.0.3.json new file mode 100644 index 00000000..3bfb14c3 --- /dev/null +++ b/deployments/.arbitrum-one-v1.0.3.json @@ -0,0 +1,3 @@ +{ +"deployments.auctionModules.FixedPriceBatch": "0x04974BcFC715c148818724d9Caab3Fe8d0391b8b" +} diff --git a/deployments/.arbitrum-sepolia-v1.0.3.json b/deployments/.arbitrum-sepolia-v1.0.3.json new file mode 100644 index 00000000..06641ab2 --- /dev/null +++ b/deployments/.arbitrum-sepolia-v1.0.3.json @@ -0,0 +1,3 @@ +{ +"deployments.auctionModules.FixedPriceBatch": "0xAF4AaFC046FB329EB1181c0094a95DA7Cee38211" +} diff --git a/deployments/.base-sepolia-v1.0.3.json b/deployments/.base-sepolia-v1.0.3.json new file mode 100644 index 00000000..3fc55b2b --- /dev/null +++ b/deployments/.base-sepolia-v1.0.3.json @@ -0,0 +1,3 @@ +{ +"deployments.auctionModules.FixedPriceBatch": "0x1A6Ba70B8e5957bCd03C20f9CF42D9e6D3d9b514" +} diff --git a/deployments/.base-v1.0.3.json b/deployments/.base-v1.0.3.json new file mode 100644 index 00000000..6c823932 --- /dev/null +++ b/deployments/.base-v1.0.3.json @@ -0,0 +1,3 @@ +{ +"deployments.auctionModules.FixedPriceBatch": "0x4042D4F2236D055212d485E028E8FE4939252F88" +} diff --git a/deployments/.berachain-bartio-v1.0.3.json b/deployments/.berachain-bartio-v1.0.3.json new file mode 100644 index 00000000..d91d3108 --- /dev/null +++ b/deployments/.berachain-bartio-v1.0.3.json @@ -0,0 +1,3 @@ +{ +"deployments.auctionModules.FixedPriceBatch": "0x4044d6dE91FB3049A9eBA24e4299d0d7ec7E53a3" +} diff --git a/deployments/.blast-sepolia-v1.0.3.json b/deployments/.blast-sepolia-v1.0.3.json new file mode 100644 index 00000000..df185baa --- /dev/null +++ b/deployments/.blast-sepolia-v1.0.3.json @@ -0,0 +1,3 @@ +{ +"deployments.auctionModules.FixedPriceBatch": "0xf1E5FA9008fC3a62D90c7e569E02D98315C19DC3" +} diff --git a/deployments/.blast-v1.0.3.json b/deployments/.blast-v1.0.3.json new file mode 100644 index 00000000..0cf4dc35 --- /dev/null +++ b/deployments/.blast-v1.0.3.json @@ -0,0 +1,3 @@ +{ +"deployments.auctionModules.FixedPriceBatch": "0x0e4996960731Fec8E7C9DBbD51383fC71174DD88" +} diff --git a/deployments/.mainnet-v1.0.3.json b/deployments/.mainnet-v1.0.3.json new file mode 100644 index 00000000..ed179ce3 --- /dev/null +++ b/deployments/.mainnet-v1.0.3.json @@ -0,0 +1,3 @@ +{ +"deployments.auctionModules.FixedPriceBatch": "0x4ED7160dA0020070ADf1AB149c730E8A4bD73d15" +} diff --git a/deployments/.mode-sepolia-v1.0.3.json b/deployments/.mode-sepolia-v1.0.3.json new file mode 100644 index 00000000..15fc0c63 --- /dev/null +++ b/deployments/.mode-sepolia-v1.0.3.json @@ -0,0 +1,3 @@ +{ +"deployments.auctionModules.FixedPriceBatch": "0x8e5a555bcaB474C91dcA326bE3DFdDa7e30c3765" +} diff --git a/deployments/.mode-v1.0.3.json b/deployments/.mode-v1.0.3.json new file mode 100644 index 00000000..059b2818 --- /dev/null +++ b/deployments/.mode-v1.0.3.json @@ -0,0 +1,3 @@ +{ +"deployments.auctionModules.FixedPriceBatch": "0x3A327c856AF41EcF4d783975CE38f669dEeaB298" +} diff --git a/script/env.json b/script/env.json index 1aa683ba..c40bf1ad 100644 --- a/script/env.json +++ b/script/env.json @@ -13,7 +13,7 @@ "BatchCatalogue": "0xA17fC2B153222bdC549AE22Af5AcA7aC773979Fc", "auctionModules": { "EncryptedMarginalPrice": "0xA06A0A5D22E31D8d19c49FFd65c8FC37477077e2", - "FixedPriceBatch": "0xB1e9E16a40321Fe06Cfd797619C345c143D11Aa7" + "FixedPriceBatch": "0x04974BcFC715c148818724d9Caab3Fe8d0391b8b" }, "derivativeModules": { "BatchLinearVesting": "0xCaAE490470305a9d6f58b026cdD36cc747F8F0b9" @@ -33,7 +33,7 @@ "BatchCatalogue": "0xBC1a6e1327c0CdA84Bc6feC65f99cdfCA976DD97", "auctionModules": { "EncryptedMarginalPrice": "0x9099dd8Db39B8aD5D31d9865F013F1d2278c3506", - "FixedPriceBatch": "0x43ce692c6C538C76eFeA6f495AdA280B60a7ceCA" + "FixedPriceBatch": "0xAF4AaFC046FB329EB1181c0094a95DA7Cee38211" }, "derivativeModules": { "BatchLinearVesting": "0x14726B9D69d4Fb957e4F3C736bda029Fd96e1FFb" @@ -53,7 +53,7 @@ "BatchCatalogue": "0x2B63Aa737a1AD617A6d6894698Abd043F95cCecb", "auctionModules": { "EncryptedMarginalPrice": "0x408fB738592232372069B592022F03BF3a241613", - "FixedPriceBatch": "0xc83Cbb79072CE3341f25326C6a3ad0Cefe36AfdD" + "FixedPriceBatch": "0x4042D4F2236D055212d485E028E8FE4939252F88" }, "derivativeModules": { "BatchLinearVesting": "0x5C439EAa3F039Bac9Bf1ea4Eb6121d5767C63864" @@ -73,7 +73,7 @@ "BatchCatalogue": "0x97145edD2F06ADF1d91CB9Aa5eb52D842a3f5c54", "auctionModules": { "EncryptedMarginalPrice": "0xf0a4d1f805312438ea146E5df873bD8d64D9dBe4", - "FixedPriceBatch": "0xd13d64dD95F3DB8d1B3E1E65a1ef3F952ee1FC73" + "FixedPriceBatch": "0x1A6Ba70B8e5957bCd03C20f9CF42D9e6D3d9b514" }, "derivativeModules": { "BatchLinearVesting": "0x909F26919989167d051312fBB0a1Df4CD93Bf70b" @@ -93,7 +93,7 @@ "BatchCatalogue": "0x37886d0667c16f41F73F6586f087166Ae3CF1155", "auctionModules": { "EncryptedMarginalPrice": "0x2C7aE1A3989f17a6d9935382bDe7F1b021055083", - "FixedPriceBatch": "0x68a8d91d9936b5Ef8b65f516F8a5AAB6c7b1E43e" + "FixedPriceBatch": "0x4044d6dE91FB3049A9eBA24e4299d0d7ec7E53a3" }, "derivativeModules": { "BatchLinearVesting": "0xD55227c0C37C97Fa2619a9C7F658C173883C1E2a" @@ -118,7 +118,7 @@ "BatchCatalogue": "0xBFfBef6f8a0Ef38121716860E2Ff824c018a467d", "auctionModules": { "EncryptedMarginalPrice": "0x16D5Aab9d35f8B3ac7BD086eEDcCe5343682D5F0", - "FixedPriceBatch": "0xCaAE490470305a9d6f58b026cdD36cc747F8F0b9" + "FixedPriceBatch": "0x0e4996960731Fec8E7C9DBbD51383fC71174DD88" }, "derivativeModules": { "BatchLinearVesting": "0x5998a28a71e6BDc2b592c14e3517212391782db0" @@ -143,7 +143,7 @@ "BatchCatalogue": "0x26e5Fd9ea25a5719D4EbA3b1966dd4864c48e517", "auctionModules": { "EncryptedMarginalPrice": "0x1043ef1f242e3FC5E90fd67Bb5a1B1356b102b39", - "FixedPriceBatch": "0x527Bec0Ed0660c7fc4Dcf64b741eb4CfCDEA1615" + "FixedPriceBatch": "0xf1E5FA9008fC3a62D90c7e569E02D98315C19DC3" }, "derivativeModules": { "BatchLinearVesting": "0x9011aC431f91Fd92437cBfdAE30a4ee4b76fEE1F" @@ -163,7 +163,7 @@ "BatchCatalogue": "0xD33e5cC03ad1C8F73cc57053f8a749ac76F14988", "auctionModules": { "EncryptedMarginalPrice": "0x0000000000000000000000000000000000000000", - "FixedPriceBatch": "0xaC9957282BeA578f371078ddc4cD12A135B105d6" + "FixedPriceBatch": "0x4ED7160dA0020070ADf1AB149c730E8A4bD73d15" }, "derivativeModules": { "BatchLinearVesting": "0x605A7105CA51FD5F107258362f52d8269eeA851A" @@ -223,7 +223,7 @@ "BatchCatalogue": "0x8Db46375e73545226E99b5e8cBfe2794ac835D38", "auctionModules": { "EncryptedMarginalPrice": "0xA17fC2B153222bdC549AE22Af5AcA7aC773979Fc", - "FixedPriceBatch": "0x4044d6dE91FB3049A9eBA24e4299d0d7ec7E53a3" + "FixedPriceBatch": "0x3A327c856AF41EcF4d783975CE38f669dEeaB298" }, "derivativeModules": { "BatchLinearVesting": "0xc20918b09dE9708d2A7997dfFc3c5ACB34d4a15b" @@ -243,7 +243,7 @@ "BatchCatalogue": "0x2eF571199c0BA4923FCf18cB802e302C0aF544Ef", "auctionModules": { "EncryptedMarginalPrice": "0xD6F9425776eE91b7181a16256768fAB9aB8B20a4", - "FixedPriceBatch": "0xa9458b5C26810F4bE972d9fB50147e5E2395dC3E" + "FixedPriceBatch": "0x8e5a555bcaB474C91dcA326bE3DFdDa7e30c3765" }, "derivativeModules": { "BatchLinearVesting": "0xE8546C3f5d5dB707081ffAfDB5416d808758D120" From f20380eabf39a463e8712bd336732cc261910e32 Mon Sep 17 00:00:00 2001 From: Oighty Date: Fri, 13 Dec 2024 14:52:53 -0600 Subject: [PATCH 15/21] chore: lint --- deployments/.arbitrum-one-v1.0.3.json | 2 +- deployments/.arbitrum-sepolia-v1.0.3.json | 2 +- deployments/.base-sepolia-v1.0.3.json | 2 +- deployments/.base-v1.0.3.json | 2 +- deployments/.berachain-bartio-v1.0.3.json | 2 +- deployments/.blast-sepolia-v1.0.3.json | 2 +- deployments/.blast-v1.0.3.json | 2 +- deployments/.mainnet-v1.0.2.json | 2 +- deployments/.mainnet-v1.0.3.json | 2 +- deployments/.mode-sepolia-v1.0.3.json | 2 +- deployments/.mode-v1.0.3.json | 2 +- 11 files changed, 11 insertions(+), 11 deletions(-) diff --git a/deployments/.arbitrum-one-v1.0.3.json b/deployments/.arbitrum-one-v1.0.3.json index 3bfb14c3..d3d06dbb 100644 --- a/deployments/.arbitrum-one-v1.0.3.json +++ b/deployments/.arbitrum-one-v1.0.3.json @@ -1,3 +1,3 @@ { -"deployments.auctionModules.FixedPriceBatch": "0x04974BcFC715c148818724d9Caab3Fe8d0391b8b" + "deployments.auctionModules.FixedPriceBatch": "0x04974BcFC715c148818724d9Caab3Fe8d0391b8b" } diff --git a/deployments/.arbitrum-sepolia-v1.0.3.json b/deployments/.arbitrum-sepolia-v1.0.3.json index 06641ab2..9e7c0341 100644 --- a/deployments/.arbitrum-sepolia-v1.0.3.json +++ b/deployments/.arbitrum-sepolia-v1.0.3.json @@ -1,3 +1,3 @@ { -"deployments.auctionModules.FixedPriceBatch": "0xAF4AaFC046FB329EB1181c0094a95DA7Cee38211" + "deployments.auctionModules.FixedPriceBatch": "0xAF4AaFC046FB329EB1181c0094a95DA7Cee38211" } diff --git a/deployments/.base-sepolia-v1.0.3.json b/deployments/.base-sepolia-v1.0.3.json index 3fc55b2b..2cc8b390 100644 --- a/deployments/.base-sepolia-v1.0.3.json +++ b/deployments/.base-sepolia-v1.0.3.json @@ -1,3 +1,3 @@ { -"deployments.auctionModules.FixedPriceBatch": "0x1A6Ba70B8e5957bCd03C20f9CF42D9e6D3d9b514" + "deployments.auctionModules.FixedPriceBatch": "0x1A6Ba70B8e5957bCd03C20f9CF42D9e6D3d9b514" } diff --git a/deployments/.base-v1.0.3.json b/deployments/.base-v1.0.3.json index 6c823932..36ee8ef4 100644 --- a/deployments/.base-v1.0.3.json +++ b/deployments/.base-v1.0.3.json @@ -1,3 +1,3 @@ { -"deployments.auctionModules.FixedPriceBatch": "0x4042D4F2236D055212d485E028E8FE4939252F88" + "deployments.auctionModules.FixedPriceBatch": "0x4042D4F2236D055212d485E028E8FE4939252F88" } diff --git a/deployments/.berachain-bartio-v1.0.3.json b/deployments/.berachain-bartio-v1.0.3.json index d91d3108..a0210d08 100644 --- a/deployments/.berachain-bartio-v1.0.3.json +++ b/deployments/.berachain-bartio-v1.0.3.json @@ -1,3 +1,3 @@ { -"deployments.auctionModules.FixedPriceBatch": "0x4044d6dE91FB3049A9eBA24e4299d0d7ec7E53a3" + "deployments.auctionModules.FixedPriceBatch": "0x4044d6dE91FB3049A9eBA24e4299d0d7ec7E53a3" } diff --git a/deployments/.blast-sepolia-v1.0.3.json b/deployments/.blast-sepolia-v1.0.3.json index df185baa..fd185edb 100644 --- a/deployments/.blast-sepolia-v1.0.3.json +++ b/deployments/.blast-sepolia-v1.0.3.json @@ -1,3 +1,3 @@ { -"deployments.auctionModules.FixedPriceBatch": "0xf1E5FA9008fC3a62D90c7e569E02D98315C19DC3" + "deployments.auctionModules.FixedPriceBatch": "0xf1E5FA9008fC3a62D90c7e569E02D98315C19DC3" } diff --git a/deployments/.blast-v1.0.3.json b/deployments/.blast-v1.0.3.json index 0cf4dc35..cfdb7592 100644 --- a/deployments/.blast-v1.0.3.json +++ b/deployments/.blast-v1.0.3.json @@ -1,3 +1,3 @@ { -"deployments.auctionModules.FixedPriceBatch": "0x0e4996960731Fec8E7C9DBbD51383fC71174DD88" + "deployments.auctionModules.FixedPriceBatch": "0x0e4996960731Fec8E7C9DBbD51383fC71174DD88" } diff --git a/deployments/.mainnet-v1.0.2.json b/deployments/.mainnet-v1.0.2.json index e787240e..a9f55858 100644 --- a/deployments/.mainnet-v1.0.2.json +++ b/deployments/.mainnet-v1.0.2.json @@ -1,3 +1,3 @@ { -"deployments.auctionModules.FixedPriceBatch": "0xaC9957282BeA578f371078ddc4cD12A135B105d6" + "deployments.auctionModules.FixedPriceBatch": "0xaC9957282BeA578f371078ddc4cD12A135B105d6" } diff --git a/deployments/.mainnet-v1.0.3.json b/deployments/.mainnet-v1.0.3.json index ed179ce3..a82150c7 100644 --- a/deployments/.mainnet-v1.0.3.json +++ b/deployments/.mainnet-v1.0.3.json @@ -1,3 +1,3 @@ { -"deployments.auctionModules.FixedPriceBatch": "0x4ED7160dA0020070ADf1AB149c730E8A4bD73d15" + "deployments.auctionModules.FixedPriceBatch": "0x4ED7160dA0020070ADf1AB149c730E8A4bD73d15" } diff --git a/deployments/.mode-sepolia-v1.0.3.json b/deployments/.mode-sepolia-v1.0.3.json index 15fc0c63..24236c6e 100644 --- a/deployments/.mode-sepolia-v1.0.3.json +++ b/deployments/.mode-sepolia-v1.0.3.json @@ -1,3 +1,3 @@ { -"deployments.auctionModules.FixedPriceBatch": "0x8e5a555bcaB474C91dcA326bE3DFdDa7e30c3765" + "deployments.auctionModules.FixedPriceBatch": "0x8e5a555bcaB474C91dcA326bE3DFdDa7e30c3765" } diff --git a/deployments/.mode-v1.0.3.json b/deployments/.mode-v1.0.3.json index 059b2818..0939a1d2 100644 --- a/deployments/.mode-v1.0.3.json +++ b/deployments/.mode-v1.0.3.json @@ -1,3 +1,3 @@ { -"deployments.auctionModules.FixedPriceBatch": "0x3A327c856AF41EcF4d783975CE38f669dEeaB298" + "deployments.auctionModules.FixedPriceBatch": "0x3A327c856AF41EcF4d783975CE38f669dEeaB298" } From 0bc55ad3e7b3d5d49041aa62b36bf5cc4762e2be Mon Sep 17 00:00:00 2001 From: Oighty Date: Thu, 6 Feb 2025 09:01:51 -0600 Subject: [PATCH 16/21] deploy: berachain --- deployments/.berachain-v1.0.3.json | 7 +++++++ script/env.json | 20 ++++++++++++++++++++ script/salts/salts.json | 1 + src/modules/auctions/batch/FPB.sol | 2 +- 4 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 deployments/.berachain-v1.0.3.json diff --git a/deployments/.berachain-v1.0.3.json b/deployments/.berachain-v1.0.3.json new file mode 100644 index 00000000..48e704dd --- /dev/null +++ b/deployments/.berachain-v1.0.3.json @@ -0,0 +1,7 @@ +{ +"deployments.BatchAuctionHouse": "0xBA0000907c7812AEC8F7e9e27AefF4Ea7565A8bA", +"deployments.BatchCatalogue": "0x30c356DFBAc808BC62c860A9B285f024b40dF1fc", +"deployments.auctionModules.EncryptedMarginalPrice": "0x053219a03D5Bb08B8EeC2BB9743F723b312A1cE3", +"deployments.auctionModules.FixedPriceBatch": "0xe6c04Ce6ca70eeE60bEc40E2e6e62958D91E02CC", +"deployments.derivativeModules.BatchLinearVesting": "0xE292cF4e316191CbFEbD74909356DF3cd9455e96" +} diff --git a/script/env.json b/script/env.json index c40bf1ad..56690198 100644 --- a/script/env.json +++ b/script/env.json @@ -80,6 +80,26 @@ } } }, + "berachain": { + "constants": { + "axis": { + "OWNER": "0xB47C8e4bEb28af80eDe5E5bF474927b110Ef2c0e", + "PERMIT2": "0x000000000022D473030F116dDEE9F6B43aC78BA3", + "PROTOCOL": "0x007F3eD580c754A9495881b066e9FC98e406c214" + } + }, + "deployments": { + "BatchAuctionHouse": "0xBA0000907c7812AEC8F7e9e27AefF4Ea7565A8bA", + "BatchCatalogue": "0x30c356DFBAc808BC62c860A9B285f024b40dF1fc", + "auctionModules": { + "EncryptedMarginalPrice": "0x053219a03D5Bb08B8EeC2BB9743F723b312A1cE3", + "FixedPriceBatch": "0xe6c04Ce6ca70eeE60bEc40E2e6e62958D91E02CC" + }, + "derivativeModules": { + "BatchLinearVesting": "0xE292cF4e316191CbFEbD74909356DF3cd9455e96" + } + } + }, "berachain-bartio": { "constants": { "axis": { diff --git a/script/salts/salts.json b/script/salts/salts.json index 9116e347..f70a5031 100644 --- a/script/salts/salts.json +++ b/script/salts/salts.json @@ -4,6 +4,7 @@ }, "BatchAuctionHouse": { "0x1d8b7b9cfbd8610a556d5e2e85dcdb25a17d6b5407574aef07970a86e4b0e2c3": "0x06374b73456c869d550c6cb45aff40113752ac3c4dd8efb8185b6da5c898aa82", + "0x202b619611dd286dfe88a9dd0b5d5b49a029668f13f105b85822bdebedc2b810": "0x4e32cb70023deafb333b82de96002fa0b26aa468ca31f23dd45f36a5d9435e26", "0x338aa33d128442ed702dafeeb23c4f9b2e26e640deefe754dc51983ed8c76aed": "0xf509875cb56d491d6692ba3c6d81794c77f842245c036ffb4eb561ff00dcf27e", "0x4c4d86f9737bd18dab3f6dc74d2f5c610b7169459c90a457e0e126ed42ae3bba": "0xbe4a9dc1b73685497c6104df59c2a3d2c1c5039bd48b1b25e9c0a029f3744311", "0x6d17f21ad1db4ff3649431f0e693cbf4a3e564389ee57d0b4f3e27fa3dc2bd68": "0xc69c9730f0ecd8b51cbe816d85c2ff802e07634c93d7429a42ef1d70e1c0de2d", diff --git a/src/modules/auctions/batch/FPB.sol b/src/modules/auctions/batch/FPB.sol index 5b4c3477..40086cf3 100644 --- a/src/modules/auctions/batch/FPB.sol +++ b/src/modules/auctions/batch/FPB.sol @@ -46,7 +46,7 @@ contract FixedPriceBatch is BatchAuctionModule, IFixedPriceBatch { /// @inheritdoc Module function VEECODE() public pure override returns (Veecode) { - return toVeecode("03FPBA"); + return toVeecode("01FPBA"); } // ========== AUCTION ========== // From 4fdc8a76e175f85769a8c438a2e1068f1cd94b9d Mon Sep 17 00:00:00 2001 From: Oighty Date: Thu, 6 Feb 2025 09:02:13 -0600 Subject: [PATCH 17/21] chore: add optimizer config to foundry.toml --- foundry.toml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/foundry.toml b/foundry.toml index 7549be42..24958d08 100644 --- a/foundry.toml +++ b/foundry.toml @@ -5,6 +5,8 @@ fs_permissions = [{access = "read-write", path = "./bytecode/"}, {access = "read ffi = true solc_version = "0.8.19" evm_version = "paris" +optimizer = true +optimizer_runs = 200 [fuzz] runs = 1024 From a4e7a4eaf97138c36407ceddbde21e4c38d5e945 Mon Sep 17 00:00:00 2001 From: Jem <0x0xjem@gmail.com> Date: Wed, 5 Mar 2025 22:28:22 +0400 Subject: [PATCH 18/21] chore: linting --- deployments/.berachain-v1.0.3.json | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/deployments/.berachain-v1.0.3.json b/deployments/.berachain-v1.0.3.json index 48e704dd..6796fa3e 100644 --- a/deployments/.berachain-v1.0.3.json +++ b/deployments/.berachain-v1.0.3.json @@ -1,7 +1,7 @@ { -"deployments.BatchAuctionHouse": "0xBA0000907c7812AEC8F7e9e27AefF4Ea7565A8bA", -"deployments.BatchCatalogue": "0x30c356DFBAc808BC62c860A9B285f024b40dF1fc", -"deployments.auctionModules.EncryptedMarginalPrice": "0x053219a03D5Bb08B8EeC2BB9743F723b312A1cE3", -"deployments.auctionModules.FixedPriceBatch": "0xe6c04Ce6ca70eeE60bEc40E2e6e62958D91E02CC", -"deployments.derivativeModules.BatchLinearVesting": "0xE292cF4e316191CbFEbD74909356DF3cd9455e96" + "deployments.BatchAuctionHouse": "0xBA0000907c7812AEC8F7e9e27AefF4Ea7565A8bA", + "deployments.BatchCatalogue": "0x30c356DFBAc808BC62c860A9B285f024b40dF1fc", + "deployments.auctionModules.EncryptedMarginalPrice": "0x053219a03D5Bb08B8EeC2BB9743F723b312A1cE3", + "deployments.auctionModules.FixedPriceBatch": "0xe6c04Ce6ca70eeE60bEc40E2e6e62958D91E02CC", + "deployments.derivativeModules.BatchLinearVesting": "0xE292cF4e316191CbFEbD74909356DF3cd9455e96" } From e2b73a539caae7f01fd96f9ac48c2fb3797b02c4 Mon Sep 17 00:00:00 2001 From: Jem <0x0xjem@gmail.com> Date: Wed, 5 Mar 2025 22:34:00 +0400 Subject: [PATCH 19/21] Regenerate soldeer.lock --- soldeer.lock | 39 +++++++++++++++++++++------------------ 1 file changed, 21 insertions(+), 18 deletions(-) diff --git a/soldeer.lock b/soldeer.lock index 070185c9..0b6369e8 100644 --- a/soldeer.lock +++ b/soldeer.lock @@ -1,30 +1,33 @@ +[[dependencies]] +name = "@openzeppelin-contracts" +version = "4.9.2" +url = "https://soldeer-revisions.s3.amazonaws.com/@openzeppelin-contracts/4_9_2_22-01-2024_13:13:52_contracts.zip" +checksum = "0f4450671798ea5659e6391876a3cf443ca50a696d9b556ac622ec7660bce306" +integrity = "f69bd90f264280204b2a1172a02a2d20f3611f5993a61e5215647bec696a8420" + +[[dependencies]] +name = "clones-with-immutable-args" +version = "1.1.1" +git = "git@github.com:wighawag/clones-with-immutable-args.git" +rev = "f5ca191afea933d50a36d101009b5644dc28bc99" [[dependencies]] name = "forge-std" version = "1.9.1" -source = "https://soldeer-revisions.s3.amazonaws.com/forge-std/v1_9_1_03-07-2024_14:44:59_forge-std-v1.9.1.zip" +url = "https://soldeer-revisions.s3.amazonaws.com/forge-std/v1_9_1_03-07-2024_14:44:59_forge-std-v1.9.1.zip" checksum = "110b35ad3604d91a919c521c71206c18cd07b29c750bd90b5cbbaf37288c9636" - -[[dependencies]] -name = "solmate" -version = "6.8.0" -source = "https://soldeer-revisions.s3.amazonaws.com/solmate/6_8_0_29-10-2024_19:01:45_solmate.zip" -checksum = "e3ec0f0182cb3bbedecf8a0bcc39897266534a795ec732b2b03dafa285d78a5b" +integrity = "389f8bfe6b6aad01915b1e38e6d4839f8189e8d4792b42be4e10d0a96a358e3f" [[dependencies]] name = "solady" version = "0.0.124" -source = "https://soldeer-revisions.s3.amazonaws.com/solady/0_0_124_22-01-2024_13:28:04_solady.zip" +url = "https://soldeer-revisions.s3.amazonaws.com/solady/0_0_124_22-01-2024_13:28:04_solady.zip" checksum = "9342385eaad08f9bb5408be0b41b241dd2b974c001f7da8c3b1ac552b52ce16b" +integrity = "29d93e52694d8e858cf5a737257f4a6f21aefccaf803174fd00b9d686172ab27" [[dependencies]] -name = "@openzeppelin-contracts" -version = "4.9.2" -source = "https://soldeer-revisions.s3.amazonaws.com/@openzeppelin-contracts/4_9_2_22-01-2024_13:13:52_contracts.zip" -checksum = "0f4450671798ea5659e6391876a3cf443ca50a696d9b556ac622ec7660bce306" - -[[dependencies]] -name = "clones-with-immutable-args" -version = "1.1.1" -source = "git@github.com:wighawag/clones-with-immutable-args.git" -checksum = "f5ca191afea933d50a36d101009b5644dc28bc99" +name = "solmate" +version = "6.8.0" +url = "https://soldeer-revisions.s3.amazonaws.com/solmate/6_8_0_29-10-2024_19:01:45_solmate.zip" +checksum = "e3ec0f0182cb3bbedecf8a0bcc39897266534a795ec732b2b03dafa285d78a5b" +integrity = "a22e5a352de0231f671ee8adf5667bbe83c50012670083987bd1099a69feb429" From 3e89ff04e72a59833ac9ec8953dc09978b9778cf Mon Sep 17 00:00:00 2001 From: Jem <0x0xjem@gmail.com> Date: Wed, 5 Mar 2025 22:35:27 +0400 Subject: [PATCH 20/21] Use HTTPS for git --- foundry.toml | 2 +- soldeer.lock | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/foundry.toml b/foundry.toml index 24958d08..ebe6496e 100644 --- a/foundry.toml +++ b/foundry.toml @@ -32,4 +32,4 @@ forge-std = "1.9.1" solmate = "6.8.0" solady = "0.0.124" "@openzeppelin-contracts" = "4.9.2" -clones-with-immutable-args = { version = "1.1.1", git = "git@github.com:wighawag/clones-with-immutable-args.git", rev = "f5ca191afea933d50a36d101009b5644dc28bc99" } +clones-with-immutable-args = { version = "1.1.1", git = "https://github.com/wighawag/clones-with-immutable-args.git", rev = "f5ca191afea933d50a36d101009b5644dc28bc99" } diff --git a/soldeer.lock b/soldeer.lock index 0b6369e8..1b59539b 100644 --- a/soldeer.lock +++ b/soldeer.lock @@ -8,7 +8,7 @@ integrity = "f69bd90f264280204b2a1172a02a2d20f3611f5993a61e5215647bec696a8420" [[dependencies]] name = "clones-with-immutable-args" version = "1.1.1" -git = "git@github.com:wighawag/clones-with-immutable-args.git" +git = "https://github.com/wighawag/clones-with-immutable-args.git" rev = "f5ca191afea933d50a36d101009b5644dc28bc99" [[dependencies]] From d1d1c24a8bced09adf6c620357f5ab7adc366a22 Mon Sep 17 00:00:00 2001 From: Jem <0x0xjem@gmail.com> Date: Wed, 5 Mar 2025 22:53:52 +0400 Subject: [PATCH 21/21] Fix test failures due to forge 1.0 --- test/callbacks/Callbacks.t.sol | 11 ++++++++- test/lib/ECIES/decrypt.t.sol | 7 ++++-- test/lib/ECIES/encrypt.t.sol | 39 +++++++++++++++++++++--------- test/lib/MaxPriorityQueue.t.sol | 6 +++++ test/modules/Modules/Keycode.t.sol | 14 +++++++---- 5 files changed, 58 insertions(+), 19 deletions(-) diff --git a/test/callbacks/Callbacks.t.sol b/test/callbacks/Callbacks.t.sol index 4eb6e9e5..d173f7b1 100644 --- a/test/callbacks/Callbacks.t.sol +++ b/test/callbacks/Callbacks.t.sol @@ -401,6 +401,7 @@ contract CallbacksTest is Test, WithSalts { ); } + /// forge-config: default.allow_internal_expect_revert = true function test_validateCallbacksPermissions_allFalse() public { (bytes32 salt, Callbacks.Permissions memory permissions) = _allFalseSalt(); ICallback callback = _createCallback(salt, permissions); @@ -408,6 +409,7 @@ contract CallbacksTest is Test, WithSalts { _assertValidateCallbacksPermissions(callback, permissions); } + /// forge-config: default.allow_internal_expect_revert = true function test_validateCallbacksPermissions_onCreate() public { (bytes32 salt, Callbacks.Permissions memory permissions) = _onCreateSalt(); ICallback callback = _createCallback(salt, permissions); @@ -415,6 +417,7 @@ contract CallbacksTest is Test, WithSalts { _assertValidateCallbacksPermissions(callback, permissions); } + /// forge-config: default.allow_internal_expect_revert = true function test_validateCallbacksPermissions_onCancel() public { (bytes32 salt, Callbacks.Permissions memory permissions) = _onCancelSalt(); ICallback callback = _createCallback(salt, permissions); @@ -422,6 +425,7 @@ contract CallbacksTest is Test, WithSalts { _assertValidateCallbacksPermissions(callback, permissions); } + /// forge-config: default.allow_internal_expect_revert = true function test_validateCallbacksPermissions_onCurate() public { (bytes32 salt, Callbacks.Permissions memory permissions) = _onCurateSalt(); ICallback callback = _createCallback(salt, permissions); @@ -429,6 +433,7 @@ contract CallbacksTest is Test, WithSalts { _assertValidateCallbacksPermissions(callback, permissions); } + /// forge-config: default.allow_internal_expect_revert = true function test_validateCallbacksPermissions_onPurchase() public { (bytes32 salt, Callbacks.Permissions memory permissions) = _onPurchaseSalt(); ICallback callback = _createCallback(salt, permissions); @@ -436,6 +441,7 @@ contract CallbacksTest is Test, WithSalts { _assertValidateCallbacksPermissions(callback, permissions); } + /// forge-config: default.allow_internal_expect_revert = true function test_validateCallbacksPermissions_onBid() public { (bytes32 salt, Callbacks.Permissions memory permissions) = _onBidSalt(); ICallback callback = _createCallback(salt, permissions); @@ -443,6 +449,7 @@ contract CallbacksTest is Test, WithSalts { _assertValidateCallbacksPermissions(callback, permissions); } + /// forge-config: default.allow_internal_expect_revert = true function test_validateCallbacksPermissions_onSettle() public { (bytes32 salt, Callbacks.Permissions memory permissions) = _onSettleSalt(); ICallback callback = _createCallback(salt, permissions); @@ -450,6 +457,7 @@ contract CallbacksTest is Test, WithSalts { _assertValidateCallbacksPermissions(callback, permissions); } + /// forge-config: default.allow_internal_expect_revert = true function test_validateCallbacksPermissions_onReceiveQuoteTokens() public { (bytes32 salt, Callbacks.Permissions memory permissions) = _receiveQuoteTokensSalt(); ICallback callback = _createCallback(salt, permissions); @@ -457,6 +465,7 @@ contract CallbacksTest is Test, WithSalts { _assertValidateCallbacksPermissions(callback, permissions); } + /// forge-config: default.allow_internal_expect_revert = true function test_validateCallbacksPermissions_onSendBaseTokens() public { (bytes32 salt, Callbacks.Permissions memory permissions) = _sendBaseTokensSalt(); ICallback callback = _createCallback(salt, permissions); @@ -646,7 +655,7 @@ contract CallbacksTest is Test, WithSalts { // [X] if only RECEIVE_QUOTE_TOKENS_FLAG is set, return true // [X] if any callback function is set, return true - function test_isValidCallbacksAddress_zero() public { + function test_isValidCallbacksAddress_zero() public pure { ICallback callback = ICallback(address(0)); assertEq(callback.isValidCallbacksAddress(), true, "invalid"); diff --git a/test/lib/ECIES/decrypt.t.sol b/test/lib/ECIES/decrypt.t.sol index 4ca03596..af4ffb1a 100644 --- a/test/lib/ECIES/decrypt.t.sol +++ b/test/lib/ECIES/decrypt.t.sol @@ -20,6 +20,7 @@ contract ECIESDecryptTest is Test { function setUp() external {} + /// forge-config: default.allow_internal_expect_revert = true function testRevert_invalidPubKey() public { // Setup encryption parameters uint256 ciphertext = 1; @@ -33,6 +34,7 @@ contract ECIESDecryptTest is Test { ECIES.decrypt(ciphertext, ciphertextPubKey, recipientPrivateKey, salt); } + /// forge-config: default.allow_internal_expect_revert = true function testRevert_privateKeyTooLarge( uint256 privateKey_ ) public { @@ -49,6 +51,7 @@ contract ECIESDecryptTest is Test { ECIES.decrypt(ciphertext, ciphertextPubKey, privateKey_, salt); } + /// forge-config: default.allow_internal_expect_revert = true function testRevert_privateKeyZero() public { // Setup encryption parameters uint256 ciphertext = 1; @@ -62,7 +65,7 @@ contract ECIESDecryptTest is Test { ECIES.decrypt(ciphertext, ciphertextPubKey, privateKey, salt); } - function test_decrypt() public { + function test_decrypt() public view { // Setup encryption parameters uint256 ciphertext = 0xf96d7675ae04b89c9b5a9b0613d3530bb939186d05959efba9b3249a461abbc4; Point memory ciphertextPubKey = Point( @@ -84,7 +87,7 @@ contract ECIESDecryptTest is Test { uint256 salt_, uint256 recipientPrivKey_, uint256 messagePrivKey_ - ) public { + ) public view { vm.assume(recipientPrivKey_ > 0 && recipientPrivKey_ < ECIES.GROUP_ORDER); vm.assume(messagePrivKey_ > 0 && messagePrivKey_ < ECIES.GROUP_ORDER); diff --git a/test/lib/ECIES/encrypt.t.sol b/test/lib/ECIES/encrypt.t.sol index 179ed864..bedd7c31 100644 --- a/test/lib/ECIES/encrypt.t.sol +++ b/test/lib/ECIES/encrypt.t.sol @@ -9,6 +9,18 @@ import {ECIESFFITest} from "./ECIES_FFI.sol"; // ECIES import {Point, ECIES} from "../../../src/lib/ECIES.sol"; +contract EncryptWrapper { + function encrypt( + uint256 message_, + Point memory recipientPubKey_, + uint256 privateKey_, + uint256 salt_ + ) public view returns (uint256 ciphertext_, Point memory ciphertextPubKey_) { + (ciphertext_, ciphertextPubKey_) = + ECIES.encrypt(message_, recipientPubKey_, privateKey_, salt_); + } +} + contract ECIESEncryptTest is Test { // [X] when the public key is invalid // [X] it reverts @@ -18,21 +30,25 @@ contract ECIESEncryptTest is Test { // [X] it reverts // [X] it encrypts the message and provides the message pub key - function testFail_invalidPubKey() public view { + /// forge-config: default.allow_internal_expect_revert = true + function test_invalidPubKey_reverts() public { // Setup encryption parameters uint256 message = 1; Point memory recipientPubKey = Point(1, 1); uint256 privateKey = 1; uint256 salt = 1; - // Attempt to encrypt with an invalid public key, expect revert - // bytes memory err = abi.encodePacked("Invalid public key."); - // vm.expectRevert(err); - // For some reason, using expect revert causes the ecMul operation to fail. - // It seems to be a bug in the VM, so we use a generic fail test, which we've shown reverts correctly with stack traces. - ECIES.encrypt(message, recipientPubKey, privateKey, salt); + EncryptWrapper wrapper = new EncryptWrapper(); + + // Expect revert + vm.expectRevert("Invalid public key."); + + // For some reason, using expect revert causes the ecMul operation to fail when using the ECIES library directly. + // It seems to be a bug in the VM, so we wrap the call in another contract. + wrapper.encrypt(message, recipientPubKey, privateKey, salt); } + /// forge-config: default.allow_internal_expect_revert = true function testRevert_privateKeyTooLarge( uint256 privateKey_ ) public { @@ -49,6 +65,7 @@ contract ECIESEncryptTest is Test { ECIES.encrypt(message, recipientPubKey, privateKey_, salt); } + /// forge-config: default.allow_internal_expect_revert = true function testRevert_privateKeyZero() public { // Setup encryption parameters uint256 message = 1; @@ -62,7 +79,7 @@ contract ECIESEncryptTest is Test { ECIES.encrypt(message, recipientPubKey, privateKey, salt); } - function test_encrypt() public { + function test_encrypt() public view { // Setup encryption parameters uint256 message = 1; Point memory recipientPubKey = ECIES.calcPubKey(Point(1, 2), 2); @@ -92,7 +109,7 @@ contract ECIESEncryptTest is Test { uint256 salt_, uint256 recipientPrivKey_, uint256 messagePrivKey_ - ) public { + ) public view { vm.assume(recipientPrivKey_ > 0 && recipientPrivKey_ < ECIES.GROUP_ORDER); vm.assume(messagePrivKey_ > 0 && messagePrivKey_ < ECIES.GROUP_ORDER); @@ -134,7 +151,7 @@ contract ECIESEncryptTest is Test { console2.log("Gas used: ", startGas - endGas); } - function test_roundtrip() public { + function test_roundtrip() public view { // Setup encryption parameters uint256 message = 1; uint256 recipientPrivKey = 2; @@ -159,7 +176,7 @@ contract ECIESEncryptTest is Test { uint256 recipientPrivKey_, uint256 messagePrivKey_, uint256 salt_ - ) public { + ) public view { // Limit fuzz values since we do not allow private keys to be 0 or greater than the group order vm.assume(recipientPrivKey_ > 0 && recipientPrivKey_ < ECIES.GROUP_ORDER); vm.assume(messagePrivKey_ > 0 && messagePrivKey_ < ECIES.GROUP_ORDER); diff --git a/test/lib/MaxPriorityQueue.t.sol b/test/lib/MaxPriorityQueue.t.sol index 8bf6b597..b9a1ad38 100644 --- a/test/lib/MaxPriorityQueue.t.sol +++ b/test/lib/MaxPriorityQueue.t.sol @@ -303,6 +303,7 @@ contract MaxPriorityQueueTest is Test { assertEq(_queue.isEmpty(), true, "isEmpty mismatch"); } + /// forge-config: default.allow_internal_expect_revert = true function test_insert_zeroAmountOut_reverts() external { _queue.initialize(); @@ -334,6 +335,7 @@ contract MaxPriorityQueueTest is Test { assertEq(amountOut, 1e18); } + /// forge-config: default.allow_internal_expect_revert = true function testRevert_insert_bidAlreadyExists() external { _queue.initialize(); @@ -344,6 +346,7 @@ contract MaxPriorityQueueTest is Test { _queue.insert(_QUEUE_START, 0, 1, 1, _BASE_SCALE); } + /// forge-config: default.allow_internal_expect_revert = true function testRevert_insert_prevHintDoesNotExist() external { _queue.initialize(); @@ -355,6 +358,7 @@ contract MaxPriorityQueueTest is Test { _queue.insert(keyNotInQueue, 0, 1, 1, _BASE_SCALE); } + /// forge-config: default.allow_internal_expect_revert = true function testRevert_insert_bidHigherPriorityThanHint() external { _queue.initialize(); @@ -415,6 +419,8 @@ contract MaxPriorityQueueTest is Test { } // ========== delMax ========== // + + /// forge-config: default.allow_internal_expect_revert = true function testRevert_delMax_emptyQueue() external { _queue.initialize(); diff --git a/test/modules/Modules/Keycode.t.sol b/test/modules/Modules/Keycode.t.sol index d7040b6e..0d74228f 100644 --- a/test/modules/Modules/Keycode.t.sol +++ b/test/modules/Modules/Keycode.t.sol @@ -16,19 +16,19 @@ import { } from "../../../src/modules/Modules.sol"; contract KeycodeTest is Test { - function test_keycode() external { + function test_keycode() external pure { Keycode keycode = toKeycode("TEST"); assertEq(fromKeycode(keycode), "TEST"); } - function test_ensureValidVeecode_singleDigitNumber() external { + function test_ensureValidVeecode_singleDigitNumber() external pure { Keycode keycode = toKeycode("TEST"); Veecode t1Veecode = wrapVeecode(keycode, 1); ensureValidVeecode(t1Veecode); } - function test_ensureValidVeecode_doubleDigitNumber() external { + function test_ensureValidVeecode_doubleDigitNumber() external pure { Keycode keycode = toKeycode("TEST"); Veecode t1Veecode = wrapVeecode(keycode, 11); @@ -45,7 +45,7 @@ contract KeycodeTest is Test { return bytes5(keycodeBytes); } - function test_ensureValidVeecode_length() external { + function test_ensureValidVeecode_length() external pure { Keycode t1Keycode = toKeycode("TES"); Veecode t1Veecode = wrapVeecode(t1Keycode, 11); ensureValidVeecode(t1Veecode); @@ -66,6 +66,7 @@ contract KeycodeTest is Test { assertFalse(fromVeecode(t3Veecode) == fromVeecode(t4Veecode)); } + /// forge-config: default.allow_internal_expect_revert = true function testRevert_ensureValidVeecode_invalidRequiredCharacter( uint8 character_, uint8 index_ @@ -88,6 +89,7 @@ contract KeycodeTest is Test { ensureValidVeecode(t1Veecode); } + /// forge-config: default.allow_internal_expect_revert = true function testRevert_ensureValidVeecode_invalidOptionalCharacter( uint8 character_, uint8 index_ @@ -110,6 +112,7 @@ contract KeycodeTest is Test { ensureValidVeecode(t1Veecode); } + /// forge-config: default.allow_internal_expect_revert = true function testRevert_ensureValidVeecode_zeroVersion() external { Keycode keycode = toKeycode("TEST"); Veecode t1Veecode = wrapVeecode(keycode, 0); @@ -120,6 +123,7 @@ contract KeycodeTest is Test { ensureValidVeecode(t1Veecode); } + /// forge-config: default.allow_internal_expect_revert = true function testRevert_ensureValidVeecode_invalidVersion( uint8 version_ ) external { @@ -135,7 +139,7 @@ contract KeycodeTest is Test { ensureValidVeecode(t1Veecode); } - function test_unwrapVeecode() external { + function test_unwrapVeecode() external pure { Keycode keycode = toKeycode("TEST"); Veecode t1Veecode = wrapVeecode(keycode, 1); (Keycode keycode_, uint8 moduleVersion_) = unwrapVeecode(t1Veecode);