1/5
--- ## Overview of CVL Definitions In this section, we're going to discuss how CVL definitions function similarly to type-checked macros and how they encapsulate commonly used expressions. This will help streamline your coding process and make your code cleaner and more maintainable. ### Using CVL Definitions for Constants Consider a scenario where you're working with a common expression, like `1E18`, in your Solidity code. Instead of repeating this value throughout your code, you can define it once using CVL and reference it wherever needed. Here's how you can do it: 1. **Identify the Common Value**: In our example, `1E18` is a frequently used number that represents a significant value in Ethereum, typically used to convert Ether to Wei. 2. **Create a CVL Definition**: - **Definition**: To correct this, define it like so: ```js definition WAD() returns uint256 = 1000000000000000000; ``` Add parentheses to ensure the expression is evaluated correctly. 3. **Replace the Hard-Coded Values**: Replace all instances of `1E18` in your code with the new CVL definition. For instance, use `WAD` instead of `1E18`.
A detailed breakdown of definitions in the Certora Verification Language - This lesson explains how to use definitions to encapsulate commonly used expressions. You will learn how to declare a definition, how to use a definition, and what kind of expressions you can encapsulate within a definition.
Previous lesson
Previous
Next lesson
Next
Give us feedback
Course Overview
About the course
Assembly
Writing smart contracts using Huff and Yul
Ethereum Virtual Machine OPCodes
Formal verification testing
Smart contract invariant testing
Halmos, Certora, Kontrol
Security researcher
$49,999 - $120,000 (avg. salary)
Smart Contract Auditor
$100,000 - $200,000 (avg. salary)
Guest lecturers:
Josselin Feist
Head of Blockchain at Trail of Bits
Last updated on January 17, 2025
Solidity Developer
Assembly and Formal VerificationDuration: 30min
Duration: 4h 38min
Duration: 3h 57min
Duration: 1h 56min
Course Overview
About the course
Assembly
Writing smart contracts using Huff and Yul
Ethereum Virtual Machine OPCodes
Formal verification testing
Smart contract invariant testing
Halmos, Certora, Kontrol
Security researcher
$49,999 - $120,000 (avg. salary)
Smart Contract Auditor
$100,000 - $200,000 (avg. salary)
Guest lecturers:
Josselin Feist
Head of Blockchain at Trail of Bits
Last updated on January 17, 2025
Testimonials
Read what our students have to say about this course.
Chainlink
Chainlink
Gustavo Gonzalez
Solutions Engineer at OpenZeppelin
Francesco Andreoli
Lead Devrel at Metamask
Albert Hu
DeForm Founding Engineer
Radek
Senior Developer Advocate at Ceramic
Boidushya
WalletConnect
Idris
Developer Relations Engineer at Axelar