File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff 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 } ) ;
You can’t perform that action at this time.
0 commit comments