@@ -82,9 +82,6 @@ contract LifCrowdsale is Ownable, Pausable {
82
82
// Amount of lif minted and transferred during the TGE
83
83
uint256 public tokensSold;
84
84
85
- // Amount of wei received as private presale payments
86
- uint256 public totalPresaleWei;
87
-
88
85
// Address of the vesting schedule for the foundation created at the
89
86
// end of the crowdsale
90
87
VestedPayment public foundationVestedPayment;
@@ -257,7 +254,7 @@ contract LifCrowdsale is Ownable, Pausable {
257
254
258
255
uint256 tokens = weiSent.mul (rate);
259
256
260
- totalPresaleWei = totalPresaleWei .add (weiSent);
257
+ weiRaised = weiRaised .add (weiSent);
261
258
262
259
token.mint (beneficiary, tokens);
263
260
@@ -268,17 +265,18 @@ contract LifCrowdsale is Ownable, Pausable {
268
265
@dev Internal. Forwards funds to the foundation wallet and in case the soft
269
266
cap was exceeded it also creates and funds the Market Validation Mechanism.
270
267
*/
271
- function forwardFunds () internal {
268
+ function forwardFunds (bool deployMVM ) internal {
272
269
273
270
// calculate the max amount of wei for the foundation
274
271
uint256 foundationBalanceCapWei = maxFoundationCapUSD.mul (weiPerUSDinTGE);
275
272
276
- // If the minimiun cap for the MVM is not reached transfer all funds to foundation
277
- // else if the min cap for the MVM is reached, create it and send the remaining funds.
273
+ // If the minimiun cap for the MVM is not reached or the MVM cant be deployed
274
+ // transfer all funds to foundation else if the min cap for the MVM is reached,
275
+ // create it and send the remaining funds.
278
276
// We use weiRaised to compare becuase that is the total amount of wei raised in all TGE
279
277
// but we have to distribute the balance using `this.balance` because thats the amount
280
278
// raised by the crowdsale
281
- if (weiRaised <= foundationBalanceCapWei) {
279
+ if (( weiRaised <= foundationBalanceCapWei) || ! deployMVM ) {
282
280
283
281
foundationWallet.transfer (this .balance);
284
282
@@ -332,7 +330,8 @@ contract LifCrowdsale is Ownable, Pausable {
332
330
foundersVestedPayment.transferOwnership (foundersWallet);
333
331
334
332
// create the vested payment schedule for the foundation
335
- uint256 foundationPaymentStart = foundationMonthsStart.mul (30 days);
333
+ uint256 foundationPaymentStart = foundationMonthsStart.mul (30 days)
334
+ .add (30 days);
336
335
foundationVestedPayment = new VestedPayment (
337
336
block .timestamp .add (foundationPaymentStart), 30 days,
338
337
foundationMonthsStart, 0 , foundationTokens, token
@@ -418,13 +417,13 @@ contract LifCrowdsale is Ownable, Pausable {
418
417
Mechanism in case the soft cap was exceeded. It also unpauses the token to
419
418
enable transfers. It can be called only once, after `end2Timestamp`
420
419
*/
421
- function finalize () public onlyOwner hasEnded {
420
+ function finalize (bool deployMVM ) public onlyOwner hasEnded {
422
421
require (! isFinalized);
423
422
424
423
// foward founds and unpause token only if minCap is reached
425
424
if (funded ()) {
426
425
427
- forwardFunds ();
426
+ forwardFunds (deployMVM );
428
427
429
428
// finish the minting of the token
430
429
token.finishMinting ();
0 commit comments