Skip to content

Instantly share code, notes, and snippets.

View ArslanKathia's full-sized avatar
🌏
Working from home

Arslan Maqbool ArslanKathia

🌏
Working from home
View GitHub Profile
@ArslanKathia
ArslanKathia / contracts...sample.sol
Created January 26, 2023 17:25
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.8.7+commit.e28d00a7.js&optimize=false&runs=200&gist=
// SPDX-License-Identifier: MIT
pragma solidity ^0.8;
contract ownable{
address public owner;
constructor(){
owner = msg.sender;
}
@ArslanKathia
ArslanKathia / contracts...valuetype.sol
Created January 26, 2023 17:26
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.8.7+commit.e28d00a7.js&optimize=false&runs=200&gist=
// SPDX-License-Identifier: MIT
pragma solidity ^0.8;
//data type & value type - references
contract valueType{
bool public boolTemp = true;
uint public temp = 2335;
@ArslanKathia
ArslanKathia / contracts...funcintro.sol
Created January 26, 2023 17:26
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.8.7+commit.e28d00a7.js&optimize=false&runs=200&gist=
// SPDX-License-Identifier: MIT
pragma solidity ^0.8;
contract funcIntro{
uint age;
function add(uint _x,uint _y) public pure returns(uint){
return _x + _y;
@ArslanKathia
ArslanKathia / contracts...statevariable.sol
Created January 26, 2023 17:26
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.8.7+commit.e28d00a7.js&optimize=false&runs=200&gist=
// SPDX-License-Identifier: MIT
pragma solidity ^0.8;
contract stateVariable{
//state variable which is defined in contract but used outside of the functions
//state variable stored on blockchain block storage so we can't create extra state variable bcz its cost gas
uint public salary;
constructor(){
@ArslanKathia
ArslanKathia / contracts...localvariable.sol
Created January 26, 2023 17:26
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.8.7+commit.e28d00a7.js&optimize=false&runs=200&gist=
// SPDX-License-Identifier: MIT
pragma solidity ^0.8;
contract localVariable{
//local variable created in functions that are local
//when function work is done that local variable work washout from RAM as well
uint public age;
bool public b;
address public addr;
@ArslanKathia
ArslanKathia / contracts...globalvariable.sol
Created January 26, 2023 17:26
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.8.7+commit.e28d00a7.js&optimize=false&runs=200&gist=
//SPDX-License-Identifier: MIT
pragma solidity ^0.8;
contract gloablVariable{
//predefined variable used in workspace is global variable
address public addr = msg.sender;
uint public timestamp = block.timestamp;
uint public diff = block.difficulty;
uint public gasprice = tx.gasprice;
@ArslanKathia
ArslanKathia / contracts...viewpure.sol
Created January 26, 2023 17:27
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.8.7+commit.e28d00a7.js&optimize=false&runs=200&gist=
// SPDX-License-Identifier: MIT
pragma solidity ^0.8;
contract viewAndPureFunctions{
uint public age;
constructor(){
age =20;
}
@ArslanKathia
ArslanKathia / contracts...defaultValue.sol
Created January 26, 2023 17:27
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.8.7+commit.e28d00a7.js&optimize=false&runs=200&gist=
// SPDX-License-Identifier: MIT
pragma solidity ^0.8;
contract defaultValue{
uint public x;
bool public y;
string public str;
address public addr;
bytes32 public b32;
@ArslanKathia
ArslanKathia / contracts...strings.sol
Created January 26, 2023 17:27
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.8.7+commit.e28d00a7.js&optimize=false&runs=200&gist=
// SPDX-License-Identifier: MIT
pragma solidity ^0.8;
contract _string{
string public str= "gateway"; //state variable
//constant keyword variable charge lower gas than other variable
address public constant ownerAddress = 0x5B38Da6a701c568545dCfcB03FcB875f56beddC4; //lower gas cost
@ArslanKathia
ArslanKathia / contracts...constructor.sol
Created January 26, 2023 17:27
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.8.7+commit.e28d00a7.js&optimize=false&runs=200&gist=
//SPDX-License-Identifier: MIT
pragma solidity ^0.8;
contract CONSTRUCTOR{
//contract level
/**
inside the contract and outside of function
**/
uint public age;