Developer Docs
AppGitHub
  • Welcome!
  • Smart contracts
    • Core
      • Introduction
      • Deep Dive
      • Smart Contract Reference
        • PWN Hub
          • Tags
        • PWN Config
        • PWN Vault
        • Loan Types
          • Simple Loan
        • Proposals
          • Simple Loan Proposal
            • Simple Proposal
            • List Proposal
            • Elastic Proposal
            • Elastic Chainlink Proposal
            • Dutch Proposal
        • PWN Utilized Credit
        • PWN LOAN
        • PWN Revoked Nonce
        • Peripheral Contracts
          • Acceptor Controller
            • World ID
          • State Fingerprint Computer
            • UniV3
            • Chicken Bonds
          • Pool Adapter
            • Aave
            • Compound
            • ERC4626
        • Miscellaneous
          • PWN Fee Calculator
          • PWN Signature Checker
          • PWN Errors
          • PWN Periphery
          • Timelock
    • PWN DAO
      • Governance
        • Optimistic
        • Token
      • Tokens
        • PWN
        • stPWN
        • vePWN
          • Stake
          • Power
          • Metadata
      • Epoch Clock
      • Miscellaneous
        • Errors
        • EpochPowerLib
    • Tools
      • PWN Safe
        • Architecture
        • Security considerations
        • Smart Contract Reference
          • PWN Safe Factory
          • ATR Module
            • Tokenized Asset Manager
            • Recipient Permission Manager
          • Whitelist
          • ATR Guard
            • Operators context
      • Token Bundler
      • PWN Deployer
    • Libraries
      • MultiToken
    • Contract Addresses
  • More documentation
    • PWN Docs
    • FAQ
    • Audits
    • Using PWN without front-end
  • Deprecated
    • PWN Beta
      • Architecture
      • PWN
        • Off-chain signed offer
        • Offer types
      • PWN Vault
      • PWN LOAN
Powered by GitBook
On this page
  • 1. Summary
  • 2. Important links
  • 3. Contract details
  • Features
  • Inherited contracts, implemented Interfaces and ERCs
  • Functions
  • Events and Errors
  • AcceptorData Struct
Edit on GitHub
  1. Smart contracts
  2. Core
  3. Smart Contract Reference
  4. Peripheral Contracts
  5. Acceptor Controller

World ID

PreviousAcceptor ControllerNextState Fingerprint Computer

Last updated 1 month ago

1. Summary

WorldIdAcceptorController.sol contract enables users to require zero-knowledge proof for their lending or borrowing counterparties through World ID. One of the use cases is verifying the humanness of the counterparty.

For more information about World ID please refer to the .

2. Important links

3. Contract details

  • WorldIdAcceptorController.sol is written in Solidity version 0.8.16

Features

  • Verify World ID zero-knowledge proof

Inherited contracts, implemented Interfaces and ERCs

Functions

checkAcceptor

Overview

Proposal contracts call this function to verify submitted World ID proofs.

This function takes three arguments supplied by the proposal contracts:

  • addressacceptor

  • bytes calldataproposerData - data to be verified from the proposer

  • bytes calldataacceptorData - data to be verified from the acceptor

Implementation

function checkAcceptor(
    address acceptor, bytes calldata proposerData, bytes calldata acceptorData
) external view returns (bytes4) {
    if (proposerData.length > 0) {
        revert NonEmptyProposerData();
    }

    AcceptorData memory data = abi.decode(acceptorData, (AcceptorData));

    worldId.verifyProof(
        data.root,
        groupId,
        _hashToField(abi.encodePacked(acceptor)),
        data.nullifierHash,
        externalNullifier,
        data.proof
    );

    return type(IPWNAcceptorController).interfaceId;
}

Events and Errors

The World ID Acceptor Controller contract defines one custom error and no events.

error NonEmptyProposerData();
NonEmptyProposerData

A NonEmptyProposerData error is thrown when proposer data are not empty.

This error doesn't have any parameters.

Check for empty acceptorData is ensured though abi.decode validation.

AcceptorData Struct

Type
Name
Comment

uint256

root

Root of the proof merkle tree

uint256

nullifierHash

Nullifier hash for the proof

uint256[8]

proof

ZK Proof itself

IPWNAcceptorController
World Docs
pwn_protocol_periphery/src/acceptor-controller/WorldIdAcceptorController.sol at world-id · PWNDAO/pwn_protocol_peripheryGitHub
Logo