-
Notifications
You must be signed in to change notification settings - Fork 4
Workflow
-
A registry contract is being deployed, its address is being published in a publicly accessible location.
-
A miner declares that he is supporting events communication over that registry.
- Mapping
(emittingEventContractAddress, eventType)=>(subscriberEventContractAddress, functionToBeInvoked, invokationBounty) - Mapping
eventSubscriberContract=>balanceOfSubscriberContract
-
addEntry- Adding an entry to mapping (1) -
getBalanceOf- Retrieving the current balance of subscriber from mapping (2) -
addToBalanceOf- Adding value to the balance of a subscriber -
invokeEvent- Recieving the event that was mined and a proof (TBD) for that event. -
rewardMiner- Transfer bounties from subscirbers to an event miner -
removeEntry- Removes an entry from mapping (1) and return remaining funds in mapping (2)
Now to the flow:
-
Devloper which requires event handling logic, estimates the gas required for executing his callback function. Then calls the
addEntryand lists:- which event he is interested in
- which callback function should be invoked upon recieving that event.
- Funds as he see fit to invoke the callback function.
- Those should include (the invokation gas + a bounty to incentivize miners to publish events mined) * initial number of times he wishes that eventHandling to take place.
-
Event of type
Eis being emitted from a contract. -
Miner
M(the publisher) is mining that event and calls theinvokeEvent. -
The registry varifies
Eusing the proof provided with it. -
Upon successful varification, the registery invokes the callback function of all the subscribers that are listed for
E, using capital from their registry balances (mapping (2)). -
Regisgtry invokes
rewardMinertransferring all the bounties from the above subscribers toM.
Note, it is up for the subscriber contract to validate its funds at the registry and update them accordingly to meet its needs.