mirror of
https://github.com/Instadapp/instadapp-dsa-subgraph.git
synced 2024-07-29 21:48:18 +00:00
feat: 🎸 support matic + add prepare functions for both networks
This commit is contained in:
parent
312fde1f26
commit
c03b3b9aec
4
.gitignore
vendored
4
.gitignore
vendored
|
@ -1,3 +1,5 @@
|
|||
node_modules/
|
||||
/generated
|
||||
/build
|
||||
/build
|
||||
subgraph.yaml
|
||||
src/utils/helpers/instaIndex.ts
|
5
config/mainnet.json
Normal file
5
config/mainnet.json
Normal file
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
"network": "mainnet",
|
||||
"InstaIndexAddress": "0x2971adfa57b20e5a416ae5a708a8655a9c74f723",
|
||||
"InstaEventsAddress": "0x2af7ea6cb911035f3eb1ed895cb6692c39ecba97"
|
||||
}
|
5
config/matic.json
Normal file
5
config/matic.json
Normal file
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
"network": "matic",
|
||||
"InstaIndexAddress": "0xA9B99766E6C676Cf1975c0D3166F96C0848fF5ad",
|
||||
"InstaEventsAddress": "0xA4BF319968986D2352FA1c550D781bBFCCE3FcaB"
|
||||
}
|
7934
package-lock.json
generated
Normal file
7934
package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
|
@ -9,10 +9,13 @@
|
|||
"deploy-dev": "graph deploy --node https://api.thegraph.com/deploy/ --ipfs https://api.thegraph.com/ipfs/ protofire/instadapp-defi-smart-accounts",
|
||||
"create-local": "graph create --node http://localhost:8020/ protofire/instadapp-defi-smart-accounts",
|
||||
"remove-local": "graph remove --node http://localhost:8020/ protofire/instadapp-defi-smart-accounts",
|
||||
"deploy-local": "graph deploy --node http://localhost:8020/ --ipfs http://localhost:5001 protofire/instadapp-defi-smart-accounts"
|
||||
"deploy-local": "graph deploy --node http://localhost:8020/ --ipfs http://localhost:5001 protofire/instadapp-defi-smart-accounts",
|
||||
"prepare:mainnet": "mustache config/mainnet.json subgraph.template.yaml > subgraph.yaml && mustache config/mainnet.json src/utils/helpers/instaIndex.template.ts src/utils/helpers/instaIndex.ts",
|
||||
"prepare:matic": "mustache config/matic.json subgraph.template.yaml > subgraph.yaml && mustache config/matic.json src/utils/helpers/instaIndex.template.ts src/utils/helpers/instaIndex.ts"
|
||||
},
|
||||
"dependencies": {
|
||||
"@graphprotocol/graph-cli": "0.18.0",
|
||||
"@graphprotocol/graph-ts": "0.18.0"
|
||||
"@graphprotocol/graph-ts": "0.18.0",
|
||||
"mustache": "^4.2.0"
|
||||
}
|
||||
}
|
||||
}
|
|
@ -2,7 +2,7 @@ import {
|
|||
User,
|
||||
SmartAccount,
|
||||
AccountModule,
|
||||
InstaIndex
|
||||
InstaIndex,
|
||||
} from "../../../generated/schema";
|
||||
import { InstaAccount as AccountTemplate } from "../../../generated/templates";
|
||||
import { Address } from "@graphprotocol/graph-ts";
|
||||
|
@ -36,8 +36,8 @@ export function getOrCreateSmartAccount(
|
|||
smartAccount = new SmartAccount(id);
|
||||
|
||||
smartAccount.shield = false;
|
||||
if(address != null) {
|
||||
AccountTemplate.create(address as Address)
|
||||
if (address != null) {
|
||||
AccountTemplate.create(address as Address);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -61,10 +61,10 @@ export function getOrCreateAccountModule(
|
|||
}
|
||||
|
||||
export function getOrCreateInstaIndex(): InstaIndex {
|
||||
let index = InstaIndex.load("0x2971adfa57b20e5a416ae5a708a8655a9c74f723");
|
||||
let index = InstaIndex.load("{{InstaIndexAddress}}");
|
||||
|
||||
if (index == null) {
|
||||
index = new InstaIndex("0x2971adfa57b20e5a416ae5a708a8655a9c74f723");
|
||||
index = new InstaIndex("{{InstaIndexAddress}}");
|
||||
index.save();
|
||||
}
|
||||
|
|
@ -6,9 +6,9 @@ schema:
|
|||
dataSources:
|
||||
- kind: ethereum/contract
|
||||
name: InstaIndex
|
||||
network: mainnet
|
||||
network: {{network}}
|
||||
source:
|
||||
address: "0x2971adfa57b20e5a416ae5a708a8655a9c74f723"
|
||||
address: "{{InstaIndexAddress}}"
|
||||
abi: InstaIndex
|
||||
startBlock: 9747241
|
||||
mapping:
|
||||
|
@ -42,9 +42,9 @@ dataSources:
|
|||
handler: handleBuild
|
||||
- kind: ethereum/contract
|
||||
name: InstaEvents
|
||||
network: mainnet
|
||||
network: {{network}}
|
||||
source:
|
||||
address: "0x2af7ea6cb911035f3eb1ed895cb6692c39ecba97"
|
||||
address: "{{InstaEventsAddress}}"
|
||||
abi: InstaEvents
|
||||
startBlock: 9747294
|
||||
mapping:
|
||||
|
@ -67,7 +67,7 @@ dataSources:
|
|||
templates:
|
||||
- name: InstaConnectors
|
||||
kind: ethereum/contract
|
||||
network: mainnet
|
||||
network: {{network}}
|
||||
source:
|
||||
abi: InstaConnectors
|
||||
mapping:
|
||||
|
@ -98,7 +98,7 @@ templates:
|
|||
handler: handleLogRemoveController
|
||||
- name: InstaAccount
|
||||
kind: ethereum/contract
|
||||
network: mainnet
|
||||
network: {{network}}
|
||||
source:
|
||||
abi: InstaAccount
|
||||
mapping:
|
Loading…
Reference in New Issue
Block a user