Skip to content

Commit

Permalink
chore: add in vars
Browse files Browse the repository at this point in the history
  • Loading branch information
cinnabarhorse committed Nov 11, 2024
1 parent 4779c85 commit 947bbfc
Show file tree
Hide file tree
Showing 8 changed files with 45 additions and 99 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/deploy-alchemy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,12 @@ jobs:
- name: Build
run: yarn build

- name: Export Vars
run: |
NETWORK=${{ steps.extract-network.outputs.NETWORK }}
AAVEGOTCHI_DIAMOND=$(node -e "console.log(require('./config/$NETWORK.json').contracts.diamond)")
echo "AAVEGOTCHI_DIAMOND=$AAVEGOTCHI_DIAMOND" >> $GITHUB_OUTPUT
- name: Deploy to Alchemy
env:
SUBGRAPH_NAME: aavegotchi-svg-${{ steps.extract-network.outputs.NETWORK }}
Expand Down
33 changes: 0 additions & 33 deletions .github/workflows/deploy-tags-test.yml

This file was deleted.

32 changes: 0 additions & 32 deletions .github/workflows/deploy-tags.yml

This file was deleted.

6 changes: 6 additions & 0 deletions config/amoy.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"network": "polygon-amoy",
"startBlock": 9668200,
"address": "0xC80DB01aeDAD5F6E3088c75F60E52f579Cf1D3Cb",
"sideviewsActivatedBlock": 9672225
}
3 changes: 2 additions & 1 deletion config/baseSepolia.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"coreAddress": "0x87C969d083189927049f8fF3747703FB9f7a8AEd",
"coreStartBlock": 16665803,
"network": "base-sepolia"
"network": "base-sepolia",
"sideviewsActivatedBlock": 16665803
}
4 changes: 2 additions & 2 deletions config/polter.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"coreAddress": "0x1F0eb9099b9c398323dcf2F133dFdAD9dE7cF994",
"coreStartBlock": 4273,
"address": "0x1F0eb9099b9c398323dcf2F133dFdAD9dE7cF994",
"startBlock": 4273,
"network": "geist-polter"
}
5 changes: 0 additions & 5 deletions src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,3 @@ 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"
55 changes: 29 additions & 26 deletions src/helper.ts
Original file line number Diff line number Diff line change
@@ -1,41 +1,44 @@
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(AAVEGOTCHI_DIAMOND))
let svg = contract.try_getAavegotchiSvg(gotchi);
if(svg.reverted) {
return null; // just skip
}
let contract = Contract.bind(
Address.fromString(process.env.AAVEGOTCHI_DIAMOND as string)
);
let svg = contract.try_getAavegotchiSvg(gotchi);
if (svg.reverted) {
return null; // just skip
}

let gotchiEntity = getOrCreateAavegotchi(gotchi);
gotchiEntity.svg = svg.value;
return gotchiEntity;
let gotchiEntity = getOrCreateAavegotchi(gotchi);
gotchiEntity.svg = svg.value;
return gotchiEntity;
}

export function updateSideViews(gotchi: BigInt): Aavegotchi | null {
let contract = Contract.bind(Address.fromString(AAVEGOTCHI_DIAMOND))
let svgs = contract.try_getAavegotchiSideSvgs(gotchi);
let contract = Contract.bind(
Address.fromString(process.env.AAVEGOTCHI_DIAMOND as string)
);
let svgs = contract.try_getAavegotchiSideSvgs(gotchi);

if(svgs.reverted) {
return null; // just skip
}
let gotchiEntity = getOrCreateAavegotchi(gotchi);
let svgsValue = svgs.value;
gotchiEntity.svg = svgsValue[0];
gotchiEntity.left = svgsValue[1];
gotchiEntity.right = svgsValue[2];
gotchiEntity.back = svgsValue[3];
return gotchiEntity
if (svgs.reverted) {
return null; // just skip
}
let gotchiEntity = getOrCreateAavegotchi(gotchi);
let svgsValue = svgs.value;
gotchiEntity.svg = svgsValue[0];
gotchiEntity.left = svgsValue[1];
gotchiEntity.right = svgsValue[2];
gotchiEntity.back = svgsValue[3];
return gotchiEntity;
}

export function getOrCreateAavegotchi(gotchi: BigInt): Aavegotchi {
let gotchiEntity = Aavegotchi.load(gotchi.toString())
if(!gotchiEntity) {
gotchiEntity = new Aavegotchi(gotchi.toString())
}
let gotchiEntity = Aavegotchi.load(gotchi.toString());
if (!gotchiEntity) {
gotchiEntity = new Aavegotchi(gotchi.toString());
}

return gotchiEntity as Aavegotchi;
return gotchiEntity as Aavegotchi;
}

0 comments on commit 947bbfc

Please sign in to comment.