Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
102 commits
Select commit Hold shift + click to select a range
1c09954
Initial circleci script
maxsam4 Dec 10, 2018
cd83c01
circle ci run fixed
maxsam4 Dec 10, 2018
1dba68c
Added global truffle installation
maxsam4 Dec 10, 2018
e260585
Added sudo to global install
maxsam4 Dec 10, 2018
e157e39
Added coverage, parallelism
maxsam4 Dec 10, 2018
3df37ca
Workflow fixed
maxsam4 Dec 10, 2018
2a3a859
Removed parallelism
maxsam4 Dec 10, 2018
30a8c5d
WIP
maxsam4 Dec 13, 2018
6e14daf
CircleCI changes
maxsam4 Dec 13, 2018
6469520
CircleCI changes
maxsam4 Dec 13, 2018
65441f5
CircleCI changes
maxsam4 Dec 13, 2018
1c0fd7c
Badge
maxsam4 Dec 13, 2018
8f81424
Store test results
maxsam4 Dec 13, 2018
57db7a9
Removed coverage from commit workflow
maxsam4 Dec 13, 2018
23bf3a8
Fix merge conflict
maxsam4 Dec 13, 2018
edbd4b1
Addded artifact collection
maxsam4 Dec 13, 2018
88607d6
Added parallelism
maxsam4 Dec 13, 2018
a2ef395
Comment
maxsam4 Dec 13, 2018
f5c1d87
Bumped parallelism to 3
maxsam4 Dec 13, 2018
d84e09d
Coverage requires approval
maxsam4 Dec 13, 2018
e5d28e4
Bumped parallelism to 4
maxsam4 Dec 13, 2018
c8d4b72
Removed manual approval
maxsam4 Dec 13, 2018
97c7b6f
Combine travis and CircleCI
maxsam4 Dec 13, 2018
731f1e8
env var changes
maxsam4 Dec 13, 2018
e20c91a
comment
maxsam4 Dec 13, 2018
8968166
Increased no o/p timeout
maxsam4 Dec 14, 2018
9352849
Merge pull request #471 from PolymathNetwork/master-circleci
pabloruiz55 Dec 17, 2018
bf2cca9
update contributing.md (#486)
CPSTL Jan 7, 2019
3c4531c
Initial auto deploy
maxsam4 Feb 7, 2019
e6fb8bf
HDWalletProvider
maxsam4 Feb 7, 2019
ad72cc2
Use local truffle
maxsam4 Feb 7, 2019
5c10dfb
Deploy only on dev and master branches
maxsam4 Feb 7, 2019
f775272
Added deploy script
maxsam4 Feb 9, 2019
287fe50
Enabled deployment on commit
maxsam4 Feb 9, 2019
2967a6c
Deploy only on dev/master branches
maxsam4 Feb 9, 2019
21228c1
Merge branch 'dev-2.1.0' into auto-deploy
maxsam4 Feb 9, 2019
82f78aa
Merge pull request #545 from PolymathNetwork/auto-deploy
satyamakgec Feb 9, 2019
411e874
Add files via upload
pabloruiz55 Mar 1, 2019
0a029dc
Force overrite existing solc
maxsam4 Mar 6, 2019
3b8c481
Merge pull request #584 from PolymathNetwork/docs-fix
maxsam4 Mar 6, 2019
577dd46
Fix reading factory address from module registry for dividends modules
VictorVicente Mar 6, 2019
6ff157b
Merge pull request #585 from PolymathNetwork/CLI-bug-fix
pabloruiz55 Mar 6, 2019
fb7bfd3
Alternative symbol() ABI for ERC20 tokens
VictorVicente Mar 6, 2019
be6264e
Merge branch 'dev-2.1.0' into CLI-bug-fix
pabloruiz55 Mar 6, 2019
9062fdf
Merge pull request #587 from PolymathNetwork/CLI-bug-fix
pabloruiz55 Mar 6, 2019
fd51e7a
STO fixes (#583)
maxsam4 Mar 7, 2019
69b96d5
Finalize changed granularity edge case fixed (#588)
maxsam4 Mar 7, 2019
b4b8c18
Added libz3-dev
maxsam4 Mar 8, 2019
0ef87ee
Updated circleci image
maxsam4 Mar 8, 2019
b3233a9
Updated solidity-docgen
maxsam4 Mar 8, 2019
b8eb2f3
Added git identity
maxsam4 Mar 8, 2019
5407f5d
Generate docs only on merge to master
maxsam4 Mar 8, 2019
28a77af
Merge pull request #590 from PolymathNetwork/fix-docs
maxsam4 Mar 9, 2019
3d45fb2
USDTieredSTO Granularity edge case fixed (#595)
maxsam4 Mar 13, 2019
0008f28
gtm matm optimizations (#601)
maxsam4 Mar 18, 2019
c3c7fd1
Fixes
adamdossa Mar 18, 2019
eba4a93
Allow maturity / expiry dates to be updated
adamdossa Mar 18, 2019
548d7fd
Add tests & fixes
adamdossa Mar 18, 2019
4463496
Typo
adamdossa Mar 18, 2019
8577bd8
More tests
adamdossa Mar 18, 2019
219f24e
Add more test cases
adamdossa Mar 18, 2019
a90d729
Merge pull request #606 from PolymathNetwork/fix_dividend_bugs
satyamakgec Mar 19, 2019
8766fb1
Update versions
adamdossa Mar 20, 2019
06bec00
Only bump dividends
adamdossa Mar 20, 2019
9872bf9
Fix decimals in dividends modules
VictorVicente Mar 20, 2019
7095b38
STOs are listed with its version
VictorVicente Mar 20, 2019
90c3100
Merge pull request #612 from PolymathNetwork/change-versions
pabloruiz55 Mar 20, 2019
daf208b
Reclaim ETH and ERC20 tokens from STO and Dividends modules
VictorVicente Mar 20, 2019
a6f289b
Pause/Unpase dividend modules
VictorVicente Mar 20, 2019
b0b71d3
Minor fix
VictorVicente Mar 20, 2019
715d3f6
Merge branch 'dev-2.1.0' into cli-dividend-fixes
VictorVicente Mar 20, 2019
fc88f2d
BigNumber library for dividends
VictorVicente Mar 20, 2019
ea1cbc8
STO selection fix
VictorVicente Mar 20, 2019
2c20b2f
Fix for pause/unpause STOs
VictorVicente Mar 21, 2019
a19b2a7
Show sto version when selecting
VictorVicente Mar 21, 2019
c604925
Updated Kovan addresses
pabloruiz55 Mar 21, 2019
bb59d5d
Merge branch 'dev-2.1.0' into cli-dividend-fixes
pabloruiz55 Mar 21, 2019
a5b6c32
Version info for all modules
VictorVicente Mar 21, 2019
923926e
Merge pull request #613 from PolymathNetwork/cli-dividend-fixes
pabloruiz55 Mar 21, 2019
c4afe28
audit fixes 1..9
SatyamSB Mar 26, 2019
95e7b2c
add test cases for the major issue
SatyamSB Mar 26, 2019
de6decc
test fix
SatyamSB Mar 26, 2019
1191f38
improve the test run
SatyamSB Mar 27, 2019
60b2aa0
add the startTime == 0 check
SatyamSB Mar 28, 2019
031f5dd
resolve the edge case when the investors restriction changes
SatyamSB Mar 29, 2019
3672305
Minor change
maxsam4 Mar 29, 2019
6aba6b9
VRTM size reduction to 24.21KB
maxsam4 Mar 29, 2019
5a2231a
Reduced VRTM size to be under the limit
maxsam4 Mar 29, 2019
7309dcb
add the code comments
SatyamSB Mar 29, 2019
4c43cf5
increase the time to fix the coverage
SatyamSB Mar 29, 2019
8d87605
optimize the code
SatyamSB Mar 29, 2019
bed595d
Merge pull request #617 from PolymathNetwork/vrtm-audit-fixes
satyamakgec Mar 29, 2019
c4b537d
updated readme with 2.1.0 mainnet addresses
pabloruiz55 Apr 2, 2019
5b4f429
Fix to keep transfer_manager compatible with GTM v1.0.0
VictorVicente Apr 2, 2019
bba2546
Merge pull request #626 from PolymathNetwork/CLI-gtm-multiversion
pabloruiz55 Apr 3, 2019
3409ff9
merge dev-2.1.0 to master
SatyamSB Apr 3, 2019
2e481ac
docs update & minor improvements
SatyamSB Apr 5, 2019
52e2410
Merge pull request #633 from PolymathNetwork/audit-minor-fixes-vrtm
maxsam4 Apr 5, 2019
6470391
Merge branch 'dev-2.1.0' into dev2-to-master
SatyamSB Apr 5, 2019
236e2a3
Merge pull request #627 from PolymathNetwork/dev2-to-master
pabloruiz55 Apr 5, 2019
23f87ab
Use bokky's timestamp library in scheduled checkpoint (#466)
kostind Jan 10, 2019
a18d544
add getTokensByDelegate (#547)
adamdossa Feb 11, 2019
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
26 changes: 26 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,22 @@ jobs:
- node_modules
- store_artifacts:
path: ./coverage/lcov.info
deploy_kovan:
docker:
- image: maxsam4/solidity-kit:0.4.24
steps:
- checkout
- restore_cache:
key: dependency-cache-{{ checksum "package.json" }}
- run: yarn install
- run: node --version
- run: truffle version
- run: mv truffle-ci.js truffle-config.js
- run: npm run deploy-kovan
- save_cache:
key: dependency-cache-{{ checksum "package.json" }}
paths:
- node_modules
docs:
docker:
- image: circleci/node:8
Expand Down Expand Up @@ -98,3 +114,13 @@ workflows:
branches:
only:
- master
deploy:
jobs:
- deploy_kovan:
filters:
branches:
only:
- master
- dev-2.1.0
- dev-2.2.0
- dev-3.0.0
156 changes: 110 additions & 46 deletions CLI/commands/dividends_manager.js

Large diffs are not rendered by default.

20 changes: 16 additions & 4 deletions CLI/commands/helpers/contract_abis.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ let erc20DividendCheckpointABI;
let etherDividendCheckpointABI;
let moduleInterfaceABI;
let ownableABI;
let iSTOABI;
let stoABI;
let iTransferManagerABI;
let moduleFactoryABI;
let erc20ABI;
Expand Down Expand Up @@ -50,7 +50,7 @@ try {
etherDividendCheckpointABI = JSON.parse(require('fs').readFileSync(`${__dirname}/../../../build/contracts/EtherDividendCheckpoint.json`).toString()).abi;
moduleInterfaceABI = JSON.parse(require('fs').readFileSync(`${__dirname}/../../../build/contracts/IModule.json`).toString()).abi;
ownableABI = JSON.parse(require('fs').readFileSync(`${__dirname}/../../../build/contracts/Ownable.json`).toString()).abi;
iSTOABI = JSON.parse(require('fs').readFileSync(`${__dirname}/../../../build/contracts/ISTO.json`).toString()).abi
stoABI = JSON.parse(require('fs').readFileSync(`${__dirname}/../../../build/contracts/STO.json`).toString()).abi
iTransferManagerABI = JSON.parse(require('fs').readFileSync(`${__dirname}/../../../build/contracts/ITransferManager.json`).toString()).abi
moduleFactoryABI = JSON.parse(require('fs').readFileSync(`${__dirname}/../../../build/contracts/ModuleFactory.json`).toString()).abi;
erc20ABI = JSON.parse(require('fs').readFileSync(`${__dirname}/../../../build/contracts/DetailedERC20.json`).toString()).abi;
Expand Down Expand Up @@ -129,8 +129,8 @@ module.exports = {
ownable: function () {
return ownableABI;
},
ISTO: function () {
return iSTOABI;
sto: function () {
return stoABI;
},
ITransferManager: function () {
return iTransferManagerABI;
Expand All @@ -140,5 +140,17 @@ module.exports = {
},
erc20: function () {
return erc20ABI;
},
alternativeErc20: function () {
let alternativeErc20 = [{
"constant": true,
"inputs": [],
"name": "symbol",
"outputs": [{ "name": "", "type": "bytes32" }],
"payable": false,
"stateMutability": "view",
"type": "function"
}];
return alternativeErc20;
}
}
75 changes: 59 additions & 16 deletions CLI/commands/sto_manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ function selectExistingSTO(stoModules, showPaused) {
if (!showPaused) {
filteredModules = stoModules.filter(m => !m.paused);
}
let options = filteredModules.map(m => `${m.name} at ${m.address}`);
let options = filteredModules.map(m => `${m.name} (${m.version}) at ${m.address}`);
let index = readlineSync.keyInSelect(options, 'Select a module: ', { cancel: false });
console.log('Selected:', options[index], '\n');
let selectedName = filteredModules[index].name;
Expand Down Expand Up @@ -119,27 +119,34 @@ async function modifySTO(selectedSTO, currentSTO) {
async function addSTOModule(stoConfig) {
console.log(chalk.blue('Launch STO - Configuration'));

let factorySelected;
let optionSelected;
if (typeof stoConfig === 'undefined') {
let availableModules = await moduleRegistry.methods.getModulesByTypeAndToken(gbl.constants.MODULES_TYPES.STO, securityToken.options.address).call();
let options = await Promise.all(availableModules.map(async function (m) {
moduleList = await Promise.all(availableModules.map(async function (m) {
let moduleFactoryABI = abis.moduleFactory();
let moduleFactory = new web3.eth.Contract(moduleFactoryABI, m);
return web3.utils.hexToUtf8(await moduleFactory.methods.name().call());
let moduleName = web3.utils.hexToUtf8(await moduleFactory.methods.name().call());
let moduleVersion = await moduleFactory.methods.version().call();
return { name: moduleName, version: moduleVersion, factoryAddress: m };
}));
let options = moduleList.map(m => `${m.name} - ${m.version} (${m.factoryAddress})`);

let index = readlineSync.keyInSelect(options, 'What type of STO do you want?', { cancel: 'RETURN' });
optionSelected = index != -1 ? options[index] : 'RETURN';
optionSelected = index != -1 ? moduleList[index].name : 'RETURN';
factorySelected = moduleList[index].factoryAddress;
} else {
optionSelected = stoConfig.type;
factorySelected = await await contracts.getModuleFactoryAddressByName(securityToken.options.address, gbl.constants.MODULES_TYPES.STO, optionSelected);
}
console.log('Selected:', optionSelected, '\n');
switch (optionSelected) {
case 'CappedSTO':
let cappedSTO = await cappedSTO_launch(stoConfig);
let cappedSTO = await cappedSTO_launch(stoConfig, factorySelected);
await cappedSTO_status(cappedSTO);
break;
case 'USDTieredSTO':
let usdTieredSTO = await usdTieredSTO_launch(stoConfig);
let usdTieredSTO = await usdTieredSTO_launch(stoConfig, factorySelected);
await usdTieredSTO_status(usdTieredSTO);
break;
}
Expand All @@ -148,12 +155,11 @@ async function addSTOModule(stoConfig) {
////////////////
// Capped STO //
////////////////
async function cappedSTO_launch(stoConfig) {
async function cappedSTO_launch(stoConfig, factoryAddress) {
console.log(chalk.blue('Launch STO - Capped STO in No. of Tokens'));

let cappedSTOFactoryABI = abis.cappedSTOFactory();
let cappedSTOFactoryAddress = await contracts.getModuleFactoryAddressByName(securityToken.options.address, gbl.constants.MODULES_TYPES.STO, "CappedSTO");
let cappedSTOFactory = new web3.eth.Contract(cappedSTOFactoryABI, cappedSTOFactoryAddress);
let cappedSTOFactory = new web3.eth.Contract(cappedSTOFactoryABI, factoryAddress);
cappedSTOFactory.setProvider(web3.currentProvider);
let stoFee = new web3.utils.BN(await cappedSTOFactory.methods.getSetupCost().call());

Expand Down Expand Up @@ -217,7 +223,7 @@ async function cappedSTO_launch(stoConfig) {
cappedSTOconfig.wallet]
);

let addModuleAction = securityToken.methods.addModule(cappedSTOFactoryAddress, bytesSTO, stoFee, 0);
let addModuleAction = securityToken.methods.addModule(cappedSTOFactory.options.address, bytesSTO, stoFee, 0);
let receipt = await common.sendTransaction(addModuleAction);
let event = common.getEventFromLogs(securityToken._jsonInterface, receipt.logs, 'ModuleAdded');
console.log(`STO deployed at address: ${event._module}`);
Expand Down Expand Up @@ -508,12 +514,11 @@ function timesConfigUSDTieredSTO(stoConfig) {
return times;
}

async function usdTieredSTO_launch(stoConfig) {
async function usdTieredSTO_launch(stoConfig, factoryAddress) {
console.log(chalk.blue('Launch STO - USD pegged tiered STO'));

let usdTieredSTOFactoryABI = abis.usdTieredSTOFactory();
let usdTieredSTOFactoryAddress = await contracts.getModuleFactoryAddressByName(securityToken.options.address, gbl.constants.MODULES_TYPES.STO, 'USDTieredSTO');
let usdTieredSTOFactory = new web3.eth.Contract(usdTieredSTOFactoryABI, usdTieredSTOFactoryAddress);
let usdTieredSTOFactory = new web3.eth.Contract(usdTieredSTOFactoryABI, factoryAddress);
usdTieredSTOFactory.setProvider(web3.currentProvider);
let stoFee = new web3.utils.BN(await usdTieredSTOFactory.methods.getSetupCost().call());

Expand Down Expand Up @@ -558,7 +563,7 @@ async function usdTieredSTO_launch(stoConfig) {
addresses.usdToken]
);

let addModuleAction = securityToken.methods.addModule(usdTieredSTOFactoryAddress, bytesSTO, stoFee, 0);
let addModuleAction = securityToken.methods.addModule(usdTieredSTOFactory.options.address, bytesSTO, stoFee, 0);
let receipt = await common.sendTransaction(addModuleAction);
let event = common.getEventFromLogs(securityToken._jsonInterface, receipt.logs, 'ModuleAdded');
console.log(`STO deployed at address: ${event._module}`);
Expand Down Expand Up @@ -782,6 +787,8 @@ async function usdTieredSTO_configure(currentSTO) {
'Modify limits configuration', 'Modify funding configuration');
}

options.push('Reclaim ETH or ERC20 token from contract');

let index = readlineSync.keyInSelect(options, 'What do you want to do?', { cancel: 'RETURN' });
let selected = index != -1 ? options[index] : 'Exit';
switch (selected) {
Expand Down Expand Up @@ -840,6 +847,9 @@ async function usdTieredSTO_configure(currentSTO) {
await modfifyFunding(currentSTO);
await usdTieredSTO_status(currentSTO);
break;
case 'Reclaim ETH or ERC20 token from contract':
await reclaimFromContract(currentSTO);
break;
}
}
}
Expand Down Expand Up @@ -963,6 +973,33 @@ async function modfifyTiers(currentSTO) {
await common.sendTransaction(modifyTiersAction);
}

async function reclaimFromContract(currentSTO) {
let options = ['ETH', 'ERC20'];
let index = readlineSync.keyInSelect(options, 'What do you want to reclaim?', { cancel: 'RETURN' });
let selected = index != -1 ? options[index] : 'RETURN';
switch (selected) {
case 'ETH':
let ethBalance = await this.getBalance(currentSTO.options.address, gbl.constants.FUND_RAISE_TYPES.ETH);
console.log(chalk.yellow(`Current ETH balance: ${web3.utils.fromWei(ethBalance)} ETH`));
let reclaimETHAction = currentSTO.methods.reclaimETH();
await common.sendTransaction(reclaimETHAction);
console.log(chalk.green('ETH has been reclaimed succesfully!'));
break;
case 'ERC20':
let erc20Address = readlineSync.question('Enter the ERC20 token address to reclaim (POLY = ' + polyToken.options.address + '): ', {
limit: function (input) {
return web3.utils.isAddress(input);
},
limitMessage: "Must be a valid address",
defaultInput: polyToken.options.address
});
let reclaimERC20Action = currentSTO.methods.reclaimERC20(erc20Address);
await common.sendTransaction(reclaimERC20Action);
console.log(chalk.green('ERC20 has been reclaimed succesfully!'));
break
}
}

//////////////////////
// HELPER FUNCTIONS //
//////////////////////
Expand All @@ -972,17 +1009,20 @@ async function getBalance(from, type) {
return await web3.eth.getBalance(from);
case gbl.constants.FUND_RAISE_TYPES.POLY:
return await polyToken.methods.balanceOf(from).call();
default:
return '0';
}
}

async function getAllModulesByType(type) {
function ModuleInfo(_moduleType, _name, _address, _factoryAddress, _archived, _paused) {
function ModuleInfo(_moduleType, _name, _address, _factoryAddress, _archived, _paused, _version) {
this.name = _name;
this.type = _moduleType;
this.address = _address;
this.factoryAddress = _factoryAddress;
this.archived = _archived;
this.paused = _paused;
this.version = _version;
}

let modules = [];
Expand All @@ -998,7 +1038,10 @@ async function getAllModulesByType(type) {
let contractTemp = new web3.eth.Contract(abiTemp, details[1]);
pausedTemp = await contractTemp.methods.paused().call();
}
modules.push(new ModuleInfo(type, nameTemp, details[1], details[2], details[3], pausedTemp));
let factoryAbi = abis.moduleFactory();
let factory = new web3.eth.Contract(factoryAbi, details[2]);
let versionTemp = await factory.methods.version().call();
modules.push(new ModuleInfo(type, nameTemp, details[1], details[2], details[3], pausedTemp, versionTemp));
}

return modules;
Expand Down
Loading