Skip to content

Commit

Permalink
fix eth events in deposit precompile method
Browse files Browse the repository at this point in the history
  • Loading branch information
skosito authored and fbac committed Sep 16, 2024
1 parent 02ddce3 commit c1836a3
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 12 deletions.
3 changes: 1 addition & 2 deletions e2e/e2etests/test_precompiles_bank.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,8 @@ func TestPrecompilesBank(r *runner.E2ERunner, args []string) {
tx, err = bankContract.Deposit(r.ZEVMAuth, r.WZetaAddr, big.NewInt(25))
fmt.Printf("DEBUG: bank.deposit() tx hash %s\n", tx.Hash().String())
require.NoError(r, err, "Error calling bank.deposit()")
utils.MustWaitForTxReceipt(r.Ctx, r.ZEVMClient, tx, r.Logger, r.ReceiptTimeout)

r.Logger.Info("Waiting for 5 blocks")
r.WaitForBlocks(5)
fmt.Printf("DEBUG: bank.deposit() tx %+v\n", tx)

// Check the balance of the spender in coins "zevm/WZetaAddr".
Expand Down
3 changes: 3 additions & 0 deletions precompiles/bank/method_deposit.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ func (c *Contract) deposit(
ContractAddress,
zrc20Addr,
"balanceOf",
true,
[]interface{}{caller},
)
if err != nil {
Expand Down Expand Up @@ -96,6 +97,7 @@ func (c *Contract) deposit(
ContractAddress,
zrc20Addr,
"allowance",
true,
[]interface{}{caller, ContractAddress},
)
if err != nil {
Expand Down Expand Up @@ -168,6 +170,7 @@ func (c *Contract) deposit(
ContractAddress,
zrc20Addr,
"transferFrom",
true,
[]interface{}{caller, ContractAddress, amount},
)
if err != nil {
Expand Down
22 changes: 12 additions & 10 deletions precompiles/types/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ type ContractCaller interface {
from common.Address,
dst common.Address,
method string,
noEthereumTxEvent bool,
args []interface{}) ([]interface{}, error)
}

Expand Down Expand Up @@ -74,19 +75,20 @@ func (c *baseContract) CallContract(
from common.Address,
dst common.Address,
method string,
noEthereumTxEvent bool,
args []interface{},
) ([]interface{}, error) {
res, err := fungibleKeeper.CallEVM(
ctx, // ctx
*abi, // abi
from, // from
dst, // to
big.NewInt(0), // value
nil, // gasLimit
true, // commit
false, // noEthereumTxEvent
method, // method
args..., // args
ctx, // ctx
*abi, // abi
from, // from
dst, // to
big.NewInt(0), // value
nil, // gasLimit
true, // commit
noEthereumTxEvent, // noEthereumTxEvent
method, // method
args..., // args
)
if err != nil {
return nil, &ErrUnexpected{
Expand Down

0 comments on commit c1836a3

Please sign in to comment.