import { store } from '@graphprotocol/graph-ts' ; import { GenericScheme , NewCallProposal , ProposalExecuted , } from '../../types/GenericScheme/GenericScheme' ; import * as domain from '../../domain' ; import { GenericSchemeParam , GenericSchemeProposal , } from '../../types/schema' ; function insertNewProposal ( event ) { let genericSchemeParams = GenericSchemeParam . load ( event . address . toHex ( ) ) ; let ent = new GenericSchemeProposal ( event . params . _proposalId . toHex ( ) ) ; ent . dao = event . params . _avatar . toHex ( ) ; ent . contractToCall = genericSchemeParams . contractToCall ; ent . callData = event . params . _callData ; ent . value = event . params . _value ; ent . executed = false ; store . set ( 'GenericSchemeProposal' , event . params . _proposalId . toHex ( ) , ent ) ; } export function handleNewCallProposal ( event ) { domain . handleNewCallProposal ( event . params . _avatar , event . params . _proposalId , event . block . timestamp , event . params . _descriptionHash , event . address ) ; insertNewProposal ( event ) ; } export function handleProposalExecuted ( event ) { let ent = store . get ( 'GenericSchemeProposal' , event . params . _proposalId . toHex ( ) ) as GenericSchemeProposal ; if ( ent != null ) { ent . executed = true ; ent . returnValue = event . params . _genericCallReturnValue ; } store . set ( 'GenericSchemeProposal' , event . params . _proposalId . toHex ( ) , ent ) ; }