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

Pod Marketplace Subgraph + UI Fixes #952

Merged
merged 94 commits into from
Jul 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
94 commits
Select commit Hold shift + click to select a range
3b3c051
add mock events
soilking May 11, 2024
24f7f72
more mock marketplace events
soilking May 11, 2024
fd4981f
pod listing created test
soilking May 13, 2024
23911e5
assert market state and index fix
soilking May 13, 2024
966d6a3
fix listing cancellation amount
soilking May 13, 2024
f43cee3
pod fill tests
soilking May 14, 2024
492cdee
pod listing cancel test
soilking May 14, 2024
6a27d5c
set partial cancellation status
soilking May 14, 2024
bffdde5
create order test
soilking May 14, 2024
dc2be1b
Fill order test
soilking May 14, 2024
75b3af4
fix order fill not removing order
soilking May 14, 2024
8ae795a
cancel order test
soilking May 14, 2024
06db416
partial order fill test
soilking May 14, 2024
276db85
partial order cancellation test
soilking May 14, 2024
81b5672
re-order pods test
soilking May 14, 2024
4736e13
refactor market order state to use beanAmount rather than podAmount
soilking May 14, 2024
63cd64d
entirely remove podAmount
soilking May 14, 2024
a32ac55
specify if pod order is new or relisted
soilking May 14, 2024
a11dfa5
Merge master to sk/fix/pod-market
soilking May 14, 2024
1207460
Revert "specify if pod order is new or relisted"
soilking May 14, 2024
42a422b
recreate order fix
soilking May 14, 2024
d29549a
relist pod test
soilking May 14, 2024
78836ca
marketplace test refactor
soilking May 14, 2024
1b22ac3
refactor shared test methods
soilking May 14, 2024
d44eac8
change reference to mockBeanstalkEvent
soilking May 14, 2024
a5979bf
listing expiry test and fixes
soilking May 14, 2024
a5dabf5
minor refactor and notes
soilking May 15, 2024
9cef39a
refactor stored listing/order format
soilking May 15, 2024
433e751
fix expire on exceed max harvestable
soilking May 15, 2024
206190d
expand moving podline test
soilking May 15, 2024
d569484
harvest listed plot test
soilking May 15, 2024
6accc87
Fix expire listing on harvest
soilking May 15, 2024
b2941d9
add expiredOrderBeans field
soilking May 15, 2024
63f9f9f
add availableOrderBeans field
soilking May 15, 2024
af85ecc
refactor remainingAmount to contain the amount in a plot at cancellat…
soilking May 15, 2024
96d0956
fix cancel nonexisting listing/order
soilking May 15, 2024
354679e
refactor - orders dont expire
soilking May 15, 2024
662d858
remove unnecessary test
soilking May 15, 2024
c57b3d0
add mock events for v1
soilking May 15, 2024
81fa503
add market v1 tests
soilking May 15, 2024
5e92987
generalized listing fill
soilking May 15, 2024
ac3edb2
generalize pod order fill handler
soilking May 15, 2024
3c6a6b7
generalize pod order create handler
soilking May 15, 2024
5411d15
generalize pod listing create handler
soilking May 16, 2024
39197d4
update comment
soilking May 16, 2024
d4ae609
add fields and method for current harvestable index
soilking May 16, 2024
9130e98
set place in line on market txn
soilking May 16, 2024
a667536
test pod events tracking place in line
soilking May 16, 2024
dd471f5
reorder transfer
soilking May 16, 2024
90337aa
plot source tests
soilking May 16, 2024
65c8d9e
sow and plot source test
soilking May 16, 2024
ae3af6e
set beans per pod after market fill
soilking May 16, 2024
cea6a46
market transfer middle test
soilking May 17, 2024
79bdb2f
market transfer tests
soilking May 17, 2024
830a972
minimal changes to accommodate new schema
soilking May 21, 2024
31f2930
Merge master to sk/fix/pod-market
soilking May 21, 2024
3d15a59
Update listing/order fetch size
soilking May 21, 2024
176e205
increase pod price precision
soilking May 21, 2024
c44423f
use verbose id
soilking May 21, 2024
0e0f0d3
bump subgraph version
soilking May 21, 2024
e2db68c
add log index into history id
soilking May 21, 2024
f6ef05b
update test
soilking May 21, 2024
d394f3f
fix basin test
soilking May 21, 2024
d0f2f60
Merge branch 'master' into sk/fix/pod-market2
soilking Jun 27, 2024
e49b45e
Remove deprecated test and bump version
soilking Jun 27, 2024
c78c801
update codegen
soilking Jun 27, 2024
0e5446e
use placeInLine
uncoolzero Jul 3, 2024
e6fadb7
update pod listings/orders queries
uncoolzero Jul 4, 2024
ec8f59c
remove fetchMoreData
uncoolzero Jul 4, 2024
53cc612
update marketevents query
uncoolzero Jul 4, 2024
c56097b
updateActivityData now fetches all market events
uncoolzero Jul 4, 2024
257a0c1
update table spacings
uncoolzero Jul 4, 2024
26b1324
fix broken forms
uncoolzero Jul 4, 2024
f08a363
update chart tooltip
uncoolzero Jul 4, 2024
9e42ead
fix pod amount on orders
uncoolzero Jul 4, 2024
9878b79
rename cancelled_partial column
uncoolzero Jul 4, 2024
4835ad9
mark orders >99.99% filled as filled
uncoolzero Jul 5, 2024
7583ce8
update allPodListings/allPodOrders queries
uncoolzero Jul 6, 2024
bb6de55
add support for more than 1000 listings/orders
uncoolzero Jul 6, 2024
a446674
fix issue on first load
uncoolzero Jul 6, 2024
680b6fe
fix error on successfull pod order fill
uncoolzero Jul 7, 2024
e1bc8f0
fix dust pods on pod order fill
uncoolzero Jul 7, 2024
64e80cc
fix dust pods on pod listing fill
uncoolzero Jul 8, 2024
8a11c14
fix css errors
uncoolzero Jul 9, 2024
5cc483f
fix css warning message
uncoolzero Jul 9, 2024
16d3843
update error message parsing
uncoolzero Jul 9, 2024
06e5aee
simplify
uncoolzero Jul 9, 2024
4f6a41f
Merge branch 'master' into sk/fix/pod-market2
soilking Jul 9, 2024
7364865
fix build
uncoolzero Jul 9, 2024
f4f1a6c
fix market activity table values
uncoolzero Jul 10, 2024
422b04d
fix values of pod order creation events
uncoolzero Jul 10, 2024
06aa623
fix pod amount on pod order cancellations
uncoolzero Jul 10, 2024
2330778
comment on 43
soilking Jul 15, 2024
9759b3e
Merge branch 'master' into sk/fix/pod-market2
soilking Jul 15, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion projects/subgraph-beanft/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"codegen": "rm -rf ./generated && graph codegen",
"build": "yarn codegen && graph build",
"test": "graph test",
"testd": "docker run -it --rm --mount type=bind,source=\"$(pwd)\"/matchstick.yaml.docker,target=/matchstick/matchstick.yaml --mount type=bind,source=\"$(pwd)\"/../../,target=/matchstick/repo-mounted/ matchstick",
"testd": "docker run -it --rm --mount type=bind,source=\"$(pwd)\"/matchstick-docker.yaml,target=/matchstick/matchstick.yaml --mount type=bind,source=\"$(pwd)\"/../../,target=/matchstick/repo-mounted/ matchstick",
"testd-named": "../subgraph-core/tests/scripts/docker-run-named.sh",
"create-local": "graph create --node http://localhost:8020/ beanft",
"remove-local": "graph remove --node http://localhost:8020/ beanft",
Expand Down
160 changes: 84 additions & 76 deletions projects/subgraph-beanstalk/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ enum MarketStatus {

enum PlotSource {
SOW
HARVEST
TRANSFER
MARKET
}

enum EmaWindow {
Expand Down Expand Up @@ -669,28 +669,28 @@ type Plot @entity {
field: Field!
"Farmer who owns this plot"
farmer: Farmer!
"Transaction source for this plot"
"Transaction source for this plot. Not the same as creationHash which can include plots splitting from transfer or harvest without the owner changing"
source: PlotSource!
"Transaction hash corresponding to source"
sourceHash: String!
"Associated plot listing"
listing: PodListing
"Season when created"
season: Int!
"Creation transaction hash"
"Transaction hash of when this plot entity was created"
creationHash: String!
"Timestamp of creation"
createdAt: BigInt!
"Timestamp when updated"
updatedAt: BigInt!
"Block when updated"
updatedAtBlock: BigInt!
"Plot Index"
index: BigInt!
"Beans used to sow, if any"
beans: BigInt!
"Total pods in plot"
pods: BigInt!
"Total pods that were sown, if any"
sownPods: BigInt!
"Temperature when the plot was sown"
temperature: Int!
"Number of beans spent for each pod, whether through sowing or on the marketplace"
beansPerPod: BigInt!
"Number of pods harvestable"
harvestablePods: BigInt!
"Number of pods harvested"
Expand All @@ -704,10 +704,10 @@ type PodMarketplace @entity {
id: ID!
"Current season of the marketplace"
season: Int!
"Indexes of actively listed plots"
listingIndexes: [BigInt!]!
"Active pod order IDs"
orders: [PodOrder!]!
"Information about the active pod listings. Each entry of the form 'account-index-expiry'"
activeListings: [String!]!
"Information about the active pod orders. Each entry of the form 'orderId-maxPlaceInLine'"
activeOrders: [String!]!
"All historical listings"
allListings: [PodListing!]! @derivedFrom(field: "podMarketplace")
"All historical orders"
Expand All @@ -716,20 +716,24 @@ type PodMarketplace @entity {
fills: [PodFill!]! @derivedFrom(field: "podMarketplace")
"Current cumulative pods listed for sale"
listedPods: BigInt!
"Current amount of total pods listed"
availableListedPods: BigInt!
"Current cumulative pod listings filled"
filledListedPods: BigInt!
"Current cumulative pod listings that expired"
expiredListedPods: BigInt!
"Current cumulative pod listings that were cancelled"
cancelledListedPods: BigInt!
"Current amount of total pods listed"
availableListedPods: BigInt!
"Current cumulative pod orders created"
orderedPods: BigInt!
"Current cumulative beans in pod orders created"
orderBeans: BigInt!
"Current amount of total beans in pod orders"
availableOrderBeans: BigInt!
"Current cumulative filled beans in pod orders"
filledOrderBeans: BigInt!
"Current cumulative pod orders filled"
filledOrderedPods: BigInt!
"Current cumulative pod orders cancelled"
cancelledOrderedPods: BigInt!
"Current cumulative beans in pod orders cancelled"
cancelledOrderBeans: BigInt!
"Cumulative pod volume between listings and orders"
podVolume: BigInt!
"Cumulative bean volume between listings and orders"
Expand All @@ -749,40 +753,48 @@ type PodMarketplaceHourlySnapshot @entity {
podMarketplace: PodMarketplace!
"Point in time current cumulative pods listed for sale"
listedPods: BigInt!
"Point in time current amount of total pods listed"
availableListedPods: BigInt!
"Point in time current cumulative pod listings filled"
filledListedPods: BigInt!
"Point in time current cumulative pod listings that expired"
expiredListedPods: BigInt!
"Point in time current cumulative pod listings that were cancelled"
cancelledListedPods: BigInt!
"Point in time current amount of total pods listed"
availableListedPods: BigInt!
"Point in time current cumulative pod orders created"
orderedPods: BigInt!
"Point in time current cumulative pod orders filled"
"Current cumulative beans in pod orders created"
orderBeans: BigInt!
"Current amount of total beans in pod orders"
availableOrderBeans: BigInt!
"Current cumulative filled beans in pod orders"
filledOrderBeans: BigInt!
"Current cumulative pod orders filled"
filledOrderedPods: BigInt!
"Point in time current cumulative pod orders cancelled"
cancelledOrderedPods: BigInt!
"Current cumulative beans in pod orders cancelled"
cancelledOrderBeans: BigInt!
"Point in time current cumulative pod volume between listings and orders"
podVolume: BigInt!
"Point in time current cumulative bean volume between listings and orders"
beanVolume: BigInt!
"Point in time current delta pods listed for sale"
deltaListedPods: BigInt!
"Point in time current delta of total pods listed"
deltaAvailableListedPods: BigInt!
"Point in time current delta pod listings filled"
deltaFilledListedPods: BigInt!
"Point in time current delta pod listings that expired"
deltaExpiredListedPods: BigInt!
"Point in time current delta pod listings that were cancelled"
deltaCancelledListedPods: BigInt!
"Point in time current delta of total pods listed"
deltaAvailableListedPods: BigInt!
"Point in time current delta pod orders created"
deltaOrderedPods: BigInt!
"Point in time current delta ordered beans in pod orders created"
deltaOrderBeans: BigInt!
"Point in time current delta available ordered beans in pod orders"
deltaAvailableOrderBeans: BigInt!
"Point in time current delta filled ordered beans in pod orders"
deltaFilledOrderBeans: BigInt!
"Point in time current delta pod orders filled"
deltaFilledOrderedPods: BigInt!
"Point in time current delta pod orders cancelled"
deltaCancelledOrderedPods: BigInt!
"Point in time current delta cancelled ordered beans in pod orders"
deltaCancelledOrderBeans: BigInt!
"Point in time current delta pod volume between listings and orders"
deltaPodVolume: BigInt!
"Point in time current delta bean volume between listings and orders"
Expand All @@ -802,40 +814,48 @@ type PodMarketplaceDailySnapshot @entity {
podMarketplace: PodMarketplace!
"Point in time current cumulative pods listed for sale"
listedPods: BigInt!
"Point in time current amount of total pods listed"
availableListedPods: BigInt!
"Point in time current cumulative pod listings filled"
filledListedPods: BigInt!
"Point in time current cumulative pod listings that expired"
expiredListedPods: BigInt!
"Point in time current cumulative pod listings that were cancelled"
cancelledListedPods: BigInt!
"Point in time current amount of total pods listed"
availableListedPods: BigInt!
"Point in time current cumulative pod orders created"
orderedPods: BigInt!
"Point in time current cumulative pod orders filled"
"Current cumulative beans in pod orders created"
orderBeans: BigInt!
"Current amount of total beans in pod orders"
availableOrderBeans: BigInt!
"Current cumulative filled beans in pod orders"
filledOrderBeans: BigInt!
"Current cumulative pod orders filled"
filledOrderedPods: BigInt!
"Point in time current cumulative pod orders cancelled"
cancelledOrderedPods: BigInt!
"Current cumulative beans in pod orders cancelled"
cancelledOrderBeans: BigInt!
"Point in time current cumulative pod volume between listings and orders"
podVolume: BigInt!
"Point in time current cumulative bean volume between listings and orders"
beanVolume: BigInt!
"Point in time current delta pods listed for sale"
deltaListedPods: BigInt!
"Point in time current delta of total pods listed"
deltaAvailableListedPods: BigInt!
"Point in time current delta pod listings filled"
deltaFilledListedPods: BigInt!
"Point in time current delta pod listings that expired"
deltaExpiredListedPods: BigInt!
"Point in time current delta pod listings that were cancelled"
deltaCancelledListedPods: BigInt!
"Point in time current delta of total pods listed"
deltaAvailableListedPods: BigInt!
"Point in time current delta pod orders created"
deltaOrderedPods: BigInt!
"Point in time current delta ordered beans in pod orders created"
deltaOrderBeans: BigInt!
"Point in time current delta available ordered beans in pod orders"
deltaAvailableOrderBeans: BigInt!
"Point in time current delta filled ordered beans in pod orders"
deltaFilledOrderBeans: BigInt!
"Point in time current delta pod orders filled"
deltaFilledOrderedPods: BigInt!
"Point in time current delta pod orders cancelled"
deltaCancelledOrderedPods: BigInt!
"Point in time current delta cancelled ordered beans in pod orders"
deltaCancelledOrderBeans: BigInt!
"Point in time current delta pod volume between listings and orders"
deltaPodVolume: BigInt!
"Point in time current delta bean volume between listings and orders"
Expand Down Expand Up @@ -981,11 +1001,6 @@ type PodListing @entity {
"""
filledAmount: BigInt!

"""
The number of Pods that were remaining in *this* PodListing when it was Cancelled.
"""
cancelledAmount: BigInt!

######################## Activity ########################

"Any Fills associated with this PodListing."
Expand Down Expand Up @@ -1072,21 +1087,16 @@ type PodOrder @entity {
######################## Amounts ########################

"""
The original number of Pods requested by this PodOrder.
The original number of Beans locked in the PodOrder.

Does NOT change as Fills occur.
Not deterministic for PodOrders with pricingType = DYNAMIC.

If pricingType = FIXED:
Set to the number of Pods which can be purchased by the Order.
If FIXED (V1): `amount` field emitted in PodOrderCreated.
If FIXED (V2): `amount / pricePerPod` fields emitted in PodOrderCreated.
Always deterministic, since the Farmer must lock Beans for PodOrder fulfillment.

If pricingType = DYNAMIC:
Set to `0`. The number of Pods that will be provided is unknown, since
the price is calculated based on the place in line of supplied Pods.
If FIXED (V1): `amount * pricePerPod` fields emitted in PodOrderCreated.
If FIXED (V2): `amount` field emitted in PodOrderCreated.
If DYNAMIC (V2): `amount` field emitted in PodOrderCreated.
"""
podAmount: BigInt!
beanAmount: BigInt!

"""
The current number of Pods that have been purchased by this PodOrder.
Expand All @@ -1099,18 +1109,6 @@ type PodOrder @entity {
"""
podAmountFilled: BigInt!

"""
The original number of Beans locked in the PodOrder.

Does NOT change as Fills occur.
Always deterministic, since the Farmer must lock Beans for PodOrder fulfillment.

If FIXED (V1): `amount * pricePerPod` fields emitted in PodOrderCreated.
If FIXED (V2): `amount` field emitted in PodOrderCreated.
If DYNAMIC (V2): `amount` field emitted in PodOrderCreated.
"""
beanAmount: BigInt!

"""
The current number of Beans spent to acquire Pods.

Expand Down Expand Up @@ -1152,18 +1150,20 @@ type PodFill @entity {
listing: PodListing
"Associated order, if any"
order: PodOrder
"Account fulfilling the order"
"Account that is sending pods"
from: String! # These are already referenced via the listing and order entities.
"Account filling the order"
"Account that is receiving pods"
to: Farmer!
"Number of pods filled"
amount: BigInt!
"Where these pods were in line when filled"
placeInLine: BigInt!
"Index of plot transferred"
index: BigInt!
"Start of plot transferred"
start: BigInt!
"Total beans used to fill listing/order"
costInBeans: BigInt
costInBeans: BigInt!
}

##################################
Expand Down Expand Up @@ -1548,6 +1548,8 @@ type PodListingCreated implements MarketplaceEvent @entity(immutable: true) {
historyID: String!
" Account creating the listing"
account: String!
"Where these pods were in line when listed"
placeInLine: BigInt!
" Index of the plot listed"
index: BigInt!
" Start value of the plot listed "
Expand Down Expand Up @@ -1587,6 +1589,8 @@ type PodListingFilled implements MarketplaceEvent @entity(immutable: true) {
from: String!
"Account buying pods"
to: String!
"Where these pods were in line when filled"
placeInLine: BigInt!
"Index of the plot transferred"
index: BigInt!
"Start of the plot transferred"
Expand Down Expand Up @@ -1614,6 +1618,8 @@ type PodListingCancelled implements MarketplaceEvent @entity(immutable: true) {
historyID: String!
" Account cancelling listing"
account: String!
"Where these pods were in line when cancelled"
placeInLine: BigInt!
" Index of plot listing being cancelled"
index: BigInt!
" Block number of this event "
Expand Down Expand Up @@ -1672,6 +1678,8 @@ type PodOrderFilled implements MarketplaceEvent @entity(immutable: true) {
from: String!
"Account buying pods"
to: String!
"Where these pods were in line when filled"
placeInLine: BigInt!
"Index of the plot transferred"
index: BigInt!
"Start of the plot transferred"
Expand Down
Loading
Loading