Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
04763c3
Added multiple stable coins support
maxsam4 Nov 27, 2018
7a82d72
Updated tests
maxsam4 Nov 27, 2018
1cb1346
Updated function signature and selector
maxsam4 Nov 27, 2018
3270166
tests fixed
maxsam4 Nov 27, 2018
ff5fca0
Fixed simulation test
maxsam4 Nov 27, 2018
c878e9a
Added separate function for changing usd tokens
maxsam4 Nov 27, 2018
728276f
Merge modifyUSDTokens function
maxsam4 Nov 27, 2018
420fdc6
Added test case
maxsam4 Nov 27, 2018
d30f809
Added a comment
maxsam4 Nov 27, 2018
dd20c06
Updated changelog
maxsam4 Nov 27, 2018
a462f7f
Merge branch 'dev-2.1.0' into multiple-stable-coins
maxsam4 Nov 27, 2018
557d286
Combined modifiers
maxsam4 Nov 27, 2018
8c7f45e
Merge branch 'multiple-stable-coins' of https://github.com/PolymathNe…
maxsam4 Nov 27, 2018
5fdd2e2
Added data validation
maxsam4 Nov 27, 2018
846d03f
test case fixed
maxsam4 Nov 27, 2018
987bfac
Merge branch 'dev-2.1.0' into multiple-stable-coins
satyamakgec Nov 29, 2018
992d9c5
Merge branch 'dev-2.1.0' into multiple-stable-coins
VictorVicente Dec 3, 2018
78bf819
adding and listing stable coins in sto manager
shuffledex Dec 3, 2018
b040af4
investor portal improvements
shuffledex Dec 4, 2018
db68e80
Merge branch 'dev-2.1.0' into multiple-stable-coins
adamdossa Dec 4, 2018
11b6fe3
Add getUsdTokens
adamdossa Dec 5, 2018
a4c31ce
Fix typo
adamdossa Dec 5, 2018
b6bf04d
manual merge
shuffledex Dec 5, 2018
3b983b5
code advances
shuffledex Dec 6, 2018
e14a18e
final code
shuffledex Dec 6, 2018
48f06e4
Merge branch 'dev-2.1.0' into multiple-stable-coins
VictorVicente Dec 7, 2018
4d9af7b
PR fixes
shuffledex Dec 10, 2018
bc93fdd
Merge pull request #453 from PolymathNetwork/private/fede/cli/stableCoin
VictorVicente Dec 10, 2018
09be6cc
Update CLI/commands/sto_manager.js
F-OBrien Dec 10, 2018
4a94e71
Added native currency raised
maxsam4 Dec 10, 2018
985dca4
Merge branch 'multiple-stable-coins' of https://github.com/PolymathNe…
maxsam4 Dec 10, 2018
55e0cb9
Merge branch 'dev-2.1.0' into multiple-stable-coins
maxsam4 Dec 11, 2018
ac7541f
Merge fix
maxsam4 Dec 11, 2018
3477f0f
Minor fixes
maxsam4 Dec 11, 2018
6e2768a
Updated changelog
maxsam4 Dec 11, 2018
9410fbe
Changed currencyRaised to stableCoinsRaised
maxsam4 Dec 11, 2018
9b4e7b2
individual balance for every stable coin listed
shuffledex Dec 11, 2018
3fd1e07
CLI minor fixes
shuffledex Dec 12, 2018
4054bcb
Minor fix
VictorVicente Dec 12, 2018
549f83e
CLI - Script to generate tokens, whitelist investors and mint to them
VictorVicente Dec 17, 2018
629613f
Merge branch 'dev-2.1.0' into multiple-stable-coins
maxsam4 Dec 18, 2018
15d9dcf
Merge branch 'dev-2.1.0' into multiple-stable-coins
VictorVicente Dec 19, 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
5 changes: 4 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,14 @@ All notable changes to this project will be documented in this file.

