Setting up the Environment using Protostar
curl -L https://raw.githubusercontent.com/software-mansion/protostar/master/install.sh | bash
protostar init
- Specify contracts and their files in protostar.toml.
protostar build
protostar declare ./build/main.json --network alpha-goerli
- Print program
In this program we will learn,
- Use of output_ptr builtins and implicit arguments
- Variable Program
In this program we will learn,
- Diff bw let , tempvar and local variables
a) const used for constants, can not be re-assigned. local used for local variables. Can not be re-assigned and requires adding alloc_locals to the function. tempvar used for temporary variables. They can be re-assigned. let used to create alias by value or by reference to other variables. Can be re-assigned.
- constructors Program
In this program we will learn,
- Using constructor and deployment by passing arguments
protostar deploy ./build/main.json --inputs 123 200 --network alpha-goerli
- Revoked references Program
In this program we will learn,
-
The scope of some types of references in Cairo (e.g., return values of functions and temporary variables) is somewhat restricted.
-
a call to another function may revoke those references.
to be continued....
In this program we will learn,
alloc : alloc is function that help us allocate a block of memory to store our values.
To store a value you will alloc and alloc will give you a address which is free.