PNS
  • PNS: Your Identity in Polkadot
  • Summary
  • Advanced Topics
  • Contributing
  • Core Concepts
  • FAQ & Troubleshooting
  • PNS Troubleshooting Guide
  • PNS User Guide
  • advanced-topics
    • Contract Deployments
    • Custom Resolvers
    • Custom Top-Level Domain (TLD) Registration
    • Subdomain Management
  • contributing
    • GitHub Workflow
    • Contribution Guidelines
    • Issue Reporting
  • faq
    • Common Issues
    • Technical FAQ
Powered by GitBook
On this page
  • Code Style
  • Solidity
  • TypeScript/JavaScript
  • Documentation
  • Review Process
  1. contributing

Contribution Guidelines

PreviousGitHub WorkflowNextIssue Reporting

Last updated 3 days ago

Code Style

Solidity

  • Follow the

  • Use 4 spaces for indentation

  • Maximum line length: 120 characters

  • Use @notice for public function documentation

  • Use @dev for implementation details

// Good
function transferOwnership(address newOwner) public {
    require(msg.sender == owner, "Not authorized");
    require(newOwner != address(0), "Invalid address");
    owner = newOwner;
}

// Bad
function transferOwnership(address newOwner) public{
require(msg.sender==owner);owner=newOwner;}

TypeScript/JavaScript

  • Use ESLint with provided configuration

  • Use Prettier for formatting

  • Use TypeScript for new code

  • Write JSDoc comments for public APIs

// Good
interface DomainInfo {
  name: string;
  owner: string;
  expires: number;
}

// Bad
interface domainInfo {
  n: string,
  o: string,
  e: number
}

Documentation

  1. Code Documentation

    • Document all public functions

    • Explain complex logic

    • Update relevant documentation files

  2. README Updates

    • Keep installation instructions current

    • Document new features

    • Update examples when needed

Review Process

  1. Before Submitting

    • Run all tests locally

    • Ensure code is formatted

    • Update documentation

    • Check for breaking changes

  2. During Review

    • Respond to comments promptly

    • Make requested changes

    • Rebase if needed

    • Keep PR scope focused

Solidity Style Guide