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

[Feature] add optional terminate condition for recurring job #39

Merged

Conversation

dev8723
Copy link
Contributor

@dev8723 dev8723 commented Jul 22, 2023

Summary

Add a terminate_condition attribute to the job, it's optional and has same type as the condition which is used to decide if a job is executable, terminate_condition decides if a recurring job should be terminated (i.e. stop creating follow up job) when it executed successfully.

If terminate_condition resolves to true or fail to resolve, recurring job will be terminated. Similar to condition resolves to true or fail to resolve, job will be executed.

Test plan

  • Unit test
  • Deploy the contract to localterra or testnet and verify if a DCA job can terminate by the terminate condition.

@dev8723 dev8723 changed the base branch from master to chore/contract-split July 22, 2023 07:13
@dev8723
Copy link
Contributor Author

dev8723 commented Jul 22, 2023

originally implemented in #34, but since we are splitting the contract now, adopt the latest change for terminate_condition

@dev8723 dev8723 force-pushed the feat/terminate-condition branch from bad178b to 9d40d04 Compare July 24, 2023 17:02
@vladjdk vladjdk self-requested a review July 25, 2023 02:26
@vladjdk vladjdk added the enhancement New feature or request label Jul 25, 2023
@vladjdk
Copy link
Contributor

vladjdk commented Jul 25, 2023

We need to include the terminate_condition in the all_vector_vars_present and string_vars_in_vector functions during the check in the QueryValidateJobCreation to account for the presence of vars in the terminate function. The rest looks fine to me

@dev8723
Copy link
Contributor Author

dev8723 commented Jul 25, 2023

We need to include the terminate_condition in the all_vector_vars_present and string_vars_in_vector functions during the check in the QueryValidateJobCreation to account for the presence of vars in the terminate function. The rest looks fine to me

Pushed a new commit to fix that.

Copy link
Contributor

@vladjdk vladjdk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm! nice work on this one

@vladjdk vladjdk merged commit 09e266d into terra-money:chore/contract-split Jul 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants