Skip to content
This repository has been archived by the owner on Dec 13, 2019. It is now read-only.

Commit

Permalink
Update DEPLOY_STATE_DEPOSIT_HOLDER to use pre-computed multisigAddress (
Browse files Browse the repository at this point in the history
  • Loading branch information
snario authored and LayneHaber committed Nov 6, 2019
1 parent 337df84 commit 5eb9752
Showing 1 changed file with 8 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,9 @@ import {
sortAddresses,
xkeysToSortedKthAddresses
} from "../../../engine/xkeys";
import { StateChannel } from "../../../models";
import { RequestHandler } from "../../../request-handler";
import {
getCreate2MultisigAddress,
prettyPrintObject,
wait
} from "../../../utils";
import { prettyPrintObject, wait } from "../../../utils";
import { NodeController } from "../../controller";
import {
CHANNEL_CREATION_FAILED,
Expand Down Expand Up @@ -53,7 +50,7 @@ export default class DeployStateDepositHolderController extends NodeController {
if ((await provider.getCode(multisigAddress)) === "0x") {
tx = await sendMultisigDeployTx(
wallet,
channel.userNeuteredExtendedKeys,
channel,
networkContext,
retryCount
);
Expand All @@ -65,7 +62,7 @@ export default class DeployStateDepositHolderController extends NodeController {

async function sendMultisigDeployTx(
signer: Signer,
owners: string[],
stateChannel: StateChannel,
networkContext: NetworkContext,
retryCount: number = 3
): Promise<TransactionResponse> {
Expand All @@ -75,6 +72,8 @@ async function sendMultisigDeployTx(
signer
);

const owners = stateChannel.userNeuteredExtendedKeys;

const provider = signer.provider as JsonRpcProvider;

if (!provider) {
Expand Down Expand Up @@ -108,7 +107,7 @@ async function sendMultisigDeployTx(
tx!,
provider,
owners,
networkContext
stateChannel.multisigAddress
);

if (!ownersAreCorrectlySet) {
Expand Down Expand Up @@ -140,14 +139,8 @@ async function checkForCorrectOwners(
tx: TransactionResponse,
provider: Provider,
xpubs: string[],
networkContext: NetworkContext
multisigAddress: string
): Promise<boolean> {
const multisigAddress = getCreate2MultisigAddress(
xpubs,
networkContext.ProxyFactory,
networkContext.MinimumViableMultisig
);

await tx.wait();

const contract = new Contract(
Expand Down

0 comments on commit 5eb9752

Please sign in to comment.