Skip to content

Commit 3dba7bd

Browse files
authored
Optimise GTM (#443)
* WIP * WIP * Fixes * Update config * Log gas for 50 txs * WIP * update * Fix tests * Fix typo * Change onWhitelist logic * Update changelog * Update all test cases * Add whitelist optimization * Make Dividend modules proxies * Updates * minor cleanup * make script dynamic * Keep ABI constant * Fixes * Update change log * Updates * add require statement in factory constructors * remove the test cases for the STVRTM * Return investor data in getAllInvestorsData * CLI changes according GTM optimizations * Bump versions * version changes * Update CHANGELOG.md
1 parent 4fc9f24 commit 3dba7bd

38 files changed

+1067
-1368
lines changed

CHANGELOG.md

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,26 @@ All notable changes to this project will be documented in this file.
1616
* Added `getTokensSoldByTier` to return sold (not minted during finalisation) tokens in each tier to USDTSTO.
1717
* Removed individual mappings for tier data removed in UDSTSTO.
1818

19+
## GeneralTransferManager
20+
* `getInvestors`, `getAllInvestorsData`, `getInvestorsData` added to GTM to allow easy data queries.
21+
* `modifyDefaults(uint64 _defaultFromTime, uint64 _defaultToTime)` added which sets a default timestamp used when `fromTime` or `toTime` are 0
22+
* Add `address[] public investors` to record a list of all addresses that have been added to the whitelist (`getInvestors`).
23+
* General Transfer Manager: Fix for when `allowAllWhitelistIssuances` is FALSE
24+
* General Transfer Manager: Make GTM a Proxy based implementation to reduce deployment gas costs
25+
* Changed the version of `GeneralTransferManagerFactory` from `1.0.0` to `2.1.0`.
26+
1927
## Manual Approval TransferManager
2028
* Removed `0x0` check for the `_from` address to `ManualApprovalTransferManager`. This allows for the Issuer/Transfer Agent to approve a one-off mint of tokens that otherwise would not be possible.
21-
* Changed the version of `ManualApprovalTransferManagerFactory` from `1.0.0` to `2.0.1`.
29+
* Changed the version of `ManualApprovalTransferManagerFactory` from `1.0.0` to `2.1.0`.
2230
* Deployed 2.0.1 `ManualApprovalTransferManagerFactory` to address 0x6af2afad53cb334e62b90ddbdcf3a086f654c298
2331

32+
## Dividends
33+
* Changed the version of `ERC20DividendCheckpointFactory` & `EtherDividendCheckpointFactory` from `1.0.0` to `2.1.0`.
34+
* Applied proxy pattern to Dividends modules
35+
2436
## Changed
2537
* `getAllModulesAndPermsFromTypes()` does not take securityToken address as a parameter anymore.
26-
38+
2739

2840
# v1.5.0 - Release Candidate
2941

CLI/commands/transfer_manager.js

Lines changed: 55 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ const contracts = require('./helpers/contract_addresses');
66
const abis = require('./helpers/contract_abis');
77
const gbl = require('./common/global');
88
const csvParse = require('./helpers/csv');
9+
const { table } = require('table')
910

1011
///////////////////
1112
// Constants
@@ -328,17 +329,28 @@ async function generalTransferManager() {
328329
let displayAllowAllWhitelistTransfers = await currentTransferManager.methods.allowAllWhitelistTransfers().call();
329330
let displayAllowAllWhitelistIssuances = await currentTransferManager.methods.allowAllWhitelistIssuances().call();
330331
let displayAllowAllBurnTransfers = await currentTransferManager.methods.allowAllBurnTransfers().call();
332+
let displayDefaults = await currentTransferManager.methods.defaults().call();
333+
let displayInvestors = await currentTransferManager.methods.getInvestors().call();
331334

332335
console.log(`- Issuance address: ${displayIssuanceAddress}`);
333336
console.log(`- Signing address: ${displaySigningAddress}`);
334337
console.log(`- Allow all transfers: ${displayAllowAllTransfers ? `YES` : `NO`}`);
335338
console.log(`- Allow all whitelist transfers: ${displayAllowAllWhitelistTransfers ? `YES` : `NO`}`);
336339
console.log(`- Allow all whitelist issuances: ${displayAllowAllWhitelistIssuances ? `YES` : `NO`}`);
337340
console.log(`- Allow all burn transfers: ${displayAllowAllBurnTransfers ? `YES` : `NO`}`);
341+
console.log(`- Default times:`);
342+
console.log(` - From time: ${displayDefaults.fromTime} (${moment.unix(displayDefaults.fromTime).format('MMMM Do YYYY, HH:mm:ss')})`);
343+
console.log(` - To time: ${displayDefaults.toTime} (${moment.unix(displayDefaults.toTime).format('MMMM Do YYYY, HH:mm:ss')})`);
344+
console.log(`- Investors: ${displayInvestors.length}`);
338345
// ------------------
339346

340-
let options = ['Check whitelist', 'Modify whitelist', 'Modify whitelist from CSV', /*'Modify Whitelist Signed',*/
341-
`Change issuance address`, 'Change signing address'];
347+
let options = [];
348+
if (displayInvestors.length > 0) {
349+
options.push(`Show investors`, `Show whitelist data`);
350+
}
351+
options.push('Modify whitelist', 'Modify whitelist from CSV', /*'Modify Whitelist Signed',*/
352+
'Change the default times used when they are zero', `Change issuance address`, 'Change signing address');
353+
342354
if (displayAllowAllTransfers) {
343355
options.push('Disallow all transfers');
344356
} else {
@@ -364,18 +376,33 @@ async function generalTransferManager() {
364376
let optionSelected = options[index];
365377
console.log('Selected:', index != -1 ? optionSelected : 'Return', '\n');
366378
switch (optionSelected) {
367-
case 'Check whitelist':
368-
let investorToCheck = readlineSync.question('Enter the address you want to check: ', {
379+
case `Show investors`:
380+
console.log('***** List of investors on whitelist *****');
381+
displayInvestors.map(i => console.log(i));
382+
break;
383+
case `Show whitelist data`:
384+
let investorsToShow = readlineSync.question(`Enter the addresses of the investors you want to show (i.e: addr1,addr2,addr3) or leave empty to show them all: `, {
369385
limit: function (input) {
370-
return web3.utils.isAddress(input);
386+
return input === '' || input.split(",").every(a => web3.utils.isAddress(a));
371387
},
372-
limitMessage: "Must be a valid address"
388+
limitMessage: `All addresses must be valid`
373389
});
374-
let timeRestriction = await currentTransferManager.methods.whitelist(investorToCheck).call();
375-
console.log(`Sale lockup: ${moment.unix(timeRestriction.fromTime).format('MMMM Do YYYY, HH:mm:ss')}`);
376-
console.log(`Buy lockup: ${moment.unix(timeRestriction.toTime).format('MMMM Do YYYY, HH:mm:ss')}`);
377-
console.log(`KYC expiry time: ${moment.unix(timeRestriction.expiryTime).format('MMMM Do YYYY, HH:mm:ss')}`);
378-
console.log(`Restricted investor: ${timeRestriction.canBuyFromSTO ? 'YES' : 'NO'} `);
390+
if (investorsToShow === '') {
391+
let whitelistData = await currentTransferManager.methods.getAllInvestorsData().call();
392+
showWhitelistTable(whitelistData[0], whitelistData[1], whitelistData[2], whitelistData[3], whitelistData[4]);
393+
} else {
394+
let investorsArray = investorsToShow.split(',');
395+
let whitelistData = await currentTransferManager.methods.getInvestorsData(investorsArray).call();
396+
showWhitelistTable(investorsArray, whitelistData[0], whitelistData[1], whitelistData[2], whitelistData[3]);
397+
}
398+
break;
399+
case 'Change the default times used when they are zero':
400+
let fromTimeDefault = readlineSync.questionInt(`Enter the default time (Unix Epoch time) used when fromTime is zero: `);
401+
let toTimeDefault = readlineSync.questionInt(`Enter the default time (Unix Epoch time) used when fromTime is zero: `);
402+
let changeDefaultsAction = currentTransferManager.methods.changeDefaults(fromTimeDefault, toTimeDefault);
403+
let changeDefaultsReceipt = await common.sendTransaction(changeDefaultsAction);
404+
let changeDefaultsEvent = common.getEventFromLogs(currentTransferManager._jsonInterface, changeDefaultsReceipt.logs, 'ChangeDefaults');
405+
console.log(chalk.green(`Default times have been updated successfully!`));
379406
break;
380407
case 'Modify whitelist':
381408
let investor = readlineSync.question('Enter the address to whitelist: ', {
@@ -490,6 +517,21 @@ async function generalTransferManager() {
490517
}
491518
}
492519

520+
function showWhitelistTable(investorsArray, fromTimeArray, toTimeArray, expiryTimeArray, canBuyFromSTOArray) {
521+
let dataTable = [['Investor', 'From time', 'To time', 'KYC expiry date', 'Restricted']];
522+
for (let i = 0; i < investorsArray.length; i++) {
523+
dataTable.push([
524+
investorsArray[i],
525+
moment.unix(fromTimeArray[i]).format('MM/DD/YYYY HH:mm'),
526+
moment.unix(toTimeArray[i]).format('MM/DD/YYYY HH:mm'),
527+
moment.unix(expiryTimeArray[i]).format('MM/DD/YYYY HH:mm'),
528+
canBuyFromSTOArray[i] ? 'YES' : 'NO'
529+
]);
530+
}
531+
console.log();
532+
console.log(table(dataTable));
533+
}
534+
493535
async function modifyWhitelistInBatch() {
494536
let csvFilePath = readlineSync.question(`Enter the path for csv data file (${WHITELIST_DATA_CSV}): `, {
495537
defaultInput: WHITELIST_DATA_CSV
@@ -553,8 +595,8 @@ async function manualApprovalTransferManager() {
553595
let manualApproval = await getManualApproval(from, to);
554596
if (manualApproval) {
555597
console.log(`Manual approval found!`);
556-
console.log(`Allowance: ${web3.utils.fromWei(manualApproval.allowance)} `);
557-
console.log(`Expiry time: ${moment.unix(manualApproval.expiryTime).format('MMMM Do YYYY, HH:mm:ss')}; `)
598+
console.log(`Allowance: ${web3.utils.fromWei(manualApproval.allowance)}`);
599+
console.log(`Expiry time: ${moment.unix(manualApproval.expiryTime).format('MMMM Do YYYY, HH:mm:ss')}`);
558600
} else {
559601
console.log(chalk.yellow(`There are no manual approvals from ${from} to ${to}.`));
560602
}

CLI/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
"readline-sync": "^1.4.9",
1818
"request": "^2.88.0",
1919
"request-promise": "^4.2.2",
20+
"table": "^5.1.1",
2021
"web3": "1.0.0-beta.35"
2122
}
2223
}

CLI/yarn.lock

Lines changed: 83 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,22 @@ ajv@^5.3.0:
3030
fast-json-stable-stringify "^2.0.0"
3131
json-schema-traverse "^0.3.0"
3232

33-
ansi-styles@^3.2.1:
33+
ajv@^6.6.1:
34+
version "6.6.1"
35+
resolved "https://registry.yarnpkg.com/ajv/-/ajv-6.6.1.tgz#6360f5ed0d80f232cc2b294c362d5dc2e538dd61"
36+
integrity sha512-ZoJjft5B+EJBjUyu9C9Hc0OZyPZSSlOF+plzouTrg6UlA8f+e/n8NIgBFG/9tppJtpPWfthHakK7juJdNDODww==
37+
dependencies:
38+
fast-deep-equal "^2.0.1"
39+
fast-json-stable-stringify "^2.0.0"
40+
json-schema-traverse "^0.4.1"
41+
uri-js "^4.2.2"
42+
43+
ansi-regex@^3.0.0:
44+
version "3.0.0"
45+
resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-3.0.0.tgz#ed0317c322064f79466c02966bddb605ab37d998"
46+
integrity sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=
47+
48+
ansi-styles@^3.2.0, ansi-styles@^3.2.1:
3449
version "3.2.1"
3550
resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-3.2.1.tgz#41fbb20243e50b12be0f04b8dedbf07520ce841d"
3651
integrity sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==
@@ -68,6 +83,11 @@ [email protected], assert-plus@^1.0.0:
6883
resolved "https://registry.yarnpkg.com/assert-plus/-/assert-plus-1.0.0.tgz#f12e0f3c5d77b0b1cdd9146942e4e96c1e4dd525"
6984
integrity sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=
7085

86+
astral-regex@^1.0.0:
87+
version "1.0.0"
88+
resolved "https://registry.yarnpkg.com/astral-regex/-/astral-regex-1.0.0.tgz#6c8c3fb827dd43ee3918f27b82782ab7658a6fd9"
89+
integrity sha512-+Ryf6g3BKoRc7jfp7ad8tM4TtMiaWvbF/1/sQcZPkkS7ag3D5nMBCe2UfOTONtAkaG0tO0ij3C5Lwmf1EiyjHg==
90+
7191
async-limiter@~1.0.0:
7292
version "1.0.0"
7393
resolved "https://registry.yarnpkg.com/async-limiter/-/async-limiter-1.0.0.tgz#78faed8c3d074ab81f22b4e985d79e8738f720f8"
@@ -741,6 +761,11 @@ fast-deep-equal@^1.0.0:
741761
resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-1.1.0.tgz#c053477817c86b51daa853c81e059b733d023614"
742762
integrity sha1-wFNHeBfIa1HaqFPIHgWbcz0CNhQ=
743763

764+
fast-deep-equal@^2.0.1:
765+
version "2.0.1"
766+
resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-2.0.1.tgz#7b05218ddf9667bf7f370bf7fdb2cb15fdd0aa49"
767+
integrity sha1-ewUhjd+WZ79/Nwv3/bLLFf3Qqkk=
768+
744769
fast-json-stable-stringify@^2.0.0:
745770
version "2.0.0"
746771
resolved "https://registry.yarnpkg.com/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz#d5142c0caee6b1189f87d3a76111064f86c8bbf2"
@@ -1042,6 +1067,11 @@ is-callable@^1.1.3:
10421067
resolved "https://registry.yarnpkg.com/is-callable/-/is-callable-1.1.4.tgz#1e1adf219e1eeb684d691f9d6a05ff0d30a24d75"
10431068
integrity sha512-r5p9sxJjYnArLjObpjA4xu5EKI3CuKHkJXMhT7kwbpUyIFD1n5PMAsoPvWnvtZiNz7LjkYDRZhd7FlI0eMijEA==
10441069

1070+
is-fullwidth-code-point@^2.0.0:
1071+
version "2.0.0"
1072+
resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz#a3b30a5c4f199183167aaab93beefae3ddfb654f"
1073+
integrity sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=
1074+
10451075
is-function@^1.0.1:
10461076
version "1.0.1"
10471077
resolved "https://registry.yarnpkg.com/is-function/-/is-function-1.0.1.tgz#12cfb98b65b57dd3d193a3121f5f6e2f437602b5"
@@ -1120,6 +1150,11 @@ json-schema-traverse@^0.3.0:
11201150
resolved "https://registry.yarnpkg.com/json-schema-traverse/-/json-schema-traverse-0.3.1.tgz#349a6d44c53a51de89b40805c5d5e59b417d3340"
11211151
integrity sha1-NJptRMU6Ud6JtAgFxdXlm0F9M0A=
11221152

1153+
json-schema-traverse@^0.4.1:
1154+
version "0.4.1"
1155+
resolved "https://registry.yarnpkg.com/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz#69f6a87d9513ab8bb8fe63bdb0979c448e684660"
1156+
integrity sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==
1157+
11231158
11241159
version "0.2.3"
11251160
resolved "https://registry.yarnpkg.com/json-schema/-/json-schema-0.2.3.tgz#b480c892e59a2f05954ce727bd3f2a4e882f9e13"
@@ -1155,7 +1190,7 @@ keccakjs@^0.2.1:
11551190
browserify-sha3 "^0.0.1"
11561191
sha3 "^1.1.0"
11571192

1158-
lodash@^4.13.1:
1193+
lodash@^4.13.1, lodash@^4.17.11:
11591194
version "4.17.11"
11601195
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.11.tgz#b39ea6229ef607ecd89e2c8df12536891cac9b8d"
11611196
integrity sha512-cQKh8igo5QUhZ7lg38DYWAxMvjSAKG0A8wGSVimP07SIUEK2UO+arSRKbRZWtelMtN5V0Hkwh5ryOto/SshYIg==
@@ -1496,6 +1531,11 @@ punycode@^1.4.1:
14961531
resolved "https://registry.yarnpkg.com/punycode/-/punycode-1.4.1.tgz#c0d5a63b2718800ad8e1eb0fa5269c84dd41845e"
14971532
integrity sha1-wNWmOycYgArY4esPpSachN1BhF4=
14981533

1534+
punycode@^2.1.0:
1535+
version "2.1.1"
1536+
resolved "https://registry.yarnpkg.com/punycode/-/punycode-2.1.1.tgz#b58b010ac40c22c5657616c8d2c2c02c7bf479ec"
1537+
integrity sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==
1538+
14991539
[email protected], qs@~6.5.2:
15001540
version "6.5.2"
15011541
resolved "https://registry.yarnpkg.com/qs/-/qs-6.5.2.tgz#cb3ae806e8740444584ef154ce8ee98d403f3e36"
@@ -1749,6 +1789,15 @@ simple-get@^2.7.0:
17491789
once "^1.3.1"
17501790
simple-concat "^1.0.0"
17511791

1792+
1793+
version "2.0.0"
1794+
resolved "https://registry.yarnpkg.com/slice-ansi/-/slice-ansi-2.0.0.tgz#5373bdb8559b45676e8541c66916cdd6251612e7"
1795+
integrity sha512-4j2WTWjp3GsZ+AOagyzVbzp4vWGtZ0hEZ/gDY/uTvm6MTxUfTUIsnMIFb1bn8o0RuXiqUw15H1bue8f22Vw2oQ==
1796+
dependencies:
1797+
ansi-styles "^3.2.0"
1798+
astral-regex "^1.0.0"
1799+
is-fullwidth-code-point "^2.0.0"
1800+
17521801
sshpk@^1.7.0:
17531802
version "1.15.1"
17541803
resolved "https://registry.yarnpkg.com/sshpk/-/sshpk-1.15.1.tgz#b79a089a732e346c6e0714830f36285cd38191a2"
@@ -1784,13 +1833,28 @@ strict-uri-encode@^1.0.0:
17841833
resolved "https://registry.yarnpkg.com/strict-uri-encode/-/strict-uri-encode-1.1.0.tgz#279b225df1d582b1f54e65addd4352e18faa0713"
17851834
integrity sha1-J5siXfHVgrH1TmWt3UNS4Y+qBxM=
17861835

1836+
string-width@^2.1.1:
1837+
version "2.1.1"
1838+
resolved "https://registry.yarnpkg.com/string-width/-/string-width-2.1.1.tgz#ab93f27a8dc13d28cac815c462143a6d9012ae9e"
1839+
integrity sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==
1840+
dependencies:
1841+
is-fullwidth-code-point "^2.0.0"
1842+
strip-ansi "^4.0.0"
1843+
17871844
string_decoder@~1.1.1:
17881845
version "1.1.1"
17891846
resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-1.1.1.tgz#9cf1611ba62685d7030ae9e4ba34149c3af03fc8"
17901847
integrity sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==
17911848
dependencies:
17921849
safe-buffer "~5.1.0"
17931850

1851+
strip-ansi@^4.0.0:
1852+
version "4.0.0"
1853+
resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-4.0.0.tgz#a8479022eb1ac368a871389b635262c505ee368f"
1854+
integrity sha1-qEeQIusaw2iocTibY1JixQXuNo8=
1855+
dependencies:
1856+
ansi-regex "^3.0.0"
1857+
17941858
strip-dirs@^2.0.0:
17951859
version "2.1.0"
17961860
resolved "https://registry.yarnpkg.com/strip-dirs/-/strip-dirs-2.1.0.tgz#4987736264fc344cf20f6c34aca9d13d1d4ed6c5"
@@ -1831,6 +1895,16 @@ [email protected]:
18311895
tar.gz "^1.0.5"
18321896
xhr-request-promise "^0.1.2"
18331897

1898+
table@^5.1.1:
1899+
version "5.1.1"
1900+
resolved "https://registry.yarnpkg.com/table/-/table-5.1.1.tgz#92030192f1b7b51b6eeab23ed416862e47b70837"
1901+
integrity sha512-NUjapYb/qd4PeFW03HnAuOJ7OMcBkJlqeClWxeNlQ0lXGSb52oZXGzkO0/I0ARegQ2eUT1g2VDJH0eUxDRcHmw==
1902+
dependencies:
1903+
ajv "^6.6.1"
1904+
lodash "^4.17.11"
1905+
slice-ansi "2.0.0"
1906+
string-width "^2.1.1"
1907+
18341908
tar-stream@^1.5.2:
18351909
version "1.6.2"
18361910
resolved "https://registry.yarnpkg.com/tar-stream/-/tar-stream-1.6.2.tgz#8ea55dab37972253d9a9af90fdcd559ae435c555"
@@ -1956,6 +2030,13 @@ [email protected], unpipe@~1.0.0:
19562030
resolved "https://registry.yarnpkg.com/unpipe/-/unpipe-1.0.0.tgz#b2bf4ee8514aae6165b4817829d21b2ef49904ec"
19572031
integrity sha1-sr9O6FFKrmFltIF4KdIbLvSZBOw=
19582032

2033+
uri-js@^4.2.2:
2034+
version "4.2.2"
2035+
resolved "https://registry.yarnpkg.com/uri-js/-/uri-js-4.2.2.tgz#94c540e1ff772956e2299507c010aea6c8838eb0"
2036+
integrity sha512-KY9Frmirql91X2Qgjry0Wd4Y+YTdrdZheS8TFwvkbLWf/G5KNJDCh6pKL5OZctEW4+0Baa5idK2ZQuELRwPznQ==
2037+
dependencies:
2038+
punycode "^2.1.0"
2039+
19592040
url-parse-lax@^1.0.0:
19602041
version "1.0.0"
19612042
resolved "https://registry.yarnpkg.com/url-parse-lax/-/url-parse-lax-1.0.0.tgz#7af8f303645e9bd79a272e7a14ac68bc0609da73"

contracts/modules/Checkpoint/DividendCheckpoint.sol

Lines changed: 2 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
pragma solidity ^0.4.24;
99

1010
import "./ICheckpoint.sol";
11+
import "./DividendCheckpointStorage.sol";
1112
import "../Module.sol";
1213
import "../../interfaces/ISecurityToken.sol";
1314
import "openzeppelin-solidity/contracts/math/SafeMath.sol";
@@ -17,43 +18,9 @@ import "openzeppelin-solidity/contracts/math/Math.sol";
1718
* @title Checkpoint module for issuing ether dividends
1819
* @dev abstract contract
1920
*/
20-
contract DividendCheckpoint is ICheckpoint, Module {
21+
contract DividendCheckpoint is DividendCheckpointStorage, ICheckpoint, Module {
2122
using SafeMath for uint256;
2223

23-
uint256 public EXCLUDED_ADDRESS_LIMIT = 50;
24-
bytes32 public constant DISTRIBUTE = "DISTRIBUTE";
25-
bytes32 public constant MANAGE = "MANAGE";
26-
bytes32 public constant CHECKPOINT = "CHECKPOINT";
27-
28-
struct Dividend {
29-
uint256 checkpointId;
30-
uint256 created; // Time at which the dividend was created
31-
uint256 maturity; // Time after which dividend can be claimed - set to 0 to bypass
32-
uint256 expiry; // Time until which dividend can be claimed - after this time any remaining amount can be withdrawn by issuer -
33-
// set to very high value to bypass
34-
uint256 amount; // Dividend amount in WEI
35-
uint256 claimedAmount; // Amount of dividend claimed so far
36-
uint256 totalSupply; // Total supply at the associated checkpoint (avoids recalculating this)
37-
bool reclaimed; // True if expiry has passed and issuer has reclaimed remaining dividend
38-
uint256 dividendWithheld;
39-
uint256 dividendWithheldReclaimed;
40-
mapping (address => bool) claimed; // List of addresses which have claimed dividend
41-
mapping (address => bool) dividendExcluded; // List of addresses which cannot claim dividends
42-
bytes32 name; // Name/title - used for identification
43-
}
44-
45-
// List of all dividends
46-
Dividend[] public dividends;
47-
48-
// List of addresses which cannot claim dividends
49-
address[] public excluded;
50-
51-
// Mapping from address to withholding tax as a percentage * 10**16
52-
mapping (address => uint256) public withholdingTax;
53-
54-
// Total amount of ETH withheld per investor
55-
mapping (address => uint256) public investorWithheld;
56-
5724
event SetDefaultExcludedAddresses(address[] _excluded, uint256 _timestamp);
5825
event SetWithholding(address[] _investors, uint256[] _withholding, uint256 _timestamp);
5926
event SetWithholdingFixed(address[] _investors, uint256 _withholding, uint256 _timestamp);

0 commit comments

Comments
 (0)