Skip to content

Commit a3a2a06

Browse files
authored
fix: event emission in erc20 precompile (#774)
* fix * fix
1 parent 0c29708 commit a3a2a06

File tree

2 files changed

+2
-3
lines changed

2 files changed

+2
-3
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
- [\#748](https://github.com/cosmos/evm/pull/748) Fix DynamicFeeChecker in Cosmos ante handler to respect NoBaseFee feemarkets' parameter.
1616
- [\#756](https://github.com/cosmos/evm/pull/756) Fix error message typo in NewMsgCancelProposal.
1717
- [\#772](https://github.com/cosmos/evm/pull/772) Avoid panic on close if evm mempool not used.
18+
- [\#774](https://github.com/cosmos/evm/pull/774) Emit proper allowance amount in erc20 event.
1819

1920
## v0.5.0
2021

precompiles/erc20/tx.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,14 +87,12 @@ func (p *Precompile) transfer(
8787
newAllowance := big.NewInt(0)
8888

8989
if isTransferFrom {
90-
spenderAddr := contract.Caller()
91-
9290
prevAllowance, err := p.erc20Keeper.GetAllowance(ctx, p.Address(), from, spenderAddr)
9391
if err != nil {
9492
return nil, ConvertErrToERC20Error(err)
9593
}
9694

97-
newAllowance := new(big.Int).Sub(prevAllowance, amount)
95+
newAllowance = new(big.Int).Sub(prevAllowance, amount)
9896
if newAllowance.Sign() < 0 {
9997
return nil, ErrInsufficientAllowance
10098
}

0 commit comments

Comments
 (0)