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

Migration away from the hosted service #158

Merged
merged 35 commits into from
May 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
fab12ab
initial changes
mattt-w Aug 4, 2023
5c42cc2
remove ipfsOnEthereumContracts
Aug 4, 2023
36c370f
changes to yaml files
mattt-w Aug 4, 2023
cd6f63d
change to warn
Aug 4, 2023
e9094c6
add logs
mattt-w Aug 4, 2023
83972fa
use just ipfshash
mattt-w Aug 4, 2023
22945cb
add minting factory
mattt-w Aug 4, 2023
f864972
add export to handleMetaData
mattt-w Aug 4, 2023
63251eb
remove resaving of metadata
mattt-w Aug 7, 2023
068a5e6
update yarn lock
mattt-w Aug 7, 2023
2f788f4
mvoe to yarn install
mattt-w Aug 7, 2023
6cd37be
Uncapitilise install
mattt-w Aug 7, 2023
25cfbf9
yarn to npm
mattt-w Aug 7, 2023
1b28fdf
move artist metadata to toHexString method
mattt-w Aug 7, 2023
dfb9481
manipulate address json value
mattt-w Aug 7, 2023
7aa97c2
back to artist string
mattt-w Aug 7, 2023
cc4dda4
remove unused packages
mattt-w Aug 9, 2023
7d51218
fix workflow
mattt-w Aug 9, 2023
9d2199f
Update README.md
mattt-w Aug 14, 2023
8f33ac4
update package scripts
mattt-w Aug 14, 2023
de53c87
update package.json to fix tests
mattt-w Aug 17, 2023
3def51c
further fixes to tests
mattt-w Aug 17, 2023
4a1985f
Merge with upstream
jamesmorgan Aug 17, 2023
6215e73
Goerli migration to prod
jamesmorgan Sep 5, 2023
3784f1d
Adding subgraph URL
jamesmorgan Oct 2, 2023
69b9010
0.0.9 deployment
jamesmorgan May 13, 2024
e376d25
Adding immutable flags
jamesmorgan May 15, 2024
a96ad06
Deployments with immutable flags
jamesmorgan May 15, 2024
d9aea41
Deployments with immutable flags
jamesmorgan May 15, 2024
8b55d37
More deployments
jamesmorgan May 15, 2024
c46683c
More deployments
jamesmorgan May 16, 2024
d00d905
Move from ID to Bytes
mattt-w May 16, 2024
98b22d8
Failed deploy
jamesmorgan May 17, 2024
5908307
Revert ID change
jamesmorgan May 21, 2024
1c3c58f
Removing immutable flag
jamesmorgan May 22, 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
8 changes: 4 additions & 4 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
cache-name: cache-node-modules
with:
path: ~/.npm
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/yarn.lock') }}
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
Expand All @@ -35,13 +35,13 @@ jobs:
node-version: v16.13.1

- name: Install dependencies
run: yarn --frozen-lockfile
run: npm install

- name: Build subgraph.yaml for mainnet
run: yarn prep:mainnet
run: npm run prep:mainnet

- name: Run matchstick tests
run: yarn test
run: npm run test

# - name: Generate code coverage report
# run: yarn coverage
72 changes: 69 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,71 @@
# KnownOrigin.io Subgraph
# KnownOrigin.io Indexed Subgraph V2 (Graph Network)

See: https://thegraph.com/docs/en/deploying/subgraph-studio/#publish-your-subgraphs

### URIs

| Chain | Studio Link (requires auth) | Public URL|
|-----------------------|-----------------------------------------------------------|----|
| Mainnet | https://thegraph.com/studio/subgraph/known-origin/ | https://gateway.thegraph.com/api/[api-key]/subgraphs/id/CGZ1hQkiQXTyGLrAFH1yk3H8xPjBy6avbTB8rCLw9sJL ||
| Goerli | https://thegraph.com/studio/subgraph/known-origin-goerli/ | https://gateway.testnet.thegraph.com/api/[api-key]/subgraphs/id/CGZ1hQkiQXTyGLrAFH1yk3H8xPjBy6avbTB8rCLw9sJL ||

### Installing the Graph CLI

```bash
npm install -g @graphprotocol/graph-cli
```

### Authing with the CLI

To deploy any changes to a subgraph you must be authed with the specific deploy_key for that subgraph, ask a code owner for these keys before attempting to deploy.

