Skip to content
This repository was archived by the owner on Jul 6, 2022. It is now read-only.

Commit f4f5aa3

Browse files
committed
fix: 🐛 implement ErrorCode type for module wrapper
1 parent 06a3b43 commit f4f5aa3

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

src/contract_wrappers/modules/module_wrapper.ts

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import {
88
} from '@polymathnetwork/abi-wrappers';
99
import ContractWrapper from '../contract_wrapper';
1010
import ContractFactory from '../../factories/contractFactory';
11-
import { TxParams, GenericModuleContract, GetLogs, Subscribe } from '../../types';
11+
import { TxParams, GenericModuleContract, GetLogs, Subscribe, ErrorCode } from '../../types';
1212
import { stringToBytes32 } from '../../utils/convert';
1313
import functionsUtils from '../../utils/functions_utils';
1414
import assert from '../../utils/assert';
@@ -83,12 +83,20 @@ export default class ModuleWrapper extends ContractWrapper {
8383
};
8484

8585
public reclaimETH = async (params: TxParams) => {
86-
assert.assert(await this.isCallerTheSecurityTokenOwner(params.txData), 'The caller must be the ST owner');
86+
assert.assert(
87+
await this.isCallerTheSecurityTokenOwner(params.txData),
88+
ErrorCode.Unauthorized,
89+
'The caller must be the ST owner',
90+
);
8791
return (await this.contract).reclaimETH.sendTransactionAsync(params.txData, params.safetyFactor);
8892
};
8993

9094
public reclaimERC20 = async (params: ReclaimERC20Params) => {
91-
assert.assert(await this.isCallerTheSecurityTokenOwner(params.txData), 'The caller must be the ST owner');
95+
assert.assert(
96+
await this.isCallerTheSecurityTokenOwner(params.txData),
97+
ErrorCode.Unauthorized,
98+
'The caller must be the ST owner',
99+
);
92100
assert.isNonZeroETHAddressHex('tokenContract', params.tokenContract);
93101
return (await this.contract).reclaimERC20.sendTransactionAsync(
94102
params.tokenContract,

0 commit comments

Comments
 (0)