Skip to content

Commit

Permalink
Merge pull request #1123 from privacy-scaling-explorations/fix/1105
Browse files Browse the repository at this point in the history
fix(cli): give priority to gatekeeper and voice credit proxy args
  • Loading branch information
ctrlc03 authored Jan 29, 2024
2 parents 175398b + 1597ee3 commit fffffa3
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions cli/ts/commands/deploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ export const deploy = async ({
const poseidonT6 = poseidonT6Address || readContractAddress("PoseidonT6", network?.name);

// if we did not deploy it before, then deploy it now
let initialVoiceCreditProxyContractAddress: string | undefined;
let initialVoiceCreditProxyContractAddress: string | undefined =
initialVoiceCreditsProxyAddress || readContractAddress("InitialVoiceCreditProxy", network?.name);

if (!initialVoiceCreditsProxyAddress) {
const contract = await deployConstantInitialVoiceCreditProxy(
Expand All @@ -64,8 +65,9 @@ export const deploy = async ({
}

// check if we have a signupGatekeeper already deployed or passed as arg
let signupGatekeeperContractAddress = readContractAddress("SignUpGatekeeper", network?.name);
if (!signupGatekeeperContractAddress && !signupGatekeeperAddress) {
let signupGatekeeperContractAddress =
signupGatekeeperAddress || readContractAddress("SignUpGatekeeper", network?.name);
if (!signupGatekeeperContractAddress) {
const contract = await deployFreeForAllSignUpGatekeeper(signer, true);
signupGatekeeperContractAddress = await contract.getAddress();
}
Expand All @@ -84,7 +86,7 @@ export const deploy = async ({
// deploy MACI, stateAq, PollFactory and poseidon
const { maciContract, stateAqContract, pollFactoryContract, poseidonAddrs } = await deployMaci({
signUpTokenGatekeeperContractAddress: signupGatekeeperContractAddress,
initialVoiceCreditBalanceAddress: initialVoiceCreditProxyContractAddress!,
initialVoiceCreditBalanceAddress: initialVoiceCreditProxyContractAddress,
topupCreditContractAddress: topUpCreditAddress,
poseidonAddresses: {
poseidonT3,
Expand All @@ -104,7 +106,7 @@ export const deploy = async ({
]);

// save to the JSON File
storeContractAddress("InitialVoiceCreditProxy", initialVoiceCreditProxyContractAddress!, network?.name);
storeContractAddress("InitialVoiceCreditProxy", initialVoiceCreditProxyContractAddress, network?.name);
storeContractAddress("SignUpGatekeeper", signupGatekeeperContractAddress, network?.name);
storeContractAddress("Verifier", verifierContractAddress, network?.name);
storeContractAddress("MACI", maciContractAddress, network?.name);
Expand All @@ -130,6 +132,6 @@ export const deploy = async ({
poseidonT5Address: poseidonAddrs.poseidonT5,
poseidonT6Address: poseidonAddrs.poseidonT6,
signUpGatekeeperAddress: signupGatekeeperContractAddress,
initialVoiceCreditProxyAddress: initialVoiceCreditProxyContractAddress!,
initialVoiceCreditProxyAddress: initialVoiceCreditProxyContractAddress,
};
};

0 comments on commit fffffa3

Please sign in to comment.