Skip to content

Commit

Permalink
fix: check for array of addresses when prepping sweep
Browse files Browse the repository at this point in the history
  • Loading branch information
dmccartney committed Jun 26, 2024
1 parent 47ad93c commit 29bc873
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
3 changes: 2 additions & 1 deletion web/src/components/SafeSweepCard.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ import {
estimateDistributeConsensusBatchGas,
estimateFinalizeGas,
estimateTipsMevGas,
firstOrOnly,
MinipoolStatus,
safeAppUrl,
} from "../utils";
Expand Down Expand Up @@ -499,7 +500,7 @@ function useSweeper({ nodeAddress }) {
txs = txs.concat([
{
operation: "0x00",
to: contracts.RocketMerkleDistributorMainnet.address,
to: firstOrOnly(contracts.RocketMerkleDistributorMainnet.address),
value: "0",
data: new ethers.utils.Interface(
contracts.RocketMerkleDistributorMainnet.abi
Expand Down
4 changes: 4 additions & 0 deletions web/src/utils.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import { ethers } from "ethers";
import _ from "lodash";

export function firstOrOnly(arrayOrNot) {
return Array.isArray(arrayOrNot) ? arrayOrNot[0] : arrayOrNot;
}

// Trim the input address to be "0x####...####"
export function shortenAddress(address, charCount = 4) {
// .getAddress here ensures we're dealing with the checksum address
Expand Down

0 comments on commit 29bc873

Please sign in to comment.