Skip to content

Commit

Permalink
fix(precompile-funtoken.go): Fixes a bug where the err != nil check i…
Browse files Browse the repository at this point in the history
…s missing in the bankBalance precompile method
  • Loading branch information
Unique-Divine committed Nov 26, 2024
1 parent 8907a61 commit 7582f9b
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,8 @@ tests for race conditions within funtoken precompile
- [#2101](https://github.com/NibiruChain/nibiru/pull/2101) - fix(evm): tx receipt proper marshalling
- [#2105](https://github.com/NibiruChain/nibiru/pull/2105) - test(evm): precompile call with revert
- [#2107](https://github.com/NibiruChain/nibiru/pull/2107) -
feat(evm-funtoken-precompile): Implement methods: balance, bankBalance, whoAmI
- [#2xxx](https://github.com/NibiruChain/nibiru/pull/2xxx) -feat(evm-funtoken-precompile): Implement methods: balance, bankBalance, whoAmI
fix(precompile-funtoken.go): Fixes a bug where the err != nil check is missing in the bankBalance precompile method

#### Nibiru EVM | Before Audit 1 - 2024-10-18

Expand Down
3 changes: 3 additions & 0 deletions evm-e2e/justfile
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,6 @@ test:
# Format
fmt:
npm run format

gen-types:
npx hardhat typechain
8 changes: 7 additions & 1 deletion x/evm/precompile/funtoken.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ func (p precompileFunToken) sendToBank(

erc20, amount, to, err := p.parseArgsSendToBank(args)
if err != nil {
err = ErrInvalidArgs(err)
return
}

Expand Down Expand Up @@ -376,6 +377,10 @@ func (p precompileFunToken) bankBalance(
}

addrEth, addrBech32, bankDenom, err := p.parseArgsBankBalance(args)
if err != nil {
err = ErrInvalidArgs(err)
return
}
bankBal := p.evmKeeper.Bank.GetBalance(ctx, addrBech32, bankDenom).Amount.BigInt()

return method.Outputs.Pack([]any{
Expand Down Expand Up @@ -455,7 +460,8 @@ func (p precompileFunToken) whoAmI(

addrEth, addrBech32, err := p.parseArgsWhoAmI(args)
if err != nil {
return bz, err
err = ErrInvalidArgs(err)
return
}

return method.Outputs.Pack([]any{
Expand Down

0 comments on commit 7582f9b

Please sign in to comment.