Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 3 additions & 1 deletion contracts/modules/STO/PreSaleSTO.sol
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,10 @@ contract PreSaleSTO is ISTO {
require(now <= endTime, "Current time should less than the endTime");
require(_amount > 0, "No. of tokens provided should be greater the zero");
ISecurityToken(securityToken).mint(_investor, _amount);
if (investors[_investor] == uint256(0)) {
investorCount = investorCount.add(1);
}
investors[_investor] = investors[_investor].add(_amount);
investorCount = investorCount.add(1);
fundsRaised[uint8(FundRaiseType.ETH)] = fundsRaised[uint8(FundRaiseType.ETH)].add(_etherContributed);
fundsRaised[uint8(FundRaiseType.POLY)] = fundsRaised[uint8(FundRaiseType.POLY)].add(_polyContributed);
totalTokensSold = totalTokensSold.add(_amount);
Expand Down
8 changes: 7 additions & 1 deletion test/m_presale_sto.js
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,13 @@ contract("PreSaleSTO", accounts => {
);
});

it("Should failed at the time of buying the tokens -- Because STO has started", async () => {
it("Should buy some more tokens to previous investor", async() => {
await I_PreSaleSTO.allocateTokens(account_investor1, web3.utils.toWei("1000", "ether"), web3.utils.toWei("1", "ether"), 0, { from: account_issuer });
// No change in the investor count
assert.equal((await I_PreSaleSTO.getNumberInvestors.call()).toNumber(), 3);
})

it("Should failed at the time of buying the tokens -- Because STO has ended", async () => {
await increaseTime(duration.days(100)); // increased beyond the end time of the STO

await catchRevert(
Expand Down