Analyzing: Smart Contracts

August 2, 2021
Read Time

Reserved for only the most enthusiastic cryptocurrency investors, reading smart contracts is a common Fundamental Analysis (FA) method. By searching through a smart contract’s content, it is possible to discover flaws, malicious functions, features that do not work, copied code, and so on.

If you have read Shrimpy Academy’s lesson on smart contracts, you already know how they work. But if not, here is a quick summary:

“A smart contract is a piece of self-executable software that is autonomously activated once certain preimposed conditions, written in code, are met.”

Basically, a smart contract is akin to an algorithm in the way that, once activated, developers and users alike can process or activate a function. Any interaction or activity on a decentralized application falls into this category, including:

  • Swapping tokens
  • Executing a trade
  • Withdrawing funds
  • Depositing funds
  • Adding liquidity

As you can see, smart contracts are more than essential. They represent a tool that not only automates certain tasks but makes them possible to exist in the first place. As such, you might come to realize that reading smart contracts is the most important skill of them all.

How to analyze smart contracts

At the end of the day, a smart contract is simply a digital contract. Like all contracts, you can understand their terms and conditions by reading them. To learn more about the functioning of smart contracts, we recommend reading the following lesson.

A smart contract can be read by visiting a project’s Etherscan (if based on Ethereum) and GitHub page. For the sake of this lesson, we will use Yearn Finance as an example.

We found the Etherscan page for Yearn Finance by typing its ticker (YFI) into the search bar.

Right below the page, we can find a list of tabs that includes a ‘Contract’ tab. Here we can read the basic contract for the YFI token, which includes a set of functions that you can expand and read as seen in the image below.

The sections for decimals, governance and totalSupply reveal the following information:

  • YFI is a token with 18 decimals
  • YFI has a separate governance contract
  • YFI has a maximum total supply of 36,666 tokens

If we head over to the address provided in the governance field, we can find a specific section of YFI’s governance contract describing the timelock system, which involves the voting period’s duration.

With the help of Etherscan, we have also come across another more advanced governance contract. After continuous research, we found even more smart contracts to read.

However, a majority of Andre Cronje’s work can be found on the Yearn Protocol GitHub page, which we have discovered by reading Yearn’s support documents.

On the page dedicated to Yearn Vaults, we had the chance to discover how automated vault yield strategies work. Thanks to numerous comments added throughout the lines of code, even a layman can understand Yearn’s vaults.

The question you might have is: what is our end goal?

While this is not particularly useful in Yearn’s example, due to the team’s well-established reputation, the average user can read smart contracts on the aforementioned platforms to crosscheck supposed development updates with actual code. If a feature was implemented but cannot be found in a repository we can confidently say that it does not exist.

In another instance, which is oftentimes encountered, we can compare numerous smart contracts. Seeing a clone, an occurrence in which users create a new dApp by copying another successful platform is always bad news. To confirm that a new project called ‘Rocket Finance,’ which bears similarity to Yearn Finance, stole the competitor’s code, we can compare each other’s smart contracts.

Naturally, this is just the tip of the iceberg. We can confirm a number of things by reading smart contracts. However, we note that you will be checking for clones and features most of the time.