Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error:Failed to fetch gas estimate #292

Closed
AlleniCode opened this issue Nov 27, 2020 · 11 comments
Closed

Error:Failed to fetch gas estimate #292

AlleniCode opened this issue Nov 27, 2020 · 11 comments
Labels
💸 gitcoin-bounty Earn money by helping with this issue! question Further information is requested

Comments

@AlleniCode
Copy link

AlleniCode commented Nov 27, 2020

My code:

let keystore = try! EthereumKeystoreV3(privateKey: "MyPrivateKey", password: "MyPassword")!
let name = "New Wallet"
let keyData = try! JSONEncoder().encode(keystore.keystoreParams)
let address = keystore.addresses!.first!.address
let wallet = Wallet(address: address, data: keyData, name: name, isHD: false)

let web3 = Web3.InfuraMainnetWeb3(accessToken: "fdde8c95e4704489aac3c8b014871980")
let contractAdddress = EthereumAddress("0x7a9E457991352F8feFB90AB1ce7488DF7cDa6ed5")
let keystoreManager = KeystoreManager([EthereumKeystoreV3(wallet.data)!])
web3.addKeystoreManager(keystoreManager)

let amount = "1.0"
var options = TransactionOptions.defaultOptions
options.value = Web3.Utils.parseToBigUInt(amount, units: .eth)
options.from = EthereumAddress(wallet.address)
options.gasPrice = . automatic
options.gasLimit = .automatic

let contract = web3.contract("MyABI", at: contractAdddress, abiVersion: 2)
let parameters = [EthereumAddress("0x000000000000000000000000000000000000000E"), Web3.Utils.parseToBigUInt(amount, units: .eth)] as [AnyObject]
let transaction = contract?.write("deposit",
                                               parameters: parameters,
                                               extraData: Data(),
                                               transactionOptions: options)

let result  = try transaction?.send(password: "MyPassword", transactionOptions: options)

In 'Web3+MutatingTransaction.swift' file, line 102, printing description of results:
expression produced error: error: /var/folders/z0/89zqhrn56hn16zv5y_h4vhlr0000gn/T/expr5-4bebed..swift:1:102: error: 'BigUInt' is not a member type of 'BigInt'
Swift._DebuggerSupport.stringForPrintObject(Swift.UnsafePointer<Swift.Array<PromiseKit.Result<BigInt.BigUInt>>>(bitPattern: 0x110307d20)!.pointee)

Please help me, THX!

@dangell7
Copy link

dangell7 commented Nov 27, 2020

This is typically an issue with your "parameters".

Double quoting is not needed?

@dangell7
Copy link

If "0x000000000000000000000000000000000000000E" is an address it needs to be EthereumAddress(whateverAddress).

@AlleniCode
Copy link
Author

@dangell7 Thanks!I have reedited my question, but I still get this error.

@dangell7
Copy link

dangell7 commented Dec 4, 2020

can I see the contract code?

@dangell7
Copy link

dangell7 commented Dec 4, 2020

You're putting the value of the transaction and the value of the parameters as the same...

Most likely you want one or the other? Or you wrote a bad sc.... You can always get the msg.value in the contract, so why are you passing the value in?

@gitcoinbot
Copy link

Issue Status: 1. Open 2. Started 3. Submitted 4. Done


This issue now has a funding of 25.6 DAI (25.6 USD @ $1.0/DAI) attached to it.

@skywinder
Copy link
Collaborator

@dangell7 thank you for supporting this project and helping users. Feel free to apply for this bounty.
I want to release bounties for the pull requests and help to resolve issues like this. 👍

@skywinder skywinder added question Further information is requested 💸 gitcoin-bounty Earn money by helping with this issue! labels Dec 31, 2020
@gitcoinbot
Copy link

gitcoinbot commented Mar 12, 2021

Issue Status: 1. Open 2. Started 3. Submitted 4. Done


Work has been started.

These users each claimed they can complete the work by 265 years, 4 months from now.
Please review their action plans below:

1) frostiq has been approved to start work.

#324

Learn more on the Gitcoin Issue Details page.

@Iysbaera
Copy link
Collaborator

@AlleniCode Hey, is this still an issue for you? We recently merged a pr with a gas estimate fix into develop.
Could you please check it?

@gitcoinbot
Copy link

Issue Status: 1. Open 2. Started 3. Submitted 4. Done


Work for 50.6 DAI (50.6 USD @ $1.0/DAI) has been submitted by:


@Iysbaera
Copy link
Collaborator

Iysbaera commented Nov 5, 2021

Authour of this issue haven't replied, so I suppose it was resolved and thus closing this issue.

To anyone still experiencing similar problems, feel free to reopen it.

@Iysbaera Iysbaera closed this as completed Nov 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
💸 gitcoin-bounty Earn money by helping with this issue! question Further information is requested
Projects
None yet
Development

No branches or pull requests

5 participants