# Unable to deploy to mainnet via Truffle/Infura

**URL:** <https://forum.openzeppelin.com/t/unable-to-deploy-to-mainnet-via-truffle-infura/5199>\
**Category:** Contracts\
**Created:** [December 28, 2020, 1:37pm UTC](https://forum.openzeppelin.com/t/unable-to-deploy-to-mainnet-via-truffle-infura/5199 "2020-12-28T13:37:18Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![jaureguino](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/jaureguino/32/9820_2.png) [@jaureguino](https://forum.openzeppelin.com/u/jaureguino)\
**Post date:** [December 28, 2020, 1:37pm UTC](https://forum.openzeppelin.com/t/unable-to-deploy-to-mainnet-via-truffle-infura/5199/1 "2020-12-28T13:37:18Z")

</div>

Greetings Community!  
It has been a while, but I am now back at it. 🦾 😃

On 12/26/2020 I successfully compiled, migrated and tested on Ropsten via Truffle the following contract [https://github.com/estudios-amazonia/FilmVault/blob/main/contracts/FVP\_Token.sol](https://github.com/estudios-amazonia/FilmVault/blob/main/contracts/FVP_Token.sol). See Ropsten Contract Address: 0x82Bc5871e30FB2C00A3E5B5E6475A2baD88978ba

Yesterday, 12/27/2020 I tried to deploy the same contract using the same truffle-config.js file on Mainnet and it gets frozen after compilying. I have used an array of gas / gasPrice combinations. The latest is as follows:

```auto
mainnet: {
  networkCheckTimeout: 100000000,
  provider: function() {
    return new HDWalletProvider(maimnem, 'https://mainnet.infura.io/v3' + key);
},
  network_id: 1,
  gas: 4000000,
  gasPrice: 65000000000, // 65Gwei

```

Therefore, I tried to use Remix, with GASLIMIT 350000 and VALUE 60 Gwei and it failed twice. See the following Tx [https://etherscan.io/tx/0xdbdbe42e7f937f18952db19e94c6e6b42628f90241653f06d724999e278698e5](https://etherscan.io/tx/0xdbdbe42e7f937f18952db19e94c6e6b42628f90241653f06d724999e278698e5) [https://etherscan.io/tx/0x794243d66ba78ab9b349bb0a9abd38c3b2e6de55b396dd7a6b6a1f6258cff005](https://etherscan.io/tx/0x794243d66ba78ab9b349bb0a9abd38c3b2e6de55b396dd7a6b6a1f6258cff005)

Therefore I submitted a ticket at [https://ethereum.stackexchange.com/questions/91597/unable-to-deploy-migrate-to-mainnet-via-truffle-infura/91605#91605](https://ethereum.stackexchange.com/questions/91597/unable-to-deploy-migrate-to-mainnet-via-truffle-infura/91605#91605) and was recently informed that “The contract you are trying to deploy has a non-payable constructor and you are sending a 0.00000008 Ethers.”

I searched on this subject and I found [https://ethereum.stackexchange.com/questions/27059/the-constructor-should-be-payable-if-you-send-value-but-constructor-is-not-pay](https://ethereum.stackexchange.com/questions/27059/the-constructor-should-be-payable-if-you-send-value-but-constructor-is-not-pay) “This error jumps out for some (unpredictable) reasons when, may be, the internal remix ide stack is corrupted and/or your deployment silently fails. Very often if you save, exit and reload it does not appear anymore. If it appears again and again with your code, try to save/exit/reload and then deploy it again using a 10x gas limit.”

However, I truly want to deploy via Truffle/Infura since I already wasted almost $10 via Remix.

Would anyone be able to shed some light on how exactly I need to modify the contract so that it deploys/migrates into Mainnet via Truffle/Infura??

Greatly appreciated.

---

<div class="post-metadata">

**Author:** ![jaureguino](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/jaureguino/32/9820_2.png) [@jaureguino](https://forum.openzeppelin.com/u/jaureguino)\
**Post date:** [December 28, 2020, 2:11pm UTC](https://forum.openzeppelin.com/t/unable-to-deploy-to-mainnet-via-truffle-infura/5199/2 "2020-12-28T14:11:06Z")

</div>

I just found the following **Two Statements** on here [https://ethereum.stackexchange.com/questions/12119/solidity-web3-js-cannot-send-value-to-non-payable-constructor](https://ethereum.stackexchange.com/questions/12119/solidity-web3-js-cannot-send-value-to-non-payable-constructor)

**Statement A:** _" This always worked - I’m using MetaMask to sign the payments and inintiate the contracts. Since a week or something, I’m getting an error in my console from Web3: `Cannot send value to non-payable constructor`_

_I then started to Google around, and found out about a function needed to be `payable` and that there should be a fallback function in my contract."_

and this

**Statement B:** _" A little explanation. I renamed “reject” to “kill” and removed payable from the functions I don’t imagine should have it._

_There are two ways to inject funding into the contract:_

_1. **When deploying the contract** , add value. You can do that through meta.mask as you deploy the contract._  
_2. **After it’s deployed** , you can send Ether to the contract’s address in the same way you would send ETH to your other wallet. No function named needed. The unnamed (fallback) function, which is `payable` , will run._

_You can also trigger the fallback from JavaScript `web3.eth.sendTransaction({from: me, to: contract, value: amount})` or from another contract with `contractAddress.send(amount)` . The contract is going to execute the fallback function when no function is specified, or when the function specified doesn’t exist._

_I added an event emitter to the fallback function to show how you can use the fallback for something useful. For consistency, I dropped it into the constructor as well, and added a similar event for send()._

_We can safely say the “necessary accounting” (logs in this case) is performed for all funds that arrive and depart this contract. Nothing will sneak in through functions like `send()` that aren’t designed to process receipts."_

Could anyone shed some light on how should the Open Zeppeling Functions ought to be modified to become payable so that they work? The wierd thing is that these very same contracts were deployed successfully via Truffle/Infura over a year ago. **ALL THE FUNCTIONS ON CONTRACT THE ARE EXACTLY THE SAME** , I only changed the `constructor` 🤷‍♂️

---

<div class="post-metadata">

**Author:** ![jaureguino](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/jaureguino/32/9820_2.png) [@jaureguino](https://forum.openzeppelin.com/u/jaureguino)\
**Post date:** [December 29, 2020, 11:06pm UTC](https://forum.openzeppelin.com/t/unable-to-deploy-to-mainnet-via-truffle-infura/5199/3 "2020-12-29T23:06:06Z")

</div>

Guidance on how this issue was finally resolved came from another contributor. Details can be found at [https://ethereum.stackexchange.com/questions/91597/unable-to-deploy-migrate-to-mainnet-via-truffle-infura](https://ethereum.stackexchange.com/questions/91597/unable-to-deploy-migrate-to-mainnet-via-truffle-infura)

Although I was unable to deploy/migrate via Truffle/Infura with plenty ETH, the contract was finally deployed/migrated via Remix/Metamask by setting GAS LIMIT=800000 and VALUE=0 at a non-peak time.

See [https://etherscan.io/tx/0xde603058609d800d0ee2ccc5cf4cfa086a7161a25b9ce774cabae52a7514282c](https://etherscan.io/tx/0xde603058609d800d0ee2ccc5cf4cfa086a7161a25b9ce774cabae52a7514282c)

---

<div class="post-metadata">

**Author:** ![abcoathup](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/abcoathup/32/415_2.png) [@abcoathup](https://forum.openzeppelin.com/u/abcoathup)\
**Post date:** [December 29, 2020, 11:11pm UTC](https://forum.openzeppelin.com/t/unable-to-deploy-to-mainnet-via-truffle-infura/5199/4 "2020-12-29T23:11:17Z")

</div>

Hi @jaureguino,

Glad you were able to resolve.

---

<div class="post-metadata">

**Author:** ![jaureguino](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/jaureguino/32/9820_2.png) [@jaureguino](https://forum.openzeppelin.com/u/jaureguino)\
**Post date:** [December 29, 2020, 11:15pm UTC](https://forum.openzeppelin.com/t/unable-to-deploy-to-mainnet-via-truffle-infura/5199/5 "2020-12-29T23:15:33Z")

</div>

I am definitely rusted and outdate, since it has been a while since I coded Smart Contracts last; besides this is not my main skill, but I do it out of necessity. 🤷‍♂️

However, I will probably be more involved in Q1-2021; therefore, I will definitely be back when I get in some deep trouble… 😃

---

<div class="post-metadata">

**Author:** ![abcoathup](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/abcoathup/32/415_2.png) [@abcoathup](https://forum.openzeppelin.com/u/abcoathup)\
**Post date:** [December 29, 2020, 11:30pm UTC](https://forum.openzeppelin.com/t/unable-to-deploy-to-mainnet-via-truffle-infura/5199/6 "2020-12-29T23:30:26Z")

</div>

Hi @jaureguino,

The tools have improved 🚀, but gas prices have increased ☹. Feel free to ask all the questions that you need.

---

<div class="post-metadata">

**Author:** ![jaureguino](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/jaureguino/32/9820_2.png) [@jaureguino](https://forum.openzeppelin.com/u/jaureguino)\
**Post date:** [December 30, 2020, 12:29am UTC](https://forum.openzeppelin.com/t/unable-to-deploy-to-mainnet-via-truffle-infura/5199/7 "2020-12-30T00:29:42Z")

</div>

Will do. 🙇🏻‍♂️