```bash
graph auth --studio DEPLOY_KEY
```

### Dev cycle

**Requires Node 16 !**
```bash
nvm use
```

Install

```bash
npm install
```

Prepare subgraph.yaml for selected chain

```bash
npm run prep:mainnet || npm run prep:goerli
```

Codegen

```bash
npm run codegen
```

Build Subgraph

```bash
npm run build
```

Deploy the Subgraph

```bash
npm run deploy:mainnet || npm run deploy:goerli
```

Goerli Faucet for test GRT tokens

* https://discord.com/channels/438038660412342282/1001942596958048440


# KnownOrigin.io Hosted Subgraph (Deprecated)

### Graph UI

Expand All @@ -25,7 +92,6 @@ https://thegraph.com/hosted-service/subgraph/knownorigin/known-origin-goerli
| Production (mainnet) | https://thegraph.com/explorer/subgraph/knownorigin/known-origin ||
| Staging (mainnet) | https://thegraph.com/explorer/subgraph/knownorigin/known-origin-staging ||
| Development (goerli) | https://thegraph.com/hosted-service/subgraph/knownorigin/known-origin-goerli ||
| Development (rinkeby) | ~~https://thegraph.com/explorer/subgraph/knownorigin/knownoriginrinkeby~~ Deprecated ||
| Alpha Studio (mainnet) | https://thegraph.com/studio/subgraph/known-origin ||

### Built via
Expand Down Expand Up @@ -88,4 +154,4 @@ brew install postgresql

