Skip to content

Commit 04125fa

Browse files
authored
Merge pull request #656 from PolymathNetwork/fix/canbuyfromsto-flag
fix(issuer): fix the export of investor flags
2 parents 801b461 + 75f8329 commit 04125fa

2 files changed

Lines changed: 12 additions & 10 deletions

File tree

packages/polymath-issuer/src/actions/compliance.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -628,14 +628,13 @@ export const exportWhitelist = () => async (
628628
const {
629629
whitelist: {
630630
transferManager,
631-
percentageTM: { contract: percentageTM },
631+
percentageTM: { contract: percentageTM, isPaused: PTMPaused },
632632
},
633633
sto,
634634
} = getState();
635635

636636
const investors = await transferManager.getWhitelist();
637-
638-
if (percentageTM) {
637+
if (percentageTM && !PTMPaused) {
639638
const percentages = await percentageTM.getWhitelist();
640639
for (let i = 0; i < investors.length; i++) {
641640
for (let percentage of percentages) {
@@ -646,7 +645,6 @@ export const exportWhitelist = () => async (
646645
}
647646
}
648647
}
649-
650648
// eslint-disable-next-line max-len
651649
let csvContent =
652650
'ETH Address,Sell Restriction Date,Buy Restriction Date,KYC/AML Expiry Date,Can Buy From STO,Exempt From % Ownership,Is Accredited,Non-Accredited Limit';

packages/polymath-js/src/contracts/TransferManager.js

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ export default class TransferManager extends Contract {
6464
}
6565

6666
_mapFlagKeyToLabel(flag: number): string {
67-
const map = ['accredited', 'canBuyFromSTO', 'isVolRestricted'];
67+
const map = ['accredited', 'canNotBuyFromSTO', 'isVolRestricted'];
6868

6969
return map[flag];
7070
}
@@ -245,16 +245,20 @@ export default class TransferManager extends Contract {
245245
let flagNumbers = [];
246246
// Decode investor flags. flags variable is a uint256 representation of the flags, where
247247
// each bit represents an active flag.
248+
249+
// Investors can buy from STO, by default.
250+
investors[x]['canBuyFromSTO'] = true;
248251
for (let j = 0; j < 256; j++) {
249252
if (flags.testn(j)) {
250253
flagNumbers.push(j);
251254
const key = this._mapFlagKeyToLabel(j);
252-
investors[x][key] = true;
255+
// Negate canBuyFromSTO value.
256+
if (key === 'canNotBuyFromSTO') {
257+
investors[x]['canBuyFromSTO'] = false;
258+
} else {
259+
investors[x][key] = true;
260+
}
253261
}
254-
investors[x].canBuyFromSTO =
255-
investors[x].canBuyFromSTO === undefined
256-
? true
257-
: !investors[x].canBuyFromSTO;
258262
}
259263
}
260264

0 commit comments

Comments
 (0)