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

[TASK] Time interval / subscription hooks #288

Closed
drewstone opened this issue Sep 19, 2024 · 0 comments
Closed

[TASK] Time interval / subscription hooks #288

drewstone opened this issue Sep 19, 2024 · 0 comments
Assignees

Comments

@drewstone
Copy link
Contributor

drewstone commented Sep 19, 2024

Overview

Certain services might not require any onchain events to trigger their execution. Instead they may just require execution every block, or 6/12/30/60/3600 seconds, or another arbitrary event process. We should consider how this will be integrated into a job, probably using another macro argument. It should even be possible to "roll your own event listener / event triggering process". We should make the current one the default and be able to show an example in the macro of using it to roll it as if it were custom.

/// An example hook for a report that provides a incident reporting security service
pub fn report_incident(ctx: Context, ...) {
    // check on-chain state of this contract
    let contract = ctx.trap_contract;
    let incident_valid = contract.check_validity_of_trap();

    // Report the incident if there's a valid incident
    if (incident_valid) {
        contract.report_incident();
    }
}
@drewstone drewstone changed the title [TASK] Time interval / subscription job execution [TASK] Time interval / subscription hooks Sep 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Completed ✅
Development

No branches or pull requests

2 participants