Indexing Error Subgraph Studio

Subgraph studio is unable to track triggered events in my smart contract and throws following error while syncing:

INDEXING ERROR

Error: failed to process trigger: block #46106976 (0x86cc…fa0e), transaction 52824b8824df9eff6e4fcf45bd2423d4cef8b1198980a159c1b1d1fc7217e1e0: module instantiation failed: unknown import: env::seed has not been defined.

I am using polygon mumbai network and sepolia network. But error persists in both network.

My subgraph.yaml file is

specVersion: 1.0.0
indexerHints:
  prune: auto
schema:
  file: ./schema.graphql
dataSources:
  - kind: ethereum
    name: Paypal
    network: mumbai
    source:
      address: "0x995dD0767e870dd6bC128B92456e402eC8F3683C"
      abi: Paypal
      startBlock: 46105964
    mapping:
      kind: ethereum/events
      apiVersion: 0.0.7
      language: wasm/assemblyscript
      entities:
        - PaymentCompleted
        - RequestCreated
      abis:
        - name: Paypal
          file: ./abis/Paypal.json
      eventHandlers:
        - event: PaymentCompleted(address,address,uint256,string,string,string)
          handler: handlePaymentCompleted
        - event: RequestCreated(address,address,(uint256,string,string,bool))
          handler: handleRequestCreated
      file: ./src/paypal.ts

My schema.graphql file is

type CurrentRequest @entity {
  id: ID!
  sender: Bytes!
  receiver: Bytes!
  amount: BigInt!
  message: String!
  senderName: String
  active: Boolean!
}

type History @entity {
  id: ID!
  ownAccountNumber: Bytes!
  otherAccountNumber: Bytes!
  otherAccountName: String
  amount: BigInt!
  message: String!
  action: String!
}

My src/paypal.ts file is

import { BigInt, Bytes } from "@graphprotocol/graph-ts";
import {
  PaymentCompleted as PaymentCompletedEvent,
  RequestCreated as RequestCreatedEvent,
} from "../generated/Paypal/Paypal";
import { CurrentRequest, History } from "../generated/schema";

export function handleRequestCreated(event: RequestCreatedEvent): void {
  let currentRequest = CurrentRequest.load(
    generateIdForCreateRequest(event.params.requestor, event.params.requestedTo)
  );
  if (!currentRequest) {
    currentRequest = new CurrentRequest(
      generateIdForCreateRequest(
        event.params.requestor,
        event.params.requestedTo
      )
    );
  }
  currentRequest.sender = event.params.requestor;
  currentRequest.receiver = event.params.requestedTo;
  currentRequest.amount = event.params.requestDetails.amount;
  currentRequest.message = event.params.requestDetails.message;
  currentRequest.senderName = event.params.requestDetails.name;
  currentRequest.active = true;
  currentRequest.save();
}

export function handlePaymentCompleted(event: PaymentCompletedEvent): void {
  let currentRequest = CurrentRequest.load(
    generateIdForCreateRequest(event.params.to, event.params.from)
  );
  if (currentRequest) {
    currentRequest.active = false;
    currentRequest.save();
  }
  let history = new History(generateIdForHistory(event));

  // For Paying Account
  history.ownAccountNumber = event.params.from;
  history.otherAccountNumber = event.params.to;
  history.otherAccountName = event.params.receiverName;
  history.amount = event.params.amount;
  history.action = "Send";
  history.message = event.params.message;

  // For Receiving Account
  history.ownAccountNumber = event.params.to;
  history.otherAccountNumber = event.params.from;
  history.otherAccountName = event.params.senderName;
  history.amount = event.params.amount;
  history.action = "Receive";
  history.message = event.params.message;

  history.save();
}

function generateIdForCreateRequest(sender: Bytes, receiver: Bytes): string {
  return `${sender.toHexString().substr(-5)}~~${receiver
    .toHexString()
    .substr(-5)}`;
}

function generateIdForHistory(event: PaymentCompletedEvent): string {
  let currentTimeStamp: BigInt = event.block.timestamp;
  return currentTimeStamp.toString() + Math.random().toString(36).substr(2);
}

My networks.json file is:

{
  "mumbai": {
    "Paypal": {
      "address": "0x995dD0767e870dd6bC128B92456e402eC8F3683C",
      "startBlock": 46105964
    }
  }
}
```.

Any kind of help is highly appreciated.
![paypal-error|690x118](upload://ds5aKY8kx0a6dLH2pxhslH9dZB0.png)
2 Likes