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

Commit cec6223

Browse files
committed
fix: 🐛 implement ErrorCode type for ether dividend checkpoint
1 parent e0e1189 commit cec6223

File tree

1 file changed

+21
-4
lines changed

1 file changed

+21
-4
lines changed

src/contract_wrappers/modules/checkpoint/ether_dividend_checkpoint_wrapper.ts

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ import {
3030
Subscribe,
3131
GetLogs,
3232
Perm,
33+
ErrorCode,
3334
} from '../../../types';
3435
import { numberToBigNumber, dateToBigNumber, stringToBytes32, valueToWei } from '../../../utils/convert';
3536

@@ -246,7 +247,11 @@ export default class EtherDividendCheckpointWrapper extends DividendCheckpointWr
246247
}
247248

248249
public createDividend = async (params: CreateDividendParams) => {
249-
assert.assert(await this.isCallerAllowed(params.txData, Perm.Admin), 'Caller is not allowed');
250+
assert.assert(
251+
await this.isCallerAllowed(params.txData, Perm.Admin),
252+
ErrorCode.Unauthorized,
253+
'Caller is not allowed',
254+
);
250255
const txPayableData = {
251256
...params.txData,
252257
value: valueToWei(params.value, await this.getDecimals()),
@@ -269,7 +274,11 @@ export default class EtherDividendCheckpointWrapper extends DividendCheckpointWr
269274
};
270275

271276
public createDividendWithCheckpoint = async (params: CreateDividendWithCheckpointParams) => {
272-
assert.assert(await this.isCallerAllowed(params.txData, Perm.Admin), 'Caller is not allowed');
277+
assert.assert(
278+
await this.isCallerAllowed(params.txData, Perm.Admin),
279+
ErrorCode.Unauthorized,
280+
'Caller is not allowed',
281+
);
273282
const txPayableData = {
274283
...params.txData,
275284
value: valueToWei(params.value, await this.getDecimals()),
@@ -294,7 +303,11 @@ export default class EtherDividendCheckpointWrapper extends DividendCheckpointWr
294303
};
295304

296305
public createDividendWithExclusions = async (params: CreateDividendWithExclusionsParams) => {
297-
assert.assert(await this.isCallerAllowed(params.txData, Perm.Admin), 'Caller is not allowed');
306+
assert.assert(
307+
await this.isCallerAllowed(params.txData, Perm.Admin),
308+
ErrorCode.Unauthorized,
309+
'Caller is not allowed',
310+
);
298311
const txPayableData = {
299312
...params.txData,
300313
value: valueToWei(params.value, await this.getDecimals()),
@@ -322,7 +335,11 @@ export default class EtherDividendCheckpointWrapper extends DividendCheckpointWr
322335
public createDividendWithCheckpointAndExclusions = async (
323336
params: CreateDividendWithCheckpointAndExclusionsParams,
324337
) => {
325-
assert.assert(await this.isCallerAllowed(params.txData, Perm.Admin), 'Caller is not allowed');
338+
assert.assert(
339+
await this.isCallerAllowed(params.txData, Perm.Admin),
340+
ErrorCode.Unauthorized,
341+
'Caller is not allowed',
342+
);
326343
const txPayableData = {
327344
...params.txData,
328345
value: valueToWei(params.value, await this.getDecimals()),

0 commit comments

Comments
 (0)