-
Notifications
You must be signed in to change notification settings - Fork 212
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
Move AMM into a package that collects RUN protocol components #4218
Conversation
be5c2b8
to
25c2117
Compare
ea3af66
to
24d13d4
Compare
25c2117
to
5d1b0d2
Compare
687c4ed
to
577a4d3
Compare
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.
renaming test-stablecoin.js
seems worth doing
* @property {() => Brand[]} getAllPoolBrands | ||
* @property {() => Allocation} getProtocolPoolBalance |
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 curious what prompted this. It looks like a bit of a (welcome) drive-by.
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 didn't investigate, but I suspected that moving tests around caused a change to the way declarations were imported or how eslint was configured in tests. As I recall, we have eslint warnings turned off in some test directories.
* @typedef {Object} SwapPriceArgs | ||
* @property {Amount} amountGiven | ||
* @property {PoolAllocation} poolAllocation | ||
* @property {Amount=} amountWanted | ||
* @property {Ratio} protocolFeeRatio | ||
* @property {Ratio} poolFeeRatio | ||
*/ |
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.
more (welcome) type tweaks... seems worth a mention in the commit message.
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.
added a few lines to the message.
@@ -110,6 +119,7 @@ function checkGetOutput(t, args, result) { | |||
|
|||
const testGetInputPrice = (t, inputs, runIn) => { | |||
const args = runIn ? prepareRUNInTest(inputs) : prepareRUNOutTest(inputs); | |||
// @ts-ignore |
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.
add a few words about why @ts-ignore
is appropriate here?
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.
done
@@ -39,6 +39,7 @@ const prepareSwapInTest = ({ inputReserve, outputReserve, inputValue }) => { | |||
|
|||
const testInputGetPrice = (t, inputs, expectedOutput) => { | |||
const { args, bld } = prepareSwapInTest(inputs); | |||
// @ts-ignore |
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.
likewise for the other @ts-ignore
occurrences
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.
done
@@ -18,11 +18,11 @@ import { | |||
import { makePromiseKit } from '@agoric/promise-kit'; | |||
import { makeScriptedPriceAuthority } from '@agoric/zoe/tools/scriptedPriceAuthority.js'; | |||
import { assertAmountsEqual } from '@agoric/zoe/test/zoeTestHelpers.js'; | |||
import { makeParamManagerBuilder } from '@agoric/governance'; |
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.
the name of this file should change, yes?
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.
good point. I looked around and found a few files with treasury in their names and renamed them, too.
@@ -119,7 +119,7 @@ function checkGetOutput(t, args, result) { | |||
|
|||
const testGetInputPrice = (t, inputs, runIn) => { | |||
const args = runIn ? prepareRUNInTest(inputs) : prepareRUNOutTest(inputs); | |||
// @ts-ignore | |||
// @ts-ignore typescript doesn't like param list built by destructuring |
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 wonder if there's a way to use Parameters<Type>
.
I'm not inspired to work it out just now, though.
5d1b0d2
to
150238a
Compare
7785520
to
61dd1c8
Compare
61dd1c8
to
f452917
Compare
renamed some files from treasury/stablecoin to vaultFactory annotated some ts-ignore statements in tests. regenerated png files in docs/threat_models
f452917
to
af6710b
Compare
refs: #4199
Description
Move the AMM out of the Zoe contacts directory and into packages/run-protocol.
Security Considerations
This should be without security implications. It's just rearranging packages.
Documentation Considerations
As mentioned in #4199 and #4209, the docs need to be reorganized to make RUN protocol more visible.
Testing Considerations
Rearranging the test subdirectory to distinguish the various RUN protocol components.
Updates to Type Declarations
As a result of the rearrangement, eslint reported some type inconsistencies that weren't previously evident. I suspect that type checking is loose in .../zoe/src/contracts or .../zoe/tests, but tighter in run-protocol. In any case, I cleaned up some type declarations in .../src/. I also added some
// @ts-ignore
comments in tests that were constructing parameter lists on the fly by destructuring objects.