It’s so exhausting to keep up with all these new DeFi projects. But very few DeFi projects are really original. Most of them are copies and just re-use the same smart contracts. And if you know these contracts, it’s much easier to analyze new DeFi projects and spot patterns. Let’s explore the 3 most important smart contracts in DeFi, that have been re-used times and times again.
UniswapV2Pair is a smart contract created by Uniswap. Uniswap is the biggest decentralized exchange on Ethereum. Traders can use Uniswap to trade their ERC20 tokens in a decentralized way, and the UniswapV2Pair contract is at the core of this system. Each pair contract represents an automated market maker, for a specific market. There is a separate pair contract for each market. What makes this smart contract so special is the so-called constant product formula, an algorithm that is used to determine the price of a token. It is used by a large number of decentralized exchange on Ethereum and on other chain, including Sushiswap And Pancakeswap. UniswapV2Pair has been updated to V3, but most protocols who forked Uniswap still use the V2 version, and this version is also easier to understand. That’s why I recommend to study the V2 version first.
GovernorAlpha is a smart contract created by Compound. Compound is the biggest lending protocol on Ethereum. It is used to borrow and lender ERC20 tokens on the Blockchain. The GovernorAlpha contract is used for the governance of the Compound ecosystem. Holders of the COMP token, the governance token of Compound, can use GovernorAlpha to vote for the parameters and the evolution of the Compound protocol. GovernorAlpha is used in the governance of a large number of protocols and DAOs. GovernorAlpha has been updated to a new version called GovernorBravo. Most other protocols still use GovernorAlpha, and the updates of GovernorBravo are not very significant, that’s why I recommend to study GovernorAlpha first.
MasterChef is a smart contract created by Sushiswap. Sushiswap is one of the largest decentralized on Ethereum. Sushiswap was originally a fork of Uniswap, but it did bring some innovations like MasterChef. MasterChef is a smart contract that is used to build staking pools. With MasterChef, users can lock their tokens in the smart contract, and in exchange, they will get a token reward. Beside Sushiswap, MasterChef has been used in many other protocols like PancakeSwap. MasterChef is probably the most forked smart contracts in the whole Blockchain ecosystem.
So now, you know the most important smart contracts in DeFi. The next step is to go read their code and understand how they work in detail. What is especially important is to understand how you can interact with these smart contracts. And on my channel, I have another tutorial that dives into UniswapV2Pair. I will see you there!