Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/feat/amoy'
Browse files Browse the repository at this point in the history
  • Loading branch information
cinnabarhorse committed Nov 11, 2024
2 parents dc7601d + fe2e114 commit 4779c85
Show file tree
Hide file tree
Showing 8 changed files with 111 additions and 8 deletions.
33 changes: 33 additions & 0 deletions .github/workflows/deploy-tags-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Deploy to Satsuma Service on testnet

on:
push:
tags:
- "test-*"

jobs:
buildAndDeploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Install node
uses: actions/setup-node@v1
with:
node-version: 16
- name: Install Yarn
run: npm i -g yarn
- name: Install Libs
run: yarn --frozen-lockfile
- name: Codegen
run: yarn codegen:testnet
- name: Build
run: yarn build:testnet
- name: Deploy to Satsuma on test
run: |
npx graph deploy aavegotchi-svg-amoy \
--deploy-key ${{secrets.SATSUMA_ACCESS_TOKEN}} \
--node https://subgraphs.alchemy.com/api/subgraphs/deploy \
--ipfs https://ipfs.satsuma.xyz \
--version-label ${GITHUB_REF#refs/*/} \
subgraph.testnet.yaml
shell: bash
32 changes: 32 additions & 0 deletions .github/workflows/deploy-tags.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Deploy to Satsuma Service

on:
push:
tags:
- "prod-*"

jobs:
buildAndDeploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Install node
uses: actions/setup-node@v1
with:
node-version: 16
- name: Install Yarn
run: npm i -g yarn
- name: Install Libs
run: yarn --frozen-lockfile
- name: Codegen
run: yarn codegen
- name: Build
run: yarn build
- name: Deploy to Satsuma
run: |
npx graph deploy aavegotchi-svg-matic \
--deploy-key ${{secrets.SATSUMA_ACCESS_TOKEN}} \
--node https://subgraphs.alchemy.com/api/subgraphs/deploy \
--ipfs https://ipfs.satsuma.xyz \
--version-label ${GITHUB_REF#refs/*/}
shell: bash
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
build/
generated/
node_modules/
yarn-error.log
yarn-error.log
.idea
7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
"scripts": {
"codegen": "graph codegen",
"build": "graph build",
"codegen:testnet": "graph codegen subgraph.testnet.yaml",
"build:testnet": "graph build subgraph.testnet.yaml",
"deploy": "graph deploy --node https://api.studio.thegraph.com/deploy/ aavegotchi-svgs-subgraph",
"prepare:polygon": "mustache config/polygon.json subgraph.template.yaml > subgraph.yaml",
"prepare:baseSepolia": "mustache config/baseSepolia.json subgraph.template.yaml > subgraph.yaml",
Expand All @@ -13,9 +15,8 @@
"deploy-local": "graph deploy --node http://localhost:8020/ --ipfs http://localhost:5001 aavegotchi-svgs-subgraph"
},
"dependencies": {
"@graphprotocol/graph-cli": "0.59.0",
"@graphprotocol/graph-cli": "0.60.0",
"@graphprotocol/graph-ts": "0.31.0",
"apollo-fetch": "^0.7.0",
"mustache": "^4.2.0"
"apollo-fetch": "^0.7.0"
}
}
6 changes: 6 additions & 0 deletions src/constants.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
import { BigInt } from "@graphprotocol/graph-ts";

// matic
export let BLOCK_SIDEVIEWS_ACTIVATED = BigInt.fromI32(39130900);
export const AAVEGOTCHI_DIAMOND = "0x86935F11C86623deC8a25696E1C19a8659CbF95d"

// amoy
// export let BLOCK_SIDEVIEWS_ACTIVATED = BigInt.fromI32(9672225);
// export const AAVEGOTCHI_DIAMOND = "0xC80DB01aeDAD5F6E3088c75F60E52f579Cf1D3Cb"
5 changes: 3 additions & 2 deletions src/helper.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import { Address, BigInt } from "@graphprotocol/graph-ts";
import { Contract } from "../generated/Contract/Contract";
import { Aavegotchi } from "../generated/schema";
import {AAVEGOTCHI_DIAMOND} from "./constants";

export function updateSvg(gotchi: BigInt): Aavegotchi | null {
let contract = Contract.bind(Address.fromString("0x86935F11C86623deC8a25696E1C19a8659CbF95d"))
let contract = Contract.bind(Address.fromString(AAVEGOTCHI_DIAMOND))
let svg = contract.try_getAavegotchiSvg(gotchi);
if(svg.reverted) {
return null; // just skip
Expand All @@ -15,7 +16,7 @@ export function updateSvg(gotchi: BigInt): Aavegotchi | null {
}

export function updateSideViews(gotchi: BigInt): Aavegotchi | null {
let contract = Contract.bind(Address.fromString("0x86935F11C86623deC8a25696E1C19a8659CbF95d"))
let contract = Contract.bind(Address.fromString(AAVEGOTCHI_DIAMOND))
let svgs = contract.try_getAavegotchiSideSvgs(gotchi);

if(svgs.reverted) {
Expand Down
29 changes: 29 additions & 0 deletions subgraph.testnet.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
specVersion: 0.0.4
schema:
file: ./schema.graphql
dataSources:
- kind: ethereum/contract
name: Contract
network: polygon-amoy
source:
address: "0xC80DB01aeDAD5F6E3088c75F60E52f579Cf1D3Cb"
abi: Contract
startBlock: 9668200
mapping:
kind: ethereum/events
apiVersion: 0.0.6
language: wasm/assemblyscript
entities:
- ClaimAavegotchi
- EquipWearables
abis:
- name: Contract
file: ./abis/Contract.json
eventHandlers:
- event: EquipWearables(indexed uint256,uint16[16],uint16[16])
handler: handleEquipWearables
- event: ClaimAavegotchi(indexed uint256)
handler: handleClaimAavegotchi
blockHandlers:
- handler: handleBlock
file: ./src/mapping.ts
4 changes: 2 additions & 2 deletions subgraph.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
specVersion: 0.0.2
specVersion: 0.0.4
schema:
file: ./schema.graphql
dataSources:
Expand All @@ -11,7 +11,7 @@ dataSources:
startBlock: 39130899
mapping:
kind: ethereum/events
apiVersion: 0.0.5
apiVersion: 0.0.6
language: wasm/assemblyscript
entities:
- ClaimAavegotchi
Expand Down

0 comments on commit 4779c85

Please sign in to comment.