-
Notifications
You must be signed in to change notification settings - Fork 197
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add pages for describing cairo builtins
- Loading branch information
Showing
2 changed files
with
53 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
52 changes: 52 additions & 0 deletions
52
.../Starknet/modules/architecture_and_concepts/pages/Smart_Contracts/builtins.adoc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
= Cairo Builtins | ||
|
||
== Conceptual | ||
|
||
Cairo builtins form the fundamental functions powering Cairo smart contract language. They enable you, as a developer, to perform various operations efficiently within the Cairo virtual machine. Understanding Cairo builtins is crucial for you to write efficient and secure smart contracts. | ||
|
||
Cairo builtins are predefined functions provided by the Cairo runtime environment. They perform specific tasks such as arithmetic operations, bitwise manipulations, memory access, and more. These builtins are optimized for performance and are essential for you to develop complex smart contracts. | ||
|
||
== Procedural | ||
|
||
=== Using Cairo Builtins in Smart Contracts | ||
|
||
==== Overview of Cairo Builtins | ||
|
||
Cairo builtins play a vital role in Cairo smart contract development, providing you with powerful tools to implement complex logic efficiently. When writing Cairo code, invoke these builtins to perform various operations, ranging from simple arithmetic calculations to advanced memory manipulations. | ||
|
||
To invoke a builtin in Cairo, simply use its name followed by the required arguments, similar to calling a function in other programming languages. | ||
|
||
==== List of Cairo Builtins | ||
|
||
[cols="1,2"] | ||
|=== | ||
| Builtin Name | Description | ||
| add | Performs addition operation | ||
| sub | Performs subtraction operation | ||
| ... | ... | ||
|=== | ||
|
||
==== Example Usage | ||
|
||
Here are some examples of high-level Cairo code snippets demonstrating the usage of different builtins: | ||
|
||
[source, cairo] | ||
---- | ||
a := add(b, c) // Addition | ||
d := sub(e, f) // Subtraction | ||
---- | ||
|
||
In the above code, use `add` and `sub` builtins to perform addition and subtraction operations, respectively. Invoke each builtin with specific arguments, and store the result in the corresponding variables. | ||
|
||
=== Cairo Builtins Reference | ||
|
||
The following table provides a reference for Cairo builtins: | ||
|
||
[cols="1,2"] | ||
|=== | ||
| Builtin Name | Description | ||
| add | Performs addition operation | ||
| sub | Performs subtraction operation | ||
| ... | ... | ||
|=== | ||
|