-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFactoryStorage.sol
More file actions
31 lines (18 loc) · 821 Bytes
/
FactoryStorage.sol
File metadata and controls
31 lines (18 loc) · 821 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
30
31
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.18;
import {SimpleStorage} from "./SimpleStorage.sol";
contract FactoryStorage{
SimpleStorage[] listOfSimpleStorage;
// This function create and add a new SimpleStorage to the listOfSimpleStorage
function CreateSimpleStorage() public {
SimpleStorage _ststorage = new SimpleStorage();
listOfSimpleStorage.push(_ststorage);
}
//This function use the store function of SimpleStorage to attribute a favoNumber to the ST that we createn and choose
function stStore(uint32 _stIndex, uint32 _stStorageNumber) public {
listOfSimpleStorage[_stIndex].store(_stStorageNumber);
}
function stGet(uint256 _stIndex) public view returns (uint256){
return listOfSimpleStorage[_stIndex].watch();
}
}