Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(cli): give priority to gatekeeper and voice credit proxy args #1123

Merged
merged 1 commit into from
Jan 29, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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,
};
};
Loading