Skip to content
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

Merge in latest dev-1.5.0 from polymath #6

Merged
merged 107 commits into from
Oct 4, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
107 commits
Select commit Hold shift + click to select a range
c0f3630
Add `getDefaultExcluded`
adamdossa Sep 26, 2018
45550bb
Add events for withholding tax and change to setDefaultExcluded
adamdossa Sep 26, 2018
8a0d25b
CLI: Switch over text menu options instead of indexes.
VictorVicente Sep 26, 2018
6120339
CLI: Support for tax withholding and exclusions from dividends.
VictorVicente Sep 27, 2018
dda3365
Merge branch 'development-1.5.0' into withholding_tax_on_dividends
VictorVicente Sep 27, 2018
9e9b0e3
overruling the whenNotPaused modifier when msg.sender is owner
SatyamSB Sep 27, 2018
1ebe0da
Start ethereum bridge only on Travis CI cron jobs
VictorVicente Sep 27, 2018
f09c2f6
Exclude s_v130_to_v140_upgrade.js test
VictorVicente Sep 27, 2018
b3c8d95
Merge branch 'development-1.5.0' into TravisCI-cron-jobs
VictorVicente Sep 27, 2018
e70b072
Update burn functions
adamdossa Sep 27, 2018
d06a69f
Merge branch 'development-1.5.0' into check-pause-flow
SatyamSB Sep 28, 2018
825208e
some fixes
SatyamSB Sep 28, 2018
6421e09
Merge pull request #2 from PolymathNetwork/development-1.5.0
glitch003 Sep 28, 2018
4d6d169
Updates
adamdossa Sep 28, 2018
4570480
Merge pull request #285 from PolymathNetwork/check-pause-flow
adamdossa Sep 28, 2018
3d75dda
Add an example redemption module
adamdossa Sep 28, 2018
d8827f1
Merge branch 'development-1.5.0' into withholding_tax_on_dividends
VictorVicente Sep 28, 2018
8a1d8f9
Event names modified
VictorVicente Sep 28, 2018
fe71172
Fix for calculate dividend
VictorVicente Sep 28, 2018
8022b1b
Merge branch 'development-1.5.0' into TravisCI-cron-jobs
VictorVicente Sep 28, 2018
2c818be
Merge pull request #283 from PolymathNetwork/withholding_tax_on_divid…
pabloruiz55 Sep 28, 2018
147d7cd
Coverage fix for TravisCI
VictorVicente Sep 28, 2018
62b1dce
Merge branch 'development-1.5.0' into TravisCI-cron-jobs
VictorVicente Sep 28, 2018
2841e8a
Merge pull request #286 from PolymathNetwork/TravisCI-cron-jobs
pabloruiz55 Sep 28, 2018
23f5f98
Optimisations
adamdossa Sep 28, 2018
0fd5637
CLI: Get factories address from ModuleRegistry
VictorVicente Sep 28, 2018
4da0183
Get checkpoints from function istead of events
VictorVicente Sep 28, 2018
e94e025
WIP
adamdossa Sep 30, 2018
cd952c3
Updates
adamdossa Sep 30, 2018
e425691
Add assertion
adamdossa Sep 30, 2018
7ad0c19
Update interface
adamdossa Sep 30, 2018
6ca6b19
Merge branch 'development-1.5.0' into optimise_str_size
adamdossa Sep 30, 2018
0384c3c
Update tests
adamdossa Sep 30, 2018
9d547ec
Add module test cases
adamdossa Sep 30, 2018
d2f3502
Merge branch 'development-1.5.0' into multiple_types
adamdossa Sep 30, 2018
c92ed87
minor fixes to reduce the size
SatyamSB Oct 1, 2018
0ea44ab
Revert changes to setProtocol
adamdossa Oct 1, 2018
04fb3a1
Only allow STs to be added if there is a valid ticker registration first
adamdossa Oct 1, 2018
6621d9e
Change logic to allow tickers to be registered directly when modifyin…
adamdossa Oct 1, 2018
6deb8e2
CLI: STR getters for fees and expiry limit
VictorVicente Oct 1, 2018
7eddf7d
CLI typo
VictorVicente Oct 1, 2018
27e13cb
minor fixes
SatyamSB Oct 1, 2018
c7ddbe5
Merge branch 'optimise_str_size' of https://github.com/PolymathNetwor…
SatyamSB Oct 1, 2018
d56957f
Minor change
adamdossa Oct 1, 2018
712ec47
Fixes based on Satyam feedback
adamdossa Oct 1, 2018
d348ff8
Modify require text
adamdossa Oct 1, 2018
1420bce
CLI: Owner getter on STR
VictorVicente Oct 1, 2018
555aa9b
add version check in the getAvailableModulesOfType()
SatyamSB Oct 1, 2018
befd377
Merge pull request #296 from PolymathNetwork/improve-getter-mr
satyamakgec Oct 1, 2018
37c59f7
WIP
adamdossa Oct 1, 2018
922f037
Merge branch 'development-1.5.0' into fix_namespace_squatting_in_MR
adamdossa Oct 1, 2018
02d9426
Fix
adamdossa Oct 1, 2018
dd7d1b0
Merge branch 'development-1.5.0' into multiple_types
adamdossa Oct 1, 2018
fefbb87
Updates
adamdossa Oct 1, 2018
626083a
More fixes for tests
adamdossa Oct 1, 2018
3f6f9c5
Merge branch 'development-1.5.0' into optimise_str_size
adamdossa Oct 1, 2018
c993c5f
Fix every test case (sigh)
adamdossa Oct 1, 2018
5a01e07
More test fixes
adamdossa Oct 1, 2018
0658566
Last fix
adamdossa Oct 1, 2018
1f557fd
Merge branch 'development-1.5.0' into CLI-minor-updates
VictorVicente Oct 1, 2018
1c7ed17
Fix modifyTicker
adamdossa Oct 1, 2018
37b0b96
Add more test cases
adamdossa Oct 1, 2018
d7fc06a
Merge pull request #298 from PolymathNetwork/CLI-minor-updates
pabloruiz55 Oct 1, 2018
0f98a41
Merge branch 'development-1.5.0' into optimise_str_size
VictorVicente Oct 2, 2018
213b318
Added name to dividend struct
maxsam4 Oct 2, 2018
9b626d5
test case typos fixed
maxsam4 Oct 2, 2018
259a4de
small changelog fix
SatyamSB Oct 2, 2018
8dfa7b3
Merge branch 'development-1.5.0' into fix_namespace_squatting_in_MR
SatyamSB Oct 2, 2018
e871913
Merge pull request #297 from PolymathNetwork/fix_namespace_squatting_…
satyamakgec Oct 2, 2018
1d8f211
Merge branch 'development-1.5.0' into dividend-name
maxsam4 Oct 2, 2018
9373adc
Merge branch 'development-1.5.0' into optimise_str_size
adamdossa Oct 2, 2018
472b513
Merge branch 'development-1.5.0' into multiple_types
adamdossa Oct 2, 2018
c8195a5
Update title
adamdossa Oct 2, 2018
840fb8f
Fix test case based on registerModule change
adamdossa Oct 2, 2018
b666431
Small fix
adamdossa Oct 2, 2018
61056d8
Updated changelog
maxsam4 Oct 2, 2018
efaaf5a
Merge branch 'multiple_types' into development-1.5.0
adamdossa Oct 2, 2018
e9e31ac
Merge branch 'development-1.5.0' into optimise_str_size
adamdossa Oct 2, 2018
8b79b91
changed ganache test limit to 8mm
pabloruiz55 Oct 2, 2018
6f0f44e
Fix bad merge
adamdossa Oct 2, 2018
4d81666
changed ganache test limit to 0xfffffffffff for coverage
pabloruiz55 Oct 2, 2018
b756224
Removed hard-coded gas in some tests
maxsam4 Oct 2, 2018
a15f2ef
Removed more gas amounts
maxsam4 Oct 2, 2018
b6981b2
CLI: Gas limit for estimation
VictorVicente Oct 2, 2018
bc24a72
Merge branch 'development-1.5.0' into CLI-minor-updates
VictorVicente Oct 2, 2018
ec34f02
Renamed a function
maxsam4 Oct 2, 2018
aa1d100
Merge branch 'development-1.5.0' into dividend-name
maxsam4 Oct 2, 2018
c06beaa
Merge pull request #294 from PolymathNetwork/optimise_str_size
adamdossa Oct 2, 2018
803f537
Merge branch 'development-1.5.0' into ganache-limit
pabloruiz55 Oct 2, 2018
bd35cc9
Merge pull request #300 from PolymathNetwork/ganache-limit
satyamakgec Oct 2, 2018
7090b18
Merge branch 'development-1.5.0' into dividend-name
maxsam4 Oct 2, 2018
94495e3
Name changed from string to bytes32
maxsam4 Oct 2, 2018
8427603
Removed duplicate test case
maxsam4 Oct 2, 2018
e6a04e5
Merge branch 'development-1.5.0' into CLI-minor-updates
pabloruiz55 Oct 2, 2018
c2b8b06
remove Log prefix from the oracles contract
SatyamSB Oct 2, 2018
c971a98
Merge branch 'development-1.5.0' into remove-log-oracles
SatyamSB Oct 2, 2018
deeb1fe
Merge pull request #299 from PolymathNetwork/dividend-name
satyamakgec Oct 2, 2018
9073afa
Merge branch 'development-1.5.0' into remove-log-oracles
SatyamSB Oct 2, 2018
12879cd
Merge branch 'development-1.5.0' into CLI-minor-updates
pabloruiz55 Oct 2, 2018
0d1c40b
Merge pull request #301 from PolymathNetwork/CLI-minor-updates
pabloruiz55 Oct 2, 2018
bdcd843
Merge branch 'development-1.5.0' into remove-log-oracles
pabloruiz55 Oct 2, 2018
874b81b
CLI: rename of getModulesByTypeAndToken function
VictorVicente Oct 2, 2018
96399a7
CLI: Dividend name or title
VictorVicente Oct 2, 2018
8667113
Merge pull request #302 from PolymathNetwork/remove-log-oracles
pabloruiz55 Oct 2, 2018
d391ea1
Merge branch 'development-1.5.0' into CLI-minor-updates
pabloruiz55 Oct 2, 2018
af9ae8c
Merge pull request #303 from PolymathNetwork/CLI-minor-updates
pabloruiz55 Oct 2, 2018
3904fa9
Merge pull request #5 from PolymathNetwork/development-1.5.0
glitch003 Oct 4, 2018
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
2 changes: 1 addition & 1 deletion .solcover.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ module.exports = {
norpc: true,
port: 8545,
copyPackages: ['openzeppelin-solidity'],
testCommand: 'node ../node_modules/.bin/truffle test `find test/*.js ! -name a_poly_oracle.js` --network coverage',
testCommand: 'node ../node_modules/.bin/truffle test `find test/*.js ! -name a_poly_oracle.js -and ! -name s_v130_to_v140_upgrade.js` --network coverage',
deepSkip: true,
skipFiles: ['external', 'flat']
};
9 changes: 6 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ All notable changes to this project will be documented in this file.
[__1.5.0__](https://www.npmjs.com/package/polymath-core?activeTab=readme) __15-08-18__

## Added
* Added `name` field to dividends struct in DividendCheckpoint. #295
* Added `getTagsByType`, `getTagsByTypeAndToken`, `getModulesByType`, `getModulesByTypeAndToken` to MR
* Added `getTokensByOwner` to STR
* Added withholding tax to ether & erc20 dividends
* Generalised MakerDAO oracle to allow different instances referencing different currencies
Expand All @@ -24,10 +26,11 @@ All notable changes to this project will be documented in this file.
## Fixed
* Generalize the STO varaible names and added them in `ISTO.sol` to use the common standard in all STOs.
* Generalize the event when any new token get registered with the polymath ecosystem. `LogNewSecurityToken` should emit _ticker, _name, _securityTokenAddress, _owner, _addedAt, _registrant respectively. #230
## Removed

## Removed
* Remove `swarmHash` from the `registerTicker(), addCustomTicker(), generateSecurityToken(), addCustomSecurityToken()` functions of TickerRegistry.sol and SecurityTokenRegistry.sol. #230
* Remove `Log` prefix from all the event present in the ecosystem.
* Remove `Log` prefix from all the event present in the ecosystem.
* Removed `addTagByModuleType` & `removeTagsByModuleType` from MR.

======

Expand Down
68 changes: 32 additions & 36 deletions CLI/commands/ST20Generator.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,20 @@ var common = require('./common/common_functions');
var global = require('./common/global');

let securityTokenRegistryAddress;
let cappedSTOFactoryAddress;
let usdTieredSTOFactoryAddress;

///////////////////
// Crowdsale params
let tokenName;
let tokenSymbol;
let selectedSTO;

const STO_KEY = 3;
const REG_FEE_KEY = 'tickerRegFee';
const LAUNCH_FEE_KEY = 'stLaunchFee';
const MODULES_TYPES = {
PERMISSION: 1,
TRANSFER: 2,
STO: 3,
DIVIDENDS: 4
}

const cappedSTOFee = 20000;
const usdTieredSTOFee = 100000;
const tokenDetails = "";
Expand All @@ -37,8 +39,6 @@ let usdToken;
let securityToken;
let generalTransferManager;
let currentSTO;
let cappedSTOFactory;
let usdTieredSTOFactory;

// App flow
let _tokenConfig;
Expand Down Expand Up @@ -90,16 +90,6 @@ async function setup(){
let usdTokenAddress = await contracts.usdToken();
usdToken = new web3.eth.Contract(polytokenABI, usdTokenAddress);
usdToken.setProvider(web3.currentProvider);

cappedSTOFactoryAddress = await contracts.cappedSTOFactoryAddress();
let cappedSTOFactoryABI = abis.cappedSTOFactory();
cappedSTOFactory = new web3.eth.Contract(cappedSTOFactoryABI, cappedSTOFactoryAddress);
cappedSTOFactory.setProvider(web3.currentProvider);

usdTieredSTOFactoryAddress = await contracts.usdTieredSTOFactoryAddress();
let usdTieredSTOFactoryABI = abis.usdTieredSTOFactory();
usdTieredSTOFactory = new web3.eth.Contract(usdTieredSTOFactoryABI, usdTieredSTOFactoryAddress);
usdTieredSTOFactory.setProvider(web3.currentProvider);
} catch (err) {
console.log(err)
console.log('\x1b[31m%s\x1b[0m',"There was a problem getting the contracts. Make sure they are deployed to the selected network.");
Expand All @@ -111,7 +101,8 @@ async function step_ticker_reg(){
console.log('\n\x1b[34m%s\x1b[0m',"Token Creation - Symbol Registration");

let available = false;
let regFee = web3.utils.fromWei(await securityTokenRegistry.methods.getUintValues(web3.utils.soliditySha3(REG_FEE_KEY)).call());
let regFee = web3.utils.fromWei(await securityTokenRegistry.methods.getTickerRegistrationFee().call());
let isDeployed;

while (!available) {
console.log(chalk.green(`\nRegistering the new token symbol requires ${regFee} POLY & deducted from '${Issuer.address}', Current balance is ${(await currentBalance(Issuer.address))} POLY\n`));
Expand All @@ -123,6 +114,7 @@ async function step_ticker_reg(){
}

let details = await securityTokenRegistry.methods.getTickerDetails(tokenSymbol).call();
isDeployed = details[4];
if (new BigNumber(details[1]).toNumber() == 0) {
available = true;
await approvePoly(securityTokenRegistryAddress, regFee);
Expand All @@ -135,18 +127,20 @@ async function step_ticker_reg(){
}
}

if (typeof _tokenConfig === 'undefined' && readlineSync.keyInYNStrict(`Do you want to transfer the ownership of ${tokenSymbol} ticker?`)) {
let newOwner = readlineSync.question('Enter the address that will be the new owner: ', {
limit: function(input) {
return web3.utils.isAddress(input);
},
limitMessage: "Must be a valid address"
});
let transferTickerOwnershipAction = securityTokenRegistry.methods.transferTickerOwnership(newOwner, tokenSymbol);
let receipt = await common.sendTransaction(Issuer, transferTickerOwnershipAction, defaultGasPrice, 0, 1.5);
let event = common.getEventFromLogs(securityTokenRegistry._jsonInterface, receipt.logs, 'LogChangeTickerOwnership');
console.log(chalk.green(`Ownership trasferred successfully. The new owner is ${event._newOwner}`));
process.exit(0);
if (!isDeployed) {
if (typeof _tokenConfig === 'undefined' && readlineSync.keyInYNStrict(`Do you want to transfer the ownership of ${tokenSymbol} ticker?`)) {
let newOwner = readlineSync.question('Enter the address that will be the new owner: ', {
limit: function(input) {
return web3.utils.isAddress(input);
},
limitMessage: "Must be a valid address"
});
let transferTickerOwnershipAction = securityTokenRegistry.methods.transferTickerOwnership(newOwner, tokenSymbol);
let receipt = await common.sendTransaction(Issuer, transferTickerOwnershipAction, defaultGasPrice, 0, 1.5);
let event = common.getEventFromLogs(securityTokenRegistry._jsonInterface, receipt.logs, 'ChangeTickerOwnership');
console.log(chalk.green(`Ownership trasferred successfully. The new owner is ${event._newOwner}`));
process.exit(0);
}
}
}

Expand All @@ -160,7 +154,7 @@ async function step_token_deploy(){
} else {
console.log('\n\x1b[34m%s\x1b[0m',"Token Creation - Token Deployment");

let launchFee = web3.utils.fromWei(await securityTokenRegistry.methods.getUintValues(web3.utils.soliditySha3(LAUNCH_FEE_KEY)).call());
let launchFee = web3.utils.fromWei(await securityTokenRegistry.methods.getSecurityTokenLaunchFee().call());
console.log(chalk.green(`\nToken deployment requires ${launchFee} POLY & deducted from '${Issuer.address}', Current balance is ${(await currentBalance(Issuer.address))} POLY\n`));

if (typeof _tokenConfig !== 'undefined' && _tokenConfig.hasOwnProperty('name')) {
Expand All @@ -187,15 +181,15 @@ async function step_token_deploy(){
await approvePoly(securityTokenRegistryAddress, launchFee);
let generateSecurityTokenAction = securityTokenRegistry.methods.generateSecurityToken(tokenName, tokenSymbol, tokenDetails, divisibility);
let receipt = await common.sendTransaction(Issuer, generateSecurityTokenAction, defaultGasPrice);
let event = common.getEventFromLogs(securityTokenRegistry._jsonInterface, receipt.logs, 'LogNewSecurityToken');
let event = common.getEventFromLogs(securityTokenRegistry._jsonInterface, receipt.logs, 'NewSecurityToken');
console.log(`Deployed Token at address: ${event._securityTokenAddress}`);
let securityTokenABI = abis.securityToken();
securityToken = new web3.eth.Contract(securityTokenABI, event._securityTokenAddress);
}
}

async function step_Wallet_Issuance(){
let result = await securityToken.methods.getModulesByType(STO_KEY).call();
let result = await securityToken.methods.getModulesByType(MODULES_TYPES.STO).call();
if (result.length > 0) {
console.log('\x1b[32m%s\x1b[0m',"STO has already been created at address " + result[0] + ". Skipping initial minting");
} else {
Expand Down Expand Up @@ -275,7 +269,7 @@ async function step_STO_launch() {
console.log("\n");
console.log('\x1b[34m%s\x1b[0m',"Token Creation - STO Configuration");

let result = await securityToken.methods.getModulesByType(STO_KEY).call();
let result = await securityToken.methods.getModulesByType(MODULES_TYPES.STO).call();
if (result.length > 0) {
STO_Address = result[0];
let stoModuleData = await securityToken.methods.getModule(STO_Address).call();
Expand Down Expand Up @@ -442,9 +436,10 @@ async function cappedSTO_launch() {
]
}, [startTime, endTime, web3.utils.toWei(cap), rate, raiseType, wallet]);

let cappedSTOFactoryAddress = await contracts.getModuleFactoryAddressByName(securityToken.options.address, MODULES_TYPES.STO, "CappedSTO");
let addModuleAction = securityToken.methods.addModule(cappedSTOFactoryAddress, bytesSTO, new BigNumber(stoFee).times(new BigNumber(10).pow(18)), 0);
let receipt = await common.sendTransaction(Issuer, addModuleAction, defaultGasPrice);
let event = common.getEventFromLogs(securityToken._jsonInterface, receipt.logs, 'LogModuleAdded');
let event = common.getEventFromLogs(securityToken._jsonInterface, receipt.logs, 'ModuleAdded');
console.log(`STO deployed at address: ${event._module}`);

STO_Address = event._module;
Expand Down Expand Up @@ -826,9 +821,10 @@ async function usdTieredSTO_launch() {
addresses.usdToken
]);

let usdTieredSTOFactoryAddress = await contracts.getModuleFactoryAddressByName(securityToken.options.address, MODULES_TYPES.STO, 'USDTieredSTO');
let addModuleAction = securityToken.methods.addModule(usdTieredSTOFactoryAddress, bytesSTO, new BigNumber(stoFee).times(new BigNumber(10).pow(18)), 0);
let receipt = await common.sendTransaction(Issuer, addModuleAction, defaultGasPrice);
let event = common.getEventFromLogs(securityToken._jsonInterface, receipt.logs, 'LogModuleAdded');
let event = common.getEventFromLogs(securityToken._jsonInterface, receipt.logs, 'ModuleAdded');
console.log(`STO deployed at address: ${event._module}`);

STO_Address = event._module;
Expand Down
4 changes: 1 addition & 3 deletions CLI/commands/TickerRollForward.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ var abis = require('./helpers/contract_abis');
let remoteNetwork = process.argv.slice(2)[0]; //batch size

///////////////////////// GLOBAL VARS /////////////////////////
const REG_FEE_KEY = 'tickerRegFee';

let ticker_data = [];
let registered_tickers = [];
let failed_tickers = [];
Expand Down Expand Up @@ -80,7 +78,7 @@ async function readFile() {
async function registerTickers() {
// Poly approval for registration fees
let polyBalance = BigNumber(await polyToken.methods.balanceOf(Issuer.address).call());
let fee = web3.utils.fromWei(await securityTokenRegistry.methods.getUintValues(web3.utils.soliditySha3(REG_FEE_KEY)).call());
let fee = web3.utils.fromWei(await securityTokenRegistry.methods.getTickerRegistrationFee().call());
let totalFee = BigNumber(ticker_data.length).mul(fee);

if (totalFee.gt(polyBalance)) {
Expand Down
5 changes: 5 additions & 0 deletions CLI/commands/common/common_functions.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,12 @@ module.exports = {
sendTransaction: async function (from, action, gasPrice, value, factor) {
if (typeof factor === 'undefined') factor = 1.2;

let block = await web3.eth.getBlock("latest");
let networkGasLimit = block.gasLimit;

let gas = Math.round(factor * (await action.estimateGas({ from: from.address, value: value})));
if (gas > networkGasLimit) gas = networkGasLimit;

console.log(chalk.black.bgYellowBright(`---- Transaction executed: ${action._method.name} - Gas limit provided: ${gas} ----`));

let nonce = await web3.eth.getTransactionCount(from.address);
Expand Down
21 changes: 8 additions & 13 deletions CLI/commands/contract_manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,6 @@ var global = require('./common/global');
var contracts = require('./helpers/contract_addresses');
var abis = require('./helpers/contract_abis');

const OWNER_KEY = 'owner';
const REG_FEE_KEY = 'tickerRegFee';
const LAUNCH_FEE_KEY = 'stLaunchFee';
const EXPIRY_LIMIT_KEY = 'expiryLimit';

// App flow
let currentContract = null;

Expand Down Expand Up @@ -79,7 +74,7 @@ async function selectContract() {

async function strActions() {
console.log('\n\x1b[34m%s\x1b[0m',"Security Token Registry - Main menu");
let contractOwner = await currentContract.methods.getAddressValues(web3.utils.soliditySha3(OWNER_KEY)).call();
let contractOwner = await currentContract.methods.owner().call();

if (contractOwner != Issuer.address) {
console.log(chalk.red(`You are not the owner of this contract. Current owner is ${contractOwner}`));
Expand Down Expand Up @@ -117,7 +112,7 @@ async function strActions() {
console.log(chalk.green(`Ticker has been updated successfuly`));
break;
case 'Remove Ticker':
let tickerToRemove = readlineSync.question('Enter the token symbol that you want to add or modify: ');
let tickerToRemove = readlineSync.question('Enter the token symbol that you want to remove: ');
let tickerToRemoveDetails = await currentContract.methods.getTickerDetails(tickerToRemove).call();
if (tickerToRemoveDetails[1] == 0) {
console.log(chalk.yellow(`${ticker} does not exist.`));
Expand Down Expand Up @@ -168,30 +163,30 @@ async function strActions() {
console.log(chalk.green(`Security Token has been updated successfuly`));
break;
case 'Change Expiry Limit':
let currentExpiryLimit = await currentContract.methods.getUintValues(web3.utils.soliditySha3(EXPIRY_LIMIT_KEY)).call();
let currentExpiryLimit = await currentContract.methods.getExpiryLimit().call();
console.log(chalk.yellow(`Current expiry limit is ${Math.floor(parseInt(currentExpiryLimit)/60/60/24)} days`));
let newExpiryLimit = duration.days(readlineSync.questionInt('Enter a new value in days for expiry limit: '));
let changeExpiryLimitAction = currentContract.methods.changeExpiryLimit(newExpiryLimit);
let changeExpiryLimitReceipt = await common.sendTransaction(Issuer, changeExpiryLimitAction, defaultGasPrice);
let changeExpiryLimitEvent = common.getEventFromLogs(currentContract._jsonInterface, changeExpiryLimitReceipt.logs, 'LogChangeExpiryLimit');
let changeExpiryLimitEvent = common.getEventFromLogs(currentContract._jsonInterface, changeExpiryLimitReceipt.logs, 'ChangeExpiryLimit');
console.log(chalk.green(`Expiry limit was changed successfuly. New limit is ${Math.floor(parseInt(changeExpiryLimitEvent._newExpiry)/60/60/24)} days\n`));
break;
case 'Change registration fee':
let currentRegFee = web3.utils.fromWei(await currentContract.methods.getUintValues(web3.utils.soliditySha3(REG_FEE_KEY)).call());
let currentRegFee = web3.utils.fromWei(await currentContract.methods.getTickerRegistrationFee().call());
console.log(chalk.yellow(`\nCurrent ticker registration fee is ${currentRegFee} POLY`));
let newRegFee = web3.utils.toWei(readlineSync.questionInt('Enter a new value in POLY for ticker registration fee: ').toString());
let changeRegFeeAction = currentContract.methods.changeTickerRegistrationFee(newRegFee);
let changeRegFeeReceipt = await common.sendTransaction(Issuer, changeRegFeeAction, defaultGasPrice);
let changeRegFeeEvent = common.getEventFromLogs(currentContract._jsonInterface, changeRegFeeReceipt.logs, 'LogChangeTickerRegistrationFee');
let changeRegFeeEvent = common.getEventFromLogs(currentContract._jsonInterface, changeRegFeeReceipt.logs, 'ChangeTickerRegistrationFee');
console.log(chalk.green(`Fee was changed successfuly. New fee is ${web3.utils.fromWei(changeRegFeeEvent._newFee)} POLY\n`));
break;
case 'Change ST launch fee':
let currentLaunchFee = web3.utils.fromWei(await currentContract.methods.getUintValues(web3.utils.soliditySha3(LAUNCH_FEE_KEY)).call());
let currentLaunchFee = web3.utils.fromWei(await currentContract.methods.getSecurityTokenLaunchFee().call());
console.log(chalk.yellow(`\nCurrent ST launch fee is ${currentLaunchFee} POLY`));
let newLaunchFee = web3.utils.toWei(readlineSync.questionInt('Enter a new value in POLY for ST launch fee: ').toString());
let changeLaunchFeeAction = currentContract.methods.changeSecurityLaunchFee(newLaunchFee);
let changeLaunchFeeReceipt = await common.sendTransaction(Issuer, changeLaunchFeeAction, defaultGasPrice);
let changeLaunchFeeEvent = common.getEventFromLogs(currentContract._jsonInterface, changeLaunchFeeReceipt.logs, 'LogChangeSecurityLaunchFee');
let changeLaunchFeeEvent = common.getEventFromLogs(currentContract._jsonInterface, changeLaunchFeeReceipt.logs, 'ChangeSecurityLaunchFee');
console.log(chalk.green(`Fee was changed successfuly. New fee is ${web3.utils.fromWei(changeLaunchFeeEvent._newFee)} POLY\n`));
break;
case 'CANCEL':
Expand Down
Loading