```
yarn test
```
```
25 changes: 12 additions & 13 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,26 @@
"scripts": {
"codegen": "graph codegen",
"build": "graph build",
"prep:mainnet": "mustache templates/mainnet.json subgraph.template.yaml > subgraph.yaml && yarn codegen;",
"deploy:mainnet": "yarn run prep:mainnet; graph deploy --debug --node https://api.thegraph.com/deploy/ --ipfs https://api.thegraph.com/ipfs/ knownorigin/known-origin",
"deploy:prod2": "yarn run prep:mainnet; graph deploy --debug --node https://api.thegraph.com/deploy/ --ipfs https://api.thegraph.com/ipfs/ knownorigin/knownoriginprod2",
"deploy:staging": "yarn run prep:mainnet; graph deploy --debug --node https://api.thegraph.com/deploy/ --ipfs https://api.thegraph.com/ipfs/ knownorigin/known-origin-staging",
"prep:rinkeby": "mustache templates/rinkeby.json subgraph.template.yaml > subgraph.yaml && yarn codegen;",
"deploy:rinkeby": "yarn run prep:rinkeby; graph deploy --debug --node https://api.thegraph.com/deploy/ --ipfs https://api.thegraph.com/ipfs/ knownorigin/knownoriginrinkeby",
"prep:goerli": "mustache templates/goerli.json subgraph.template.yaml > subgraph.yaml && yarn codegen;",
"deploy:goerli": "yarn run prep:goerli; graph deploy --product hosted-service knownorigin/known-origin-goerli",
"deploy:mainnet-studio": "yarn run prep:mainnet; graph deploy --studio known-origin",
"prep:mainnet": "mustache templates/mainnet.json subgraph.template.yaml > subgraph.yaml && graph codegen;",
"prep:goerli": "mustache templates/goerli.json subgraph.template.yaml > subgraph.yaml && graph codegen;",
"deploy:mainnet": "npm run prep:mainnet; graph deploy --studio known-origin",
"deploy:goerli": "npm run prep:goerli; graph deploy --studio known-origin-goerli",
"deploy:mainnet-hosted": "yarn run prep:mainnet; graph deploy --debug --node https://api.thegraph.com/deploy/ --ipfs https://api.thegraph.com/ipfs/ knownorigin/known-origin",
"deploy:prod2-hosted": "yarn run prep:mainnet; graph deploy --debug --node https://api.thegraph.com/deploy/ --ipfs https://api.thegraph.com/ipfs/ knownorigin/knownoriginprod2",
"deploy:staging-hosted": "yarn run prep:mainnet; graph deploy --debug --node https://api.thegraph.com/deploy/ --ipfs https://api.thegraph.com/ipfs/ knownorigin/known-origin-staging",
"deploy:goerli-hosted": "yarn run prep:goerli; graph deploy --product hosted-service knownorigin/known-origin-goerli",
"create-local": "graph create --node http://localhost:8020/ knownorigin/known-origin",
"remove-local": "graph remove --node http://localhost:8020/ knownorigin/known-origin",
"deploy-local": "graph deploy --node http://localhost:8020/ --ipfs http://localhost:5001 knownorigin/known-origin",
"test": "graph test",
"test-docker": "graph test --docker"
},
"dependencies": {
"@graphprotocol/graph-cli": "0.30.4",
"@graphprotocol/graph-ts": "0.27.0",
"mustache": "^4.2.0"
"@graphprotocol/graph-cli": "0.55.0",
"@graphprotocol/graph-ts": "0.31.0",
"mustache": "4.2.0"
},
"devDependencies": {
"matchstick-as": "0.5.1"
"matchstick-as": "0.5.2"
}
}
14 changes: 7 additions & 7 deletions schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

# Generic activity stream events for history of actions including primary and secondary sales actions & triggers
# Used for listing out token history on the token pages
type TokenEvent @entity {
type TokenEvent @entity(immutable: true) {
id: ID! # Composite key made form multiple items
version: BigInt! # KODA 2 or 3
name: String!
Expand All @@ -28,7 +28,7 @@ type TokenEvent @entity {
}

# Token events for transfers
type TransferEvent @entity {
type TransferEvent @entity(immutable: true) {
id: ID!
version: BigInt! # KODA 2 or 3
from: Bytes! # address
Expand All @@ -48,7 +48,7 @@ type TransferEvent @entity {
}

# Edition primary sale auction events
type AuctionEvent @entity {
type AuctionEvent @entity(immutable: true) {
id: ID!
version: BigInt! # KODA 2 or 3
edition: Edition!
Expand All @@ -70,7 +70,7 @@ type AuctionEvent @entity {
}

# Common unified event stream spanning KODA versions and various types
type ActivityEvent @entity {
type ActivityEvent @entity(immutable: true) {
id: ID!
type: String! # Token, Edition or Creator Contract
version: BigInt! # KODA 2 or 3
Expand Down Expand Up @@ -305,7 +305,7 @@ type Composable @entity {
}

# ComposableItem represents one token attached to a composable
type ComposableItem @entity {
type ComposableItem @entity {
id: ID! # ID made up of combined tokenID/composing contract/composing IDs
address: String! # Address of the ERC20/ERC721 token
tokenID: String! # ID of the token
Expand Down Expand Up @@ -443,7 +443,7 @@ type Edition @entity {
}

# A token/editions and its meta data
type MetaData @entity {
type MetaData @entity(immutable: true) {
id: ID!
name: String
description: String
Expand Down Expand Up @@ -474,7 +474,7 @@ type MetaData @entity {
}

# Single high level entity capturing the top offer on the secondary marketplace
type TokenOffer @entity {
type TokenOffer @entity(immutable: true) {
id: ID!
version: BigInt! # KODA 2 or 3
token: Token!
Expand Down
3 changes: 0 additions & 3 deletions src/services/Edition.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,6 @@ export function loadOrCreateV2Edition(editionNumber: BigInt, block: ethereum.Blo
let metaData = constructMetaData(editionNumber.toString(), _editionData.value7)

if (metaData != null) {
metaData.save()
editionEntity.metadata = metaData.id

editionEntity.metadataName = metaData.name ? metaData.name as string : ''
Expand Down Expand Up @@ -249,7 +248,6 @@ function buildEdition(_editionId: BigInt, _originalCreator: Address, _size: BigI

let metaData = constructMetaData(_editionId.toString(), _uri)
if (metaData != null) {
metaData.save()
editionEntity.metadata = metaData.id
editionEntity.metadataFormat = metaData.format
editionEntity.metadataTheme = metaData.theme
Expand Down Expand Up @@ -324,7 +322,6 @@ function buildV4Edition(_editionId: BigInt, _originalCreator: Address, _size: Bi
export function populateEditionMetadata(editionEntity: Edition, _editionId: string, _uri: string): void {
let metaData = constructMetaData(_editionId, _uri)
if (metaData != null) {
metaData.save()
editionEntity.metadata = metaData.id
editionEntity.metadataFormat = metaData.format
editionEntity.metadataTheme = metaData.theme
Expand Down
Loading
Loading