{"id":13790753,"url":"https://github.com/arbazkiraak/SmartContractLearning","last_synced_at":"2025-05-12T09:33:13.134Z","repository":{"id":87088881,"uuid":"364130745","full_name":"arbazkiraak/SmartContractLearning","owner":"arbazkiraak","description":"Roadmap ","archived":false,"fork":false,"pushed_at":"2021-08-27T17:46:23.000Z","size":489,"stargazers_count":17,"open_issues_count":0,"forks_count":5,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-11-18T05:38:26.375Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Solidity","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/arbazkiraak.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2021-05-04T03:40:57.000Z","updated_at":"2024-08-14T03:01:19.000Z","dependencies_parsed_at":null,"dependency_job_id":"18bd1c9c-cfed-4252-af42-696a331ff317","html_url":"https://github.com/arbazkiraak/SmartContractLearning","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arbazkiraak%2FSmartContractLearning","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arbazkiraak%2FSmartContractLearning/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arbazkiraak%2FSmartContractLearning/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arbazkiraak%2FSmartContractLearning/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/arbazkiraak","download_url":"https://codeload.github.com/arbazkiraak/SmartContractLearning/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253709407,"owners_count":21951136,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-03T22:00:50.897Z","updated_at":"2025-05-12T09:33:12.190Z","avatar_url":"https://github.com/arbazkiraak.png","language":"Solidity","funding_links":[],"categories":["Roadmap"],"sub_categories":[],"readme":"NOTES:\n\n--------\n\nSolidity code -\u003e compiles to bytecode -\u003e EVM can understand only bytecode and process the instructions in Assembly.\n\n--------\n\n1. get the amount of ether stored in this contract\n\n```\nuint amount = address(this).balance;\n```\n\n2. send ether to other address\n\n```\naddress payable public owner;\n\nuint amount = address(this).balance; // get total balance of ether in current SC\n(bool success,) = owner.call{value: amount}(\"\");\nrequire(sucess,\"Failed to  send ether to owner\")\n```\n\n\u003e Caller methods\n\n```\nmsg.data (bytes): complete calldata\nmsg.gas (uint): remaining gas.\nmsg.sender (address): send of the message (current call) : address of the caller or sender to sended eth to our SC address.\nmsg.sig (bytes4): first four bytes of  the calldata\nmsg.value (uint): number of wei send with the message : number of wei sent by the caller.\n\nmsg.value is automatically set to the amount of ether sent with that payable function.\n\ngasleft() : (uint) : number of remaining gas\n\n```\n\n-----\n\n\n```\naddress(0) -\u003e is same as 0x0 an uniniatialized address ex: 0x0000000000000000\nbalances[address(0)] then means how many tokens the address 0 (0x00000000...00) owns.\n\naddress(this) -\u003e address of the current Smart contract deployed.\naddress(this).balance -\u003e total balance amount of the current smart contract\n```\n\n-----\n\nTransactions properities : \n\n```\nblock.number (uint) : current block number\nblock.timestamp (uint) : current block timestamp as seconds since uinx epoch\nblock.gaslimit  (uint) : current block gaslimit\nblock.difficuly (uint) : current block difficulty\nblock.coinbase  (address) : current block miner's address\n\nblock.blockhash(uint blockNumber) returns (bytes32) : takes blocknumber as input, returns hash of the given block.\n\nnow(uint) : current block timestampt, same to (block.timestamp)\n\ntx.gasprice (uint) : gas price of the transaction\ntx.origin (address) : sender of the transaction address\n\n```\n\n\n-----\n\n```\nmsg.sender.transfer(1000); // transfer the 1000 wei from SC to the caller address who called the function\nmsg.sender.transfer(address(this).balance) // transfer all the SC balance amount to  the function caller address.\n```\n-----\n\n* ABI works similar like api, to call functions,variables to get information about those\n\n```\n\ncall function has a api called \"abi.encodeWithSignature\"\n\nfirst arg: is function structure along with arguments.\nsecond arg: arguments values \n\n1. _addr.call{value:msg.value,gas:5000}(\n\tabi.encodeWithSignature(\"somepublicfunction(string,uint256)\",\"this is a string\",1337) \n)\n\n```\n\n------------------\n\nHashing:\n\nKeccak-256\n\n* Like any hash, it has an infinite input space. This enables one to \"make a hash\" of a super large file. The hash should entirely change if a single bit of data in the source is different - unlike say a CRC32, or a checksum. It means your password could be a million chars long maybe. It's stored on disk as a hash, much smaller in size. fixed length\n\nhttps://emn178.github.io/online-tools/keccak_256.html\n\n-------------------------\n\nhttps://www.w3schools.com/java/java_data_types.asp -\u003e boolean takes 1 bit\n\nBitfields are to used memory in more efficient way:\n\nIn solidity `bool` is stored in 1byte(8 bits), However single bit can actually used.  \nhex value of `true` is `0x01` and `false` is `0x00` converted to binary these are `00000001` and `00000000` where 7 of the total 8 bits are not used.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farbazkiraak%2FSmartContractLearning","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Farbazkiraak%2FSmartContractLearning","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farbazkiraak%2FSmartContractLearning/lists"}