mirror of
https://github.com/Instadapp/instadapp-dsa-subgraph.git
synced 2024-07-29 21:48:18 +00:00
fixed subgraph indexing failed because of base account module
This commit is contained in:
parent
c7a72ab648
commit
816653c12b
|
@ -6,10 +6,10 @@
|
|||
"codegen": "graph codegen",
|
||||
"build": "graph build",
|
||||
"deploy": "graph deploy --node https://api.thegraph.com/deploy/ --ipfs https://api.thegraph.com/ipfs/ juanmardefago/dsa",
|
||||
"deploy-dev": "graph deploy --node https://api.thegraph.com/deploy/ --ipfs https://api.thegraph.com/ipfs/ protofire/augur-v2-kovan",
|
||||
"create-local": "graph create --node http://localhost:8020/ protofire/augur-v2-kovan",
|
||||
"remove-local": "graph remove --node http://localhost:8020/ protofire/augur-v2-kovan",
|
||||
"deploy-local": "graph deploy --node http://localhost:8020/ --ipfs http://localhost:5001 protofire/augur-v2-kovan"
|
||||
"deploy-dev": "graph deploy --node https://api.thegraph.com/deploy/ --ipfs https://api.thegraph.com/ipfs/ protofire/instadapp-dsa",
|
||||
"create-local": "graph create --node http://localhost:8020/ protofire/instadapp-dsa",
|
||||
"remove-local": "graph remove --node http://localhost:8020/ protofire/instadapp-dsa",
|
||||
"deploy-local": "graph deploy --node http://localhost:8020/ --ipfs http://localhost:5001 protofire/instadapp-dsa"
|
||||
},
|
||||
"dependencies": {
|
||||
"@graphprotocol/graph-cli": "0.18.0",
|
||||
|
|
|
@ -20,11 +20,11 @@ type AccountModule @entity {
|
|||
"ID is the account module version"
|
||||
id: ID!
|
||||
|
||||
version: Int
|
||||
address: String!
|
||||
|
||||
connectors: String!
|
||||
|
||||
check: String!
|
||||
check: String
|
||||
|
||||
instaIndex: InstaIndex!
|
||||
}
|
||||
|
|
|
@ -3,5 +3,6 @@ export {
|
|||
handleLogNewAccount,
|
||||
handleLogNewCheck,
|
||||
handleLogNewMaster,
|
||||
handleLogUpdateMaster
|
||||
handleLogUpdateMaster,
|
||||
handleSetBasics
|
||||
} from "./mappings/instaIndex";
|
||||
|
|
|
@ -5,12 +5,14 @@ import {
|
|||
LogNewCheck,
|
||||
LogNewMaster,
|
||||
LogUpdateMaster,
|
||||
SetBasicsCall,
|
||||
InstaIndex
|
||||
} from "../../generated/InstaIndex/InstaIndex";
|
||||
import {
|
||||
getOrCreateAccountModule,
|
||||
getOrCreateUser,
|
||||
getOrCreateSmartAccount
|
||||
getOrCreateSmartAccount,
|
||||
getOrCreateInstaIndex
|
||||
} from '../utils/helpers'
|
||||
|
||||
// - event: LogAccountCreated(address,indexed address,indexed address,indexed address)
|
||||
|
@ -24,7 +26,7 @@ export function handleLogAccountCreated(event: LogAccountCreated): void {
|
|||
let sender = getOrCreateUser(event.params.sender.toHexString())
|
||||
|
||||
smartAccount.owner = owner.id;
|
||||
smartAccount.sender = sender.id;
|
||||
smartAccount.creator = sender.id;
|
||||
smartAccount.origin = event.params.origin.toHexString();
|
||||
|
||||
smartAccount.save();
|
||||
|
@ -79,3 +81,16 @@ export function handleLogUpdateMaster(event: LogUpdateMaster): void {
|
|||
|
||||
index.save();
|
||||
}
|
||||
|
||||
// - event: LogUpdateMaster(indexed address)
|
||||
// handler: handleLogUpdateMaster
|
||||
|
||||
export function handleSetBasics(call: SetBasicsCall): void {
|
||||
let accountVersion = InstaIndex.bind(call.to).versionCount();
|
||||
let accountModule = getOrCreateAccountModule(accountVersion.toString())
|
||||
|
||||
accountModule.address = call.inputs._account.toHexString();
|
||||
accountModule.connectors = call.inputs._connectors.toHexString();
|
||||
|
||||
accountModule.save();
|
||||
}
|
||||
|
|
|
@ -50,7 +50,7 @@ export function getOrCreateAccountModule(
|
|||
export function getOrCreateInstaIndex(): InstaIndex {
|
||||
let index = InstaIndex.load("INDEX");
|
||||
|
||||
if (index == null && createIfNotFound) {
|
||||
if (index == null) {
|
||||
index = new InstaIndex("INDEX");
|
||||
index.save();
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
specVersion: 0.0.2
|
||||
description: Augur v2 subgraph
|
||||
repository: https://github.com/protofire/augur-v2-subgraph
|
||||
description: InstaDapp Defi Smart Account
|
||||
repository: https://github.com/protofire/instadapp-dsa-subgraph
|
||||
schema:
|
||||
file: ./schema.graphql
|
||||
dataSources:
|
||||
|
@ -33,3 +33,6 @@ dataSources:
|
|||
handler: handleLogNewMaster
|
||||
- event: LogUpdateMaster(indexed address)
|
||||
handler: handleLogUpdateMaster
|
||||
callHandlers:
|
||||
- function: setBasics(address,address,address,address)
|
||||
handler: handleSetBasics
|
||||
|
|
Loading…
Reference in New Issue
Block a user