Skip to content

Commit 4177018

Browse files
committed
fix: uniswap v2 now using evm
1 parent 319868c commit 4177018

File tree

1 file changed

+10
-32
lines changed

1 file changed

+10
-32
lines changed

smart-contracts/cookbook/eth-dapps/uniswap-v2.md

Lines changed: 10 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ Before starting, make sure you have:
2020

2121
- Node.js (v16.0.0 or later) and npm installed.
2222
- Basic understanding of Solidity and JavaScript.
23-
- Familiarity with `hardhat-polkadot` development environment.
24-
- Some PAS test tokens to cover transaction fees (obtained from the [Polkadot faucet](https://faucet.polkadot.io/?parachain=1111){target=\_blank}).
23+
- Familiarity with [`hardhat`](/smart-contracts/dev-environments/hardhat/){target=\_blank} development environment.
24+
- Some test tokens to cover transaction fees (obtained from the [Polkadot faucet](https://faucet.polkadot.io/?parachain=1111){target=\_blank}).
2525
- Basic understanding of how AMMs and liquidity pools work.
2626

2727
## Set Up the Project
@@ -31,7 +31,8 @@ Start by cloning the Uniswap V2 project:
3131
1. Clone the Uniswap V2 repository:
3232

3333
```
34-
git clone https://github.com/polkadot-developers/polkavm-hardhat-examples.git -b v0.0.6
34+
git clone https://github.com/polkadot-developers/polkavm-hardhat-examples.git
35+
git checkout hardhat-polkadot-evm
3536
cd polkavm-hardhat-examples/uniswap-v2-polkadot/
3637
```
3738
@@ -41,31 +42,14 @@ Start by cloning the Uniswap V2 project:
4142
npm install
4243
```
4344
44-
3. Update the `hardhat.config.js` file so the paths for the Substrate node and the ETH-RPC adapter match with the paths on your machine:
45-
46-
```js title="hardhat.config.js"
47-
hardhat: {
48-
polkavm: true,
49-
nodeConfig: {
50-
nodeBinaryPath: '../bin/substrate-node',
51-
rpcPort: 8000,
52-
dev: true,
53-
},
54-
adapterConfig: {
55-
adapterBinaryPath: '../bin/eth-rpc',
56-
dev: true,
57-
},
58-
},
59-
```
60-
61-
4. Create a `.env` file in your project root to store your private keys (you can use as an example the `env.example` file):
45+
3. Create a `.env` file in your project root to store your private keys (you can use as an example the `env.example` file):
6246
6347
```text title=".env"
6448
LOCAL_PRIV_KEY="INSERT_LOCAL_PRIVATE_KEY"
6549
AH_PRIV_KEY="INSERT_AH_PRIVATE_KEY"
6650
```
6751
68-
Ensure to replace `"INSERT_LOCAL_PRIVATE_KEY"` with a private key available in the local environment (you can get them from this [file](https://github.com/paritytech/hardhat-polkadot/blob/main/packages/hardhat-polkadot-node/src/constants.ts#L22){target=\_blank}). And `"INSERT_AH_PRIVATE_KEY"` with the account's private key you want to use to deploy the contracts. You can get this by exporting the private key from your wallet (e.g., MetaMask).
52+
Ensure to replace `"INSERT_LOCAL_PRIVATE_KEY"` with a private key available in the local environment (you can get them from this [file](https://github.com/paritytech/hardhat-polkadot/blob/main/packages/hardhat-polkadot-node/src/constants.ts#L21){target=\_blank}). And `"INSERT_AH_PRIVATE_KEY"` with the account's private key you want to use to deploy the contracts. You can get this by exporting the private key from your wallet (e.g., MetaMask).
6953
7054
!!!warning
7155
Keep your private key safe, and never share it with anyone. If it is compromised, your funds can be stolen.
@@ -80,7 +64,7 @@ If the compilation is successful, you should see the following output:
8064
8165
--8<-- 'code/smart-contracts/cookbook/eth-dapps/uniswap-v2/compilation-output.html'
8266
83-
After running the above command, you should see the compiled contracts in the `artifacts-pvm` directory. This directory contains the ABI and bytecode of your contracts.
67+
After running the above command, you should see the compiled contracts in the `artifacts` directory. This directory contains the ABI and bytecode of your contracts.
8468
8569
## Understanding Uniswap V2 Architecture
8670
@@ -138,13 +122,7 @@ You can run the provided test suite to ensure the contracts are working as expec
138122

139123
To test it locally, you can run the following commands:
140124

141-
1. Spawn a local node for testing:
142-
143-
```bash
144-
npx hardhat node
145-
```
146-
147-
This command will spawn a local Substrate node along with the ETH-RPC adapter. The node will be available at `ws://127.0.0.1:8000` and the ETH-RPC adapter at `http://localhost:8545`.
125+
1. Run the local `revive-dev-node`, for this, you can check the [Local Development Node](/smart-contracts/dev-environments/local-dev-node/){target=\_blank} guide.
148126

149127
2. In a new terminal, run the tests:
150128

@@ -169,10 +147,10 @@ npx hardhat run scripts/deploy.js --network localNode
169147
This command deploys the contracts to your local blockchain for development and testing. If you want to deploy to Polkadot Hub, you can use the following command:
170148

171149
```bash
172-
npx hardhat run scripts/deploy.js --network passetHub
150+
npx hardhat run scripts/deploy.js --network polkadotHubTestNet
173151
```
174152

175-
The command above deploys to the actual Polkadot TestNet. It requires PAS test tokens, persists on the network, and operates under real network conditions.
153+
The command above deploys to the actual Polkadot Hub TestNet. It requires test tokens, persists on the network, and operates under real network conditions.
176154

177155
The deployment script will output the addresses of the deployed contracts. Save these addresses, as you will need them to interact with the contracts. For example, the output should look like this:
178156

0 commit comments

Comments
 (0)