Skip to content

Commit

Permalink
Getting the default multisend address from safe-deployments
Browse files Browse the repository at this point in the history
  • Loading branch information
cristovaoth committed Nov 1, 2022
1 parent f826e70 commit 9e9758c
Showing 1 changed file with 12 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ import { deployRolesModifier, RolesModifierParams } from "services"
import { ParamInput } from "../../../../components/ethereum/ParamInput"
import { ParamType } from "@ethersproject/abi"
import useSafeAppsSDKWithProvider from "hooks/useSafeAppsSDKWithProvider"
import { SafeInfo } from "@gnosis.pm/safe-apps-sdk"
import {
networkAddresses as multisendNetworkAddresses,
defaultAddress as defaultMultisendAddress,
} from "@gnosis.pm/safe-deployments/dist/assets/v1.3.0/multi_send.json"

interface RolesModifierModalProps {
open: boolean
Expand All @@ -23,8 +28,6 @@ const useStyles = makeStyles((theme) => ({
},
}))

const MULTISEND_ADDRESS = "0xA238CBeb142c10Ef7Ad8442C6D1f9E89e07e7761"

export const RolesModifierModal = ({
open,
onClose,
Expand All @@ -40,7 +43,7 @@ export const RolesModifierModal = ({
})
const [params, setParams] = useState<RolesModifierParams>({
target: safe.safeAddress,
multisend: MULTISEND_ADDRESS,
multisend: defaultMultisend(safe),
})

const isValid = Object.values(errors).every((field) => field)
Expand Down Expand Up @@ -107,3 +110,9 @@ export const RolesModifierModal = ({
</AddModuleModal>
)
}

function defaultMultisend(safeInfo: SafeInfo) {
const address = (multisendNetworkAddresses as Record<string, string>)[safeInfo.chainId]

return address || defaultMultisendAddress
}

0 comments on commit 9e9758c

Please sign in to comment.