Compare commits

...

5 Commits

Author SHA1 Message Date
Bahador
1355436484 Merge fa02b20067 into 5ff48033e1 2023-07-10 15:49:10 +03:30
Julien Le Coupanec
5ff48033e1 Merge pull request #304 from sangeethkc/master
new laravel artisan commands added
2023-06-26 22:00:00 +02:00
SANGEETH
6c3b6ee90e Merge branch 'LeCoupa:master' into master 2023-06-26 15:24:39 +05:30
Bahador Gh
fa02b20067 Adding solidity cheatsheet 2023-01-07 15:44:05 +03:30
sangeethkc
cb9ca87a4b new laravel commands added 2022-10-18 15:27:14 +05:30
2 changed files with 260 additions and 2 deletions

View File

@@ -8,6 +8,8 @@
// MAIN.
php artisan clear-compiled // Remove the compiled class file
php artisan db // Start a new database CLI session
php artisan docs // Access the Laravel documentation
php artisan down // Put the application into maintenance mode
php artisan dump-server // Start the dump server to collect dump information.
php artisan env // Display the current framework environment
@@ -43,6 +45,9 @@ php artisan config:clear // Remove the configuration cache file
// DB
php artisan db:seed // Seed the database with records
php artisan db:show // Display information about the given database
php artisan db:table // Display information about the given database table
php artisan db:wipe // Drop all tables, views, and types
// EVENT
@@ -54,9 +59,10 @@ php artisan key:generate // Set the application key
// MAKE
php artisan make:auth // Scaffold basic login and registration views and routes
php artisan make:cast // Create a new custom Eloquent cast class
php artisan make:channel // Create a new channel class
php artisan make:command // Create a new Artisan command
php artisan make:component // Create a new view component class
php artisan make:controller // Create a new controller class
php artisan make:event // Create a new event class
php artisan make:exception // Create a new custom exception class
@@ -74,6 +80,7 @@ php artisan make:provider // Create a new service provider class
php artisan make:request // Create a new form request class
php artisan make:resource // Create a new resource
php artisan make:rule // Create a new validation rule
php artisan make:scope // Create a new scope class
php artisan make:seeder // Create a new seeder class
php artisan make:test // Create a new test class
@@ -86,6 +93,10 @@ php artisan migrate:reset // Rollback all database migrations
php artisan migrate:rollback // Rollback the last database migration
php artisan migrate:status // Show the status of each migration
// MODEL
php artisan model:prune // Prune models that are no longer needed
php artisan model:show // Show information about an Eloquent model
// NOTIFICATIONS
php artisan notifications:table // Create a migration for the notifications table
@@ -100,13 +111,19 @@ php artisan package:discover // Rebuild the cached package manifest
// QUEUE
php artisan queue:batches-table // Create a migration for the batches database table
php artisan queue:clear // Delete all of the jobs from the specified queue
php artisan queue:failed // List all of the failed queue jobs
php artisan queue:failed-table // Create a migration for the failed queue jobs database table
php artisan queue:flush // Flush all of the failed queue jobs
php artisan queue:forget // Delete a failed queue job
php artisan queue:listen // Listen to a given queue
php artisan queue:monitor // Monitor the size of the specified queues
php artisan queue:prune-batches // Prune stale entries from the batches database
php artisan queue:prune-failed // Prune stale entries from the failed jobs table
php artisan queue:restart // Restart queue worker daemons after their current job
php artisan queue:retry // Retry a failed queue job
php artisan queue:retry-batch // Retry the failed jobs for a batch
php artisan queue:table // Create a migration for the queue jobs database table
php artisan queue:work // Start processing jobs on the queue as a daemon
@@ -116,9 +133,26 @@ php artisan route:cache // Create a route cache file for faster route r
php artisan route:clear // Remove the route cache file
php artisan route:list // List all registered routes
// SAIL
php artisan sail:install // Install Laravel Sail's default Docker Compose file
php artisan sail:publish // Publish the Laravel Sail Docker files
// SANCTUM
php artisan sanctum:prune-expired // Prune tokens expired for more than specified number of hours.
// SCHEDULE
php artisan schedule:run // Run the scheduled commands
php artisan schedule:clear-cache // Delete the cached mutex files created by scheduler
php artisan schedule:list // List the scheduled commands
php artisan schedule:run // Run the scheduled commands
php artisan schedule:test // Run a scheduled command
php artisan schedule:work // Start the schedule worker
// SCHEMA
php artisan schema:dump // Dump the given database schema
// SESSION
@@ -128,6 +162,10 @@ php artisan session:table // Create a migration for the session database
php artisan storage:link // Create a symbolic link from "public/storage" to "storage/app/public"
// STUD
php artisan stub:publish // Publish all stubs that are available for customization
// VENDOR
php artisan vendor:publish // Publish any publishable assets from vendor packages

220
backend/solidity.sol Normal file
View File

