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

Commit e0e1189

Browse files
committed
fix: 🐛 implement ErrorCode type for erc20 dividend checkpoint
1 parent 5bebc6b commit e0e1189

File tree

1 file changed

+21
-4
lines changed

1 file changed

+21
-4
lines changed

src/contract_wrappers/modules/checkpoint/erc20_dividend_checkpoint_wrapper.ts

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ import {
2626
Subscribe,
2727
GetLogs,
2828
Perm,
29+
ErrorCode,
2930
} from '../../../types';
3031
import { numberToBigNumber, dateToBigNumber, stringToBytes32, valueToWei } from '../../../utils/convert';
3132

@@ -189,7 +190,11 @@ export default class ERC20DividendCheckpointWrapper extends DividendCheckpointWr
189190
};
190191

191192
public createDividend = async (params: CreateDividendParams) => {
192-
assert.assert(await this.isCallerAllowed(params.txData, Perm.Admin), 'Caller is not allowed');
193+
assert.assert(
194+
await this.isCallerAllowed(params.txData, Perm.Admin),
195+
ErrorCode.Unauthorized,
196+
'Caller is not allowed',
197+
);
193198
await this.checkIfDividendCreationIsValid(
194199
params.expiry,
195200
params.maturity,
@@ -211,7 +216,11 @@ export default class ERC20DividendCheckpointWrapper extends DividendCheckpointWr
211216
};
212217

213218
public createDividendWithCheckpoint = async (params: CreateDividendWithCheckpointParams) => {
214-
assert.assert(await this.isCallerAllowed(params.txData, Perm.Admin), 'Caller is not allowed');
219+
assert.assert(
220+
await this.isCallerAllowed(params.txData, Perm.Admin),
221+
ErrorCode.Unauthorized,
222+
'Caller is not allowed',
223+
);
215224
await this.checkIfDividendCreationIsValid(
216225
params.expiry,
217226
params.maturity,
@@ -235,7 +244,11 @@ export default class ERC20DividendCheckpointWrapper extends DividendCheckpointWr
235244
};
236245

237246
public createDividendWithExclusions = async (params: CreateDividendWithExclusionsParams) => {
238-
assert.assert(await this.isCallerAllowed(params.txData, Perm.Admin), 'Caller is not allowed');
247+
assert.assert(
248+
await this.isCallerAllowed(params.txData, Perm.Admin),
249+
ErrorCode.Unauthorized,
250+
'Caller is not allowed',
251+
);
239252
await this.checkIfDividendCreationIsValid(
240253
params.expiry,
241254
params.maturity,
@@ -262,7 +275,11 @@ export default class ERC20DividendCheckpointWrapper extends DividendCheckpointWr
262275
public createDividendWithCheckpointAndExclusions = async (
263276
params: CreateDividendWithCheckpointAndExclusionsParams,
264277
) => {
265-
assert.assert(await this.isCallerAllowed(params.txData, Perm.Admin), 'Caller is not allowed');
278+
assert.assert(
279+
await this.isCallerAllowed(params.txData, Perm.Admin),
280+
ErrorCode.Unauthorized,
281+
'Caller is not allowed',
282+
);
266283
await this.checkIfDividendCreationIsValid(
267284
params.expiry,
268285
params.maturity,

0 commit comments

Comments
 (0)