Skip to content

Commit

Permalink
first round of review
Browse files Browse the repository at this point in the history
  • Loading branch information
fbac committed Oct 8, 2024
1 parent 8ef6a05 commit 445b5c3
Show file tree
Hide file tree
Showing 8 changed files with 326 additions and 331 deletions.
2 changes: 1 addition & 1 deletion precompiles/bank/method_deposit.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ func unpackDepositArgs(args []interface{}) (zrc20Addr common.Address, amount *bi
}

amount, ok = args[1].(*big.Int)
if !ok || amount.Sign() <= 0 || amount == nil || amount == new(big.Int) {
if !ok || amount == nil || amount.Sign() <= 0 {
return common.Address{}, nil, &ptypes.ErrInvalidAmount{
Got: amount.String(),
}
Expand Down
8 changes: 4 additions & 4 deletions precompiles/bank/method_withdraw.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,9 @@ func (c *Contract) withdraw(

// Check if fungible address has enough ZRC20 balance.
if err := c.fungibleKeeper.CheckFungibleZRC20Balance(ctx, c.zrc20ABI, zrc20Addr, amount); err != nil {
return nil, &ptypes.ErrUnexpected{
When: "balanceOf",
Got: err.Error(),
return nil, &ptypes.ErrInsufficientBalance{
Requested: amount.String(),
Got: err.Error(),

Check warning on line 91 in precompiles/bank/method_withdraw.go

View check run for this annotation

Codecov / codecov/patch

precompiles/bank/method_withdraw.go#L89-L91

Added lines #L89 - L91 were not covered by tests
}
}

Expand Down Expand Up @@ -134,7 +134,7 @@ func unpackWithdrawArgs(args []interface{}) (zrc20Addr common.Address, amount *b
}

amount, ok = args[1].(*big.Int)
if !ok || amount.Sign() <= 0 || amount == nil || amount == new(big.Int) {
if !ok || amount == nil || amount.Sign() <= 0 {
return common.Address{}, nil, &ptypes.ErrInvalidAmount{
Got: amount.String(),
}
Expand Down
72 changes: 0 additions & 72 deletions x/fungible/keeper/zrc20_check_allowance.go

This file was deleted.

67 changes: 0 additions & 67 deletions x/fungible/keeper/zrc20_check_balance.go

This file was deleted.

26 changes: 0 additions & 26 deletions x/fungible/keeper/zrc20_check_token_validity.go

This file was deleted.

Loading

0 comments on commit 445b5c3

Please sign in to comment.