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...ifelse.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 ifElse{
//we can't use if and else on contract level
function func(uint _x) public pure returns(string memory){
string memory val;
if(_x>100){
@ArslanKathia
ArslanKathia / contracts...ternaryop.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 ternaryOperator{
function func(uint _x) public pure returns(string memory){
string memory val;
@ArslanKathia
ArslanKathia / contracts...loops.sol
Created January 26, 2023 17:28
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 loops{
function loopss() public pure returns(uint){
uint count = 0;
for(uint i=0;i<10;i++){
@ArslanKathia
ArslanKathia / contracts...fixedsize.sol
Created January 26, 2023 17:28
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 fixedSizeArray{
uint[5] public arr = [10,20,30,50,70];
uint[10] arr2;
uint[5] public arr3;
@ArslanKathia
ArslanKathia / contracts...dynamicsizearray.sol
Created January 26, 2023 17:28
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 dynamicSizeArray{
uint[] public dArray = [10,20,30,40,5,6,7,8,9];
function func() public {
//update
@ArslanKathia
ArslanKathia / contracts...fixedsizebytes.sol
Created January 26, 2023 17:28
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 Bytes{
//dynamic bytes
bytes public temp;
@ArslanKathia
ArslanKathia / contracts...enums.sol
Created January 26, 2023 17:28
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 ENUMS{
enum Status{
PENDING,
PROCESSING,
DELAYED,
@ArslanKathia
ArslanKathia / contracts...structure.sol
Created January 26, 2023 17:28
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 Structure{
//structure are reference type data type which save the address or reference.
struct Employee{
string name;
uint age;
uint salary;
address account;
@ArslanKathia
ArslanKathia / contracts...mapping.sol
Created January 26, 2023 17:29
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;
struct donate_dts{
string name;
uint age;
string location;
uint donation;
}
@ArslanKathia
ArslanKathia / contracts...visibility.sol
Created January 26, 2023 17:29
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 A{
uint private x=10;
uint internal y=100;
uint public z=200;