Pundi
Pundi AIPundi X
  • 🤖Pundi AI overview
  • 🈁Pundi AI Data Platform
    • Data stakeholders
    • Data Labelling
    • Pundi AI Data Platform (Alpha Testnet) - User Guide
    • FAQ
  • 🦾Pundi AIFX Omnilayer
    • Pundi AIFX
    • Installation Pundi AIFX
    • Setup Node
      • Full node with Binaries
      • Full node with Docker
      • Snapshot Guide
      • Node Monitoring Device
    • Validators
      • Validator Overview
      • Setting Up a Validator for Pundi AIFX
      • Validator Recovery
      • Validator FAQ
      • Validator Security Notice
      • Migration Best Practices
      • Transfer Validator Permissions
    • Delegators
      • Delegators FAQ
      • Delegator CLI Guide
      • Delegator Security Notice
    • Pundi AIFX Tutorials
      • Pundi AIFX CLI Commands
      • Cloud Setup
      • Testnet faucet
      • Ledger Integration for fxcored
      • Sentry Nodes
      • Account Migration Guide (CLI)
    • Upgrade Instructions
      • Cosmovisor Upgrade Guide v8.5.x
        • Cosmovisor Integration - Binaries
        • Cosmovisor Integration - Docker
      • Manual Upgrade Guide v8.5.x
        • Binaries - Upgrading Your Node
        • Docker - Upgrading Your Node
      • Upgrade Versions
        • v2.2.0 Upgrade Instructions
        • v3.1.0 Upgrade Instructions
        • v4.2.1 Upgrade Instructions
        • v5.0.0 Upgrade Instructions
      • Upgrade FAQ
    • Deploying on Pundi AIFX EVM
      • Products
      • MetaMask
        • Download and Install MetaMask
        • Add Network
        • Configure Custom Tokens
        • Create and Import Accounts
      • Connect Wallet to Dapps
        • Connect using MetaMask
        • Connect using Pundi Wallet (Wallet Connect)
      • With Remix
      • With Truffle
      • With Hardhat
      • Cross-Chain Bridges
        • Bridging Tokens from other networks
        • Pundi Gravity Bridge
    • DApps and Infra
      • Margin X Swap
      • Pundi Wallet
      • PundiScan
      • Baklava Space
      • Safe Multisig
      • PortfolioX
      • Token Factory
    • Developers
      • Pundi AIFX Network
      • Pundi AIFX Modules
      • Pundi AIFX JSON RPC
      • Pundi AIFX REST API
      • Web3 JSON RPC
        • JSON RPC Server
        • Namespaces
        • JSON RPC Methods
        • Events
      • Support Leap
      • Third Party Price Oracles
      • Contract Deployments
      • Pundi AIFX Cross Chain
        • sendToFx
        • f(x)Core
        • ibc
        • Target
      • Precompiled Contracts
        • CrossChain Precompiled
        • Staking-V2 Precompiled
      • Pundi AIFX SDKs
        • Python SDK
        • JavaScript SDK
      • Contract Monitoring
    • Pundi X Chain (under Pundi X)
      • Getting Started
        • Install Pundi X (PundiXChain)
        • Setup Node
          • Full node with Binaries
          • Full node with Docker
          • Snapshot Guide
          • Node Monitoring Device
          • Node Peers
      • Validators
        • Validator Overview
        • Setting Up a Validator for PundiXChain
        • Validator Recovery
        • Validator FAQ
        • Validator Security
        • Sentry Nodes
      • Delegators
        • Delegator FAQ
        • Delegator Overview
        • Delegator CLI Guide
      • Pundi X Tutorials
        • Pundi X CLI Guide
        • Ledger Integration for pundixd
        • Testnet Faucet
        • Cloud Setup
      • Upgrade Instructions
        • Cosmovisor Integration - Binaries
        • Cosmovisor Integration - Docker
        • Support keplr
      • Developers
        • Pundi X Network
        • Pundi X Protobuf
        • Pundi X gRPC & REST
        • Pundi X JSON RPC
        • Pundi X Cross Chain
          • ibc
  • 👛PURSE+
    • Purse Box
      • How many NFTs can I mint?
      • Minting (Etherscan)
      • Minting (Pursetoken.com)
    • PURSE+
      • Links
    • Bridging
      • BSC -> Ethereum
    • Protocols
      • LP Restaking Farms
        • How to Use Farms
        • Contract on BscScan
      • PURSE Staking
      • PURSE Staking Rewards
        • Campaigns
      • PURSE Retroactive Rewards
        • Campaigns
    • Contracts
      • Ethereum
      • Binance
      • Function X
    • IBC
      • PUNDIX Chain
    • PURSE Token
      • Background
      • ERC404 intro
      • Accounting of Balances
      • Minting PURSE NFT(s)
      • Transferring PURSE
      • Maintaining PURSE NFT(s)
      • NFTs in Queue
      • Token IDs
  • 🎡Pundi AI MM Agent
    • Why Market Making
    • Traditional MM vs. AMM
    • AI MM Agent: Bridging the Gap
    • Use Cases
    • Train & Launch (Step 1 & 2)
    • Flywheel (Step 3)
    • How the AI MM Agent Works in Detail
    • Why This is Powerful
  • 🛍️Pundi AI Data Marketplace (soon)
  • 🥇PUNDIAI Token Overview
    • Revenue generation flywheel
    • vePUNDIAI
      • how to bribe with vePUNDIAI
    • Protocol pool
  • Governance
    • Governance Proposal Information
      • EGF Info
      • EGF Grants Program
      • Application Template
      • Successful Grant Applicants
      • Launching an EGF Proposal
  • Links
