diff --git a/daos/kovan/dummydao.json b/daos/kovan/dummydao.json new file mode 100644 index 00000000..6438c7ac --- /dev/null +++ b/daos/kovan/dummydao.json @@ -0,0 +1,39 @@ +{ + "name": "Parsimonious Designer", + "Avatar": "0x46e342972535e15776Cf31f9407975f3E8A4078c", + "DAOToken": "0x1f1DFd38F0cc6C1c7d2516d9aA9f99a4192C7249", + "Reputation": "0x3AFEebAb0eA2D0A31BB882d3C1a6B6f0C8dE4859", + "Controller": "0x9Ef023Ca8D27076b6b3823aA1108E0f03bfF9800", + "Schemes": [ + { + "name": "GenericScheme", + "alias": "GenericSchemeAlias", + "address": "0x38d2AD56A9F589c2d6f0a330291F79BfF9B13C6d", + "arcVersion": "0.0.1-rc.39" + }, + { + "name": "ContributionRewardExt", + "alias": "ContributionRewardExt", + "address": "0x68c29524E583380aF7896f7e63463740225Ac026", + "arcVersion": "0.0.1-rc.39" + } + ], + "StandAloneContracts": [ + { + "name": "Wallet", + "address": "0x9AD84A087C55F61e116df9A8c474703E3D58c536", + "arcVersion": "0.0.1-rc.39" + }, + { + "name": "ContributionRewardExt", + "address": "0x68c29524E583380aF7896f7e63463740225Ac026", + "arcVersion": "0.0.1-rc.39" + }, + { + "name": "Competition", + "address": "0x4b7284ac4714e27F9098c57F54306ed74454D05F", + "arcVersion": "0.0.1-rc.39" + } + ], + "arcVersion": "0.0.1-rc.39" + } \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 7e660c0a..4d70b5ff 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "@daostack/subgraph", - "version": "0.0.39-6", + "version": "0.0.39-7", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 2dd66b6c..41387150 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@daostack/subgraph", - "version": "0.0.39-6", + "version": "0.0.39-7", "author": "DAOstack (https://www.daostack.io)", "license": "GPL-3.0", "description": "A caching layer for daostack using The Graph", diff --git a/src/domain/dao.ts b/src/domain/dao.ts index d049c13a..31ea4a41 100644 --- a/src/domain/dao.ts +++ b/src/domain/dao.ts @@ -39,6 +39,7 @@ export function insertNewDAO( let avatar = Avatar.bind(avatarAddress); let dao = getDAO(avatarAddress.toHex()); dao.name = avatar.orgName().toString(); + dao.avatarContract = avatarAddress.toHex(); dao.nativeToken = nativeTokenAddress.toHex(); dao.nativeReputation = nativeReputationAddress.toHex(); dao.reputationHoldersCount = BigInt.fromI32(0); diff --git a/src/domain/schema.graphql b/src/domain/schema.graphql index b6b660c1..224a3438 100644 --- a/src/domain/schema.graphql +++ b/src/domain/schema.graphql @@ -13,6 +13,7 @@ enum Outcome { type DAO @entity { id: ID! name: String! + avatarContract: AvatarContract! nativeToken: Token! nativeReputation: Rep! proposals: [Proposal!] @derivedFrom(field: "dao") diff --git a/src/mappings/Avatar/datasource.yaml b/src/mappings/Avatar/datasource.yaml index 1cfe6441..e9e89012 100644 --- a/src/mappings/Avatar/datasource.yaml +++ b/src/mappings/Avatar/datasource.yaml @@ -1,6 +1,8 @@ entities: - AvatarContract eventHandlers: + - event: GenericCall(indexed address,bytes,uint256,bool) + handler: handleGenericCall - event: SendEther(uint256,indexed address) handler: handleSendEth - event: ReceiveEther(indexed address,uint256) diff --git a/src/mappings/Avatar/mapping.ts b/src/mappings/Avatar/mapping.ts index 2e05d23a..7ad1ce35 100644 --- a/src/mappings/Avatar/mapping.ts +++ b/src/mappings/Avatar/mapping.ts @@ -6,6 +6,7 @@ import { Address, BigInt, store } from '@graphprotocol/graph-ts'; import { Avatar, OwnershipTransferred, ReceiveEther, SendEther } from '../../types/Avatar/Avatar'; // Import entity types generated from the GraphQL schema +import { GenericCall } from '../../types/Controller/Avatar'; import { AvatarContract } from '../../types/schema'; function handleAvatarBalance( @@ -27,6 +28,12 @@ function handleAvatarBalance( store.set('AvatarContract', avatar.id, avatar); } +export function handleGenericCall(event: GenericCall): void { + if (event.params._success && BigInt.fromI32(0).lt(event.params._value)) { + handleAvatarBalance(event.address, event.params._value, false); + } +} + export function handleSendEth(event: SendEther): void { handleAvatarBalance(event.address, event.params._amountInWei, false); }