17 Smart Contracts Powering the Celo Protocol
Hello Developers 🌱
Welcome to today’s post, where we’ll break down a blockchain topic into bite-sized pieces to help you learn and apply your new skills in the real world.
Today’s topic is Celo Core Contracts.
Here’s an overview of what we’ll cover 🗒
- ✅ What is the Celo Protocol?
- ✅ Celo Core Contracts
- ✅ Navigating contract resources
- ✅ Core Contract Details
By the end of this post, you’ll be able to navigate many of the Celo Core Contracts and have the tools to explore the Celo protocol.
Let’s go! 🚀
What is the Celo Protocol?
The Celo protocol is a fully EVM compatible, proof-of-stake, carbon-negative, layer-1 protocol, featuring a fast ultralight client and built-in seigniorage stablecoins, collateralized by crypto and natural assets.
New to Celo? Everything you need to get started with Celo
The Celo Full-Stack Solution
Celo provides a full-stack blockchain solution where each layer is designed to ensure the speed, security, and stability of every application built on the Celo platform.
The Celo Blockchain is an open cryptographic protocol that allows applications to make transactions and run smart contracts. A growing collection of Celo Core Contracts run on the Celo Blockchain defining the platform logic including ERC-20 stable currencies, identity attestations, proof-of-stake, and governance. These contracts are used by developers build Applications that take advantage of innovations in the Celo Protocol.
Celo Core Contracts
The Celo Core Contracts are divided into four main groups: common, governance, identity, and stability. Each has its own folder and is available in the contracts folder.
The common folder holds files used throughout the protocol including the registry, utilities, and the CELO native asset. The governance folder handles validator elections, proposals, and rewards. The identity folder handles functions that link accounts to cell phones or other unique identifiers. Finally, the stability folder manages Celo stable coin functions including the reserve and on-chain exchanges.
View code: View Celo Core Contracts on GitHub
Contract release process
Changes to core smart contracts are made using on-chain Governance approximately four times a year. When a release is made, all smart contracts from the release branch that differ from the deployed smart contracts are released and included in the same governance proposal.
Learn more: Celo Core Contract Release Process
Secure smart contracts with OpenZeppelin
OpenZeppelin provides a service to verify smart contract security by performing smart contract audits. Celo has received and implemented all feedback from the thorough audit reports provided by the OpenZeppelin engineering team to ensure the security of their contracts.
Learn more: OpenZeppelin Audit & Audit Release 5
Navigating contract resources
The core contracts in this post include a link to the code and unit tests in GitHub, block explorer in Blockscout, and CLI commands or documentation when available.
Code
Read the smart contract code in GitHub to learn more about the structure and logic defined in the Celo platform.
Learn more: Solidity smart contract programming language
Blockscout
Navigate the contract address details in Blockscout to learn more about the contract usage, history, code, along with other contract details.
Learn more: Blockscout documentation
Unit tests
Explore the unit tests to see how each contract adheres to functional correctness and security best practices.
Learn more: Smart contract unit testing
Smart contract address
The smart contract address is the location of the deployed smart contract on the Celo blockchain.
Address: 0xed68f8B11240249382478631bA0185473984aaf7
Core Contract Details
Now you can start exploring 17 of the Celo core contracts!
Accounts
Maps an address to an account in storage.
Address: 0xccF3e2a7c06A515E36F547c6eB563dc8E00d3c08
Attestations
Contract mapping identifiers to accounts.
Address: 0xD787384d91a7fFaC85d51C63EF71580df6C677B7
Locked Gold
Allows users to lock CELO by sending it to the contract.
Address: 0xc683d91656ED9024ADDD7a40A181398E0258283F
Escrow
Utilizes Celo’s Lightweight identity feature to allow users to send payments to other users who don’t yet have a public/private key pair or an address.
- Code
- Blockscout
- Unit Tests
Address: 0xf4Fa51472Ca8d72AF678975D9F8795A504E7ada5
Exchange
Contract that allows to exchange StableToken for GoldToken and vice versa using a Constant Product Market Maker Model
Address: 0x67316300f17f063085Ca8bCa4bd3f7a5a3C66275
FeeCurrencyWhitelist
Holds a whitelist of the ERC20+ tokens that can be used to pay for gas.
Address: 0xBB024E9cdCB2f9E34d893630D19611B8A5381b3c
GasPriceMinimum
Stores and provides gas price minimum for various currencies.
Address: 0xDfca3a8d7699D8bAfe656823AD60C17cb8270ECC
GoldToken
Specifies standards for the Celo native asset, known as CELO.
Address: 0x471EcE3750Da237f93B8E339c536989b8978a438
Governance
A contract for making, passing, and executing on-chain governance proposals.
Address: 0xD533Ca259b330c7A88f74E000a3FaEa2d63B7972
Granda Mento
A mechanism for exchanging large amounts of CELO for Celo stable tokens that aren’t suitable for Mento or over-the-counter (OTC).
Address: 0x03f6842B82DD2C9276931A17dd23D73C16454a49
MultiSig
Allows multiple parties to agree on transactions before execution.
Address: 0xed68f8B11240249382478631bA0185473984aaf7
Random
Provides randomness for verifier selection
Address: 0xE43ea9C641a2af9959CaEEe54aDB089F65457028
Registry
Routes identifiers to addresses.
Address: 0x203fdf86A00999107Df531fa00b4bA81d674cb66
Reserve
Ensures price stability of StableTokens with respect to their pegs.
Address: 0xc683e6f77B58D814B31F8661331EbDf63785D607
SortedOracles
Maintains a sorted list of oracle exchange rates between CELO and other currencies.
Address: 0x6CEB70e9237dfE15eDC4A35aAd1598225609d171
StableToken
An ERC20 compliant token with adjustable supply.
Address: 0x18E6BFDc909063F7445E410a5495264619495bCB
Validators
A contract for registering and electing Validator Groups and Validators.
Address: 0x2e3b47Cf3163dE47E852ff11D53a9ad8dFE7C68D
Congratulations 🎉
That wraps up today’s topic on Celo Core Contracts. You can review each of the items we covered below and check that you’re ready to apply these new skills.
Here’s a quick review of what we covered 🤔
- ✅ What is the Celo Protocol?
- ✅ Celo Core Contracts
- ✅ Navigating contract resources
- ✅ Core Contract Details
Explore the code, unit tests, block explorer, documentation for any contract you find in the contracts folder. Hopefully, you’ve learned a few things about Getting started with the Celo CLI that you can apply in the real world.
GN! 👋