Skip to content

Commit c56fb1d

Browse files
committed
minor fixes in the STR
1 parent 039dd3f commit c56fb1d

File tree

5 files changed

+19
-41
lines changed

5 files changed

+19
-41
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ All notable changes to this project will be documented in this file.
2222
* Migrate all the getters of `SecurityTokenRegsitry.sol` to `STRGetter.sol` contract.
2323
* Removed `_polyToken` parameter from `initialize` function in `SecurityTokenRegistry`.
2424
* Allows an explicit token factory version to be used during creation of securityToken.
25-
* Rename the `getProtocolVersion()` to `getCurrentProtocolVersion()`.
25+
* Rename the `getProtocolVersion()` to `getLatestProtocolVersion()`.
2626
* Return SecurityToken version in the `getSecurityTokenData()` function.
2727

2828
## GeneralTransferManager

contracts/STRGetter.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ contract STRGetter is EternalStorage {
222222
/**
223223
* @notice Gets Protocol version
224224
*/
225-
function getCurrentProtocolVersion() public view returns(uint8[] memory) {
225+
function getLatestProtocolVersion() public view returns(uint8[] memory) {
226226
return VersionUtils.unpack(uint24(getUintValue(Encoder.getKey("latestVersion"))));
227227
}
228228

contracts/SecurityTokenRegistry.sol

Lines changed: 5 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -543,7 +543,9 @@ contract SecurityTokenRegistry is EternalStorage, Proxy {
543543
_storeSecurityTokenData(newSecurityTokenAddress, _ticker, _tokenDetails, now);
544544
set(Encoder.getKey("tickerToSecurityToken", _ticker), newSecurityTokenAddress);
545545
/*solium-disable-next-line security/no-block-members*/
546-
_emitSecurityTokenEvent(_ticker, _name, newSecurityTokenAddress, msg.sender, now, msg.sender, false, _usdFee, _polyFee, _protocolVersion);
546+
emit NewSecurityToken(
547+
_ticker, _name, newSecurityTokenAddress, msg.sender, now, msg.sender, false, _usdFee, _polyFee, _protocolVersion
548+
);
547549
}
548550

549551
/**
@@ -554,16 +556,14 @@ contract SecurityTokenRegistry is EternalStorage, Proxy {
554556
* @param _securityToken is the address of the securityToken
555557
* @param _tokenDetails is the off-chain details of the token
556558
* @param _deployedAt is the timestamp at which the security token is deployed
557-
* @param _protocolVersion Version of securityToken contract
558559
*/
559560
function modifySecurityToken(
560561
string calldata _name,
561562
string calldata _ticker,
562563
address _owner,
563564
address _securityToken,
564565
string calldata _tokenDetails,
565-
uint256 _deployedAt,
566-
uint256 _protocolVersion
566+
uint256 _deployedAt
567567
)
568568
external
569569
onlyOwner
@@ -583,28 +583,8 @@ contract SecurityTokenRegistry is EternalStorage, Proxy {
583583
set(Encoder.getKey("tickerToSecurityToken", ticker), _securityToken);
584584
_modifyTicker(_owner, ticker, _name, registrationTime, expiryTime, true);
585585
_storeSecurityTokenData(_securityToken, ticker, _tokenDetails, _deployedAt);
586-
_emitSecurityTokenEvent(
587-
ticker, _name, _securityToken, _owner, _deployedAt, msg.sender, true, uint256(0), uint256(0),
588-
(_protocolVersion == uint256(0) ? getUintValue(Encoder.getKey("latestVersion")) : _protocolVersion)
589-
);
590-
}
591-
592-
function _emitSecurityTokenEvent(
593-
string memory _ticker,
594-
string memory _name,
595-
address _securityToken,
596-
address _owner,
597-
uint256 _addedAt,
598-
address _registrant,
599-
bool _fromAdmin,
600-
uint256 _usdFee,
601-
uint256 _polyFee,
602-
uint256 _protocolVersion
603-
)
604-
internal
605-
{
606586
emit NewSecurityToken(
607-
_ticker, _name, _securityToken, _owner, _addedAt, _registrant, _fromAdmin, _usdFee, _polyFee, _protocolVersion
587+
ticker, _name, _securityToken, _owner, _deployedAt, msg.sender, true, uint256(0), uint256(0), 0
608588
);
609589
}
610590

contracts/interfaces/ISecurityTokenRegistry.sol

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,16 +30,14 @@ interface ISecurityTokenRegistry {
3030
* @param _securityToken Address of the securityToken
3131
* @param _tokenDetails Off-chain details of the token
3232
* @param _deployedAt Timestamp at which security token comes deployed on the ethereum blockchain
33-
* @param _protocolVersion Version of the protocol
3433
*/
3534
function modifySecurityToken(
3635
string calldata _name,
3736
string calldata _ticker,
3837
address _owner,
3938
address _securityToken,
4039
string calldata _tokenDetails,
41-
uint256 _deployedAt,
42-
uint256 _protocolVersion
40+
uint256 _deployedAt
4341
)
4442
external;
4543

test/n_security_token_registry.js

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -666,7 +666,7 @@ contract("SecurityTokenRegistry", async (accounts) => {
666666
address_zero,
667667
"STFactory002 contract was not deployed"
668668
);
669-
let _protocol = await I_Getter.getCurrentProtocolVersion.call();
669+
let _protocol = await I_Getter.getLatestProtocolVersion.call();
670670
assert.equal(_protocol[0], 2);
671671
assert.equal(_protocol[1], 0);
672672
assert.equal(_protocol[2], 0);
@@ -681,12 +681,12 @@ contract("SecurityTokenRegistry", async (accounts) => {
681681

682682
it("Should change the protocol version", async() => {
683683
await I_STRProxied.setProtocolVersion(I_STFactory002.address, new BN(2), new BN(2), new BN(0), { from: account_polymath });
684-
let _protocol = await I_Getter.getCurrentProtocolVersion.call();
684+
let _protocol = await I_Getter.getLatestProtocolVersion.call();
685685
assert.equal(_protocol[0], 2);
686686
assert.equal(_protocol[1], 2);
687687
assert.equal(_protocol[2], 0);
688688
await I_STRProxied.setProtocolVersion(I_STFactory.address, new BN(3), new BN(0), new BN(0), { from: account_polymath});
689-
_protocol = await I_Getter.getCurrentProtocolVersion.call();
689+
_protocol = await I_Getter.getLatestProtocolVersion.call();
690690
assert.equal(_protocol[0], 3);
691691
assert.equal(_protocol[1], 0);
692692
assert.equal(_protocol[2], 0);
@@ -755,7 +755,7 @@ contract("SecurityTokenRegistry", async (accounts) => {
755755
describe("Generate custom tokens", async () => {
756756
it("Should fail if msg.sender is not polymath", async () => {
757757
await catchRevert(
758-
I_STRProxied.modifySecurityToken("LOGAN", "LOG", account_temp, dummy_token, "I am custom ST", currentTime, 0, {
758+
I_STRProxied.modifySecurityToken("LOGAN", "LOG", account_temp, dummy_token, "I am custom ST", currentTime, {
759759
from: account_delegate
760760
}),
761761
"tx revert -> msg.sender is not polymath account"
@@ -764,7 +764,7 @@ contract("SecurityTokenRegistry", async (accounts) => {
764764

765765
it("Should fail to genrate the custom security token -- ticker length is greater than 10 chars", async () => {
766766
await catchRevert(
767-
I_STRProxied.modifySecurityToken("LOGAN", "LOGLOGLOGLOG", account_temp, dummy_token, "I am custom ST", currentTime, 0, {
767+
I_STRProxied.modifySecurityToken("LOGAN", "LOGLOGLOGLOG", account_temp, dummy_token, "I am custom ST", currentTime, {
768768
from: account_polymath
769769
}),
770770
"tx revert -> ticker length is greater than 10 chars"
@@ -773,7 +773,7 @@ contract("SecurityTokenRegistry", async (accounts) => {
773773

774774
it("Should fail to generate the custom security token -- name should not be 0 length ", async () => {
775775
await catchRevert(
776-
I_STRProxied.modifySecurityToken("", "LOG", account_temp, dummy_token, "I am custom ST", currentTime, 0, {
776+
I_STRProxied.modifySecurityToken("", "LOG", account_temp, dummy_token, "I am custom ST", currentTime, {
777777
from: account_polymath
778778
}),
779779
"tx revert -> name should not be 0 length"
@@ -782,7 +782,7 @@ contract("SecurityTokenRegistry", async (accounts) => {
782782

783783
it("Should fail if ST address is 0 address", async () => {
784784
await catchRevert(
785-
I_STRProxied.modifySecurityToken("LOGAN", "LOG", account_temp, address_zero, "I am custom ST", currentTime, 0, {
785+
I_STRProxied.modifySecurityToken("LOGAN", "LOG", account_temp, address_zero, "I am custom ST", currentTime, {
786786
from: account_polymath
787787
}),
788788
"tx revert -> Security token address is 0"
@@ -791,7 +791,7 @@ contract("SecurityTokenRegistry", async (accounts) => {
791791

792792
it("Should fail if symbol length is 0", async () => {
793793
await catchRevert(
794-
I_STRProxied.modifySecurityToken("", "0x0", account_temp, dummy_token, "I am custom ST", currentTime, 0, {
794+
I_STRProxied.modifySecurityToken("", "0x0", account_temp, dummy_token, "I am custom ST", currentTime, {
795795
from: account_polymath
796796
}),
797797
"tx revert -> zero length of the symbol is not allowed"
@@ -800,7 +800,7 @@ contract("SecurityTokenRegistry", async (accounts) => {
800800

801801
it("Should fail to generate the custom ST -- deployedAt param is 0", async () => {
802802
await catchRevert(
803-
I_STRProxied.modifySecurityToken(name2, symbol2, token_owner, dummy_token, "I am custom ST", new BN(0), 0, { from: account_polymath }),
803+
I_STRProxied.modifySecurityToken(name2, symbol2, token_owner, dummy_token, "I am custom ST", new BN(0), { from: account_polymath }),
804804
"tx revert -> because deployedAt param is 0"
805805
);
806806
});
@@ -815,7 +815,7 @@ contract("SecurityTokenRegistry", async (accounts) => {
815815
tickersListArray = await I_Getter.getTickersByOwner.call(account_temp);
816816
console.log(tickersListArray);
817817
// Generating the ST
818-
let tx = await I_STRProxied.modifySecurityToken("LOGAN", "LOG", account_temp, dummy_token, "I am custom ST", currentTime, 0, {
818+
let tx = await I_STRProxied.modifySecurityToken("LOGAN", "LOG", account_temp, dummy_token, "I am custom ST", currentTime, {
819819
from: account_polymath
820820
});
821821
tickersListArray = await I_Getter.getTickersByOwner.call(account_temp);
@@ -837,7 +837,7 @@ contract("SecurityTokenRegistry", async (accounts) => {
837837
// await catchRevert(I_STRProxied.modifySecurityToken("LOGAN2", "LOG2", account_temp, dummy_token, "I am custom ST", await latestTime(), {from: account_polymath}));
838838
// await I_STRProxied.modifyTicker(account_temp, "LOG2", "LOGAN2", await latestTime(), currentTime.add(new BN(duration.days(10))), false, {from: account_polymath});
839839
// await increaseTime(duration.days(1));
840-
let tx = await I_STRProxied.modifySecurityToken("LOGAN2", "LOG2", account_temp, dummy_token, "I am custom ST", currentTime, 0, {
840+
let tx = await I_STRProxied.modifySecurityToken("LOGAN2", "LOG2", account_temp, dummy_token, "I am custom ST", currentTime, {
841841
from: account_polymath
842842
});
843843
assert.equal(tx.logs[1].args._ticker, "LOG2", "Symbol should match with the registered symbol");

0 commit comments

Comments
 (0)