How Ethereum Smart Contracts Power Dai, the Maker Protocol, and DeFi

September 15, 2020

Smart contracts are operations written in software code that run on a blockchain platform. No third party is needed to ensure their execution; the coded processes are carried out automatically when the specified conditions are met. Ethereum’s smart contracts underpin all of the decentralized tokens, applications, and protocols, including Dai and the Maker Protocol, that run on the Ethereum blockchain. 

Simply put, smart contracts are essential to decentralized finance (DeFi) and make it possible for MakerDAO to operate in a decentralized way. They power the Protocol, the Dai stablecoin, which is the most-used cryptocurrency in the decentralized finance (DeFi) space, Maker Vaults through which Dai is generated, and MakerDAO community-based governance. Smart contracts also enable the creation of non-fungible tokens (NFTs)—one-of-a-kind assets that play important roles in the Maker ecosystem, including providing a bridge for using real-world assets as collateral types.

Transparent, reliable, and trustless, smart contracts are key to shaping the future of global finance.

What’s Behind Ethereum Smart Contracts?

Whenever you interact with a conventional web service, such as an email account or social network, the software you access runs on a centralized web server. You trust and rely on the companies that provide these services to keep them running, despite that they are vulnerable to outages, interference, and hacking. When you interact with a decentralized application (dapp) on a blockchain, however, it’s much different—there’s no need to trust any person or entity.

Smart contracts run exactly as programmed; therefore, no overseer is necessary. Trust is placed in the software code to prevent interference and any single point of failure (a collapse of one aspect of the system that would cause a breakdown of the entire system). 

To that end, smart contract code should undergo rigorous security audits, similar to the security and verification efforts surrounding the launch of Multi-Collateral Dai (MCD) on the Maker Protocol in 2019. Such reviews are especially critical for digital currencies and financial systems. 

ERC-20 Token Contracts

On the Ethereum platform, some smart contracts represent and manage tokens. The Dai token contract, for instance, manages the accounting for external Dai balances and issues approvals for transfers. Like many other tokens on Ethereum, Dai was created according to a widely-accepted standard called ERC-20. 

The ERC-20 standard encompasses rules for token operation. It also enables composable infrastructure and interoperability between different projects. In other words, because Dai is an ERC-20 token, it can easily be integrated into dapps on the Ethereum blockchain that are compatible with the ERC-20 standard. As such, Dai is composable money.    

What’s more, because any ERC-20 token can be added as a collateral asset to the Maker Protocol (if approved by Maker governance), the smart contract into which one asset is deposited in order to generate Dai can be used as an open source template to create another. This is done through contract adapter code.

Ethereum smart contracts enable the creation of NFTs, including those used in blockchain-enabled games.
A snippet of contract adaptor code used to create smart contracts for most collateral types.

ERC-721 Non-Fungible Token (NFT) Contracts

While most tokens are divisible, non-fungible tokens (NFTs), which are based on the ERC-721 token standard, are used to digitally represent indivisible items. For example,  unique works of art, trading cards, and collectible objects in video games can all be represented by NFTs. The smart contracts behind these tokens not only enable the items to be sold and traded efficiently and securely, but also prove origin and ownership. NFTs now represent a large and fast-growing element of the token economy. 

Ethereum smart contract adaptor code acts as a type of template to help create smart contracts for most collateral types.
DAInerys Vaultborn is a Dai-branded NFT  used in the blockchain-enabled game Forgotten Artifacts.

Because NFTs have value, there is no reason they could not be added to the Maker Protocol as collateral types, if approved by Maker governance. For example, a piece of art or a classic car could be used as collateral against which Dai could be generated.

Smart Contracts for Maker Governance

MakerDAO is self-governed, meaning that holders of MKR, its governance token, participate in polls and executive votes to make changes and additions to the Maker Protocol, its processes, and the DAO itself. Importantly, the voting process is written in smart contracts.

Individual MKR holders interact with the voting contract, and their decisions are recorded permanently on the blockchain for transparency. That contract collects the votes, which are weighted in proportion to the number of MKR tokens each user deploys to the voting contract. So, larger holders have greater influence. The voting contract then trustlessly processes and records the vote results. 

Next, another smart contract is created to implement the changes agreed to by voters. Currently, a member of the Maker Foundation’s Smart Contract Team creates that contract, which is called a “spell.”  As Maker governance moves toward complete decentralization, a goal is to make the process of spells automatic, removing a single point of failure.

This process of smart contract-powered governance is what allows MakerDAO to function as a Decentralized Autonomous Organization.

Ethereum Smart Contracts: The Backbone of Dai, the Maker Protocol, and DeFi 

Ethereum smart contracts are self-executing agreements that power decentralized tokens, dapps, and protocols. They underpin every major element of MakerDAO, from Dai creation to governance, providing a robust set of financial tools that fuel DeFi.  Thanks to smart contracts, anyone can generate Dai and enjoy the fundamental benefits of transparency, security, and efficiency.

The Maker Foundation publishes educational and informative content on the Maker blog and its social media channels. The MakerDAO Forum is a major hub of grassroots community-written materials and activity, and the starting point for in-depth discussions regarding the Maker Protocol and Maker governance. 

September 15, 2020