Skip to content

Commit

Permalink
fix: sto module error issue
Browse files Browse the repository at this point in the history
  • Loading branch information
Victor Wiebe committed Jan 7, 2020
1 parent 946321e commit a1a3e53
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions src/procedures/FinalizeSto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,10 @@ export class FinalizeSto extends Procedure<FinalizeStoProcedureArgs> {
});
}

const stoModuleErrorMessage = `STO ${stoAddress} is either archived or hasn't been launched`;
const stoModuleError = new PolymathError({
code: ErrorCode.ProcedureValidationError,
message: `STO ${stoAddress} is either archived or hasn't been launched`,
});

let stoModule;
let remainingTokens: BigNumber;
Expand All @@ -88,10 +91,7 @@ export class FinalizeSto extends Procedure<FinalizeStoProcedureArgs> {
});

if (!stoModule) {
throw new PolymathError({
code: ErrorCode.ProcedureValidationError,
message: stoModuleErrorMessage,
});
throw stoModuleError;
}

if (isCappedSTO_3_0_0(stoModule)) {
Expand All @@ -114,10 +114,7 @@ export class FinalizeSto extends Procedure<FinalizeStoProcedureArgs> {
});

if (!stoModule) {
throw new PolymathError({
code: ErrorCode.ProcedureValidationError,
message: stoModuleErrorMessage,
});
throw stoModuleError;
}

const { tokensSold, capPerTier } = await stoModule.getSTODetails();
Expand Down

0 comments on commit a1a3e53

Please sign in to comment.