0

Why do the results differ in the following:

truffle(development)> l.ownerOf(t) == l.ownerOf(t)
false
truffle(development)> l.ownerOf(t) != l.ownerOf(t)
true

Another version:

truffle(development)> var l1 = l.ownerOf(t)
undefined
truffle(development)> l1
'0xf17f52151ebef6c7334fad080c5704d77216b732'
truffle(development)> l1==l1
true
truffle(development)> var l2 = l.ownerOf(t)
undefined
truffle(development)> l1==l2
false
truffle(development)> l2
'0xf17f52151ebef6c7334fad080c5704d77216b732'

I can't seem to compare two identical addresses from a view function with the same parameters.

1

I believe this has to do with the the fact that both l1 and l2 are actually promises, though they log their results. This logic works:

truffle(development)> l.ownerOf(t).then(function(i){lll = i})
undefined
truffle(development)> l.ownerOf(t).then(function(i){ll = i})
undefined
truffle(development)> ll==lll
true
| improve this answer | |

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.