sales.gno
0.53 Kb · 23 lines
1package gnogle_market2
2
3import "chain/runtime"
4
5// Sale is one settled trade, kept in a bounded on-chain history.
6type Sale struct {
7 collID string
8 tokenID string
9 from address
10 to address
11 price int64
12 kind string // "buy" | "offer" | "auction"
13 height int64
14}
15
16var sales []*Sale
17
18func recordSale(collID, tokenID string, from, to address, price int64, kind string) {
19 sales = append(sales, &Sale{collID, tokenID, from, to, price, kind, runtime.ChainHeight()})
20 if len(sales) > 200 {
21 sales = sales[len(sales)-200:]
22 }
23}