-
Notifications
You must be signed in to change notification settings - Fork 221
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
refactor(scaledPriceAuthority): initialPrice by composition #7023
Conversation
bb317cd
to
f1a6fe1
Compare
const quoteAmount = harden({ | ||
brand: quoteBrand, | ||
value: [ | ||
{ | ||
amountIn, | ||
amountOut, | ||
timer, | ||
timestamp, | ||
}, | ||
], | ||
}); | ||
const quotePayment = await E(quoteMint).mintPayment({ | ||
brand: quoteBrand, | ||
value: [quoteAmount], | ||
}); | ||
return harden({ quoteAmount, quotePayment }); |
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.
dupes
const quoteAmount = { | |
brand: quoteBrand, | |
value: [{ amountIn, amountOut, timer, timestamp }], | |
}; | |
const quotePayment = await E(quoteMint).mintPayment({ | |
brand: quoteBrand, | |
value: [quoteAmount], | |
}); | |
return harden({ quoteAmount, quotePayment }); |
consider DRYing. fine to have priceAuthorityInitial depend on priceAuthorityTransform so the latter could just export that maker function
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.
LGTM, especially the mintQuote
naming
}); | ||
return harden({ quoteAmount, quotePayment }); | ||
}; | ||
const initialUpdateP = oneQuote( |
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.
consider inlining this so the promises don't try to resolve if they're never needed
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'm pushing it down/in some, but I don't want to do a round trip to the timer service for clients that repeatedly call getUpdateSince()
without bumping the updateCount
.
refactor(scaledPriceAuthority): factor out mintQuote() - clarify priceOutPerIn - clarify mintCurrentQuote
refs: #6957, #6960, #7008, #7016
Description
Rather than mucking with the internals of
makePriceAuthorityTransform
, compose it with amakeInitialTransform
.Security Considerations
more straightforward to audit
Documentation Considerations
makeInitialTransform
has a bit of documentation as to its purpose and function.Testing Considerations
Pure refactor; invisible to unit tests. :)
Tasks