Skip to content

Commit e424d24

Browse files
committed
wip ds proxy
1 parent e3ea8b0 commit e424d24

File tree

4 files changed

+71
-3
lines changed

4 files changed

+71
-3
lines changed

contracts/DataStore.sol renamed to contracts/datastore/DataStore.sol

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
pragma solidity ^0.5.0;
22

3-
import "./interfaces/ISecurityToken.sol";
4-
import "./interfaces/IOwnable.sol";
3+
import "../interfaces/ISecurityToken.sol";
4+
import "../interfaces/IOwnable.sol";
5+
import "./DataStoreStorage.sol";
56

6-
contract DataStore {
7+
contract DataStore is DataStoreStorage {
78
ISecurityToken public associatedToken;
89

910
mapping (bytes32 => uint256) internal uintData;
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
pragma solidity ^0.5.0;
2+
3+
import "../proxy/DataStoreProxy.sol";
4+
5+
contract DataStoreFactory {
6+
7+
address public implementation;
8+
9+
constructor(address _implementation) public {
10+
require(_implementation != address(0), "Address should not be 0x");
11+
implementation = _implementation;
12+
}
13+
14+
function generateDataStore(address _securityToken) public returns (address) {
15+
DataStoreProxy dsProxy = new DataStoreProxy(_securityToken, implementation);
16+
return address(dsProxy);
17+
}
18+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
pragma solidity ^0.5.0;
2+
3+
import "../interfaces/ISecurityToken.sol";
4+
5+
contract DataStoreStorage {
6+
ISecurityToken public associatedToken;
7+
8+
mapping (bytes32 => uint256) internal uintData;
9+
mapping (bytes32 => bytes32) internal bytes32Data;
10+
mapping (bytes32 => address) internal addressData;
11+
mapping (bytes32 => string) internal stringData;
12+
mapping (bytes32 => bytes) internal bytesData;
13+
mapping (bytes32 => bool) internal boolData;
14+
mapping (bytes32 => uint256[]) internal uintArrayData;
15+
mapping (bytes32 => bytes32[]) internal bytes32ArrayData;
16+
mapping (bytes32 => address[]) internal addressArrayData;
17+
mapping (bytes32 => bool[]) internal boolArrayData;
18+
19+
uint8 constant DATA_KEY = 10;
20+
}

contracts/proxy/DataStoreProxy.sol

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
pragma solidity ^0.5.0;
2+
3+
import "./OwnedProxy.sol";
4+
import "../DataStore/DataStoreStorage.sol";
5+
6+
/**
7+
* @title DataStoreProxy Proxy
8+
*/
9+
contract DataStoreProxy is DataStoreStorage, OwnedProxy {
10+
11+
/**
12+
* @notice Constructor
13+
* @param _securityToken Address of the security token
14+
* @param _implementation representing the address of the new implementation to be set
15+
*/
16+
constructor(
17+
address _securityToken,
18+
address _implementation
19+
)
20+
public
21+
{
22+
require(_implementation != address(0) && _securityToken != address(0),
23+
"Address should not be 0x"
24+
);
25+
associatedToken = ISecurityToken(_securityToken);
26+
__implementation = _implementation;
27+
}
28+
29+
}

0 commit comments

Comments
 (0)