Skip to content

Commit

Permalink
chore: Fix for solhint
Browse files Browse the repository at this point in the history
  • Loading branch information
0xJurassicPunk committed Jan 20, 2023
1 parent 51159d2 commit 9a0a7a2
Show file tree
Hide file tree
Showing 2 changed files with 74 additions and 64 deletions.
11 changes: 7 additions & 4 deletions contracts/helpers/OrderValidatorV2A.sol
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,8 @@ contract OrderValidatorV2A {

validationCodes[0] = _checkValidityMakerAskWhitelists(makerAsk.currency, makerAsk.strategyId);

// It can exit here if the strategy doesn't exist. However, if the strategy isn't valid, it can continue the execution.
// It can exit here if the strategy does not exist.
// However, if the strategy is not valid, it can continue the execution.
if (
validationCodes[0] == STRATEGY_NOT_IMPLEMENTED || validationCodes[0] == STRATEGY_MAKER_ASK_SELECTOR_INVALID
) {
Expand Down Expand Up @@ -275,7 +276,8 @@ contract OrderValidatorV2A {

validationCodes[0] = _checkValidityMakerBidWhitelists(makerBid.currency, makerBid.strategyId);

// It can exit here if the strategy doesn't exist. However, if the strategy isn't valid, it can continue the execution.
// It can exit here if the strategy does not exist.
// However, if the strategy is not valid, it can continue the execution.
if (
validationCodes[0] == STRATEGY_NOT_IMPLEMENTED || validationCodes[0] == STRATEGY_MAKER_BID_SELECTOR_INVALID
) {
Expand Down Expand Up @@ -507,7 +509,8 @@ contract OrderValidatorV2A {
* @param collection Address of the collection
* @param assetType Asset type in the maker order
* @return validationCode Validation code
* @dev This function may return false positives (i.e. assets that are tradable but don't implement the proper interfaceId). Use with care.
* @dev This function may return false positives
// (i.e. assets that are tradable but do not implement the proper interfaceId).
* If ERC165 is not implemented, it will revert.
*/
function _checkIfPotentialWrongAssetTypes(
Expand Down Expand Up @@ -681,7 +684,7 @@ contract OrderValidatorV2A {
}
}
} else {
// 1.2 If the balanceOfBatch doesn't work, use loop with balanceOf function
// 1.2 If the balanceOfBatch does not work, use loop with balanceOf function
for (uint256 i; i < length; ) {
(success, data) = collection.staticcall(abi.encodeCall(IERC1155.balanceOf, (user, itemIds[i])));

Expand Down
127 changes: 67 additions & 60 deletions contracts/libraries/OrderStructs.sol
Original file line number Diff line number Diff line change
Expand Up @@ -7,62 +7,6 @@ pragma solidity ^0.8.17;
* @author LooksRare protocol team (👀,💎)
*/
library OrderStructs {
/**
* @notice This is the constant used to compute the maker ask order hash.
*/
bytes32 internal constant _MAKER_ASK_HASH =
keccak256(
"MakerAsk("
"uint256 askNonce,"
"uint256 subsetNonce,"
"uint256 strategyId,"
"uint256 assetType,"
"uint256 orderNonce,"
"address collection,"
"address currency,"
"address signer,"
"uint256 startTime,"
"uint256 endTime,"
"uint256 minPrice,"
"uint256[] itemIds,"
"uint256[] amounts,"
"bytes additionalParameters"
")"
);

/**
* @notice This is the constant used to compute the maker bid order hash.
*/
bytes32 internal constant _MAKER_BID_HASH =
keccak256(
"MakerBid("
"uint256 bidNonce,"
"uint256 subsetNonce,"
"uint256 strategyId,"
"uint256 assetType,"
"uint256 orderNonce,"
"address collection,"
"address currency,"
"address signer,"
"uint256 startTime,"
"uint256 endTime,"
"uint256 maxPrice,"
"uint256[] itemIds,"
"uint256[] amounts,"
"bytes additionalParameters"
")"
);

/**
* @notice This is the constant used to compute the merkle root order hash (proof is not included in the hashing function).
*/
bytes32 internal constant _MERKLE_TREE_HASH =
keccak256(
"MerkleTree("
"bytes32 root"
")"
);

/**
* 1. Maker structs
*/
Expand Down Expand Up @@ -116,7 +60,8 @@ library OrderStructs {
* @param maxPrice Maximum price for execution
* @param itemIds Array of itemIds
* @param amounts Array of amounts
* @param additionalParameters Extra data specific for the order (e.g. it can contain a merkle root for specific strategies)
* @param additionalParameters Extra data specific for the order
* (e.g. it can contain a merkle root for specific strategies)
*/
struct MakerBid {
uint256 bidNonce;
Expand Down Expand Up @@ -174,12 +119,13 @@ library OrderStructs {
}

/**
* 3. Merkle tree
* 3. Merkle tree struct
*/

/**
* @notice MerkleTree is the struct for a merkle tree of order hashes.
* @dev A Merkle tree can be computed with order hashes. It can contain order hashes from both maker bid and maker ask structs.
* @dev A Merkle tree can be computed with order hashes.
* It can contain order hashes from both maker bid and maker ask structs.
* @param root Merkle root
* @param proof Array containing the merkle proof
*/
Expand All @@ -189,7 +135,68 @@ library OrderStructs {
}

/**
* 4. Hash functions
* 4. Constants
*/

/**
* @notice This is the constant used to compute the maker ask order hash.
*/
bytes32 internal constant _MAKER_ASK_HASH =
keccak256(
"MakerAsk("
"uint256 askNonce,"
"uint256 subsetNonce,"
"uint256 strategyId,"
"uint256 assetType,"
"uint256 orderNonce,"
"address collection,"
"address currency,"
"address signer,"
"uint256 startTime,"
"uint256 endTime,"
"uint256 minPrice,"
"uint256[] itemIds,"
"uint256[] amounts,"
"bytes additionalParameters"
")"
);

/**
* @notice This is the constant used to compute the maker bid order hash.
*/
bytes32 internal constant _MAKER_BID_HASH =
keccak256(
"MakerBid("
"uint256 bidNonce,"
"uint256 subsetNonce,"
"uint256 strategyId,"
"uint256 assetType,"
"uint256 orderNonce,"
"address collection,"
"address currency,"
"address signer,"
"uint256 startTime,"
"uint256 endTime,"
"uint256 maxPrice,"
"uint256[] itemIds,"
"uint256[] amounts,"
"bytes additionalParameters"
")"
);

/**
* @notice This is the constant used to compute the merkle root order hash.
* @dev The proof is not included in the hashing function.
*/
bytes32 internal constant _MERKLE_TREE_HASH =
keccak256(
"MerkleTree("
"bytes32 root"
")"
);

/**
* 5. Hash functions
*/

/**
Expand Down

0 comments on commit 9a0a7a2

Please sign in to comment.