Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Transfer and Approve events are slightly different from ERC20 standard wiki (missing _) #370

Closed
yaronvel opened this issue Aug 15, 2017 · 4 comments

Comments

@yaronvel
Copy link
Contributor

For example, you are using from instead of _from in Transfer event.
See wiki here.

It could cause problems when parsing events with web3.
However, I am guessing this standard is not strictly followed and devs cannot rely on it anyway.

@frangio
Copy link
Contributor

frangio commented Aug 15, 2017

Thanks for reporting @yaronvel!

I've noticed this before, but I don't think it's an issue. The argument names are not included in the actual event data. They're only used when decoding it at the application level. See web3's decode function. The event data is in two arrays which are "zipped" together with the names in ABI.

@yaronvel
Copy link
Contributor Author

Yeah, it is very minor issue.
I encountered it when my truffle test failed for unknown field name. So it does have (minor) meaning.

Anyway, just wanted to let you know. As you are already aware of it, i will close the issue.

@frangio
Copy link
Contributor

frangio commented Aug 15, 2017

What do you mean with the unknown field name? Is it posible that it said <indexed> ?

@yaronvel
Copy link
Contributor Author

If I use log.args._from.valueOf() it throws an exception as log.args._from is undefined.
So I have to use log.args.from.valueOf().
This is the full code:

        return tokenContract.transfer( reciver.address, amount, {from: sender.address} ).then(function(result){
            if( shouldFail ) {
                assert.fail("expecting transfer to fail");
            }
            
            assert.equal(result.logs.length, 1, "expected a single event");
            var log = result.logs[0];            
            assert.equal(log.event, "Transfer", "unexpected event");
            assert.equal(log.args.from.valueOf(), sender.address.valueOf(), "unexpected from address");
            assert.equal(log.args.to.valueOf(), reciver.address.valueOf(), "unexpected to address");
            assert.equal(log.args.value.valueOf(), amount.valueOf(), "unexpected amount");         

dforsten pushed a commit to lab10-coop/streaming-token-contracts that referenced this issue May 31, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants