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

refactor market + remove code #18

Merged
merged 3 commits into from
Sep 22, 2023
Merged

Conversation

WietzeSlagman
Copy link
Collaborator

Refactor market storage node utilisation to use nested children and remove nodes after buying or offer exit
closes : #17

Copy link
Contributor

@turadg turadg left a comment

Choose a reason for hiding this comment

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

Looks mergable :)

@@ -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;
Copy link
Contributor

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).

const claimedIdAndRecorder = await Promise.all(
itemsToSell.map(async (copyBagEntry) => {
const [_, itemSupply] = copyBagEntry;
const array = Array.from(Array(Number(itemSupply)).keys());
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
const array = Array.from(Array(Number(itemSupply)).keys());
const itemIds = Array.from(Array(Number(itemSupply)).keys());

const [itemObject, itemSupply] = copyBagEntry;

for (let n = 0; n < itemSupply; n++) {
const [id, entryRecorder] = claimedIdAndRecorder.flat()[count];
Copy link
Contributor

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

@@ -1198,6 +1253,9 @@ export const prepareKreadKit = async (

const object = objectInSellSeat.value.payload[0][0];

const entryRecorder =
await marketFacet.makeMarketCharacterRecorderKit(object.name);
Copy link
Contributor

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.

Suggested change
await marketFacet.makeMarketCharacterRecorderKit(object.name);
await marketFacet.makeMarketCharacterRecorderKit(item.name);

Copy link
Contributor

@turadg turadg left a 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 :)

@WietzeSlagman WietzeSlagman merged commit c3f7215 into develop Sep 22, 2023
@MangoDream1 MangoDream1 deleted the launch/market-refactor branch October 9, 2023 13:11
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.

storage node per marketItem
2 participants