Skip to content

Commit 40d5b38

Browse files
authored
dev 2.1 > dev 3.0 (#521)
* Updated changelog * Changed currencyRaised to stableCoinsRaised * MATM contract and test fixes * minor fix * CLI - LockupTM support * individual balance for every stable coin listed * CLI minor fixes * recommended fixes * Added code comments * Removed uninitialized pointer * CLI - Fixes for new contract changes * Minor fix * trying by adding some buffer in time travel * [WIP] CLI advances * modify function changes * WIP * CircleCI changes * CircleCI changes * CircleCI changes * Badge * Store test results * Removed coverage from commit workflow * CLI - WIP VolumeRestrictionTM support * CLI - Removed STVR TM from CLI * Added test reporter * Addded artifact collection * Added parallelism * Comment * Bumped parallelism to 3 * Coverage requires approval * Bumped parallelism to 4 * Removed manual approval * Combine travis and CircleCI * env var changes * comment * Improve MATM to allow allowances and expiryTimes to be changed for existing approvals * Refactoring and improvements * CLI - Operations in batch for VRTM * fuzz test for adding and removing modules * finished module fuzz test * Fix rounding off errors (#467) * Fixed rounding off errors * Increased tolerance * Reduced tolerance to zero * Comment updated * Tolerance set to 2 * Minor CLI changes * fix modify batch * Increased no o/p timeout * Improve menu string * Triggering CircleCI * CLI minor changes * Add ability to see excluded addresses * Updates * Fixes * Bump excluded limit to 150 * remove SRVTM * Use investor list from checkpoint * CLI - Script to generate tokens, whitelist investors and mint to them * CLI - Explore account * Update PolyTokenFaucet.sol * Improved the natspec comments * added VestingEscrowWalletLogic to output * Track withheld at dividend granularity * wip - issue with test not finishing * removed redundant dependencies * increased versions * WIP-multiple transaction within 1 day with Individual and daily Restrictions * updated yarn.lock * Add balances & claim amounts to getters * CLI - Flow change and updates for dividends_manager * Updated test script * Script updated * fixed bug with the initial test * Update test.sh * Script updated * coverage block gas limit increased * ganache-cli 6.2.5 * Travis submit coverage * added scenario 2 and 3 * fix input random number issue * Add more test cases * CLI Minor fixes * 483 484 fix (#488) * Removed the Redundant functions from eternal storage contract as mentioned in Issue#483, Converted Internal functions to public ones as mentioned in #484 & there was a function named getArrayString, I have removed that function because it was returning Array of String, which is not possible as it isn't supported by Current ABIENCODER. * Removed the Redundant functions from eternal storage contract as mentioned in Issue#483, Converted Internal functions to public ones as mentioned in #484 & there was a function named getArrayString, I have removed that function because it was returning Array of String, which is not possible as it isn't supported by Current ABIENCODER. * Add getCheckpointData * CLI minor changes * CLI typo fix * bug fixes * CLI updates * finished test case 4 * repeat period count from the startTime * WIP * fixed functions getActiveApprovalsToUser and added getAllApprovals() both will return all approval details in multiple arrays as requested * edited function description * Bumped cappedSTO version * MATM version bumped * CLI update * test case fixed * Update j_manual_approval_transfer_manager.js * WIP * reinvent the test case * Merge conflicts * indexing the param (#500) * Permissions update * Removed redundant events * dual truffle coverage * VRTM coverage fix * Added compile command * Updated coverage script * removed compile command * Updated truffle config * Pull accredited lists from USDSTO (#502) * WIP * Add getter * Update changelog * Remove commented code * CLI - Show accredited data * Update contracts/modules/STO/USDTieredSTOStorage.sol Co-Authored-By: adamdossa <[email protected]> * Remove commented code * add getRestrictedAddresses() function * minor fix * Fixed test file * Add restrictions data to getRestrictedAddresses * Remove commented code and better tests * modified the getRestrictedAddress() function * code cleanup * CLI - Show restrictions table * minor fix * CLI - Update method name, updated csv dates * Trigger TravisCI * CLI - Changed names of restrictions * Minor fix * CLI - Percentage with decimals fix * CLI - Changed names of restrictions * add exempt list getter * minor fix * CLI - Added 'show exempted addresses' * Small optimisation * compilation errors * compilation errors in modules * compilation errors * Move contracts to the respective folders (#510) * move storage contracts to storage folder and migrate vesting to experimental * BTM migrate to experimental * move Lockup to experimental * Small re-shuffling * remove _ prefix from public functions * removed polyToken from factories * Fix comments (#519) * Fix STR size * fixed b_capped_sto.js * capped_sto fix * Remove duped test cases * Fix erc20 test * More fixes * fixes for h_general_transfer_manager.js * fixes for h_general_transfer_manager.js * fixes for j_manual_approval_transfer_manager.js * fixed n_security_token_registry.js * h_general_transfer_manager.js -removed redundant block due to merge issue * fixes for u_module_registry_proxy.js * fixes for z_vesting_escrow_wallet.js * fixes for z_vesting_escrow_wallet.js * Dividend improvements (#526) * Working * Wallet change test case * Fix ether dividend tests * CLI - Update for wallet on dividends modules * Add estimated tax / amounts to getter * CLI - Update for dividends status data * Fix MATM test case * fixes for z_vesting_escrow_wallet.js * Update * Remove unnecessary import * Clean up some imports * Small size optimisation and migrate fix * fixes for z_vesting_escrow_wallet.js * fixes for z_vesting_escrow_wallet.js (finished) * fixes for y_volume_restriction_tm.js * fixes for y_volume_restriction_tm.js * Some struct refactoring. * Some more optimisations * Some more optimisations * Merge 2.1 fix * More optimisations * Remove comments * Fixed imports in tests * Some updates * Some updates * WIP fixes * Some more updates * Add temp.js * Updates * Updates * Fixes * Fixes * Updates * usdtsto optimization (#534) * Initial optimization * Tests fixed * comments removed * Make some functions external * Updates * More fixes * Fix circle-ci * Add more tests
1 parent c339f52 commit 40d5b38

File tree

122 files changed

+15479
-4717
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

122 files changed

+15479
-4717
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ cache:
77
jobs:
88
include:
99
- stage: Test
10-
install:
10+
install:
1111
- echo -ne '\n' | sudo add-apt-repository ppa:ethereum/ethereum
1212
- sudo apt-get update
1313
- sudo apt-get install -y dpkg

0

Whitespace-only changes.

CLI/commands/ST20Generator.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,9 @@ async function executeApp(_ticker, _transferOwnership, _name, _details, _divisib
3232
await step_transfer_ticker_ownership(_transferOwnership);
3333
await step_token_deploy(_name, _details, _divisible);
3434
}
35-
await tokenManager.executeApp(tokenSymbol);
35+
if (typeof _divisible === 'undefined') {
36+
await tokenManager.executeApp(tokenSymbol);
37+
}
3638
} catch (err) {
3739
console.log(err);
3840
return;

CLI/commands/TickerRollForward.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ let securityTokenRegistry;
2020
let securityTokenRegistryAddress;
2121

2222
function Ticker(_owner, _symbol, _name) {
23-
this.owner = _owner;
24-
this.symbol = _symbol;
25-
this.name = _name;
23+
this.owner = _owner;
24+
this.symbol = _symbol;
25+
this.name = _name;
2626
}
2727

2828
function FailedRegistration(_ticker, _error) {
@@ -58,11 +58,11 @@ async function startScript() {
5858
}
5959

6060
async function readFile() {
61-
var stream = fs.createReadStream("./CLI/data/ticker_data.csv");
61+
var stream = fs.createReadStream(`${__dirname}/../data/ticker_data.csv`);
6262

6363
var csvStream = csv()
6464
.on("data", function (data) {
65-
ticker_data.push(new Ticker(data[0],data[1],data[2],data[3]));
65+
ticker_data.push(new Ticker(data[0], data[1], data[2], data[3]));
6666
})
6767
.on("end", async function () {
6868
await registerTickers();
@@ -73,12 +73,12 @@ async function readFile() {
7373
async function registerTickers() {
7474
// Poly approval for registration fees
7575
let polyBalance = BigNumber(await polyToken.methods.balanceOf(Issuer.address).call());
76-
let fee = web3.utils.fromWei(await securityTokenRegistry.methods.getTickerRegistrationFee().call());
76+
let fee = web3.utils.fromWei(await securityTokenRegistry.methods.getTickerRegistrationFee().call());
7777
let totalFee = BigNumber(ticker_data.length).mul(fee);
7878

7979
if (totalFee.gt(polyBalance)) {
8080
console.log(chalk.red(`\n*******************************************************************************`));
81-
console.log(chalk.red(`Not enough POLY to pay registration fee. Require ${totalFee.div(10**18).toNumber()} POLY but have ${polyBalance.div(10**18).toNumber()} POLY.`));
81+
console.log(chalk.red(`Not enough POLY to pay registration fee. Require ${totalFee.div(10 ** 18).toNumber()} POLY but have ${polyBalance.div(10 ** 18).toNumber()} POLY.`));
8282
console.log(chalk.red(`*******************************************************************************\n`));
8383
process.exit(0);
8484
} else {
@@ -100,7 +100,7 @@ async function registerTickers() {
100100
}
101101

102102
// validate ticker
103-
await securityTokenRegistry.methods.getTickerDetails(ticker_data[i].symbol).call({}, function(error, result){
103+
await securityTokenRegistry.methods.getTickerDetails(ticker_data[i].symbol).call({}, function (error, result) {
104104
if (result[1] != 0) {
105105
failed_tickers.push(` ${i} is already registered`);
106106
valid = false;
@@ -131,7 +131,7 @@ async function logResults() {
131131
Successful registrations: ${registered_tickers.length}
132132
Failed registrations: ${failed_tickers.length}
133133
Total gas consumed: ${totalGas}
134-
Total gas cost: ${defaultGasPrice.mul(totalGas).div(10**18)} ETH
134+
Total gas cost: ${defaultGasPrice.mul(totalGas).div(10 ** 18)} ETH
135135
136136
List of failed registrations:
137137
${failed_tickers}

CLI/commands/common/common_functions.js

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ const Tx = require('ethereumjs-tx');
33
const permissionsList = require('./permissions_list');
44
const abis = require('../helpers/contract_abis');
55

6-
async function connect(abi, address) {
6+
function connect(abi, address) {
77
contractRegistry = new web3.eth.Contract(abi, address);
88
contractRegistry.setProvider(web3.currentProvider);
99
return contractRegistry
@@ -15,7 +15,7 @@ async function checkPermission(contractName, functionName, contractRegistry) {
1515
return true
1616
} else {
1717
let stAddress = await contractRegistry.methods.securityToken().call();
18-
let securityToken = await connect(abis.securityToken(), stAddress);
18+
let securityToken = connect(abis.securityToken(), stAddress);
1919
let stOwner = await securityToken.methods.owner().call();
2020
if (stOwner == Issuer.address) {
2121
return true
@@ -49,7 +49,7 @@ async function getGasLimit(options, action) {
4949

5050
async function checkPermissions(action) {
5151
let contractRegistry = await connect(action._parent.options.jsonInterface, action._parent._address);
52-
//NOTE this is a condition to verify if the transaction comes from a module or not.
52+
//NOTE this is a condition to verify if the transaction comes from a module or not.
5353
if (contractRegistry.methods.hasOwnProperty('factory')) {
5454
let moduleAddress = await contractRegistry.methods.factory().call();
5555
let moduleRegistry = await connect(abis.moduleFactory(), moduleAddress);
@@ -153,10 +153,13 @@ module.exports = {
153153
let filteredLogs = logs.filter(l => l.topics.includes(eventJsonInterface.signature));
154154
return filteredLogs.map(l => web3.eth.abi.decodeLog(eventJsonInterface.inputs, l.data, l.topics.slice(1)));
155155
},
156+
connect: function (abi, address) {
157+
return connect(abi, address)
158+
},
156159
splitIntoBatches: function (data, batchSize) {
157160
let allBatches = [];
158-
for (let index = 0; index < data.length; index += batchSize) {
159-
allBatches.push(data.slice(index, index + batchSize));
161+
for (let index = 0; index < data.length; index += parseInt(batchSize)) {
162+
allBatches.push(data.slice(index, index + parseInt(batchSize)));
160163
}
161164
return allBatches;
162165
},

CLI/commands/common/constants.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ module.exports = Object.freeze({
2929
FUND_RAISE_TYPES: {
3030
ETH: 0,
3131
POLY: 1,
32-
DAI: 2
32+
STABLE: 2
3333
},
3434
DEFAULT_BATCH_SIZE: 75,
3535
ADDRESS_ZERO: '0x0000000000000000000000000000000000000000'

CLI/commands/common/permissions_list.js

Lines changed: 48 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -60,46 +60,68 @@ function getPermissionList() {
6060
},
6161
ManualApprovalTransferManager: {
6262
addManualApproval: "TRANSFER_APPROVAL",
63-
addManualBlocking: "TRANSFER_APPROVAL",
6463
revokeManualApproval: "TRANSFER_APPROVAL",
65-
revokeManualBlocking: "TRANSFER_APPROVAL"
6664
},
6765
PercentageTransferManager: {
6866
modifyWhitelist: "WHITELIST",
6967
modifyWhitelistMulti: "WHITELIST",
7068
setAllowPrimaryIssuance: "ADMIN",
7169
changeHolderPercentage: "ADMIN"
7270
},
73-
LockupVolumeRestrictionTM: {
74-
addLockup: "ADMIN",
75-
addLockUpMulti: "ADMIN",
76-
removeLockUp: "ADMIN",
77-
modifyLockUp: "ADMIN"
71+
VolumeRestrictionTM: {
72+
changeExemptWalletList: "ADMIN",
73+
addIndividualRestriction: "ADMIN",
74+
addIndividualRestrictionMulti: "ADMIN",
75+
addGlobalRestriction: "ADMIN",
76+
addDailyGlobalRestriction: "ADMIN",
77+
removeIndividualRestriction: "ADMIN",
78+
removeIndividualRestrictionMulti: "ADMIN",
79+
removeGlobalRestriction: "ADMIN",
80+
removeDailyGlobalRestriction: "ADMIN",
81+
modifyIndividualRestriction: "ADMIN",
82+
modifyIndividualRestrictionMulti: "ADMIN",
83+
modifyGlobalRestriction: "ADMIN",
84+
modifyDailyGlobalRestriction: "ADMIN"
7885
},
79-
SingleTradeVolumeRestrictionTM: {
80-
setAllowPrimaryIssuance: "ADMIN",
81-
changeTransferLimitToPercentage: "ADMIN",
82-
changeTransferLimitToTokens: "ADMIN",
83-
changeGlobalLimitInTokens: "ADMIN",
84-
changeGlobalLimitInPercentage: "ADMIN",
85-
addExemptWallet: "ADMIN",
86-
removeExemptWallet: "ADMIN",
87-
addExemptWalletMulti: "ADMIN",
88-
removeExemptWalletMulti: "ADMIN",
89-
setTransferLimitInTokens: "ADMIN",
90-
setTransferLimitInPercentage: "ADMIN",
91-
removeTransferLimitInPercentage: "ADMIN",
92-
removeTransferLimitInTokens: "ADMIN",
93-
setTransferLimitInTokensMulti: "ADMIN",
94-
setTransferLimitInPercentageMulti: "ADMIN",
95-
removeTransferLimitInTokensMulti: "ADMIN",
96-
removeTransferLimitInPercentageMulti: "ADMIN"
86+
BlacklistTransferManager: {
87+
addBlacklistType: "ADMIN",
88+
addBlacklistTypeMulti: "ADMIN",
89+
modifyBlacklistType: "ADMIN",
90+
modifyBlacklistTypeMulti: "ADMIN",
91+
deleteBlacklistType: "ADMIN",
92+
deleteBlacklistTypeMulti: "ADMIN",
93+
addInvestorToBlacklist: "ADMIN",
94+
addInvestorToBlacklistMulti: "ADMIN",
95+
addMultiInvestorToBlacklistMulti: "ADMIN",
96+
addInvestorToNewBlacklist: "ADMIN",
97+
deleteInvestorFromAllBlacklist: "ADMIN",
98+
deleteInvestorFromAllBlacklistMulti: "ADMIN",
99+
deleteInvestorFromBlacklist: "ADMIN",
100+
deleteMultiInvestorsFromBlacklistMulti: "ADMIN",
101+
},
102+
VestingEscrowWallet: {
103+
changeTreasuryWallet: "ONLY_OWNER",
104+
depositTokens: "ADMIN",
105+
sendToTreasury: "ADMIN",
106+
pushAvailableTokens: "ADMIN",
107+
addTemplate: "ADMIN",
108+
removeTemplate: "ADMIN",
109+
addSchedule: "ADMIN",
110+
addScheduleFromTemplate: "ADMIN",
111+
modifySchedule: "ADMIN",
112+
revokeSchedule: "ADMIN",
113+
revokeAllSchedules: "ADMIN",
114+
pushAvailableTokensMulti: "ADMIN",
115+
addScheduleMulti: "ADMIN",
116+
addScheduleFromTemplateMulti: "ADMIN",
117+
revokeSchedulesMulti: "ADMIN",
118+
modifyScheduleMulti: "ADMIN"
97119
}
98120
}
99121
}
100122

101123
module.exports = {
102-
verifyPermission: function(contractName, functionName) {
124+
verifyPermission: function (contractName, functionName) {
103125
let list = getPermissionList();
104126
try {
105127
return list[contractName][functionName]

0 commit comments

Comments
 (0)