-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathStorageFactory.sol
More file actions
executable file
·29 lines (21 loc) · 893 Bytes
/
StorageFactory.sol
File metadata and controls
executable file
·29 lines (21 loc) · 893 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
// SPDX-License-Identifier: MIT
//solidity version
pragma solidity >=0.6.0 <0.9.0;
import "./SimpleStorage.sol";
//deploy a contract & interact with a contract from another contract
contract StorageFactory is SimpleStorage{
SimpleStorage[] public simpStorageArr;
function createSimpleStorage() public {
SimpleStorage simpleStorage = new SimpleStorage();
simpStorageArr.push(simpleStorage);
}
function sfStore(uint256 _simpleStorageIndex, uint256 _simpleStorageNumber) public {
//address
//ABI
SimpleStorage simpleStorage = SimpleStorage(address(simpStorageArr[_simpleStorageIndex]));
simpleStorage.store(_simpleStorageNumber);
}
function sfGet(uint256 _simpleStorageIndex) public view returns(uint256){
return SimpleStorage(address(simpStorageArr[_simpleStorageIndex])).retrieve();
}
}