|
| 1 | +type Platform @entity { |
| 2 | + id: ID! |
| 3 | + address: Bytes! |
| 4 | + totalSale: BigInt |
| 5 | + totalSaleInWei: BigInt |
| 6 | + platformFirstSalePercentage: BigInt |
| 7 | + platformSecondSalePercentage: BigInt |
| 8 | + artistSecondSalePercentage: BigInt |
| 9 | + lastModifiedTimestamp: BigInt |
| 10 | +} |
| 11 | + |
| 12 | +# TYPE @Master |
| 13 | +# Master image with id of `tokenId` |
| 14 | +# Contains layers (ControlTokens) of type `Layer` (see below) |
| 15 | +type Master @entity { |
| 16 | + id: ID! # unique `tokenId` |
| 17 | + uri: String! |
| 18 | + layerCount: Int! |
| 19 | + layers: [Layer!]! @derivedFrom(field: "master") |
| 20 | + creators: [Bytes!]! |
| 21 | + owner: Bytes! |
| 22 | + pastOwners: [Bytes!]! # inclusive of current owner |
| 23 | + highBid: BidLog @derivedFrom(field: "master") |
| 24 | + pastBids: [BidLog!] @derivedFrom(field: "master") |
| 25 | + lastUpdated: BigInt # unix timestamp |
| 26 | + pastUpdates: [BigInt!] # unix timestamp |
| 27 | + lastTransfer: TransferLog @derivedFrom(field: "master") |
| 28 | + pastTransfers: [TransferLog!] @derivedFrom(field: "master") |
| 29 | + buyNowPriceInWei: BigInt |
| 30 | +} |
| 31 | + |
| 32 | +# TYPE @Layer |
| 33 | +# Represents the `ControlToken` |
| 34 | +# Lives on a unique `Master` |
| 35 | +# Contains lever(s) of type `Lever` |
| 36 | +type Layer @entity { |
| 37 | + id: ID! # unique `tokenId` |
| 38 | + uri: String |
| 39 | + numLevers: Int |
| 40 | + levers: [Lever]! @derivedFrom(field: "layer") |
| 41 | + owner: Bytes! |
| 42 | + creators: [Bytes!]! |
| 43 | + pastOwners: [Bytes!]! # inclusive of current owner |
| 44 | + highBid: BidLog @derivedFrom(field: "layer") |
| 45 | + pastBids: [BidLog!] @derivedFrom(field: "layer") |
| 46 | + lastUpdate: BigInt # unix timestamp |
| 47 | + pastUpdates: [BigInt!] |
| 48 | + lastTransfer: TransferLog @derivedFrom(field: "layer") |
| 49 | + pastTransfers: [TransferLog!] @derivedFrom(field: "layer") |
| 50 | + buyNowPriceInWei: BigInt |
| 51 | + master: Master |
| 52 | +} |
| 53 | + |
| 54 | +# TYPE @Lever |
| 55 | +# Represents the state of a `ControlToken` |
| 56 | +# Lives on a unique `Layer` |
| 57 | +# Contains a list of values which map to `Layer` states |
| 58 | +type Lever @entity { |
| 59 | + id: ID! # unique `tokenId` + lever index ? TODO |
| 60 | + minValue: Int! |
| 61 | + maxValue: Int! |
| 62 | + currentValue: Int! |
| 63 | + layer: Layer |
| 64 | +} |
| 65 | + |
| 66 | +type Account @entity { |
| 67 | + id: ID! |
| 68 | + address: Bytes! |
| 69 | + isCreator: Boolean |
| 70 | + lastModifiedTimestamp: BigInt! |
| 71 | + bids: [BidLog!]! # @derivedFrom(field: "bidder") |
| 72 | + createdMasters: [Master]! |
| 73 | + createdLayers: [Layer]! |
| 74 | + ownedMasters: [Master]! |
| 75 | + ownedLayer: [Layer]! |
| 76 | +} |
| 77 | + |
| 78 | +type SaleLog @entity { |
| 79 | + id: ID! |
| 80 | + timestamp: BigInt! |
| 81 | + tokenId: BigInt! |
| 82 | + isMaster: Boolean! |
| 83 | + isLayer: Boolean! |
| 84 | + amountInWei: BigInt! |
| 85 | + buyer: Account! |
| 86 | + seller: Account! |
| 87 | +} |
| 88 | + |
| 89 | +type BidLog @entity { |
| 90 | + id: ID! |
| 91 | + timestamp: BigInt! |
| 92 | + master: Master |
| 93 | + layer: Layer |
| 94 | + amountInWei: BigInt! |
| 95 | + bidder: Bytes! |
| 96 | + isWithdrawn: Boolean! # whether or not the bid has been withdrawn |
| 97 | + withdrawnTimestamp: BigInt |
| 98 | +} |
| 99 | + |
| 100 | +type TransferLog @entity { |
| 101 | + id: ID! |
| 102 | + timestamp: BigInt! |
| 103 | + tokenId: String! |
| 104 | + from: Bytes! |
| 105 | + to: Bytes! |
| 106 | + master: Master |
| 107 | + layer: Layer |
| 108 | +} |
0 commit comments