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

Support off-chain claim accounting via bucket events #185

Merged
merged 7 commits into from
Jan 31, 2023

Conversation

neodaoist
Copy link
Contributor

@neodaoist neodaoist commented Jan 20, 2023

Proposed changes in this PR — 

  • Add BucketWrittenInto event
  • Add BucketAssignedExercise event

Will save for the more significant entropy and weighting PRs — 

  • Write an additional test(s) to check which buckets are getting assigned in more complex situations

@@ -598,7 +600,7 @@ contract OptionSettlementEngine is ERC1155, IOptionSettlementEngine {
address underlyingAsset = optionRecord.underlyingAsset;

// Assign exercise to writers.
_assignExercise(optionTypeState, optionRecord, amount);
_assignExercise(optionId, optionTypeState, optionRecord, amount);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

BTW, with the entropy + weighting changes, it's likely that we can drop optionRecord from the function params.

amountPresentlyExercised = amount;
amount = 0;
}
bucketInfo.amountExercised += amountPresentlyExercised;

emit BucketAssignedExercise(optionId, bucketIndex, amountPresentlyExercised);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I believe amountPresentlyExercised is the correct argument to include here — the amount of options that were just assigned exercised from this bucket.

@neodaoist neodaoist changed the title [WIP] Support off-chain claim accounting via bucket events Support off-chain claim accounting via bucket events Jan 24, 2023
@neodaoist neodaoist marked this pull request as ready for review January 24, 2023 01:06
Copy link
Member

@0xAlcibiades 0xAlcibiades left a comment

Choose a reason for hiding this comment

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

One sm0l change @neodaoist

* @param bucketIndex The index of the bucket to which the options were written.
* @param amount The amount of options contracts written.
*/
event BucketWrittenInto(uint256 indexed optionId, uint96 bucketIndex, uint112 amount);
Copy link
Member

Choose a reason for hiding this comment

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

I think this should have the claim ID indexed for the subgraph handler to know.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

RIght on, good call, will add

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.

2 participants