Skip to main content

Documentation Index

Fetch the complete documentation index at: https://core.anylayer.org/llms.txt

Use this file to discover all available pages before exploring further.

Overview

This guide provides comprehensive examples for integrating with the ZKScore Protocol Registry. It covers protocol registration, data provider management, and cross-protocol coordination.
Register your protocol to contribute to the ZKScore ecosystem and enable your users to build reputation through your platform.

Integration Class

class ProtocolRegistryIntegration {
  constructor(provider, registryAddress, abi) {
    this.provider = provider;
    this.contract = new ethers.Contract(registryAddress, abi, provider);
    this.contractWithSigner = null;
  }
  
  setSigner(signer) {
    this.contractWithSigner = this.contract.connect(signer);
  }
  
  async registerProtocol(name, description, type, dataProvider, weight) {
    if (!this.contractWithSigner) throw new Error('Signer not set');
    
    const metadata = ethers.utils.defaultAbiCoder.encode(
      ['string', 'string'],
      ['https://protocol.com', 'v1.0.0']
    );
    
    const tx = await this.contractWithSigner.registerProtocol(
      name, description, type, dataProvider, weight, metadata
    );
    
    const receipt = await tx.wait();
    const event = receipt.events.find(e => e.event === 'ProtocolRegistered');
    
    return {
      success: true,
      protocolId: event.args.protocolId.toString(),
      transactionHash: receipt.transactionHash
    };
  }
  
  async getProtocol(protocolId) {
    const protocol = await this.contract.getProtocol(protocolId);
    return { success: true, protocol };
  }
}

Best Practices

  1. Accurate Information: Provide complete protocol details
  2. Fair Weighting: Request appropriate score weights
  3. Monitor Events: Track protocol ecosystem
  4. Update Regularly: Keep protocol information current