Skip to content

Commit

Permalink
Fix setProtocolFactory() (#689)
Browse files Browse the repository at this point in the history
  • Loading branch information
satyamakgec authored and maxsam4 committed Jun 12, 2019
1 parent 045ccc1 commit dcea2c4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 2 additions & 0 deletions contracts/SecurityTokenRegistry.sol
Original file line number Diff line number Diff line change
Expand Up @@ -872,6 +872,8 @@ contract SecurityTokenRegistry is EternalStorage, Proxy {
function _setProtocolFactory(address _STFactoryAddress, uint8 _major, uint8 _minor, uint8 _patch) internal {
require(_STFactoryAddress != address(0), "Bad address");
uint24 _packedVersion = VersionUtils.pack(_major, _minor, _patch);
address stFactoryAddress = getAddressValue(Encoder.getKey("protocolVersionST", uint256(_packedVersion)));
require(stFactoryAddress == address(0), "Already exists");
set(Encoder.getKey("protocolVersionST", uint256(_packedVersion)), _STFactoryAddress);
emit ProtocolFactorySet(_STFactoryAddress, _major, _minor, _patch);
}
Expand Down
5 changes: 4 additions & 1 deletion test/n_security_token_registry.js
Original file line number Diff line number Diff line change
Expand Up @@ -683,7 +683,10 @@ contract("SecurityTokenRegistry", async (accounts) => {
assert.equal(_protocol[0], 2);
assert.equal(_protocol[1], 2);
assert.equal(_protocol[2], 0);
await I_STRProxied.setProtocolFactory(I_STFactory.address, new BN(3), new BN(0), new BN(0), { from: account_polymath});
await catchRevert(
I_STRProxied.setProtocolFactory(I_STFactory.address, new BN(3), new BN(0), new BN(0), { from: account_polymath})
);
await I_STRProxied.setProtocolFactory(I_STFactory.address, new BN(3), new BN(0), new BN(1), { from: account_polymath});
await I_STRProxied.setLatestVersion(new BN(3), new BN(0), new BN(0), { from: account_polymath});
_protocol = await I_Getter.getLatestProtocolVersion.call();
assert.equal(_protocol[0], 3);
Expand Down

0 comments on commit dcea2c4

Please sign in to comment.