A Chads Ultimate Guide to: Checking Smart contracts

DeFi Chads
5 min readMay 1, 2022

--

As a typical Etherscan user, you are likely to have a rough understanding of how smart contracts work. You might even have delved into the “read contract” section of a recent deployment and enjoyed the quirky ASCII art of a popular meme that the dev has jokingly left at the top of the text.

However, checking contracts in detail can be a confusing process — especially if you’ve got limited experience with writing code — yet it remains a critical skill if you are to successfully navigate the Wild West of crypto unscathed.

Fear not — we are here to help.

In this guide we will teach you how to spot some of the more critical contract features that could save you from making some costly mistakes in your journey through the metaverse.

For now, we are going to focus on checking for two critical elements:

- maximum transaction limit;

- renunciation of contract ownership.

Of course, there are a number of other features which could be used to pull off a rug — but these three are certainly the most useful when it comes to aping a newly launched contract.

For the sake of this guide we will use the Clifford Inu contract as a case study:

Clifford Inu: CLIFF Token | Address 0x1B9BAF2A3EdeA91eE431f02d449a1044d5726669 | Etherscan

MaxTX and MaxWallet

To discover the maximum transaction limit for a particular contract (a parameter that is critical if you are, for example, looking to snipe a new listing. Let’s start with checking the number of decimals used in that contract.

In this case, we can see the “Decimals” function listed at number 10 in the “Read Contract” section.

This contract uses 18 decimals (which is usually the case). Others may only use nine decimals.

We will then scroll down searching for the maxWallet and maxTransactionAmount maxWallet functions. Here these are listed at function 20 and 21 and return values of 5000000000000000000000000000 and 10000000000000000000000000000 respectively.

This doesn’t make much sense, but what we are going to do now is remove the decimals that we pulled from the function above. In this case we simply remove 18 zeros.

This leads to a MaxTX of: 5,000,000,000 and a MaxWallet of 10,000,000,000.

This means that the most $CLIFF you can buy in a single transaction is 5.000,000,000 $CLIFF, and the most $CLIFF a wallet can hold at any time is 10,000,000,000 $CLIFF.

The MaxTX and MaxWallet can be turned on and off by the contract owner. For example, these settings are often only activated during launch — to help prevent any one wallet acquiring a disproportionately large percentage of the token supply — and then switched back off again.

In the case of $CLIFF, we can see that the function has been turned off by looking at “limitsInEffect” at function 15. This returns false, meaning that there is currently no MaxTX or MaxWallet.

If we search the contract for “limitsinEffect”, we can see the lines allowing the contract owner to remove the limits.

In order to change the contract limits, the owner would simply go to the “Write functions” and input new values under function 19 and 20.

But who is the contract owner?

To find out who the contract owner is, go back to the “Read Contract” page and look for “Owner”, which for $CLIFF is listed at function 23. Querying this function shows us that the contract owner is: cliffordinu.eth | Address 0x81ed317154e4c6e829b0358f59c5578719e95ccb | Etherscan

This shows us that the ownership has not been renounced, meaning the owner can still call functions on the contract and change limits.

When the ownership is renounced, the query would return the “owner” address as either being 0000xDead address or the address of a timelock contract.

During a new token launch we can look out for the contract owner calling the function to renounce, as the owner calls the function below and uses 0000xDead as the input:

Remember, just because contract ownership is renounced doesn’t mean the token is safe. For example, a contract could still be a honeypot before, the LP could be unlocked or set on a very short expiry. These things also need to be thoroughly checked but, thankfully, us Chads tend to do the heavy lifting for you!

We hope this guide provided a useful insight into reading smart contracts and would encourage you to become familiar with Etherscan and to take responsibility for querying contracts you ape into yourself, rather than relying solely on input from others!

Make sure to follow our socials and leave a comment on the subjects we need to cover!

Channel: t.me/defichads
Chat channel: t.me/chadsverify
Twitter: https://twitter.com/ChadsDefi

--

--