Any of you have success deploying erc20 to a forked mainnet and seeing the balance in metamask?

Everything else regarding the fork is working. I can deploy the token and do swaps of existing tokens like eth -> usdt.
But metamask shows a 0 balance for the token I deployed.

May 16, 2023, 10:11 PM
Did you connect it to the right rpc? And import the right account
May 16, 2023, 10:13 PM
Yes I see the fake eth in MM. And able to do swaps with it and "real" tokens like usdt, dai etc.

Just get a 0 balance when I import my newly deployed token to metamask...
Tried both alchemy and defillama RPC to fork mainnet
I think the problem is I have npx hardhat node running, but when I run my deploy script I suspect it's making another separate fork.
yes that was it. fixed ✅
On a side note, is forking mainnet the best way to test deployments?

Sepolia would be nice but some dapps haven't switched over. Goerli is hard to get.

Only downside of forking I see is that etherscan can't read it
May 16, 2023, 10:34 PM
it is.
When you run your scripts, you're using the "hardhat" network.
when you run "npx hardhat node", you have to run your scripts with —network localhost
100%
May 16, 2023, 10:38 PM
Oh I see. I added another entry in the config but --network localhost would be easier 👍
May 16, 2023, 10:38 PM
i don't use testnets since months and i've deployed more then 30 projects since then
no regrets or problems
just ARB gave me some jokes with it's block.number lol
May 16, 2023, 10:39 PM
good to know, thanks
May 16, 2023, 10:39 PM
if you got clients or a frontend team that need interact with the contracts, you can host a node on a VM and offer a public link to connect, like any other network
you can use nginx proxy manager on docker to easly host multiple RPCs under public urls (with SSL)
May 16, 2023, 10:40 PM
Nice. just like serving anything else on http 👌
May 16, 2023, 10:41 PM
yep, but being a reverse proxy, you can leave it http on local, https on the net
as wallets like metamask require https for RPCs
May 16, 2023, 10:42 PM
Is there an exception for localhost? As I'm pretty sure my hardhat node is http
May 16, 2023, 10:45 PM
yeah i think it's an exception
May 16, 2023, 10:46 PM
The fork is extremely slow. Do you use a local node?
I'm on alchemy right now but can barely get uniswap to work with the fork
May 17, 2023, 12:59 AM
i have a full node on BSC, i fork it only from my pc, but my remote forks are all connected to ankr.com and never been "slow"
are you sure isn't something in your tests/scripts?
you can try with
anvil —fork-url="url"
to check if it's hardhat's fault
May 17, 2023, 1:01 AM
this is foundry's builtin network?
May 17, 2023, 1:11 AM
yep
May 17, 2023, 1:11 AM
I saw several people also say that forked mainnet is slow so I figured it was common. I will try anvil
switched to ankr rpc and it's good enough for now. I was able to add LP to a test token
working fine on all RPCs now, not sure what the slowness was earlier 🤷‍♂️
Pinning a specific block seems to make a big difference. Without pinning, the response times are very hit or miss for me.
^ in hardhat config
May 17, 2023, 2:26 AM

© 2024 Draquery.com All rights reserved.