0

what I'm trying to do is to fork the Ethereum Mainnet on my local ganache blockchain in order to interact with smart contract like Uniswap on my local machine.

I forked the Ethereum network using ganache-cli and infura node provider and I found a simple reflection token on etherscan which I'm trying to deploy on my local forked blockchain installation.

The same code is installed fine on testnet using Remix.

The code of the constructor of the contract is the following:

constructor () {
    _rOwned[_msgSender()] = _rTotal;    
    addAddress(_msgSender());
    _otAddress = address(1);
    IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);   
     // Create a uniswap pair for this new token    
    uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())   
        .createPair(address(this), _uniswapV2Router.WETH());    
    // set the rest of the contract variables   
    uniswapV2Router = _uniswapV2Router; 
        
    //exclude owner and this contract from fee  
    _isExcludedFromFee[owner()] = true;
    _isExcludedFromFee[_otAddress] = true;
    _isExcludedFromFee[address(this)] = true;   
    
    _isExcludedFromAntiWhale[owner()] = true;
    _isExcludedFromAntiWhale[_otAddress] = true;
    _isExcludedFromAntiWhale[address(this)] = true;
    _isExcludedFromAntiWhale[address(uniswapV2Router)] = true;
    _isExcludedFromAntiWhale[uniswapV2Pair] = true;
        
    emit Transfer(address(0), _msgSender(), _tTotal);   
}

The truffle compile works fine, however when I try to migrate the contract to the local blockchain I get the following error:

    "TokenCoin" ran out of gas. Something in the constructor (ex: infinite loop) caused gas estimation to fail. Try:
   * Making your contract constructor more efficient
   * Setting the gas manually in your config or as a deployment parameter
   * Using the solc optimizer settings in 'truffle-config.js'
   * Setting a higher network block limit if you are on a
     private network or test client (like ganache).

My truffle config is the following:

require('babel-register');
require('babel-polyfill');

module.exports = {
  networks: {
    development: {
      host: "127.0.0.1",
      port: 7545,
      gasPrice: 0x01,
      network_id: "*" // Match any network id
    },
  },
  contracts_directory: './src/contracts/',
  contracts_build_directory: './src/abis/',
  compilers: {
    solc: {
      version: "^0.8.4",    // Fetch exact version from solc-bin (default: truffle's version)
      optimizer: {
        enabled: true,
        runs: 1
      }
    }
  }
}

1 Answer 1

0

If you can assign ownership from an nft to an ETH address to trigger the token coin ownership with a signature you may be able to mint tokens gasless. I'm not a contract developer but some things only require signing. This must be abused to remove gas fees. By just assigning ownership.

2
  • Honestly, I don't get the point of your message.
    – xcsob
    Commented Nov 7, 2021 at 7:32
  • Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.
    – Community Bot
    Commented Nov 18, 2021 at 0:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.