Created
March 29, 2022 14:37
-
-
Save amkurian/49d506346245190a155d20b125648795 to your computer and use it in GitHub Desktop.
StorageFactory.sol
This file contains hidden or 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.6.0; | |
import "./SimpleStorage.sol"; | |
contract StorageFactory is SimpleStorage{ | |
SimpleStorage[] public simpleStorageArray; | |
function createSimpleStorageContract() public { | |
SimpleStorage simpleStorage = new SimpleStorage(); | |
simpleStorageArray.push(simpleStorage); | |
} | |
function sfStore(uint256 _simpleStorageIndex, uint256 _simpleStorageNumber) public { | |
SimpleStorage(address(simpleStorageArray[_simpleStorageIndex])).store(_simpleStorageNumber); | |
} | |
function sfGet(uint256 _simpleStorageIndex) public view returns(uint256) { | |
return SimpleStorage(address(simpleStorageArray[_simpleStorageIndex])).retrieve(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment