Created
October 31, 2023 16:56
-
-
Save AryanGodara/e33c2c31be87390fa711d4cb2309de6f to your computer and use it in GitHub Desktop.
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.19+commit.7dd6d404.js&optimize=false&runs=200&gist=
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Minified by jsDelivr using Terser v5.19.2. | |
* Original file: /npm/virtual@0.2.0/dist/index.js | |
* | |
* Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files | |
*/ | |
"use strict";var _slice=Array.prototype.slice,_inherits=function(t,e){t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(t.__proto__=e)};require("6to5/polyfill");var _=require("lodash"),should=require("should"),Promise=(global||window).Promise=require("bluebird"),__DEV__="production"!==process.env.NODE_ENV,__PROD__=!__DEV__,__BROWSER__="object"==typeof window,__NODE__=!__BROWSER__;__DEV__&&Promise.longStackTraces();var VirtualMethodCall=function(){var t=TypeError,e=function(t){this.message="Attempting to call virtual method "+t+"."};return _inherits(e,t),e}(),VirtualMethodNotImplemented=function(){var t=TypeError,e=function(t){this.message="Virtual method "+t+" not implemented."};return _inherits(e,t),e}(),__virtualMethod=function(t){return function(){if(__DEV__)throw new VirtualMethodCall(t)}};module.exports=function(){var t=_slice.call(arguments),e={};t.forEach((function(t){return e[t]=__virtualMethod(t)}));var r=function(){var r=this;__DEV__&&t.forEach((function(t){if(r[t]===e[t])throw new VirtualMethodNotImplemented(t)}))};return Object.assign(r.prototype,e),r}; | |
//# sourceMappingURL=/sm/229e18aaa3ded5fb167da8f191bcdb094f71a7ae000c69139a4cbc561ebf8360.map |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// SPDX-License-Identifier: MIT | |
pragma solidity 0.8.19; | |
import "./SimpleStorage.sol"; | |
contract AddFiveStorage is SimpleStorage { | |
function store(uint256 _favoriteNumber) public override { | |
myFavoriteNumber = _favoriteNumber + 5; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"id": "424cae3eff903d22d2faff7268cd953b", | |
"_format": "hh-sol-build-info-1", | |
"solcVersion": "0.8.19", | |
"solcLongVersion": "0.8.19+commit.7dd6d404", | |
"input": { | |
"language": "Solidity", | |
"sources": { | |
"SimpleStorage.sol": { | |
"content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.19; // Stating our version \n\ncontract SimpleStorage {\n \n}" | |
} | |
}, | |
"settings": { | |
"optimizer": { | |
"enabled": false, | |
"runs": 200 | |
}, | |
"outputSelection": { | |
"*": { | |
"": [ | |
"ast" | |
], | |
"*": [ | |
"abi", | |
"metadata", | |
"devdoc", | |
"userdoc", | |
"storageLayout", | |
"evm.legacyAssembly", | |
"evm.bytecode", | |
"evm.deployedBytecode", | |
"evm.methodIdentifiers", | |
"evm.gasEstimates", | |
"evm.assembly" | |
] | |
} | |
} | |
} | |
}, | |
"output": { | |
"contracts": { | |
"SimpleStorage.sol": { | |
"SimpleStorage": { | |
"abi": [], | |
"devdoc": { | |
"kind": "dev", | |
"methods": {}, | |
"version": 1 | |
}, | |
"evm": { | |
"assembly": " /* \"SimpleStorage.sol\":81:112 contract SimpleStorage {... */\n mstore(0x40, 0x80)\n callvalue\n dup1\n iszero\n tag_1\n jumpi\n 0x00\n dup1\n revert\ntag_1:\n pop\n dataSize(sub_0)\n dup1\n dataOffset(sub_0)\n 0x00\n codecopy\n 0x00\n return\nstop\n\nsub_0: assembly {\n /* \"SimpleStorage.sol\":81:112 contract SimpleStorage {... */\n mstore(0x40, 0x80)\n 0x00\n dup1\n revert\n\n auxdata: 0xa2646970667358221220d683fcc73194e5aaaa9659fdb036a2f2823b472a077606a75370b3391f35f7e664736f6c63430008130033\n}\n", | |
"bytecode": { | |
"functionDebugData": {}, | |
"generatedSources": [], | |
"linkReferences": {}, | |
"object": "6080604052348015600f57600080fd5b50603f80601d6000396000f3fe6080604052600080fdfea2646970667358221220d683fcc73194e5aaaa9659fdb036a2f2823b472a077606a75370b3391f35f7e664736f6c63430008130033", | |
"opcodes": "PUSH1 0x80 PUSH1 0x40 MSTORE CALLVALUE DUP1 ISZERO PUSH1 0xF JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH1 0x3F DUP1 PUSH1 0x1D PUSH1 0x0 CODECOPY PUSH1 0x0 RETURN INVALID PUSH1 0x80 PUSH1 0x40 MSTORE PUSH1 0x0 DUP1 REVERT INVALID LOG2 PUSH5 0x6970667358 0x22 SLT KECCAK256 0xD6 DUP4 0xFC 0xC7 BALANCE SWAP5 0xE5 0xAA 0xAA SWAP7 MSIZE REVERT 0xB0 CALLDATASIZE LOG2 CALLCODE DUP3 EXTCODESIZE SELFBALANCE 0x2A SMOD PUSH23 0x6A75370B3391F35F7E664736F6C634300081300330000 ", | |
"sourceMap": "81:31:0:-:0;;;;;;;;;;;;;;;;;;;" | |
}, | |
"deployedBytecode": { | |
"functionDebugData": {}, | |
"generatedSources": [], | |
"immutableReferences": {}, | |
"linkReferences": {}, | |
"object": "6080604052600080fdfea2646970667358221220d683fcc73194e5aaaa9659fdb036a2f2823b472a077606a75370b3391f35f7e664736f6c63430008130033", | |
"opcodes": "PUSH1 0x80 PUSH1 0x40 MSTORE PUSH1 0x0 DUP1 REVERT INVALID LOG2 PUSH5 0x6970667358 0x22 SLT KECCAK256 0xD6 DUP4 0xFC 0xC7 BALANCE SWAP5 0xE5 0xAA 0xAA SWAP7 MSIZE REVERT 0xB0 CALLDATASIZE LOG2 CALLCODE DUP3 EXTCODESIZE SELFBALANCE 0x2A SMOD PUSH23 0x6A75370B3391F35F7E664736F6C634300081300330000 ", | |
"sourceMap": "81:31:0:-:0;;;;;" | |
}, | |
"gasEstimates": { | |
"creation": { | |
"codeDepositCost": "12600", | |
"executionCost": "66", | |
"totalCost": "12666" | |
} | |
}, | |
"legacyAssembly": { | |
".code": [ | |
{ | |
"begin": 81, | |
"end": 112, | |
"name": "PUSH", | |
"source": 0, | |
"value": "80" | |
}, | |
{ | |
"begin": 81, | |
"end": 112, | |
"name": "PUSH", | |
"source": 0, | |
"value": "40" | |
}, | |
{ | |
"begin": 81, | |
"end": 112, | |
"name": "MSTORE", | |
"source": 0 | |
}, | |
{ | |
"begin": 81, | |
"end": 112, | |
"name": "CALLVALUE", | |
"source": 0 | |
}, | |
{ | |
"begin": 81, | |
"end": 112, | |
"name": "DUP1", | |
"source": 0 | |
}, | |
{ | |
"begin": 81, | |
"end": 112, | |
"name": "ISZERO", | |
"source": 0 | |
}, | |
{ | |
"begin": 81, | |
"end": 112, | |
"name": "PUSH [tag]", | |
"source": 0, | |
"value": "1" | |
}, | |
{ | |
"begin": 81, | |
"end": 112, | |
"name": "JUMPI", | |
"source": 0 | |
}, | |
{ | |
"begin": 81, | |
"end": 112, | |
"name": "PUSH", | |
"source": 0, | |
"value": "0" | |
}, | |
{ | |
"begin": 81, | |
"end": 112, | |
"name": "DUP1", | |
"source": 0 | |
}, | |
{ | |
"begin": 81, | |
"end": 112, | |
"name": "REVERT", | |
"source": 0 | |
}, | |
{ | |
"begin": 81, | |
"end": 112, | |
"name": "tag", | |
"source": 0, | |
"value": "1" | |
}, | |
{ | |
"begin": 81, | |
"end": 112, | |
"name": "JUMPDEST", | |
"source": 0 | |
}, | |
{ | |
"begin": 81, | |
"end": 112, | |
"name": "POP", | |
"source": 0 | |
}, | |
{ | |
"begin": 81, | |
"end": 112, | |
"name": "PUSH #[$]", | |
"source": 0, | |
"value": "0000000000000000000000000000000000000000000000000000000000000000" | |
}, | |
{ | |
"begin": 81, | |
"end": 112, | |
"name": "DUP1", | |
"source": 0 | |
}, | |
{ | |
"begin": 81, | |
"end": 112, | |
"name": "PUSH [$]", | |
"source": 0, | |
"value": "0000000000000000000000000000000000000000000000000000000000000000" | |
}, | |
{ | |
"begin": 81, | |
"end": 112, | |
"name": "PUSH", | |
"source": 0, | |
"value": "0" | |
}, | |
{ | |
"begin": 81, | |
"end": 112, | |
"name": "CODECOPY", | |
"source": 0 | |
}, | |
{ | |
"begin": 81, | |
"end": 112, | |
"name": "PUSH", | |
"source": 0, | |
"value": "0" | |
}, | |
{ | |
"begin": 81, | |
"end": 112, | |
"name": "RETURN", | |
"source": 0 | |
} | |
], | |
".data": { | |
"0": { | |
".auxdata": "a2646970667358221220d683fcc73194e5aaaa9659fdb036a2f2823b472a077606a75370b3391f35f7e664736f6c63430008130033", | |
".code": [ | |
{ | |
"begin": 81, | |
"end": 112, | |
"name": "PUSH", | |
"source": 0, | |
"value": "80" | |
}, | |
{ | |
"begin": 81, | |
"end": 112, | |
"name": "PUSH", | |
"source": 0, | |
"value": "40" | |
}, | |
{ | |
"begin": 81, | |
"end": 112, | |
"name": "MSTORE", | |
"source": 0 | |
}, | |
{ | |
"begin": 81, | |
"end": 112, | |
"name": "PUSH", | |
"source": 0, | |
"value": "0" | |
}, | |
{ | |
"begin": 81, | |
"end": 112, | |
"name": "DUP1", | |
"source": 0 | |
}, | |
{ | |
"begin": 81, | |
"end": 112, | |
"name": "REVERT", | |
"source": 0 | |
} | |
] | |
} | |
}, | |
"sourceList": [ | |
"SimpleStorage.sol", | |
"#utility.yul" | |
] | |
}, | |
"methodIdentifiers": {} | |
}, | |
"metadata": "{\"compiler\":{\"version\":\"0.8.19+commit.7dd6d404\"},\"language\":\"Solidity\",\"output\":{\"abi\":[],\"devdoc\":{\"kind\":\"dev\",\"methods\":{},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"SimpleStorage.sol\":\"SimpleStorage\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":false,\"runs\":200},\"remappings\":[]},\"sources\":{\"SimpleStorage.sol\":{\"keccak256\":\"0x2af861643f44d70f4b780f01f1e7ac9ba3a3c2d2b84adb4faa35842fc523d0a6\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://2683ae46c6f55e51d0f13554d454ab5492fd53df35d0fa9cf749027f645ed529\",\"dweb:/ipfs/QmUDoqtaua5s1B3Dax8be9Lcp6PcxMMtq5pWouEQmEBctc\"]}},\"version\":1}", | |
"storageLayout": { | |
"storage": [], | |
"types": null | |
}, | |
"userdoc": { | |
"kind": "user", | |
"methods": {}, | |
"version": 1 | |
} | |
} | |
} | |
}, | |
"sources": { | |
"SimpleStorage.sol": { | |
"ast": { | |
"absolutePath": "SimpleStorage.sol", | |
"exportedSymbols": { | |
"SimpleStorage": [ | |
2 | |
] | |
}, | |
"id": 3, | |
"license": "MIT", | |
"nodeType": "SourceUnit", | |
"nodes": [ | |
{ | |
"id": 1, | |
"literals": [ | |
"solidity", | |
"0.8", | |
".19" | |
], | |
"nodeType": "PragmaDirective", | |
"src": "32:23:0" | |
}, | |
{ | |
"abstract": false, | |
"baseContracts": [], | |
"canonicalName": "SimpleStorage", | |
"contractDependencies": [], | |
"contractKind": "contract", | |
"fullyImplemented": true, | |
"id": 2, | |
"linearizedBaseContracts": [ | |
2 | |
], | |
"name": "SimpleStorage", | |
"nameLocation": "90:13:0", | |
"nodeType": "ContractDefinition", | |
"nodes": [], | |
"scope": 3, | |
"src": "81:31:0", | |
"usedErrors": [] | |
} | |
], | |
"src": "32:80:0" | |
}, | |
"id": 0 | |
} | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"deploy": { | |
"VM:-": { | |
"linkReferences": {}, | |
"autoDeployLib": true | |
}, | |
"main:1": { | |
"linkReferences": {}, | |
"autoDeployLib": true | |
}, | |
"ropsten:3": { | |
"linkReferences": {}, | |
"autoDeployLib": true | |
}, | |
"rinkeby:4": { | |
"linkReferences": {}, | |
"autoDeployLib": true | |
}, | |
"kovan:42": { | |
"linkReferences": {}, | |
"autoDeployLib": true | |
}, | |
"goerli:5": { | |
"linkReferences": {}, | |
"autoDeployLib": true | |
}, | |
"Custom": { | |
"linkReferences": {}, | |
"autoDeployLib": true | |
} | |
}, | |
"data": { | |
"bytecode": { | |
"functionDebugData": {}, | |
"generatedSources": [], | |
"linkReferences": {}, | |
"object": "6080604052348015600f57600080fd5b50603f80601d6000396000f3fe6080604052600080fdfea2646970667358221220d683fcc73194e5aaaa9659fdb036a2f2823b472a077606a75370b3391f35f7e664736f6c63430008130033", | |
"opcodes": "PUSH1 0x80 PUSH1 0x40 MSTORE CALLVALUE DUP1 ISZERO PUSH1 0xF JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH1 0x3F DUP1 PUSH1 0x1D PUSH1 0x0 CODECOPY PUSH1 0x0 RETURN INVALID PUSH1 0x80 PUSH1 0x40 MSTORE PUSH1 0x0 DUP1 REVERT INVALID LOG2 PUSH5 0x6970667358 0x22 SLT KECCAK256 0xD6 DUP4 0xFC 0xC7 BALANCE SWAP5 0xE5 0xAA 0xAA SWAP7 MSIZE REVERT 0xB0 CALLDATASIZE LOG2 CALLCODE DUP3 EXTCODESIZE SELFBALANCE 0x2A SMOD PUSH23 0x6A75370B3391F35F7E664736F6C634300081300330000 ", | |
"sourceMap": "81:31:0:-:0;;;;;;;;;;;;;;;;;;;" | |
}, | |
"deployedBytecode": { | |
"functionDebugData": {}, | |
"generatedSources": [], | |
"immutableReferences": {}, | |
"linkReferences": {}, | |
"object": "6080604052600080fdfea2646970667358221220d683fcc73194e5aaaa9659fdb036a2f2823b472a077606a75370b3391f35f7e664736f6c63430008130033", | |
"opcodes": "PUSH1 0x80 PUSH1 0x40 MSTORE PUSH1 0x0 DUP1 REVERT INVALID LOG2 PUSH5 0x6970667358 0x22 SLT KECCAK256 0xD6 DUP4 0xFC 0xC7 BALANCE SWAP5 0xE5 0xAA 0xAA SWAP7 MSIZE REVERT 0xB0 CALLDATASIZE LOG2 CALLCODE DUP3 EXTCODESIZE SELFBALANCE 0x2A SMOD PUSH23 0x6A75370B3391F35F7E664736F6C634300081300330000 ", | |
"sourceMap": "81:31:0:-:0;;;;;" | |
}, | |
"gasEstimates": { | |
"creation": { | |
"codeDepositCost": "12600", | |
"executionCost": "66", | |
"totalCost": "12666" | |
} | |
}, | |
"methodIdentifiers": {} | |
}, | |
"abi": [] | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"compiler": { | |
"version": "0.8.19+commit.7dd6d404" | |
}, | |
"language": "Solidity", | |
"output": { | |
"abi": [], | |
"devdoc": { | |
"kind": "dev", | |
"methods": {}, | |
"version": 1 | |
}, | |
"userdoc": { | |
"kind": "user", | |
"methods": {}, | |
"version": 1 | |
} | |
}, | |
"settings": { | |
"compilationTarget": { | |
"SimpleStorage.sol": "SimpleStorage" | |
}, | |
"evmVersion": "paris", | |
"libraries": {}, | |
"metadata": { | |
"bytecodeHash": "ipfs" | |
}, | |
"optimizer": { | |
"enabled": false, | |
"runs": 200 | |
}, | |
"remappings": [] | |
}, | |
"sources": { | |
"SimpleStorage.sol": { | |
"keccak256": "0x2af861643f44d70f4b780f01f1e7ac9ba3a3c2d2b84adb4faa35842fc523d0a6", | |
"license": "MIT", | |
"urls": [ | |
"bzz-raw://2683ae46c6f55e51d0f13554d454ab5492fd53df35d0fa9cf749027f645ed529", | |
"dweb:/ipfs/QmUDoqtaua5s1B3Dax8be9Lcp6PcxMMtq5pWouEQmEBctc" | |
] | |
} | |
}, | |
"version": 1 | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// SPDX-License-Identifier: MIT | |
pragma solidity 0.8.19; | |
contract SimpleStorage { | |
uint256 myFavoriteNumber; | |
struct Person { | |
uint256 favoriteNumber; | |
string name; | |
} | |
// uint256[] public anArray; // Int array | |
Person[] public listOfPeople; // Array of Person(s) struct | |
mapping(string => uint256) public nameToFavorite; // Hashmap | |
function store(uint256 _favoriteNumber) public virtual { | |
myFavoriteNumber = _favoriteNumber; | |
} | |
function retrieve() public view returns (uint256) { | |
return myFavoriteNumber; | |
} | |
function addPerson(string memory _name, uint256 _favoriteNumber) public { | |
listOfPeople.push(Person(_favoriteNumber, _name)); | |
nameToFavorite[_name] = _favoriteNumber; | |
} | |
} | |
contract SimpleStorage2{} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// SPDX-License-Identifier: MIT | |
pragma solidity 0.8.19; | |
// import {SimpleStorage, SimpleStorage2} from "./SimpleStorage.sol"; | |
import {SimpleStorage} from "./SimpleStorage.sol"; | |
contract StorageFactory { | |
SimpleStorage[] public listOfSimpleStorageContracts; | |
function createSimpleStorageContract() public { | |
SimpleStorage simpleStorageContractVariable = new SimpleStorage(); | |
// SimpleStorage simpleStorage = new SimpleStorage(); | |
listOfSimpleStorageContracts.push(simpleStorageContractVariable); | |
} | |
function sfStore( | |
uint256 _simpleStorageIndex, | |
uint256 _simpleStorageNumber | |
) public { | |
// Address | |
// ABI | |
// SimpleStorage(address(simpleStorageArray[_simpleStorageIndex])).store(_simpleStorageNumber); | |
listOfSimpleStorageContracts[_simpleStorageIndex].store( | |
_simpleStorageNumber | |
); | |
} | |
function sfGet(uint256 _simpleStorageIndex) public view returns (uint256) { | |
// return SimpleStorage(address(simpleStorageArray[_simpleStorageIndex])).retrieve(); | |
return listOfSimpleStorageContracts[_simpleStorageIndex].retrieve(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment