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

bug: setBalance not working as expected #32

Open
1 task done
pyk opened this issue Jun 29, 2023 · 0 comments
Open
1 task done

bug: setBalance not working as expected #32

pyk opened this issue Jun 29, 2023 · 0 comments

Comments

@pyk
Copy link

pyk commented Jun 29, 2023

Is there an existing issue for this?

  • I have searched the existing issues

Package Version

1.33.0

Current Behavior

When I try to set DAI, USDC and USDT balance on Mainnet fork via gui.setBalance the balance is set to zero:

Balance of 0x7a81c7A8eaC3655b69Fb22055d40217D9D8a5281 is now 0
Balance of 0x7a81c7A8eaC3655b69Fb22055d40217D9D8a5281 is now 0
Balance of 0x7a81c7A8eaC3655b69Fb22055d40217D9D8a5281 is now 0

Expected Behavior

The DAI, USDC and USDT balance of a test account should be updated

Steps To Reproduce

Set GUARDIAN_UI_ALCHEMY_API_KEY

Then use the following test example:

import { test } from '@guardianui/test'

test('Wrap Token to saToken', async ({ page, gui }) => {
  // Fork Mainnet
  await gui.initializeChain(1, 17585757)

  // Mock balances
  await gui.setEthBalance('100000000000000000000000')
  await gui.setBalance(
    '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48', // USDC
    '1000000000000'
  )
  await gui.setBalance(
    '0xdac17f958d2ee523a2206206994597c13d831ec7', // USDT
    '1000000000000'
  )
  await gui.setBalance(
    '0x6b175474e89094c44da98b954eedeac495271d0f', // DAI
    '1000000000000000000000000'
  )
})

The console log should output the following:

Balance of 0x7a81c7A8eaC3655b69Fb22055d40217D9D8a5281 is now 0
Balance of 0x7a81c7A8eaC3655b69Fb22055d40217D9D8a5281 is now 0
Balance of 0x7a81c7A8eaC3655b69Fb22055d40217D9D8a5281 is now 0

Link to Minimal Reproducible Example

No response

Operating system

Distributor ID: Ubuntu
Description:    Ubuntu 22.04.2 LTS
Release:        22.04
Codename:       jammy

Browser

Chrome

Anything else?

Currently I need to specify the slot storage manually in order to set the token balance

For example:

  await setBalanceAtSlot({
    token: '0xae78736cd615f374d3085123a210448e74fc6393', // rETH
    slotNumber: '1',
    value: '10000000000000000000000',
    gui,
  })
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant