Skip to content

Instantly share code, notes, and snippets.

@ItayPodhajcer
Last active January 16, 2020 08:42
Show Gist options
  • Save ItayPodhajcer/678f2e135875fbc43ee432ca1d254f4f to your computer and use it in GitHub Desktop.
Save ItayPodhajcer/678f2e135875fbc43ee432ca1d254f4f to your computer and use it in GitHub Desktop.
ethereum-event-azure-function-trigger/EthereumEventListener.StartAsync
public async Task StartAsync(CancellationToken cancellationToken)
{
_cts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken);
var web3 = new Web3(_attribute.Url);
var contract = web3.Eth.GetContract(_attribute.Abi, _attribute.ContractAddress);
_event = contract.GetEvent(_attribute.EventName);
_filter = await _event.CreateFilterAsync();
ListenAsync(_cts.Token);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment