I'm currently watching my first smart contracts tutorial by freecodecamp and it works fine but, I have one question: How can I check the balance of my mainnet-fork account(s)? When I work with Rinkeby or Görli I can simply check the success of my transactions via MetaMask but how can I check my mainnet-fork balance? Where & how? Thanks in advance!
-
If you're using Metamask, the balances are shown in the usual place...– 0xSansonSep 30, 2022 at 22:58
-
@0xSanson NO! When I run the code on mainnet-fork? It works, but I don't know where to look at the accounts, and balance, is there a specific comand I have to use?– ChristopherusOct 1, 2022 at 0:03
1 Answer
print(f'account bal.: {account.balance()})
works for any network I've tried, which is to say mainnet-fork, avax-test, and ganache. If you are using the 'get_account()' function in patrick collins video then pay attention to the fact that the line
if network.show_active() in LOCAL_BLOCKCHAIN_ENVIRONMENTS:
return accounts[0]
returns a brownie (ganache-cli?) generated account rather than your wallets account if 'mainnet-fork' is in 'LOCAL_BLOCKCHAIN_ENVIRONMENTS'. So you'd be seeing that account balance rather than your wallets.