Configuration
Alchemy

Variables

Each platform should have its own secrets conifugred (optional but as a security measure):

  • ALCHEMY_CLAIM_WEBHOOK_SECRET
  • ALCHEMY_TOPUP_WEBHOOK_SECRET

Navigate to Strapi admin panel, then Content Manager, choose platform crowdex or rentinvesto in Single Types. Then you can add the secrets in JSON format (make sure you don't delete other secrets):

{
  "ALCHEMY_CLAIM_WEBHOOK_SECRET": "XYZ",
  "ALCHEMY_TOPUP_WEBHOOK_SECRET": "XYZ"
}

Those secrets can be obtained from Alchemy's dashboard -> Webhooks in section Signing Key.

Share

Events

  • Exchange Event (where in addresses you should specify address of CrowdexExchange smart contract and in topics the keccak signature of the Exchange event from smart contract)
{
  block {
    logs(filter: {addresses: ["0x8D04C9448E5f6e43FF93C0d462E5E59a447193D4"], topics: ["0x6c1eaca9ab78e92a6b7ef1e815f717ecece5f68a2479f7f21e4e47b5ae12844b"]}) {
      data
      transaction {
        hash
        logs {
          data
          account {
            address
          }
          topics
          index
        }
        type
        status
      }
    }
  }
}

POST https://dashboard.alchemy.com/api/create-webhook

HEADERS:

{
    "Content-Type": "application/json",
    "X-Alchemy-Token": "AUTH_TOKEN"
}"
{
    "network": "MATIC_MAINNET",
    "webhook_type": "GRAPHQL",
    "webhook_url": "https://3f05-2a02-a31d-a2c3-b780-ad9c-8066-f964-b472.ngrok-free.app/api/alchemy/webhook",
    "graphql_query": {
        "query": "{\n  block {\n    logs(filter: {addresses: [\n      \"0x8D04C9448E5f6e43FF93C0d462E5E59a447193D4\"\n    ], topics: [\n      \"0x6c1eaca9ab78e92a6b7ef1e815f717ecece5f68a2479f7f21e4e47b5ae12844b\"\n    ]\n    }) {\n      data\n      transaction {\n        hash\n        logs {\n          data\n          account {\n            address\n          }\n          topics\n          index\n        }\n        type\n        status\n      }\n    }\n  }\n}",
        "skip_empty_messages": true
    }
}
  • Tokens Claimed Event (where in addressses you should specify address for project's Drop smart contract and in topics the keccak signature of the TokensClaimed event from smart contract)
{
  block {
    logs(filter: {addresses: ["0xDeDDF888c649eD8426E2DA02053187FBABd81eB8"], topics: ["0xfa76a4010d9533e3e964f2930a65fb6042a12fa6ff5b08281837a10b0be7321e"]}) {
      data
      transaction {
        hash
        logs {
          data
          account {
            address
          }
          topics
          index
        }
        type
        status
      }
    }
  }
}

POST https://dashboard.alchemy.com/api/create-webhook

HEADERS:

{
    "Content-Type": "application/json",
    "X-Alchemy-Token": "AUTH_TOKEN"
}"
{
    "network": "MATIC_MAINNET",
    "webhook_type": "GRAPHQL",
    "webhook_url": "https://3f05-2a02-a31d-a2c3-b780-ad9c-8066-f964-b472.ngrok-free.app/api/alchemy/tokensClaimed",
    "graphql_query": {
        "query": "{\n  block {\n    logs(filter: {addresses: [\"0xDeDDF888c649eD8426E2DA02053187FBABd81eB8\"], topics: [\"0xfa76a4010d9533e3e964f2930a65fb6042a12fa6ff5b08281837a10b0be7321e\"]}) {\n      data\n      transaction {\n        hash\n        logs {\n          data\n          account {\n            address\n          }\n          topics\n          index\n        }\n        type\n        status\n      }\n    }\n  }\n}",
        "skip_empty_messages": true
    }
}