Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix setProtocolFactory() #689

Merged
merged 1 commit into from
Jun 12, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions contracts/SecurityTokenRegistry.sol
Original file line number Diff line number Diff line change
Expand Up @@ -831,6 +831,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 @@ -684,7 +684,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