Skip to content

Commit

Permalink
test fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
maxsam4 committed Jul 31, 2019
1 parent f0d6a7a commit c7bef8b
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 10 deletions.
2 changes: 1 addition & 1 deletion test/l_percentage_transfer_manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ contract("PercentageTransferManager", async (accounts) => {
const stoKey = 3;

// Initial fee for ticker registry and security token registry
const initRegFee = new BN();
const initRegFee = new BN(web3.utils.toWei("1000"));

// PercentageTransferManager details
const holderPercentage = new BN(web3.utils.toWei("0.7")); // Maximum number of token holders
Expand Down
28 changes: 19 additions & 9 deletions test/q_usd_tiered_sto_sim.js
Original file line number Diff line number Diff line change
Expand Up @@ -282,34 +282,44 @@ contract("USDTieredSTO Sim", async (accounts) => {
it("Should successfully attach the first STO module to the security token", async () => {
let stoId = 0;

_startTime.push(new BN(currentTime).add(new BN(duration.days(2))).toString());
_endTime.push(new BN(_startTime[stoId]).add(new BN(currentTime).add(new BN(duration.days(100)))).toString());
_startTime.push(new BN(currentTime).add(new BN(duration.days(2))));
_endTime.push(new BN(_startTime[stoId]).add(new BN(currentTime).add(new BN(duration.days(100)))));
_ratePerTier.push([new BN(50).mul(e16).toString(), new BN(130).mul(e16).toString(), new BN(170).mul(e16).toString()]); // [ 0.05 USD/Token, 0.10 USD/Token, 0.15 USD/Token ]
_ratePerTierDiscountPoly.push([new BN(50).mul(e16).toString(), new BN(80).mul(e16).toString(), new BN(130).mul(e16).toString()]); // [ 0.05 USD/Token, 0.08 USD/Token, 0.13 USD/Token ]
_tokensPerTierTotal.push([new BN(200).mul(e18).toString(), new BN(500).mul(e18).toString(), new BN(300).mul(e18).toString()]); // [ 1000 Token, 2000 Token, 1500 Token ]
_tokensPerTierDiscountPoly.push([new BN(0).toString(), new BN(50).mul(e18).toString(), new BN(300).mul(e18).toString()]); // [ 0 Token, 1000 Token, 1500 Token ]
_nonAccreditedLimitUSD.push(new BN(10).mul(e18).toString()); // 20 USD
_minimumInvestmentUSD.push(new BN(0).toString()); // 1 wei USD
_nonAccreditedLimitUSD.push(new BN(10).mul(e18)); // 20 USD
_minimumInvestmentUSD.push(new BN(0)); // 1 wei USD
_fundRaiseTypes.push([0, 1, 2]);
_wallet.push(WALLET);
_treasuryWallet.push(TREASURYWALLET);
_usdToken.push(I_DaiToken.address);

let config = [
_startTime[stoId],
_endTime[stoId],
_startTime[stoId].toString(),
_endTime[stoId].toString(),
_ratePerTier[stoId],
_ratePerTierDiscountPoly[stoId],
_tokensPerTierTotal[stoId],
_tokensPerTierDiscountPoly[stoId],
_nonAccreditedLimitUSD[stoId],
_minimumInvestmentUSD[stoId],
_nonAccreditedLimitUSD[stoId].toString(),
_minimumInvestmentUSD[stoId].toString(),
_fundRaiseTypes[stoId],
_wallet[stoId],
_treasuryWallet[stoId],
[_usdToken[stoId]]
];

_ratePerTier = [];
_ratePerTierDiscountPoly = [];
_tokensPerTierTotal = [];
_tokensPerTierDiscountPoly = [];
_ratePerTier.push([new BN(50).mul(e16), new BN(130).mul(e16), new BN(170).mul(e16)]); // [ 0.05 USD/Token, 0.10 USD/Token, 0.15 USD/Token ]
_ratePerTierDiscountPoly.push([new BN(50).mul(e16), new BN(80).mul(e16), new BN(130).mul(e16)]); // [ 0.05 USD/Token, 0.08 USD/Token, 0.13 USD/Token ]
_tokensPerTierTotal.push([new BN(200).mul(e18), new BN(500).mul(e18), new BN(300).mul(e18)]); // [ 1000 Token, 2000 Token, 1500 Token ]
_tokensPerTierDiscountPoly.push([new BN(0), new BN(50).mul(e18), new BN(300).mul(e18)]); // [ 0 Token, 1000 Token, 1500 Token ]


let bytesSTO = web3.eth.abi.encodeFunctionCall(functionSignature, config);
let tx = await I_SecurityToken.addModule(I_USDTieredSTOFactory.address, bytesSTO, new BN(0), new BN(0), false, { from: ISSUER, gasPrice: GAS_PRICE });
console.log(" Gas addModule: ".grey + tx.receipt.gasUsed.toString().grey);
Expand Down Expand Up @@ -411,7 +421,7 @@ contract("USDTieredSTO Sim", async (accounts) => {

let totalTokens = new BN(0);
for (var i = 0; i < _tokensPerTierTotal[stoId].length; i++) {
totalTokens = totalTokens.add(_tokensPerTierTotal[stoId][i]);
totalTokens = totalTokens.add(new BN(_tokensPerTierTotal[stoId][i]));
}
let tokensSold = new BN(0);
while (true) {
Expand Down

0 comments on commit c7bef8b

Please sign in to comment.