-
Notifications
You must be signed in to change notification settings - Fork 5
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 market + remove code #18
Conversation
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 mergable :)
agoric/contract/src/kreadKit.js
Outdated
@@ -1055,15 +1079,21 @@ export const prepareKreadKit = async ( | |||
const platformFee = multiplyBy(want.Price, platformFeeRate); | |||
|
|||
const object = objectInSellSeat.value.payload[0][0]; | |||
const id = this.state.market.metrics.get('item').putForSaleAmount; |
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.
"amount" is a formal term in ERTP.
please rename to something about how this is is a serial counter. Also consider making clear that it's to be incremented at the end (that it's the count of items that have already been successfully listed for sale).
agoric/contract/src/kreadKit.js
Outdated
const claimedIdAndRecorder = await Promise.all( | ||
itemsToSell.map(async (copyBagEntry) => { | ||
const [_, itemSupply] = copyBagEntry; | ||
const array = Array.from(Array(Number(itemSupply)).keys()); |
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.
const array = Array.from(Array(Number(itemSupply)).keys()); | |
const itemIds = Array.from(Array(Number(itemSupply)).keys()); |
agoric/contract/src/kreadKit.js
Outdated
const [itemObject, itemSupply] = copyBagEntry; | ||
|
||
for (let n = 0; n < itemSupply; n++) { | ||
const [id, entryRecorder] = claimedIdAndRecorder.flat()[count]; |
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 confused why you need to flatten. You have nested loops over nested arrays.
Consider just iterating over the inner array in this inner loop
agoric/contract/src/kreadKit.js
Outdated
@@ -1198,6 +1253,9 @@ export const prepareKreadKit = async ( | |||
|
|||
const object = objectInSellSeat.value.payload[0][0]; | |||
|
|||
const entryRecorder = | |||
await marketFacet.makeMarketCharacterRecorderKit(object.name); |
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.
"object" is a type for almost anything in JS.
await marketFacet.makeMarketCharacterRecorderKit(object.name); | |
await marketFacet.makeMarketCharacterRecorderKit(item.name); |
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.
Thanks for the changes. Approving again :)
Refactor market storage node utilisation to use nested children and remove nodes after buying or offer exit
closes : #17