estarriolvetch / ERC721Psi

MIT License
116 stars 28 forks source link

fix the balance quantity increase problem #3

Closed madeinfree closed 2 years ago

madeinfree commented 2 years ago

Thanks for great team !

When I try to use the ERC721PsiTrackBalance and write down the test, find some confused from balanceOf always be zero, for this patch, changed [from] to [to] to make the balance increase correctly.

Expect

call _safeMint(to, 1), to account balanceOf should be 1

Actual

balanceOf is 0

Test

Traces:
  [113270] WAGMITest::testBalanceOf()
    ├─ [92174] WAGMIPsi::multiMintTo(0x00a329c0648769a73afac7f9381e08fb43dbea72, 1)
    │   ├─ emit Transfer(from: 0x0000000000000000000000000000000000000000, to: 0x00a329c0648769a73afac7f9381e08fb43dbea72, tokenId: 0)
    │   └─ ← ()
    ├─ [2656] WAGMIPsi::balanceOf(0x00a329c0648769a73afac7f9381e08fb43dbea72) [staticcall]
    │   └─ ← 0
    ├─ emit log(: "Error: a == b not satisfied [uint]")
    ├─ emit log_named_uint(key: "  Expected", val: 1)
    ├─ emit log_named_uint(key: "    Actual", val: 0)
    ├─ [0] VM::store(VM: [0x7109709ecfa91a80626ff3989d68f67f5b1dd12d], 0x6661696c65640000000000000000000000000000000000000000000000000000, 0x0000000000000000000000000000000000000000000000000000000000000001)
    │   └─ ← ()
    └─ ← ()
estarriolvetch commented 2 years ago

Awesome! That is the experimental code. I am thinking of replacing it with this extension. @madeinfree Any idea?

https://github.com/estarriolvetch/ERC721Psi/pull/2