Best Practices for Smart Contract Listing
Guidelines for effectively listing smart contracts on Analog Watch.
The smart contract you list on the Analog Watch outlines the functions and data types available for other platform users to generate Views, bridging the gap between Analog Watch and Data Designers/Data Consumers. As such, the listed contract must be clear, easy to hand off, and free from assumptions and confusion.
Remember, once a smart contract is listed, it cannot be relisted. That is why it is important to adhere to best practices, as you won’t have another opportunity to rebuild your contract.
Here are a few best practices you can follow when listing smart contracts on the Analog Watch:
Choose meaningful names for your identifiers
When choosing names for the smart contract identifier, it’s important to choose meaningful and relevant names. An identifier needs to state the purpose of the smart contract, answering questions such as:
- Why do users need that smart contract?
- What is this smart contract doing or storing?
For example, let’s assume you’re listing Uniswap’s price feed contract on the Ethereum blockchain that lists ETH/USDC tokens.
Good example:
UniswapETHUSDCEthereumUniswapETHUSDCUniswapETHUSDC
Bad example:
Ethereum_2018ANGELETH_USDC_2016
Please note that you can't use symbols in your smart contract name.
Use pronounceable names for your identifiers.
Names that are easy to pronounce allow other users (i.e., Data Designers and Data Consumers) to grasp the functionality of your smart contract within the network.
Good example:
PancakeSwapWETHUSDTCurveFiUSDTBTCWETH
Bad example:
AT1_4046CZKO_2022
Snake case vs. Camel case
Two generally accepted conventions exist for creating variable or function names: snake case, which uses underscores to separate words in an identifier (e.g., uniswap_eth_usdc), and camel case, which uses capital letters to indicate word boundaries (e.g., uniswapEthUsdc). The convention you opt to use depends on your personal preference and the readability of your code.
Always provide a brief description of your smart contract.
Providing a brief description of your smart contract is essential because it helps other users, such as Data Designers and even yourself, understand the smart contract's purpose and structure. It makes your listed smart contract more readable. For example, our UniswapETHUSDC would be described simply as:
Uniswap ETH/USDC token pair on Ethereum.
Always use tags to enhance the categorization of your listed smart contracts.
Adding a tag to a smart contract is an excellent way to enable Analog Watch to organize your smart contract. It’s also a good way to lead other users (i.e., Data Designers and Data Consumers) to your smart contract whenever they search for similar contracts.