Skip to content

Commit

Permalink
fix(preprocessRequirement): don't reorder the min/maxAmount fields
Browse files Browse the repository at this point in the history
  • Loading branch information
BrickheadJohnny committed Feb 26, 2025
1 parent d673174 commit 118f55b
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions src/utils/preprocessRequirement.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,16 @@ const preprocessRequirement = (
processedRequirement.data.timestamps.maxAmount,
].sort((a, b) => a - b)

const [upperEnd, lowerEnd] = [
processedRequirement.data.minAmount,
processedRequirement.data.maxAmount,
].sort((a, b) => a - b)

processedRequirement.data.minAmount = lowerEnd
processedRequirement.data.maxAmount = upperEnd
// Hotfix, so we don't reorder these fields for this requirement
if (processedRequirement.type !== "COVALENT_CONTRACT_CALL_COUNT_RELATIVE") {
const [upperEnd, lowerEnd] = [
processedRequirement.data.minAmount,
processedRequirement.data.maxAmount,
].sort((a, b) => a - b)

processedRequirement.data.minAmount = lowerEnd
processedRequirement.data.maxAmount = upperEnd
}

processedRequirement.data.timestamps.minAmount = tsLowerEnd
processedRequirement.data.timestamps.maxAmount = tsUpperEnd
Expand Down

0 comments on commit 118f55b

Please sign in to comment.