poanetwork / token-wizard

(Discontinued) TokenWizard is an DApp to create and manage crowdsale and token contracts using a simple UI
MIT License
384 stars 215 forks source link

(Fix) Transaction underpriced #393

Closed vbaranov closed 6 years ago

vbaranov commented 6 years ago

If you are reporting a problem with ICO Wizard, please include the following information:

Which network did you use? (Mainnet, Kovan, Rinkeby, etc.)

Mainnet

If you were able to create it, what is the URL of your crowdsale?

There is no crowdsale. Issue happens on the first transaction.

Do you have screenshots showing the problem?

image

Do you see errors in the dev console? If yes, please include a screenshot

(To open the dev console in Google Chrome, press F12, or go to View -> Developer -> Developer Tools, and open the Console tab)

No


igorbarinov commented 6 years ago

Safe price is 50 Gwei now.. https://ethgasstation.info/

Can we get safe price by API and show an alert if safe price is > selected price?

fvictorio commented 6 years ago

Etherscan doesn't seem to have a public API to get that information. The endpoint they use does not support CORS, so I don't think we can use it.

I looked around for an alternative, but didn't find anything. If someone finds a public API for this, it should be an easy addition.

fvictorio commented 6 years ago

@fernandomg found this https://etherscan.io/apis#proxy

The second to last method, eth_gasPrice, gives a result like this:

{
  "jsonrpc": "2.0",
  "result": "0xdf8475800",
  "id": 73
}

(That's 60000000000 in hex)

Maybe we can use that as the basis of the "slow, normal, fast" options for gas price. Say, 1.0x, 1.25x and 1.5x times the result of the current gas price?

fvictorio commented 6 years ago

Btw, it has a limit of 5 requests per second for each token. If we make sure that only one request is done in the whole wizard, we should be good. But if a lot of users connect at the same time, or if a malicious user copies the token from the devtools and does a lot of requests, the token will be blocked and the app will stop working.

igorbarinov commented 6 years ago

https://twitter.com/ethgasstation/status/938906233981095936

igorbarinov commented 6 years ago

Franco, they released onchain oracle

Do you feel that you can integrate it with Wizard on main net? https://twitter.com/ethgasstation/status/938951134399647744

igorbarinov commented 6 years ago

https://github.com/ethgasstation/ethgasstation-adaptive-oracle

igorbarinov commented 6 years ago

Back to 5gwei https://twitter.com/ethgasstation/status/940533044385075200

fvictorio commented 6 years ago

ethgasstation/ethgasstation-adaptive-oracle

I tried to get that working but couldn't do it. I opened an issue in the repo about my problem, so I'll try later when they answer me.

I'm not sure how this would work, though. Would we be responsible to run the script and point it to some contract that holds the last gas price?

igorbarinov commented 6 years ago

For the reference https://github.com/ethgasstation/ethgasstation-adaptive-oracle/issues/4

We will host the oracle, will get information from it (onchain) to estimate a safe price.

igorbarinov commented 6 years ago

@fvictorio what is our plan with deploying gas price oracle.. I think we need it for mainnet

fvictorio commented 6 years ago

@igorbarinov, sorry, I just saw your message, I must have missed it in my inbox.

I'll give another chance to run it locally. I don't understand the 'onchain' part of this, though. Can we just use it as a sort of backend service, so that the ICO Wizard uses it to ask the gas price?

I'm not sure I understand how it would work onchain. Some sort of smart contract that just holds the gas price, and a setter function for the oracle to update it periodically?

igorbarinov commented 6 years ago

The plan I thought about:

fvictorio commented 6 years ago

It would be awesome if there already is a contract we can query. I'm going to ask them.

igorbarinov commented 6 years ago

@fvictorio they have a simpler oracle. Roman added a simple API and monitoring to it. please try it in your local dev environment https://github.com/poanetwork/ethgasstation-gasPrice-estimate

results of API call will be parameters for gas estimates in the dapp. if API is not available we'll use only custom field and show an alert to the user

fvictorio commented 6 years ago

Cool, I'll check it out.

igorbarinov commented 6 years ago

@fvictorio please abandon the last link the service was rewritten here https://github.com/banteg/gasprice

fvictorio commented 6 years ago

I checked it but I wasn't able to make it work (see https://github.com/banteg/gasprice/issues/1). I'll give it another try, using an Infura node.

igorbarinov commented 6 years ago

I deployed it here https://gasprice.poa.network/ please use it for integration

fvictorio commented 6 years ago

Awesome, thanks.

fvictorio commented 6 years ago

Just for the record, that endpoint doesn't support CORS. That means that (I think) it will work on https://wizard.poa.network, but probably won't in https://wizard.oracles.org.

igorbarinov commented 6 years ago

thank you for mentioning, added cors * the chain is not fully synced but we can the oracle