Skip to content

cmd/abigen, accounts/abi: add support for log subscriptions#15246

Closed
bas-vk wants to merge 5 commits into
ethereum:masterfrom
bas-vk:abigen-subs
Closed

cmd/abigen, accounts/abi: add support for log subscriptions#15246
bas-vk wants to merge 5 commits into
ethereum:masterfrom
bas-vk:abigen-subs

Conversation

@bas-vk
Copy link
Copy Markdown
Member

@bas-vk bas-vk commented Oct 5, 2017

WIP: need to regenerate the contracts included in the contracts package but solc is not accepting them during the generation step. Need to figure out why not.

This PR adds supports for subscribing to log events on the generated source code.

E.g.:

pragma solidity ^0.4.15;

// generate go bindings with
// abigen -pkg main -sol test.sol -out test.go

contract Test {
  event Ev0(address);
  event Ev1(address indexed);
  event Ev2(uint indexed intArg, bytes32) anonymous;

  function raiseEvents() {
      Ev0(msg.sender);
      Ev1(msg.sender);
      Ev2(1234, "0x00112233445566778899");
  }
}

Generates the following bindings:

func (_Test *TestCaller) SubscribeEv0(opts *bind.CallOpts, ch chan<- types.Log, topics ...[]common.Hash) (ethereum.Subscription, error)
func (_Test *TestCaller) SubscribeEv1(opts *bind.CallOpts, ch chan<- types.Log, topics ...[]common.Hash) (ethereum.Subscription, error) {
func (_Test *TestCaller) SubscribeEv2(opts *bind.CallOpts, ch chan<- types.Log, topics ...[]common.Hash) (ethereum.Subscription, error) {

Note: I don't have a java environment set up so could not test generated java code. Therefore this PR currently only has go bindings in scope. But that probably leads to problems with the java bindings.

@chatchay
Copy link
Copy Markdown

chatchay commented Oct 5, 2017

pragma solidity ^0.4.15;

// generate go bindings with
// abigen -pkg main -sol test.sol -out test.go

contract Test {
event Ev0(address);
event Ev1(address indexed);
event Ev2(uint indexed intArg, bytes32) anonymous;

function raiseEvents() {
Ev0(msg.sender);
Ev1(msg.sender);
Ev2(1234, "0x00112233445566778899");
}
}

bas-vk added 3 commits October 9, 2017 10:31
…e + support subscribe logs

- update release contract code for solidity 0.4
- add support for subscribing to filter events in simulated backend and contract backend
@GitCop
Copy link
Copy Markdown

GitCop commented Oct 9, 2017

Thank you for your contribution! Your commits seem to not adhere to the repository coding standards

  • Commit: c064b1d
  • Your commit message body contains a line that is longer than 80 characters
  • Commits must be prefixed with the package(s) they modify

Please check the contribution guidelines for more details.


This message was auto-generated by https://gitcop.com

@GitCop
Copy link
Copy Markdown

GitCop commented Oct 9, 2017

Thank you for your contribution! Your commits seem to not adhere to the repository coding standards

  • Commit: c064b1d
  • Your commit message body contains a line that is longer than 80 characters
  • Commits must be prefixed with the package(s) they modify

Please check the contribution guidelines for more details.


This message was auto-generated by https://gitcop.com

@markya0616
Copy link
Copy Markdown
Contributor

Any news on this?

@fjl
Copy link
Copy Markdown
Contributor

fjl commented Nov 13, 2017

@bas-vk ping

@karalabe
Copy link
Copy Markdown
Member

karalabe commented Jan 8, 2018

Superseded by #15832.

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

Successfully merging this pull request may close these issues.

7 participants