Skip to content

Commit 0490902

Browse files
committed
fix tests
1 parent 17833c7 commit 0490902

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

test/token/ERC20/ERC20.behavior.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,9 +132,18 @@ function shouldBehaveLikeERC20(initialSupply, opts = {}) {
132132
});
133133

134134
it('reverts when the token owner is the zero address', async function () {
135+
// transferFrom does a spendAllowance before moving the assets
136+
// - default behavior (ERC20) is to set the update the approval, which will fail because the approver is
137+
// address(0) that happens even if the amount transfered is zero, and the approval update is not actually
138+
// necessary
139+
// - in ERC20TemporaryAllowance, transfer of 0 value will not update allowance (termporary or persisten)
140+
// therefore the spend allowance does not revert. The transfer of asset will however revert because the sender
141+
// is address(0)
142+
const errorName = this.token.temporaryApprove ? 'ERC20InvalidSender' : 'ERC20InvalidApprover';
143+
135144
const value = 0n;
136145
await expect(this.token.connect(this.recipient).transferFrom(ethers.ZeroAddress, this.recipient, value))
137-
.to.be.revertedWithCustomError(this.token, 'ERC20InvalidSender')
146+
.to.be.revertedWithCustomError(this.token, errorName)
138147
.withArgs(ethers.ZeroAddress);
139148
});
140149
});

0 commit comments

Comments
 (0)