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

Feat/Flippers-for-collection-activity #35

Closed

Conversation

daiagi
Copy link
Contributor

@daiagi daiagi commented Jul 11, 2023

enabling query for flippers in colllection activity
@vikiival

schema.graphql Outdated Show resolved Hide resolved
Comment on lines +29 to +39

type FlipEvent @entity {
id: ID!
flipper: FlipperEntity!
nft: NFTEntity!
soldPrice: BigInt
soldTo: String
sellTimestamp: DateTime
boughtPrice: BigInt!
profit: BigInt
}
Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

  1. afaik we don't have initial and closing prices. that will fit more into a trading system with candles
  2. anyway, this is not the info I'm looking to capture, I am looking to capture flip events for collection activity

Copy link
Member

Choose a reason for hiding this comment

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

Is this some common good pattern or?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

not sure what you mean
i just find it convenient to wrap it inside a class
can be done otherwise as well obv

Copy link
Member

Choose a reason for hiding this comment

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

i just find it convenient to wrap it inside a class

Like I am writing is as functions, but maybe is more my approach to thing

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I usually wrote function as well
I have 0 problem changing to function if that's the preferd style

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

src/mappings/shared/flipperEventHandler.ts Outdated Show resolved Hide resolved
return
}

const previousFlipEvent = previousFlipper.flips.find((flip) => flip.nft.id === nft.id)
Copy link
Member

Choose a reason for hiding this comment

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

wut why

we-dont-do-that-here-black-panther

Copy link
Contributor Author

Choose a reason for hiding this comment

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

What is the issue?

I am looking for the previous time this (current event) nft has been bought
if it has been bought before, then we are now dealing with a flip
otherwise, it is first time purchase, and the function handlePreviousOwner returns because the previous owner got the nft somehow (minting sending, whatever), but they didn't buy it => not a flip

Copy link
Member

Choose a reason for hiding this comment

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

What is the issue?

That iterating over array in javascript would be always slower than reading from DB. If the flips would have 10k items my bet is that processor would be slow and die 🤷

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I understand.
I'll query the db instead

👌👌

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@vikiival please have a look again sir

@daiagi daiagi requested a review from vikiival July 23, 2023 12:35
@yangwao
Copy link
Member

yangwao commented Sep 6, 2023

image
cc @vikiival 👀

@vikiival
Copy link
Member

vikiival commented Sep 6, 2023

image

cc @vikiival 👀

@daiagi you are missing a db migration

@daiagi
Copy link
Contributor Author

daiagi commented Sep 14, 2023

@daiagi you are missing a db migration
tbh I am unsure how to generate the appropriate migration

@vikiival

@vikiival
Copy link
Member

Spin indexer

just upd

apply migrations

just reset

Create new

just update-db

@daiagi
Copy link
Contributor Author

daiagi commented Sep 14, 2023

@vikiival check again, please. i've added migartion

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.

3 participants