[__2.1.0__](https://www.npmjs.com/package/polymath-core?activeTab=readme) __13-09-18__

## CappedSTO 2.0.1

## CappedSTO 2.1.0
* `rate` is now accepted as multiplied by 10^18 to allow settting higher price than 1ETH/POLY per token.
* Indivisble tokens are now supported. When trying to buy partial tokens, allowed full units of tokens will be purchased and remaining funds will be returned.

## USDTieredSTO 2.1.0
* Added `stableCoinsRaised` function that returns amount of individual stable coin raised when address of that stable coin is passed.
* Added support for multiple stable coins in USDTSTO.
* Added `buyTokensView` and `getTokensMintedByTier` to USDTSTO.
* Added `getSTODetails` to USDTSTO.
* Added an Array of Tiers that will hold data about every tier in USDTSTO.
Expand Down
4 changes: 3 additions & 1 deletion CLI/commands/ST20Generator.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ async function executeApp(_ticker, _transferOwnership, _name, _details, _divisib
await step_transfer_ticker_ownership(_transferOwnership);
await step_token_deploy(_name, _details, _divisible);
}
await tokenManager.executeApp(tokenSymbol);
if (typeof _divisible === 'undefined') {
await tokenManager.executeApp(tokenSymbol);
}
} catch (err) {
console.log(err);
return;
Expand Down
18 changes: 9 additions & 9 deletions CLI/commands/TickerRollForward.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ let securityTokenRegistry;
let securityTokenRegistryAddress;

function Ticker(_owner, _symbol, _name) {
this.owner = _owner;
this.symbol = _symbol;
this.name = _name;
this.owner = _owner;
this.symbol = _symbol;
this.name = _name;
}

function FailedRegistration(_ticker, _error) {
Expand Down Expand Up @@ -58,11 +58,11 @@ async function startScript() {
}

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

var csvStream = csv()
.on("data", function (data) {
ticker_data.push(new Ticker(data[0],data[1],data[2],data[3]));
ticker_data.push(new Ticker(data[0], data[1], data[2], data[3]));
})
.on("end", async function () {
await registerTickers();
Expand All @@ -73,12 +73,12 @@ 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.getTickerRegistrationFee().call());
let fee = web3.utils.fromWei(await securityTokenRegistry.methods.getTickerRegistrationFee().call());
let totalFee = BigNumber(ticker_data.length).mul(fee);

if (totalFee.gt(polyBalance)) {
console.log(chalk.red(`\n*******************************************************************************`));
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.`));
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.`));
console.log(chalk.red(`*******************************************************************************\n`));
process.exit(0);
} else {
Expand All @@ -100,7 +100,7 @@ async function registerTickers() {
}

// validate ticker
await securityTokenRegistry.methods.getTickerDetails(ticker_data[i].symbol).call({}, function(error, result){
await securityTokenRegistry.methods.getTickerDetails(ticker_data[i].symbol).call({}, function (error, result) {
if (result[1] != 0) {
failed_tickers.push(` ${i} is already registered`);
valid = false;
Expand Down Expand Up @@ -131,7 +131,7 @@ async function logResults() {
Successful registrations: ${registered_tickers.length}
Failed registrations: ${failed_tickers.length}
Total gas consumed: ${totalGas}
Total gas cost: ${defaultGasPrice.mul(totalGas).div(10**18)} ETH
Total gas cost: ${defaultGasPrice.mul(totalGas).div(10 ** 18)} ETH

List of failed registrations:
${failed_tickers}
Expand Down
11 changes: 7 additions & 4 deletions CLI/commands/common/common_functions.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ const Tx = require('ethereumjs-tx');
const permissionsList = require('./permissions_list');
const abis = require('../helpers/contract_abis');

async function connect(abi, address) {
function connect(abi, address) {
contractRegistry = new web3.eth.Contract(abi, address);
contractRegistry.setProvider(web3.currentProvider);
return contractRegistry
Expand All @@ -15,7 +15,7 @@ async function checkPermission(contractName, functionName, contractRegistry) {
return true
} else {
let stAddress = await contractRegistry.methods.securityToken().call();
let securityToken = await connect(abis.securityToken(), stAddress);
let securityToken = connect(abis.securityToken(), stAddress);
let stOwner = await securityToken.methods.owner().call();
if (stOwner == Issuer.address) {
return true
Expand Down Expand Up @@ -48,11 +48,11 @@ async function getGasLimit(options, action) {
}

async function checkPermissions(action) {
let contractRegistry = await connect(action._parent.options.jsonInterface, action._parent._address);
let contractRegistry = connect(action._parent.options.jsonInterface, action._parent._address);
//NOTE this is a condition to verify if the transaction comes from a module or not.
if (contractRegistry.methods.hasOwnProperty('factory')) {
let moduleAddress = await contractRegistry.methods.factory().call();
let moduleRegistry = await connect(abis.moduleFactory(), moduleAddress);
let moduleRegistry = connect(abis.moduleFactory(), moduleAddress);
let parentModule = await moduleRegistry.methods.getName().call();
let result = await checkPermission(web3.utils.hexToUtf8(parentModule), action._method.name, contractRegistry);
if (!result) {
Expand Down Expand Up @@ -153,6 +153,9 @@ module.exports = {
let filteredLogs = logs.filter(l => l.topics.includes(eventJsonInterface.signature));
return filteredLogs.map(l => web3.eth.abi.decodeLog(eventJsonInterface.inputs, l.data, l.topics.slice(1)));
},
connect: function (abi, address) {
return connect(abi, address)
},
splitIntoBatches: function (data, batchSize) {
let allBatches = [];
for (let index = 0; index < data.length; index += batchSize) {
Expand Down
2 changes: 1 addition & 1 deletion CLI/commands/common/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ module.exports = Object.freeze({
FUND_RAISE_TYPES: {
ETH: 0,
POLY: 1,
DAI: 2
STABLE: 2
},
DEFAULT_BATCH_SIZE: 75,
ADDRESS_ZERO: '0x0000000000000000000000000000000000000000'
Expand Down
4 changes: 2 additions & 2 deletions CLI/commands/common/global.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ module.exports = {
console.log("Invalid remote node")
process.exit(0)
}
await httpProvider(remoteNetwork, './privKey');
await httpProvider(remoteNetwork, `${__dirname}/../../../privKey`);
} else {
await httpProvider("http://localhost:8545", './privKeyLocal');
await httpProvider("http://localhost:8545", `${__dirname}/../../../privKeyLocal`);
}
defaultGasPrice = getGasPrice(await web3.eth.net.getId());
}
Expand Down
Loading