Skip to content

Commit

Permalink
fix: review comments, unnecessary code and internal func
Browse files Browse the repository at this point in the history
  • Loading branch information
Victor Wiebe committed Jan 6, 2020
1 parent ce409eb commit 07ad557
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 14 deletions.
17 changes: 9 additions & 8 deletions src/procedures/FinalizeSto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,12 +75,7 @@ export class FinalizeSto extends Procedure<FinalizeStoProcedureArgs> {
});
}

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

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

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

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

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

const { tokensSold, capPerTier } = await stoModule.getSTODetails();
Expand Down
2 changes: 0 additions & 2 deletions src/procedures/__tests__/InvestInSimpleSto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -154,8 +154,6 @@ describe('InvestInSimpleSto', () => {
const addProcedureSpy = spy(target, 'addProcedure');
simpleStoMock.mock('buyTokensWithPoly', Promise.resolve('BuyTokensWithPoly'));

securityTokenMock.mock('balanceOf', Promise.resolve(new BigNumber(10)));

// Real call
await target.prepareTransactions();

Expand Down
4 changes: 0 additions & 4 deletions src/procedures/__tests__/InvestInTieredSto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -162,8 +162,6 @@ describe('InvestInTieredSto', () => {
const addProcedureSpy = spy(target, 'addProcedure');
tieredStoMock.mock('buyWithUSDRateLimited', Promise.resolve('BuyWithUSDRateLimited'));

securityTokenMock.mock('balanceOf', Promise.resolve(new BigNumber(10)));

// Real call
await target.prepareTransactions();

Expand Down Expand Up @@ -194,8 +192,6 @@ describe('InvestInTieredSto', () => {
const addProcedureSpy = spy(target, 'addProcedure');
tieredStoMock.mock('buyWithUSDRateLimited', Promise.resolve('BuyWithUSDRateLimited'));

securityTokenMock.mock('balanceOf', Promise.resolve(new BigNumber(10)));

// Real call
await target.prepareTransactions();

Expand Down

0 comments on commit 07ad557

Please sign in to comment.