Skip to content

getTickersOwner fix #405

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

Merged
merged 3 commits into from
Nov 10, 2018
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
10 changes: 9 additions & 1 deletion contracts/SecurityTokenRegistry.sol
Original file line number Diff line number Diff line change
Expand Up @@ -427,10 +427,18 @@ contract SecurityTokenRegistry is ISecurityTokenRegistry, EternalStorage {
uint counter = 0;
// accessing the data structure userTotickers[_owner].length
bytes32[] memory tickers = getArrayBytes32(Encoder.getKey("userToTickers", _owner));
bytes32[] memory tempList = new bytes32[](tickers.length);
for (uint i = 0; i < tickers.length; i++) {
string memory ticker = Util.bytes32ToString(tickers[i]);
/*solium-disable-next-line security/no-block-members*/
if (getUint(Encoder.getKey("registeredTickers_expiryDate", ticker)) >= now || _tickerStatus(ticker)) {
counter ++;
}
}
bytes32[] memory tempList = new bytes32[](counter);
counter = 0;
for (i = 0; i < tickers.length; i++) {
ticker = Util.bytes32ToString(tickers[i]);
/*solium-disable-next-line security/no-block-members*/
if (getUint(Encoder.getKey("registeredTickers_expiryDate", ticker)) >= now || _tickerStatus(ticker)) {
tempList[counter] = tickers[i];
counter ++;
Expand Down
1 change: 1 addition & 0 deletions test/n_security_token_registry.js
Original file line number Diff line number Diff line change
Expand Up @@ -993,6 +993,7 @@ contract("SecurityTokenRegistry", accounts => {

it("Should get the tickers by owner", async () => {
let tickersList = await I_STRProxied.getTickersByOwner.call(token_owner);
console.log(tickersList);
assert.equal(tickersList.length, 4);
let tickersListArray = await I_STRProxied.getTickersByOwner.call(account_temp);
console.log(tickersListArray);
Expand Down