-
Notifications
You must be signed in to change notification settings - Fork 10
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
Small nit suggestions #147
Conversation
CLA Assistant Lite bot: I have read the CLA Document and I hereby sign the CLA You can retrigger this bot by commenting recheck in this Pull Request |
@@ -68,21 +66,25 @@ describe('ConditionalOrder', () => { | |||
'0x910d00a310f7Dc5B29FE73458F47f519be547D3d', | |||
'0x9379a0bf532ff9a66ffde940f94b1a025d6f18803054c1aef52dc94b15255bbe' | |||
) | |||
expect(BaseConditionalOrder.leafToId(order.leaf)).toEqual( | |||
expect(ConditionalOrder.leafToId(order.leaf)).toEqual( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just to keep things simple, i suggest we just call the abstract class ConditionalOrder
instead of BaseConditionalOrder
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There needs to be some room left for further generalisation.
All conditional orders that are done now are generators - but these are a subset of conditional orders. There may be conditional order types that only specify a verify
, and these require custom logic to know what to provide them for offChain
input etc.
I'm not sure where this logic would be implemented idiomatically.
hasOffChainInput = false | ||
) { | ||
constructor(params: ConditionalOrderArguments<Params>) { | ||
const { handler, salt = utils.keccak256(utils.randomBytes(32)), staticInput, hasOffChainInput = false } = params |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe is better to use name parameters than a list of parameters, especially with optional ones.
This reduces errors using it and make params more explicit and easy to read
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great, thanks for the detailed, comprehensive review.
Mostly minor nits, but the one that stands out the most is the name of the generic used on ConditionalOrder
. My fear in that using the generic Params
may cause the SDK user to conflate this with the IConditionalOrder.ConditionalOrderParams
struct.
@@ -68,21 +66,25 @@ describe('ConditionalOrder', () => { | |||
'0x910d00a310f7Dc5B29FE73458F47f519be547D3d', | |||
'0x9379a0bf532ff9a66ffde940f94b1a025d6f18803054c1aef52dc94b15255bbe' | |||
) | |||
expect(BaseConditionalOrder.leafToId(order.leaf)).toEqual( | |||
expect(ConditionalOrder.leafToId(order.leaf)).toEqual( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There needs to be some room left for further generalisation.
All conditional orders that are done now are generators - but these are a subset of conditional orders. There may be conditional order types that only specify a verify
, and these require custom logic to know what to provide them for offChain
input etc.
I'm not sure where this logic would be implemented idiomatically.
Co-authored-by: mfw78 <[email protected]>
Nice comments! I will address! |
@anxolin unit tests also broken here |
This is a misc on some NIT suggestions.
Happy to take any of this back, but I feel is still early (we are still doing a RC), and we can arrange things a bit.
I tried to explain the changes in the code, mainly
BaseConditionalOrder
is nowConditionalOrder
, andTWAP
isTwap
utils.ts
with helperstypes.ts
with main typesutils.ts
twap
to match what we store onchain inorderClass
for theappData
To review
I left some comments in the code too