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

Commit 85668f2

Browse files
author
Victor Wiebe
committed
fix: dividendCheckpoint assertion with caller and dividendContract
1 parent 1d65417 commit 85668f2

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

src/contract_wrappers/modules/checkpoint/dividend_checkpoint_wrapper.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -512,9 +512,15 @@ export default abstract class DividendCheckpointWrapper extends ModuleWrapper {
512512
assert.isNonZeroETHAddressHex('token', token);
513513
const erc20Detailed = await this.erc20DetailedContract(token);
514514
const erc20TokenBalance = await erc20Detailed.balanceOf.callAsync(callerAddress);
515-
const erc20TokenAllowance = await erc20Detailed.allowance.callAsync(callerAddress, token);
516-
assert.assert(erc20TokenAllowance.isGreaterThanOrEqualTo(amount), 'Your allowance is less than dividend amount');
517-
assert.assert(erc20TokenBalance.isGreaterThanOrEqualTo(amount), 'Your balance is less than dividend amount');
515+
const erc20TokenAllowance = await erc20Detailed.allowance.callAsync(callerAddress, await this.address());
516+
assert.assert(
517+
erc20TokenAllowance.isGreaterThanOrEqualTo(amount.absoluteValue()),
518+
'Your allowance is less than dividend amount',
519+
);
520+
assert.assert(
521+
erc20TokenBalance.isGreaterThanOrEqualTo(amount.absoluteValue()),
522+
'Your balance is less than dividend amount',
523+
);
518524
} else {
519525
assert.assert(
520526
(await this.web3Wrapper.getBalanceInWeiAsync(callerAddress)).isGreaterThanOrEqualTo(amount.valueOf()),

0 commit comments

Comments
 (0)