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

feat: rework contract billing storage #477

Merged

Conversation

DylanVerstraete
Copy link
Contributor

@DylanVerstraete DylanVerstraete commented Oct 6, 2022

Contracts will not get reinserted after a successful bill, rather it will get a index which can be calculated as following:

Now block % billing frequency

When a contract is created the index is generated as:

Now block - 1 % billing frequency

For such, the offchain worker will not bill the contract in the same block it gets created.

Even if the offchain worker now fails to bill the contract, it can be billed in the next cycle. The elapsed time between the first bill (or creation) and next bill is calculated anyway.

@gitpod-io
Copy link

gitpod-io bot commented Oct 6, 2022

Copy link
Contributor

@brandonpille brandonpille left a comment

Choose a reason for hiding this comment

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

Looks great! Some small comments.

@DylanVerstraete DylanVerstraete changed the title Refactor billing feat: rework contract billing storage Oct 6, 2022
Copy link
Contributor

@LeeSmet LeeSmet left a comment

Choose a reason for hiding this comment

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

Looks good in general though I'd prefer the index calculation to live in its own fuction

@DylanVerstraete DylanVerstraete requested review from LeeSmet and brandonpille and removed request for LeeSmet October 10, 2022 14:24
Copy link
Contributor

@brandonpille brandonpille left a comment

Choose a reason for hiding this comment

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

Nice work. Some small comments already approving.

.github/workflows/build_test.yaml Outdated Show resolved Hide resolved
@DylanVerstraete
Copy link
Contributor Author

@LeeSmet can you review migration as well please?

@DylanVerstraete DylanVerstraete marked this pull request as ready for review October 12, 2022 07:19
@DylanVerstraete DylanVerstraete merged commit 668ef5f into feat/269-rework-pallet-smart-contract-billing Oct 12, 2022
@DylanVerstraete DylanVerstraete deleted the refactor_billing branch October 12, 2022 07:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants