rusk
rusk copied to clipboard
Add Support for Autocontracts
Summary
As part of the Economic Model, the concept of Autocontracts are introduced. Autocontracts represent event-listening contracts that are automatically executed upon the emitting of a subscribed event, given their ability to pay for their own gas.
This features enables functionalities such as limit orders and actions tied to asset price movements.
Possible solution design or implementation
Autocontracts requires a protocool for the order of subscribing to contracts and the timing of their execution in relation to events. Thought needs to be put into whether execution follows a "contract ID order", "contract fee order" or something else. Block generators have limited influence on Autocontract execution.
The timing of the subscribers execution also needs consideration. Should it be immediately after the event is triggered, post-regular execution, or after a batch of executions. The implications are significant, especially in terms of gas usage and potential to manipulate. Immediate execution might impact the block gas limit, potentially excluding other transactions and opening up avenues for attacks.
Conversely, after-batch execution presents challenges as it might be susceptible to being "gamed"/"front ran" by other transactions, making it vulnerable to sandwich bots.