How to fix undeclared identifier even though its present in ERC721Enumerable - ethereum

I am trying to prepare a solidity smart contract and everything appears fine except a single undeclared error on remix compiler. The error code is as follows:
from solidity:
DeclarationError: Undeclared identifier.
--> contracts/WTest.sol:66:22:
|
66 | uint256 supply = totalSupply();
| ^^^^^^^^^^^
For reference, my code is as follows:
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.2;
import "#openzeppelin/contracts/token/ERC721/ERC721.sol";
import "#openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol";
import "#openzeppelin/contracts/token/ERC721/extensions/ERC721Burnable.sol";
import "#openzeppelin/contracts/access/Ownable.sol";
import "#openzeppelin/contracts/utils/math/SafeMath.sol";
contract WTest is ERC721, ERC721Burnable, Ownable {
using Strings for uint256;
using SafeMath for uint256;
uint256 public mintPrice;
address public blackHoleAddress;
ERC721 public crateContract;
string public baseURI;
string public baseExtension = ".json";
mapping(uint256 => bool) private _crateProcessList;
bool public paused = false;
bool public revealed = false;
uint256 public maxSupply = 5000;
uint256 public maxPrivateSupply = 580;
uint256 public maxMintAmount = 20;
string public notRevealedUri;
event OperationResult(bool result, uint256 itemId);
constructor() ERC721("WTest", "WTST") {}
function _baseURI() internal view virtual override returns (string memory) {
return baseURI;
}
function setBASEURI(string memory newuri) public onlyOwner {
baseURI = newuri;
}
function setMintPrice(uint256 _mintPrice) public onlyOwner returns(bool success) {
mintPrice = _mintPrice;
return true;
}
function getMintPrice() public view returns (uint256)
{
return mintPrice;
}
function setBlackHoleAddress(address _blackHoleAddress) public onlyOwner returns(bool success) {
blackHoleAddress = _blackHoleAddress;
return true;
}
function setcrateContractAddress(ERC721 _crateContractAddress) public onlyOwner returns (bool success) {
crateContract = _crateContractAddress;
return true;
}
function mint(uint256 _mintAmount) public payable {
uint256 supply = totalSupply();
require(!paused);
require(_mintAmount > 0);
require(_mintAmount <= maxMintAmount);
require(supply + _mintAmount <= maxSupply);
if (msg.sender != owner()) {
require(msg.value >= mintPrice * _mintAmount);
}
for (uint256 i = 1; i <= _mintAmount; i++) {
_safeMint(msg.sender, supply + i);
}
}
As you can see I have referenced ERC721Enumerable.sol
Any help in understanding where I am going wrong would be greatly appreciated.

You must extend ERC721Enumerable, and only then you can use totalSupply() function.
Your smart contract should be similtar to this:
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.2;
import "#openzeppelin/contracts/token/ERC721/ERC721.sol";
import "#openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol";
import "#openzeppelin/contracts/token/ERC721/extensions/ERC721Burnable.sol";
import "#openzeppelin/contracts/access/Ownable.sol";
import "#openzeppelin/contracts/utils/math/SafeMath.sol";
contract WTest is ERC721, ERC721Enumerable, ERC721Burnable, Ownable {
using Strings for uint256;
using SafeMath for uint256;
uint256 public mintPrice;
address public blackHoleAddress;
ERC721 public crateContract;
string public baseURI;
string public baseExtension = ".json";
mapping(uint256 => bool) private _crateProcessList;
bool public paused = false;
bool public revealed = false;
uint256 public maxSupply = 5000;
uint256 public maxPrivateSupply = 580;
uint256 public maxMintAmount = 20;
string public notRevealedUri;
event OperationResult(bool result, uint256 itemId);
constructor() ERC721("WTest", "WTST") {}
function _baseURI() internal view virtual override returns (string memory) {
return baseURI;
}
function setBASEURI(string memory newuri) public onlyOwner {
baseURI = newuri;
}
function setMintPrice(uint256 _mintPrice) public onlyOwner returns(bool success) {
mintPrice = _mintPrice;
return true;
}
function getMintPrice() public view returns (uint256)
{
return mintPrice;
}
function setBlackHoleAddress(address _blackHoleAddress) public onlyOwner returns(bool success) {
blackHoleAddress = _blackHoleAddress;
return true;
}
function setcrateContractAddress(ERC721 _crateContractAddress) public onlyOwner returns (bool success) {
crateContract = _crateContractAddress;
return true;
}
function mint(uint256 _mintAmount) public payable {
uint256 supply = totalSupply();
require(!paused);
require(_mintAmount > 0);
require(_mintAmount <= maxMintAmount);
require(supply + _mintAmount <= maxSupply);
if (msg.sender != owner()) {
require(msg.value >= mintPrice * _mintAmount);
}
for (uint256 i = 1; i <= _mintAmount; i++) {
_safeMint(msg.sender, supply + i);
}
}
// NOTE: Override ERC721Enumerable functions
function _beforeTokenTransfer(address from, address to, uint256 tokenId) internal override(ERC721, ERC721Enumerable) {
super._beforeTokenTransfer(from, to, tokenId);
}
function supportsInterface(bytes4 interfaceId) public view override(ERC721, ERC721Enumerable) returns (bool) {
return super.supportsInterface(interfaceId);
}
}

Related

Gas estimation failed - "code": -32000, "message": "execution reverted"

I just copied a smart contract in Arbitum Goerli and tried to deploy it in Remix IDE.
https://arbiscan.io/token/0xdd8e557c8804d326c72074e987de02a23ae6ef84#code
But I received this error.
I tried adjusting the Gas limit and WEI. No luck.
This is the error message.
Gas estimation errored with the following message (see below). The transaction execution will likely fail. Do you want to force sending?
Internal JSON-RPC error.
{
"code": -32000,
"message": "execution reverted"
}
I appreciate your help in advance.
pragma solidity ^0.8.7;
pragma experimental ABIEncoderV2;
import "#openzeppelin/contracts/token/ERC20/IERC20.sol";
import "#openzeppelin/contracts/access/Ownable.sol";
import "#openzeppelin/contracts/utils/math/SafeMath.sol";
import "#openzeppelin/contracts/utils/Address.sol";
import "#uniswap/v2-core/contracts/interfaces/IUniswapV2Pair.sol";
import "#uniswap/v2-core/contracts/interfaces/IUniswapV2Factory.sol";
import "#uniswap/v2-periphery/contracts/interfaces/IUniswapV2Router02.sol";
contract LamboArbInu is Context, IERC20, Ownable {
using SafeMath for uint256;
using Address for address;
address private constant DEAD = 0x000000000000000000000000000000000000dEaD;
string private _name;
string private _symbol;
uint8 private _decimals;
address public router;
address public basePair;
uint256 public prevDevFee;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromDevFee;
mapping(address => bool) private _isExcludedFromMaxAmount;
mapping(address => bool) private _isDevWallet;
address[] private _excluded;
address public _devWalletAddress;
uint256 private _tTotal;
uint256 public _devFee;
uint256 private _previousDevFee = _devFee;
uint256 public _maxTxAmount;
uint256 public _maxHeldAmount;
IUniswapV2Router02 public uniswapV2Router;
IUniswapV2Pair public uniswapV2Pair;
constructor(
address tokenOwner,
address devWalletAddress_,
address _router,
address _basePair
) {
_name = "LamboArbInu";
_symbol = "LAMBOARBINU";
_decimals = 18;
_tTotal = 1000000000 * 10**_decimals;
_tOwned[tokenOwner] = _tTotal;
_devFee = 4;
_previousDevFee = _devFee;
_devWalletAddress = devWalletAddress_;
_maxHeldAmount = _tTotal.mul(20).div(1000); // 2%
_maxTxAmount = _maxHeldAmount;
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(_router);
// Create a uniswap pair for this new token
uniswapV2Pair = IUniswapV2Pair(
IUniswapV2Factory(_uniswapV2Router.factory()).createPair(
address(this),
_basePair
)
);
// set the rest of the contract variables
uniswapV2Router = _uniswapV2Router;
//exclude owner and this contract from fee
_isExcludedFromDevFee[owner()] = true;
_isExcludedFromDevFee[address(this)] = true;
_isExcludedFromDevFee[_devWalletAddress] = true;
_isExcludedFromMaxAmount[owner()] = true;
_isExcludedFromMaxAmount[address(this)] = true;
_isExcludedFromMaxAmount[_devWalletAddress] = true;
//set wallet provided to true
_isDevWallet[_devWalletAddress] = true;
emit Transfer(address(0), tokenOwner, _tTotal);
}
function name() public view returns (string memory) {
return _name;
}
function symbol() public view returns (string memory) {
return _symbol;
}
function decimals() public view returns (uint8) {
return _decimals;
}
function totalSupply() public view override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return _tOwned[account];
}
function getBasePairAddr() public view returns (address) {
return basePair;
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address _owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[_owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function increaseAllowance(address spender, uint256 addedValue)
public
virtual
returns (bool)
{
_approve(
_msgSender(),
spender,
_allowances[_msgSender()][spender].add(addedValue)
);
return true;
}
function decreaseAllowance(address spender, uint256 subtractedValue)
public
virtual
returns (bool)
{
_approve(
_msgSender(),
spender,
_allowances[_msgSender()][spender].sub(
subtractedValue,
"ERC20: decreased allowance below zero"
)
);
return true;
}
function excludeFromFee(address account) public onlyOwner {
require(!_isExcludedFromDevFee[account], "Account is already excluded");
_isExcludedFromDevFee[account] = true;
}
function includeInFee(address account) public onlyOwner {
require(_isExcludedFromDevFee[account], "Account is already included");
_isExcludedFromDevFee[account] = false;
}
function excludeFromMaxAmount(address account) public onlyOwner {
require(
!_isExcludedFromMaxAmount[account],
"Account is already excluded"
);
_isExcludedFromMaxAmount[account] = true;
}
function includeInMaxAmount(address account) public onlyOwner {
require(
_isExcludedFromMaxAmount[account],
"Account is already included"
);
_isExcludedFromMaxAmount[account] = false;
}
function setDevFeePercent(uint256 devFee) external onlyOwner {
require(devFee >= 0, "teamFee out of range");
_devFee = devFee;
}
function setMaxTxPercent(uint256 maxTxPercent) external onlyOwner {
require(maxTxPercent <= 100, "maxTxPercent out of range");
_maxTxAmount = _tTotal.mul(maxTxPercent).div(10**2);
}
function setDevWalletAddress(address _addr) public onlyOwner {
require(!_isDevWallet[_addr], "Wallet address already set");
if (!_isExcludedFromDevFee[_addr]) {
excludeFromFee(_addr);
}
_isDevWallet[_addr] = true;
_devWalletAddress = _addr;
}
function replaceDevWalletAddress(address _addr, address _newAddr)
external
onlyOwner
{
require(_isDevWallet[_addr], "Wallet address not set previously");
if (_isExcludedFromDevFee[_addr]) {
includeInFee(_addr);
}
_isDevWallet[_addr] = false;
if (_devWalletAddress == _addr) {
setDevWalletAddress(_newAddr);
}
}
//to recieve ETH from uniswapV2Router when swaping
receive() external payable {}
function _getValues(uint256 tAmount)
private
view
returns (uint256, uint256)
{
uint256 tDev = calculateDevFee(tAmount);
uint256 tTransferAmount = tAmount.sub(tDev);
return (tTransferAmount, tDev);
}
function _takeDev(uint256 tDev) private {
_tOwned[_devWalletAddress] = _tOwned[_devWalletAddress].add(tDev);
}
function calculateDevFee(uint256 _amount) private view returns (uint256) {
return _amount.mul(_devFee).div(10**2);
}
function removeAllFee() private {
if (_devFee == 0) return;
_previousDevFee = _devFee;
_devFee = 0;
}
function restoreAllFee() private {
_devFee = _previousDevFee;
}
function isExcludedFromFee(address account) public view returns (bool) {
return _isExcludedFromDevFee[account];
}
function isExcludedFromMaxAmount(address account)
public
view
returns (bool)
{
return _isExcludedFromMaxAmount[account];
}
function _approve(
address _owner,
address spender,
uint256 amount
) private {
require(_owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[_owner][spender] = amount;
emit Approval(_owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
// Only limit max TX for swaps, not for standard transactions
if (
from == address(uniswapV2Router) || to == address(uniswapV2Router)
) {
if (
!_isExcludedFromMaxAmount[from] && !_isExcludedFromMaxAmount[to]
)
require(
amount <= _maxTxAmount,
"Transfer amount exceeds the maxTxAmount."
);
}
//indicates if fee should be deducted from transfer
bool takeFee = true;
//if any account belongs to _isExcludedFromDevFee account then remove the fee
if (_isExcludedFromDevFee[from] || _isExcludedFromDevFee[to]) {
takeFee = false;
}
if (!_isExcludedFromMaxAmount[to]) {
require(
_tOwned[to].add(amount) <= _maxHeldAmount,
"Recipient already owns maximum amount of tokens."
);
}
//transfer amount, it will take dev, liquidity fee
_tokenTransfer(from, to, amount, takeFee);
//reset tax fees
restoreAllFee();
}
function swapTokensForEth(uint256 tokenAmount) private {
// generate the uniswap pair path of token -> WHT
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = getBasePairAddr();
_approve(address(this), address(uniswapV2Router), tokenAmount);
// make the swap
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0, // accept any amount of ETH
path,
address(this),
block.timestamp
);
}
function addLiquidity(uint256 tokenAmount, uint256 ETHAmount) private {
// approve token transfer to cover all possible scenarios
_approve(address(this), address(uniswapV2Router), tokenAmount);
// add the liquidity
uniswapV2Router.addLiquidityETH{value: ETHAmount}(
address(this),
tokenAmount,
0, // slippage is unavoidable
0, // slippage is unavoidable
DEAD,
block.timestamp
);
}
//this method is responsible for taking all fee, if takeFee is true
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) removeAllFee();
(uint256 tTransferAmount, uint256 tDev) = _getValues(amount);
_tOwned[sender] = _tOwned[sender].sub(amount);
_tOwned[recipient] = _tOwned[recipient].add(tTransferAmount);
_takeDev(tDev);
emit Transfer(sender, recipient, tTransferAmount);
}
function disableFees() public onlyOwner {
removeAllFee();
}
function enableFees() public onlyOwner {
restoreAllFee();
}
}

Verifying solidity contract on polygonscan

I created a Solidity Contract. What information should go in "Enter the Solidity Contract Code below?"
Below I am also listing the solidity code I used.
I tried putting the code in directly and the website errors out on me.
I am also attaching the link to the contract on polygonscan
https://polygonscan.com/token/0xd1a8ee4c74e0153aa1282967336b4a35f60a8dab
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.7;
import "#openzeppelin/contracts/access/Ownable.sol";
import "#openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol";
contract EmbassyBuddhas is ERC721Enumerable, Ownable {
using Strings for uint256;
string public baseURI;
string public baseExtension = ".json";
uint256 public cost = 0.05 ether;
uint256 public presaleCost = 0.03 ether;
uint256 public maxSupply = 10000;
uint256 public maxMintAmount = 20;
bool public paused = false;
mapping(address => bool) public whitelisted;
mapping(address => bool) public presaleWallets;
constructor(
string memory _name,
string memory _symbol,
string memory _initBaseURI
) ERC721(_name, _symbol) {
setBaseURI(_initBaseURI);
mint(msg.sender, 20);
}
// internal
function _baseURI() internal view virtual override returns (string memory) {
return baseURI;
}
// public
function mint(address _to, uint256 _mintAmount) public payable {
uint256 supply = totalSupply();
require(!paused);
require(_mintAmount > 0);
require(_mintAmount <= maxMintAmount);
require(supply + _mintAmount <= maxSupply);
if (msg.sender != owner()) {
if (whitelisted[msg.sender] != true) {
if (presaleWallets[msg.sender] != true) {
//general public
require(msg.value >= cost * _mintAmount);
} else {
//presale
require(msg.value >= presaleCost * _mintAmount);
}
}
}
for (uint256 i = 1; i <= _mintAmount; i++) {
_safeMint(_to, supply + i);
}
}
function walletOfOwner(address _owner)
public
view
returns (uint256[] memory)
{
uint256 ownerTokenCount = balanceOf(_owner);
uint256[] memory tokenIds = new uint256[](ownerTokenCount);
for (uint256 i; i < ownerTokenCount; i++) {
tokenIds[i] = tokenOfOwnerByIndex(_owner, i);
}
return tokenIds;
}
function tokenURI(uint256 tokenId)
public
view
virtual
override
returns (string memory)
{
require(
_exists(tokenId),
"ERC721Metadata: URI query for nonexistent token"
);
string memory currentBaseURI = _baseURI();
return
bytes(currentBaseURI).length > 0
? string(
abi.encodePacked(
currentBaseURI,
tokenId.toString(),
baseExtension
)
)
: "";
}
//only owner
function setCost(uint256 _newCost) public onlyOwner {
cost = _newCost;
}
function setPresaleCost(uint256 _newCost) public onlyOwner {
presaleCost = _newCost;
}
function setmaxMintAmount(uint256 _newmaxMintAmount) public onlyOwner {
maxMintAmount = _newmaxMintAmount;
}
function setBaseURI(string memory _newBaseURI) public onlyOwner {
baseURI = _newBaseURI;
}
function setBaseExtension(string memory _newBaseExtension)
public
onlyOwner
{
baseExtension = _newBaseExtension;
}
function pause(bool _state) public onlyOwner {
paused = _state;
}
function whitelistUser(address _user) public onlyOwner {
whitelisted[_user] = true;
}
function removeWhitelistUser(address _user) public onlyOwner {
whitelisted[_user] = false;
}
function addPresaleUser(address _user) public onlyOwner {
presaleWallets[_user] = true;
}
function add100PresaleUsers(address[100] memory _users) public onlyOwner {
for (uint256 i = 0; i < 2; i++) {
presaleWallets[_users[i]] = true;
}
}
function removePresaleUser(address _user) public onlyOwner {
presaleWallets[_user] = false;
}
function withdraw() public payable onlyOwner {
(bool success, ) = payable(msg.sender).call{
value: address(this).balance
}("");
require(success);
}
}
if you are having problems verifying contract code is because in your contract you are importing code from others contract, but you are not pasting that code there, I'll recommend you to check how to "flatten" a contract in the tool you are using and paste the flattened contract there
I would prefer to use frameworks such as truffle and hardhat to verify the contract because it will help you to make it easy.
So you can read more details How to verify contract on this link

ParserError: Expected '{' but got '(' function stake() public payable ()

pragma solidity >=0.6.0 <0.7.0;
import "hardhat/console.sol";
import "./ExampleExternalContract.sol";
contract Staker {
ExampleExternalContract public exampleExternalContract;
mapping(address => uint256) public balances;
uint256 public constant treshold = 1 ether;
event Stake(address staker, uint256 amount);
constructor(address exampleExternalContractAddress) public {
exampleExternalContract = ExampleExternalContract(exampleExternalContractAddress);
}
function stake() public payable () {
balances[msg.sender] = msg.value;
emit Stake(msg.sender, msg.value);
}
}
I am getting a parse error Expected '{' but got '(', when I try to deploy this code. Any thoughts on what's going on?
You have an extra pair of parentheses in the stake function definition.
Replace this
function stake() public payable () {
with this
function stake() public payable {

Identifier not found or not unique?

I made a solidity contract and when I compiled it, I got the following error: 'DeclarationError: Identifier not found or not unique. --> Token.sol:20:59: | 20 | function balanceOf(address owner) public view returns(unit) { | ^^^^' What's up with that?
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.2;
contract Token {
mapping(address => uint) public balances;
mapping(address => mapping(address => uint)) public allowance;
uint public totalSupply = 1000000 * 10 ** 18;
string public name = "Mebium";
string public symbol = "MEB";
uint public decimals = 18;
event Transfer(address indexed from, address indexed to, uint value);
event Approval (address indexed owner, address indexed spender, uint value);
constructor() {
balances[msg.sender] = totalSupply;
}
function balanceOf(address owner) public view returns(unit) {
return balances[owmer];
}
function transfer(address to, uint value) public returns(bool) {
require(balanceOf(msg.sender) >= value, 'balance too low');
balances[to] += value;
balances[msg.sender] -= value;
emit Transfer(msg.sender, to, value);
return true;
}
function transferFrom(address from, address to, uint value) public returns(bool) {
require(balanceOf(from) >= value, 'balance too low');
require(allowance[from][msg.sender] >= value, 'allowance too low');
balances[to] += value;
balances[from] -= value;
emit Transfer(from, to, value);
return true;
}
function approve(address spender, uint value) public returns(bool) {
allowance[msg.sender][spender] = value;
emit Approval(msg.sender, spender, value);
return true;
}
}
It's caused by a typo in your code. The return type should be uint (unsigned integer), not unit.
You have one more typo in the function - should be owner, is owmer.
function balanceOf(address owner) public view returns(uint) {
return balances[owner];
}

Error: Returned error: VM Exception while processing transaction: revert when creating with New

I'm using Drizzle and when ever I call createInvestorToken on this contract I get Error: Returned error: VM Exception while processing transaction: revert . Not sure how to debug this. It succeeds in the test, but it won't succeed otherwise.
If I remove the allTokens.push(new InvestmentToken(_name,_symbol,initalSupply,_cost)); it works.
// SPDX-License-Identifier: MIT
pragma solidity >=0.4.21 <0.7.0;
import "#openzeppelin/contracts/token/ERC20/ERC20.sol";
contract InvestmentToken is ERC20{
string public name;
string public symbol;
uint256 public decimals = 0;
uint256 public INITIAL_SUPPLY;
uint256 public cost;
address public parent;
constructor(string memory _name, string memory _symbol, uint256 initalSupply, uint256 _cost) public {
name = _name;
symbol = _symbol;
INITIAL_SUPPLY = initalSupply;
cost=_cost;
parent = msg.sender;
_mint(msg.sender, INITIAL_SUPPLY);
}
function buyToken(address receiver, uint256 amount) public {
if (msg.sender != parent) {
revert("You may only buy through the DPAC token");
}
uint256 tokensLeft = balanceOf(msg.sender);
if (tokensLeft >= amount/cost){
_transfer(msg.sender,receiver, amount/cost);
} else {
revert("There are no more tokens");
}
}
}
contract TheParentToken {
string public name = "DPAC_Token";
string public symbol = "DPAC";
uint256 public decimals = 0;
uint256 public INITIAL_SUPPLY = 10000;
uint256 public numberOfTokens = 0;
mapping(address => bool) public tokenWhiteList;
InvestmentToken[] public allTokens;
address public administrator;
constructor() public {
administrator = msg.sender;
allTokens.push(new InvestmentToken("A","B",1000,1));
allTokens.push(new InvestmentToken("B","C",1000,1));
numberOfTokens = allTokens.length;
}
function createInvestorToken(string memory _name, string memory _symbol, uint256 initalSupply, uint256 _cost) public {
allTokens.push(new InvestmentToken(_name,_symbol,initalSupply,_cost));
numberOfTokens = allTokens.length;
}
function addTokenToWhiteList(address newToken) public {
if(msg.sender != administrator){
revert("Not Admin");
}
tokenWhiteList[newToken]=true;
}
function removeTokenFromWhiteList(address newToken) public {
if(msg.sender != administrator){
revert("Not Admin");
}
tokenWhiteList[newToken]=false;
}
}
In this case the token was hitting the gas limit, and the error wasn't being displayed as the Gas Issue.
I think because it was creating a token the error is suppressed.