Skip to main content
edited body
Source Link
abb
  • 466
  • 2
  • 6

Following the logic of your code, you add this constraint into your fallback function. Replace

balances[fundsWallet] = balances[fundsWallet].sub(tokenAmount);

with

require(newBalance >= reservedTokens);
balances[fundsWallet] = newBalance;```

Number of reserved tokens can be calculated like:

```uint256 reservedTokens = totalSupply.div(51100).mul(10051);```

On a side note, it appears you have taken Zeppelin's token contract and extended it with custom ICO logic. It is not the intended approach. You might want to check https://github.com/OpenZeppelin/zeppelin-solidity/blob/master/contracts/examples/SampleCrowdsale.sol to see how Zeppelin's contracts ought to be used.

Following the logic of your code, you add this constraint into your fallback function. Replace

balances[fundsWallet] = balances[fundsWallet].sub(tokenAmount);

with

require(newBalance >= reservedTokens);
balances[fundsWallet] = newBalance;```

Number of reserved tokens can be calculated like:

```uint256 reservedTokens = totalSupply.div(51).mul(100);```

On a side note, it appears you have taken Zeppelin's token contract and extended it with custom ICO logic. It is not the intended approach. You might want to check https://github.com/OpenZeppelin/zeppelin-solidity/blob/master/contracts/examples/SampleCrowdsale.sol to see how Zeppelin's contracts ought to be used.

Following the logic of your code, you add this constraint into your fallback function. Replace

balances[fundsWallet] = balances[fundsWallet].sub(tokenAmount);

with

require(newBalance >= reservedTokens);
balances[fundsWallet] = newBalance;```

Number of reserved tokens can be calculated like:

```uint256 reservedTokens = totalSupply.div(100).mul(51);```

On a side note, it appears you have taken Zeppelin's token contract and extended it with custom ICO logic. It is not the intended approach. You might want to check https://github.com/OpenZeppelin/zeppelin-solidity/blob/master/contracts/examples/SampleCrowdsale.sol to see how Zeppelin's contracts ought to be used.
edited body
Source Link
abb
  • 466
  • 2
  • 6

Following the logic of your code, you add this constraint into your fallback function. Replace

balances[fundsWallet] = balances[fundsWallet].sub(tokenAmount);

with

require(newBalance >= reservedTokens);
balances[fundsWallet] = newBalance;```

Number of reserved tokens can be calculated like:

```uint256 reservedTokens = totalSupply.div(4951).mul(100);```

On a side note, it appears you have taken Zeppelin's token contract and extended it with custom ICO logic. It is not the intended approach. You might want to check https://github.com/OpenZeppelin/zeppelin-solidity/blob/master/contracts/examples/SampleCrowdsale.sol to see how Zeppelin's contracts ought to be used.

Following the logic of your code, you add this constraint into your fallback function. Replace

balances[fundsWallet] = balances[fundsWallet].sub(tokenAmount);

with

require(newBalance >= reservedTokens);
balances[fundsWallet] = newBalance;```

Number of reserved tokens can be calculated like:

```uint256 reservedTokens = totalSupply.div(49).mul(100);```

On a side note, it appears you have taken Zeppelin's token contract and extended it with custom ICO logic. It is not the intended approach. You might want to check https://github.com/OpenZeppelin/zeppelin-solidity/blob/master/contracts/examples/SampleCrowdsale.sol to see how Zeppelin's contracts ought to be used.

Following the logic of your code, you add this constraint into your fallback function. Replace

balances[fundsWallet] = balances[fundsWallet].sub(tokenAmount);

with

require(newBalance >= reservedTokens);
balances[fundsWallet] = newBalance;```

Number of reserved tokens can be calculated like:

```uint256 reservedTokens = totalSupply.div(51).mul(100);```

On a side note, it appears you have taken Zeppelin's token contract and extended it with custom ICO logic. It is not the intended approach. You might want to check https://github.com/OpenZeppelin/zeppelin-solidity/blob/master/contracts/examples/SampleCrowdsale.sol to see how Zeppelin's contracts ought to be used.
Source Link
abb
  • 466
  • 2
  • 6

Following the logic of your code, you add this constraint into your fallback function. Replace

balances[fundsWallet] = balances[fundsWallet].sub(tokenAmount);

with

require(newBalance >= reservedTokens);
balances[fundsWallet] = newBalance;```

Number of reserved tokens can be calculated like:

```uint256 reservedTokens = totalSupply.div(49).mul(100);```

On a side note, it appears you have taken Zeppelin's token contract and extended it with custom ICO logic. It is not the intended approach. You might want to check https://github.com/OpenZeppelin/zeppelin-solidity/blob/master/contracts/examples/SampleCrowdsale.sol to see how Zeppelin's contracts ought to be used.