Skip to content

An example of a Vue/Drizzle dApp that uses a forked mainnet via ganache-cli to convert ETH into Dai on Uniswap.

License

Notifications You must be signed in to change notification settings

remote-gildor/vue-drizzle-forked-mainnet

Repository files navigation

Vue Drizzle dApp that uses a forked mainnet

This is an example dApp with a Vue/Drizzle front-end that uses a forked mainnet as a localhost blockchain simulation (via ganache-cli).

This will not download the whole mainnet state on your computer, so no need to worry about disk space. Read more here, here, and here.

Install the needed dependencies

In root:

npm install

Then navigate to vapp/ and install npm dependencies there, too:

cd vapp && npm install

MetaMask setup

Add a new Custom RPC:

Run ganache-cli with a forked mainnet state

ganache-cli --fork <node-url>

For a node URL, you can use either your own mainnet node, or Alchemy, or Infura.

Alchemy is better than Infura because it gives you unlimited archival node access (with Infura you only get the last 30 min, which means you have to restart Ganache every 30 minutes). Also, Alchemy analytics are much better than Infura's, and you can see requests right away (Infura has a long lag).

You can add an optional flag of --networkId=1337. If you'd like to create one or more accounts with ETH balances, use this flag: --account="<private-key>,1000000000000000000000" (if you want multiple accounts, use this flag multiple times).

Run tests

truffle test

All the next runs can be just npm test.

Important: make sure to start the Ganache instance before you run tests. You might have to do truffle migrate or truffle migrate --reset before running tests.

Run Vue dApp

Make sure ganache-cli is running and the smart contract is deployed:

truffle migrate

Consider doing truffle migrate --reset instead if you've changed the smart contract in the meantime.

Then navigate to the vapp folder and run the Vue dApp:

cd vapp
npm run serve

About

An example of a Vue/Drizzle dApp that uses a forked mainnet via ganache-cli to convert ETH into Dai on Uniswap.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published