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",
|
"codegen": "graph codegen",
|
||||||
"build": "graph build",
|
"build": "graph build",
|
||||||
"deploy": "graph deploy --node https://api.thegraph.com/deploy/ --ipfs https://api.thegraph.com/ipfs/ juanmardefago/dsa",
|
"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",
|
"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/augur-v2-kovan",
|
"create-local": "graph create --node http://localhost:8020/ protofire/instadapp-dsa",
|
||||||
"remove-local": "graph remove --node http://localhost:8020/ protofire/augur-v2-kovan",
|
"remove-local": "graph remove --node http://localhost:8020/ protofire/instadapp-dsa",
|
||||||
"deploy-local": "graph deploy --node http://localhost:8020/ --ipfs http://localhost:5001 protofire/augur-v2-kovan"
|
"deploy-local": "graph deploy --node http://localhost:8020/ --ipfs http://localhost:5001 protofire/instadapp-dsa"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@graphprotocol/graph-cli": "0.18.0",
|
"@graphprotocol/graph-cli": "0.18.0",
|
||||||
|
|
|
@ -20,11 +20,11 @@ type AccountModule @entity {
|
||||||
"ID is the account module version"
|
"ID is the account module version"
|
||||||
id: ID!
|
id: ID!
|
||||||
|
|
||||||
version: Int
|
address: String!
|
||||||
|
|
||||||
connectors: String!
|
connectors: String!
|
||||||
|
|
||||||
check: String!
|
check: String
|
||||||
|
|
||||||
instaIndex: InstaIndex!
|
instaIndex: InstaIndex!
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,5 +3,6 @@ export {
|
||||||
handleLogNewAccount,
|
handleLogNewAccount,
|
||||||
handleLogNewCheck,
|
handleLogNewCheck,
|
||||||
handleLogNewMaster,
|
handleLogNewMaster,
|
||||||
handleLogUpdateMaster
|
handleLogUpdateMaster,
|
||||||
|
handleSetBasics
|
||||||
} from "./mappings/instaIndex";
|
} from "./mappings/instaIndex";
|
||||||
|
|
|
@ -5,12 +5,14 @@ import {
|
||||||
LogNewCheck,
|
LogNewCheck,
|
||||||
LogNewMaster,
|
LogNewMaster,
|
||||||
LogUpdateMaster,
|
LogUpdateMaster,
|
||||||
|
SetBasicsCall,
|
||||||
InstaIndex
|
InstaIndex
|
||||||
} from "../../generated/InstaIndex/InstaIndex";
|
} from "../../generated/InstaIndex/InstaIndex";
|
||||||
import {
|
import {
|
||||||
getOrCreateAccountModule,
|
getOrCreateAccountModule,
|
||||||
getOrCreateUser,
|
getOrCreateUser,
|
||||||
getOrCreateSmartAccount
|
getOrCreateSmartAccount,
|
||||||
|
getOrCreateInstaIndex
|
||||||
} from '../utils/helpers'
|
} from '../utils/helpers'
|
||||||
|
|
||||||
// - event: LogAccountCreated(address,indexed address,indexed address,indexed address)
|
// - 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())
|
let sender = getOrCreateUser(event.params.sender.toHexString())
|
||||||
|
|
||||||
smartAccount.owner = owner.id;
|
smartAccount.owner = owner.id;
|
||||||
smartAccount.sender = sender.id;
|
smartAccount.creator = sender.id;
|
||||||
smartAccount.origin = event.params.origin.toHexString();
|
smartAccount.origin = event.params.origin.toHexString();
|
||||||
|
|
||||||
smartAccount.save();
|
smartAccount.save();
|
||||||
|
@ -79,3 +81,16 @@ export function handleLogUpdateMaster(event: LogUpdateMaster): void {
|
||||||
|
|
||||||
index.save();
|
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 {
|
export function getOrCreateInstaIndex(): InstaIndex {
|
||||||
let index = InstaIndex.load("INDEX");
|
let index = InstaIndex.load("INDEX");
|
||||||
|
|
||||||
if (index == null && createIfNotFound) {
|
if (index == null) {
|
||||||
index = new InstaIndex("INDEX");
|
index = new InstaIndex("INDEX");
|
||||||
index.save();
|
index.save();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
specVersion: 0.0.2
|
specVersion: 0.0.2
|
||||||
description: Augur v2 subgraph
|
description: InstaDapp Defi Smart Account
|
||||||
repository: https://github.com/protofire/augur-v2-subgraph
|
repository: https://github.com/protofire/instadapp-dsa-subgraph
|
||||||
schema:
|
schema:
|
||||||
file: ./schema.graphql
|
file: ./schema.graphql
|
||||||
dataSources:
|
dataSources:
|
||||||
|
@ -33,3 +33,6 @@ dataSources:
|
||||||
handler: handleLogNewMaster
|
handler: handleLogNewMaster
|
||||||
- event: LogUpdateMaster(indexed address)
|
- event: LogUpdateMaster(indexed address)
|
||||||
handler: handleLogUpdateMaster
|
handler: handleLogUpdateMaster
|
||||||
|
callHandlers:
|
||||||
|
- function: setBasics(address,address,address,address)
|
||||||
|
handler: handleSetBasics
|
||||||
|
|
Loading…
Reference in New Issue
Block a user