@@ -0,0 +1,220 @@
/* *******************************************************************************************
* Defining Licensing of the smart contract =>
******************************************************************************************** */
// SPDX-License-Identifier: MIT
// List of allowed SPDX licenses to use => https://spdx.org/licenses/
/* *******************************************************************************************
* Defining solidity compiler(solc) version for compiling the smart contract =>
- Some possible ways to use:
- pragma solidity 0.8.0; ==> compiler version set exactly on 0.8.0 version
- pragma solidity ^0.8.0; ==> compiler version set above 0.8.0 version and lower than 0.9.0 version
- pragma solidity >= 0.7.0 < 0.9.0; ==> compiler version set equal or above 0.7.0 version and lower than 0.9.0 version
******************************************************************************************** */
pragma solidity ^0.8.0;
/* *******************************************************************************************
* Creating the smart contract => contract ContractName {}
- Note: Contracts are like classes in other programming languages.
- Note: Naming convention is like this for declaring contract: MyContract
******************************************************************************************** */
contract HelloWorld {
/* *******************************************************************************************
* Data types:
* 1) Value types:
- Value stored in smart contract storage slot
- bool
- int
- uint
- address
- bytes1 ... bytes32
- enum
* 2) Reference types:
- A reference to a stored value in smart contract storage slot will be set
- array
- string
- mapping
- struct
- bytes
******************************************************************************************** */
/* *******************************************************************************************
* Variable types:
* 1) State variables => Variables which
- Get permanently stored on blockchain(smart contract storage)
- Use most gas usage in smart contracts
- Accessible on whole smart contract
* 2) Local variables => Variables which
- Not stored on blockchain
- Use less gas in smart contracts
- Are living and working just in function body
* 3) Global variables => Variables which
- Provide information about the blockchain
- Can be used both as state variables and local variables
- Mainly used to determine contract owner and checking time
******************************************************************************************** */
/* *******************************************************************************************
* Visibility:
* 1) Variables:
- public
- private
- internal
* Ex: uint public number;
- Note: visibility is just for state variables and not applicable on local variables
- Note: default visibility of a state variable is(if we don't declare visibility scope) --> internal
- Note: if declare a variable to have 'public' scope, automatically a 'getter function' will be created for that variable
* 2) Functions:
- public
- private
- internal
- external
* Ex: function setNumber() public {}
******************************************************************************************** */
/* *******************************************************************************************
* Function types:
* 1) Non-Payable => Functions which
- Write on the blockchain
- Are our default functions type
- Are not able to accept deposits on the smart contract
* Ex: function setNumber() public {}
* 2) View => Functions which
- Are able to show us data
- Read from blockchain
* Ex: function setNumber() public view {}
* 3) Pure => Functions which
- Neither read nor write on blockchain
- Just do a specific work for us (ex: making sum of 2 numbers and returning back the value)
* Ex: function setNumber() public pure {}
* 3) Payable => Functions which
- Are able to accept Ether deposits on the smart contract
* Ex: function setNumber() public payable {}
******************************************************************************************** */
/* *******************************************************************************************
* Constructor => A function which
- Is optional
- Does not have a name
- Does not have visibility scope
- Executed during contract deployment
- Can take parameters while deploying
- Initializes smart contract state variables
- Will be at most 1 within each smart contract
- Can have payable attribute associatede with it
* Ex: constructor(uint _number) { number = _number; }
******************************************************************************************** */
/* *******************************************************************************************
* Data Locations =>
* Each variable declared and used in a contract has a data location:
- Storage:
- global memory available to all functions within a contract.
- oermanent storage that Ethereum stores on every node.
- Memory:
- local memroy available to every function within a contract.
- short living in functions.
- Calldata:
- where all incoming function execution data is stored(including function arguments)
- non-modifiable memory location(note: similar to memrory location, except it is not modifiable)
- Stack
- a stack which is maintained by EVM(Etheereum Virtual Machine) for loading variables and
intermediate values for working with Ethereum instruction set(the working set memory for the EVM).
- max limit is 1024 levels, and exceeding this limit(by storing anything more than that), raises an exception.
- Note: data location of variable, is dependent on:
- Location of the variable declaration
- Data type of the variable
- Note: We face them mostly, when are working with reference type variables.
******************************************************************************************** */
/* *******************************************************************************************
* Events =>
- Used for logging(like other languages)
- Used to notify applications about changes in contracts
- can be used to "call" JavaScript callbacks in the user interface of a dapp
- Primarily for informing the calling application about the current state of the contract
- Declared with 'event' keyword
- Firing them with 'emit' keyword
- Note: Events can be declared anonymous.
- Note: Events can have 'indexed' keyword in variable declaration(to make easier filtering of some specific data)
* Ex: event EventName(address sender,uint number)
* emit EventName(address(0), 10)
******************************************************************************************** */
/* *******************************************************************************************
* Error handling =>
* 1) Require
- Check a condition,
if true => go to next line codes,
if false => show a string message and revert to privious state
- Refund remaining gas to the caller
- Note: Use require conditions, all at beginning the function.
* Ex: require(number >= 10, "number must be greater than 10");
* 1) Revert
- Similar to require, but can have more complex conditions
- Refund remaining gas to the caller
* Ex: if(number <= 10) { revert("number must be greater than 10"); }
* 1) Assert
- Mainly used in writing contract tests
- Don't refund remaining gas to the caller
* Ex: uint number = 123;
* assert(number == 10);
******************************************************************************************** */
/* *******************************************************************************************
* Enum =>
- A user defined data type
* Ex: enum OrderStatus { pending, accepted, completed, rejected};
* OrderStatus order = OrderStatus.accepted;
******************************************************************************************** */
/* *******************************************************************************************
* Mapping =>
* Declaration: `mapping(_KeyType => _ValueType) mappingName`
- Mappings are like **Dictionary** or **hash table** which are virtually initialized
such that every possible key exists and is mapped to a specific value.
- Note: **key** can be any type which EVM internally knows about it(exceptions are: a dynamically sized array, a contract, an enum, or a struct.
- Note: **value** can actually be any type, including mappings.
******************************************************************************************** */
/* *******************************************************************************************
* Struct
* Somehow we can pack some data types(and ofcourse data values) of an specific entity with structs:
* Ex: struct UserInfo { string fName; string lName; uint8 age; address wallet;}
* UserInfo user;
******************************************************************************************** */
}