Skip to content

Commit

Permalink
chore: lint (new forge fmt)
Browse files Browse the repository at this point in the history
  • Loading branch information
Oighty committed Sep 19, 2024
1 parent 18ded86 commit e9dc8d4
Show file tree
Hide file tree
Showing 93 changed files with 1,169 additions and 420 deletions.
36 changes: 27 additions & 9 deletions script/deploy/Deploy.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down Expand Up @@ -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");
Expand Down Expand Up @@ -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");
Expand Down Expand Up @@ -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");
Expand Down Expand Up @@ -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");
Expand Down Expand Up @@ -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);
}

Expand Down Expand Up @@ -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_];

Expand Down
8 changes: 6 additions & 2 deletions script/deploy/DeployBlast.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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)");
Expand Down Expand Up @@ -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)");
Expand Down
12 changes: 9 additions & 3 deletions script/deploy/WithEnvironment.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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_);

Expand All @@ -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;
Expand All @@ -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")
Expand Down
8 changes: 6 additions & 2 deletions script/ops/Batch.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand All @@ -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));
}
}
16 changes: 12 additions & 4 deletions script/ops/lib/BatchScript.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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(
Expand All @@ -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) {
Expand All @@ -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);
}

Expand Down
20 changes: 15 additions & 5 deletions script/ops/lib/Surl.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand All @@ -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");
}
Expand All @@ -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");
}
Expand All @@ -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");
}
Expand All @@ -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");
}
Expand Down
4 changes: 3 additions & 1 deletion script/salts/WithSalts.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}

Expand Down
4 changes: 3 additions & 1 deletion script/salts/auctionHouse/AuctionHouseSalts.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down
4 changes: 3 additions & 1 deletion script/salts/auctionHouse/AuctionHouseSaltsBlast.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 3 additions & 1 deletion script/salts/test/TestSalts.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down
12 changes: 9 additions & 3 deletions src/AtomicCatalogue.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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 ========== //

Expand Down Expand Up @@ -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_)));

Expand All @@ -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_)));

Expand Down
8 changes: 6 additions & 2 deletions src/BatchAuctionHouse.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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_);

Expand Down Expand Up @@ -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_)));
}
}
8 changes: 6 additions & 2 deletions src/BatchCatalogue.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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_)));

Expand Down
Loading

0 comments on commit e9dc8d4

Please sign in to comment.