0

On BSC chain, this transaction is minting an NFT(MstToken). The evm trace shows it called MstToken.transferFrom(fromUser, ..., 0x30927f74c9de0000) to send out 0x30927f74c9de0000 token and it succeeded, the return value is 1:

{
  "type": "CALL",
...
  "calls": [
    {
      "type": "DELEGATECALL",
      ...
      "calls": [
        {
          "type": "CALL", // <-- `transferFrom(user, ..., 0x30927f74c9de0000)`, returns true
          ...
          "input": "0x23b872dd0000000000000000000000009b57b60f14fea2b9889f203ed29db879060147dc000000000000000000000000edc7fd964385ee96b8e2447e2d0e9fd8decad30000000000000000000000000000000000000000000000000030927f74c9de0000",
          "output": "0x0000000000000000000000000000000000000000000000000000000000000001"
        },
        {
          "type": "CALL",

But when I query the balance of that block from archive node, it shows only 0x13d7adaac0a4940f, less than 0x30927f74c9de0000. My code in Golang:

    client, _ := ethclient.Dial("wss://archive_node_url")

    // token address
    MstAddress := common.HexToAddress("0xe7af3fcc9cb79243f76947402117d98918bd88ea")
    blockNum := big.NewInt(17453505)

    userAddress := common.HexToAddress("0x9b57b60f14fea2b9889f203ed29db879060147dc")

    mst, _ := erc20.NewErc20(MstAddress, client)
    balance, _ := mst.BalanceOf(&bind.CallOpts{
        BlockNumber: blockNum,
    }, userAddress)

    fmt.Println(balance)

I thought maybe the user send two transactions at same block, first sending some token to it and then mints. But I check on that block number, there seems only one tx from the user.

What do I miss?

1 Answer 1

2

You're querying the block that transaction was executed on, so you'll get the amount after state change.

If you want to check the previous state, query block 17453504.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.