1

greeting

1- i will start by writing the general configurations(system, version, smart contract overall idea).

2- then i will show the main problem(with small code line, that i think it need edit).

3- third part i will show what i try until now and the results

4- at the end of i will add the github link for my full code.

note: the full original code produced by mr. PatrickAlphaC.



a- general configurations(system, version, smart contract overall idea):

  • a1- operation system: opensuse leap 15.3
  • a2- hardhat version: 2.8.3
  • a3- node version: v14.18.3
  • a4- npm version: 8.3.0
  • a5- metamask wallet addone to firefox
  • a6- target block chain: polygon(main net, test net)
  • a7- smart contract overall idea: use svg to create erc-721 nft, where it's metadata totally stored on chain(the smart contract mint tokenurl to polygon chain).


b- the main problem:

every thing work good as the size of minted file (tokenurl) less than 23.8kb(small than 23.8 kb). where i target mint file that twice this size (every tokenurl equal 50kb). so when try mint tokenurl with size (23.8 Kb < size < 50 Kb) i recive next error message.

An unexpected error occurred:
   Error: ERROR processing /home/naive/demos/secondtry/deploy/01_Deploy_SVGNFT.js:
   Error: cannot estimate gas; transaction may fail or may require manual gas limit (error={"name":"ProviderError","code":-
   32000,"_isProviderError":true}, method="estimateGas", transaction={"from":"metamask wallet address","to":"contract address",


c- what i try until now and the results:

  • c1- try set the gas limit in "hardhat.config" but did not make any effect(it was during search so i do not remmber the form or values).

  • c2- in "01_Deploy_SVGNFT" add gaslimit to tx, so the code line look like next.

    • c2-0 origonal code line before edit it: tx = await svgNFT.create(svg)
    • c2-1 code line after edit it: tx = await svgNFT.create(svg, {gasLimit: 3000000 })
    • c2-2 the result: give me some error message about wrong syntic (forum, typing)
  • c3- in "01_Deploy_SVGNFT" add gaslimit to tx, so the code line look like next.

    • c3-0 origonal code line before edit it: tx = await svgNFT.create(svg)

    • c3-1 code line after edit it: tx = await svgNFT.create({svg}, {gasLimit: 3000000 })

    • c3-2 the results:

      • 3-2-0 contract deploying, svg uploading, contract verifying, the matic value decrease in metamask wallet(gas value transfer succeed) all thing look good.
      • 3-2-1 when go to opensea there's no image appears.
      • 3-2-2 when go to polygonscan or etherscan and use token id to see the token uri it return nothing (ther's no metadata string appears, nothing appears).


d- the next github link for full code(contracts, deploy, hardhat.config.js, helper-hardhat-config.js and img folder that contains (preproduced tokenurl)

https://github.com/naive2022/onchainfork

hope help me find how can mint preproduced tokenurl(every file size is 50kb) without face this problem when use polygon test or polygon main network.

thanks in advanced

1 Answer 1

1

Set the gas limit when deploying (testing) your specific transaction.

That is separate from the gas limit in Hardhat config.

2
  • how do that, is there's some document show the command forum. i use next command "npx hardhat deploy --network mumbi" for deploying (testing) over polygon mumbi network. did i need add some terms to this command? the command deploy the contract first then go to mint the tokenurl
    – naive2022
    Feb 7, 2022 at 14:47
  • The easiest way is to deploy with Remix, on the left you can set the deployment limit. For Hardhat, use the JSON configuration which is different for production and testing Jul 30, 2022 at 14:15

Your Answer

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

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