Powered by GitBook
On this page
  • Introduction
  • Methodology
  1. Pundi AIFX Omnilayer
  2. Developers

Contract Monitoring

PreviousJavaScript SDKNextPundi X Chain (under Pundi X)

Last updated 3 months ago

Project name: Contract Monitor

Repository:

Is it open source: Yes

Prerequisites: Familiarity with /

Overview: A general solution for smart contract monitoring that enables direct querying of on-chain smart contracts or data from subgraphs

Introduction

As blockchain ecosystems grow more complex, robust monitoring tools are critical to ensure system reliability and performance. Recognizing this, Function X has developed a tool designed for real-time monitoring and alerting of smart contract activities. This contract monitoring tool is essential for developers and system administrators who need to keep track of smart contracts that have been deployed to production, particularly in a dynamic and decentralized environment.

The contract monitoring tool enables users and teams to directly interact with on-chain smart contracts or to fetch data from subgraphs, making it a useful and versatile asset in their toolkit. This flexibility allows users and teams to set up customized monitoring and alerting configurations that can react to changes in contract states or data flows, ensuring timely responses to potential issues.

Methodology

Contract Monitor's configuration is straightforward yet powerful. By setting the contract address and ABI in the configuration file, users can specify the methods to call and the parameters involved. This setup is complemented by detailed monitoring rules that can trigger alerts based on the contract's return values or state changes. Here’s a snapshot of what the configuration file might look like for a typical monitoring scenario:

{
    "name": "PIP_ETH",
    "address": "0x430a901cCBB48F0363E9cf0756a19ff1F549Ab90",
    "network": "testchain",
    "abi_path": "./abis/testchain/OSM.json",
    "functions": [
        {
            "func_name": "peek",
            "from": "0xe196908c3641A02A4E60651427cc8A3E061b4D29",
            "input": [

            ],
            "output": [
                {
                    "metric_name": "PEEK",
                    "metric_help": "ETH-A price value",
                    "labels": {
                        "severity": "warning"
                    },
                    "alert_rule": {
                        "alert": "makerdao ilk ETH-A price more than 5%",
                        "expr": "(abs(PIP_ETH_PEEK - (PIP_ETH_PEEK offset 60m)))/1e+18  > ((PIP_ETH_PEEK offset 60m) * 0.05) / 1e+18",
                        "for": "0m",
                        "annotations": {
                            "description": "makerdao ilk ETH-A price more than 5% :{{$value}}"
                        }
                    }
                }
            ]
        }
    ]
}

For monitoring subgraph data, the configuration format in the configuration file adapts to the specific data structures and needs of the monitored contracts or data fields:

{
    "table": "systemStates",
    "metric": [
        {
            "name": "systemStates_totalDebt",
            "type": "gauge",
            "help": "Total debt issued (token.debt))",
            "labels": {
                "source": "vat_debt"
            },
            "field": "totalDebt",
            "alert_rules": {
                "alert": " systemStates totalDebt change",
                "expr": "abs(systemStates_totalDebt-(systemStates_totalDebt offset 2m)) > systemStates_totalDebt * 0.05",
                "for": "0m",
                "annotations": {
                    "description": "systemStates totalDebt(vat_debt) have changed in two minutes change more than 5%,change data {{$value}}"
                }
            }
        }
    ]
}
🦾
https://github.com/PundiAI/contract-monitor
Prometheus
Alertmanager