-
Notifications
You must be signed in to change notification settings - Fork 160
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #568 from PolymathNetwork/add-protocolVersion
Allows explicit token factory version in generateSecurityToken()
- Loading branch information
Showing
36 changed files
with
249 additions
and
79 deletions.
There are no files selected for viewing
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
pragma solidity ^0.5.0; | ||
|
||
import "./SecurityTokenMock.sol"; | ||
import "../interfaces/ISTFactory.sol"; | ||
import "../datastore/DataStoreFactory.sol"; | ||
|
||
/** | ||
* @title Proxy for deploying SecurityToken instances | ||
*/ | ||
contract STFactoryMock is ISTFactory { | ||
address public transferManagerFactory; | ||
address public stDelegate; | ||
DataStoreFactory public dataStoreFactory; | ||
|
||
constructor(address _transferManagerFactory, address _dataStoreFactory, address _stDelegate) public { | ||
transferManagerFactory = _transferManagerFactory; | ||
dataStoreFactory = DataStoreFactory(_dataStoreFactory); | ||
stDelegate = _stDelegate; | ||
} | ||
|
||
/** | ||
* @notice deploys the token and adds default modules like the GeneralTransferManager. | ||
* Future versions of the proxy can attach different modules or pass different parameters. | ||
*/ | ||
function deployToken( | ||
string calldata _name, | ||
string calldata _symbol, | ||
uint8 _decimals, | ||
string calldata _tokenDetails, | ||
address _issuer, | ||
bool _divisible, | ||
address _polymathRegistry | ||
) | ||
external | ||
returns(address) | ||
{ | ||
SecurityTokenMock newSecurityToken = new SecurityTokenMock( | ||
_name, | ||
_symbol, | ||
_decimals, | ||
_divisible ? 1 : uint256(10) ** _decimals, | ||
_tokenDetails, | ||
_polymathRegistry, | ||
stDelegate | ||
); | ||
//NB When dataStore is generated, the security token address is automatically set via the constructor in DataStoreProxy. | ||
newSecurityToken.changeDataStore(dataStoreFactory.generateDataStore(address(newSecurityToken))); | ||
newSecurityToken.addModule(transferManagerFactory, "", 0, 0); | ||
newSecurityToken.transferOwnership(_issuer); | ||
return address(newSecurityToken); | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
pragma solidity ^0.5.0; | ||
|
||
import "../tokens/SecurityToken.sol"; | ||
|
||
/** | ||
* @title Security Token contract | ||
* @notice SecurityToken is an ERC1400 token with added capabilities: | ||
* @notice - Implements the ERC1400 Interface | ||
* @notice - Transfers are restricted | ||
* @notice - Modules can be attached to it to control its behaviour | ||
* @notice - ST should not be deployed directly, but rather the SecurityTokenRegistry should be used | ||
* @notice - ST does not inherit from ISecurityToken due to: | ||
* @notice - https://github.com/ethereum/solidity/issues/4847 | ||
*/ | ||
contract SecurityTokenMock is SecurityToken { | ||
|
||
/** | ||
* @notice constructor | ||
* @param _name Name of the SecurityToken | ||
* @param _symbol Symbol of the Token | ||
* @param _decimals Decimals for the securityToken | ||
* @param _granularity granular level of the token | ||
* @param _tokenDetails Details of the token that are stored off-chain | ||
* @param _polymathRegistry Contract address of the polymath registry | ||
* @param _delegate Contract address of the delegate | ||
*/ | ||
constructor( | ||
string memory _name, | ||
string memory _symbol, | ||
uint8 _decimals, | ||
uint256 _granularity, | ||
string memory _tokenDetails, | ||
address _polymathRegistry, | ||
address _delegate | ||
) | ||
public | ||
SecurityToken(_name, _symbol, _decimals, _granularity, _tokenDetails, _polymathRegistry,_delegate) | ||
{ | ||
securityTokenVersion = SemanticVersion(2, 2, 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
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
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
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
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
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
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
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
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
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
Oops, something went wrong.