Skip to content

This repo contains cairo programs with their explanation and installation guide.

Notifications You must be signed in to change notification settings

ishitarastogi/Cairo-programs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Setting up the Environment using Protostar

Installation

curl -L https://raw.githubusercontent.com/software-mansion/protostar/master/install.sh | bash

Project initialization

protostar init

Project compilation

  • Specify contracts and their files in protostar.toml.
protostar build

Project Deployment

protostar declare ./build/main.json --network alpha-goerli

Cairo programs

  1. Print program
    In this program we will learn,
  1. 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.

  1. 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
  1. 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....

  1. Array Program

In this program we will learn,
alloc : alloc is function that help us allocate a block of memory to store our values.

Medium Link

To store a value you will alloc and alloc will give you a address which is free.

About

This repo contains cairo programs with their explanation and installation guide.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages