Skip to content

Commit 9cccc2d

Browse files
nhussein11eshaben
andauthored
FIX - uniswap regular hardhat (#1269)
* fix: uniswap v2 now using evm * fix: llms * Update smart-contracts/cookbook/eth-dapps/uniswap-v2.md Co-authored-by: Erin Shaben <eshaben@icloud.com> * fix: llms --------- Co-authored-by: Erin Shaben <eshaben@icloud.com>
1 parent 9cc979c commit 9cccc2d

File tree

6 files changed

+50
-138
lines changed

6 files changed

+50
-138
lines changed

.ai/categories/dapps.md

Lines changed: 10 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -997,8 +997,8 @@ Before starting, make sure you have:
997997
998998
- Node.js (v16.0.0 or later) and npm installed.
999999
- Basic understanding of Solidity and JavaScript.
1000-
- Familiarity with `hardhat-polkadot` development environment.
1001-
- Some PAS test tokens to cover transaction fees (obtained from the [Polkadot faucet](https://faucet.polkadot.io/?parachain=1111){target=\_blank}).
1000+
- Familiarity with [Hardhat](/smart-contracts/dev-environments/hardhat/){target=\_blank} development environment.
1001+
- Some test tokens to cover transaction fees (obtained from the [Polkadot faucet](https://faucet.polkadot.io/?parachain=1111){target=\_blank}).
10021002
- Basic understanding of how AMMs and liquidity pools work.
10031003
10041004
## Set Up the Project
@@ -1008,7 +1008,8 @@ Start by cloning the Uniswap V2 project:
10081008
1. Clone the Uniswap V2 repository:
10091009
10101010
```
1011-
git clone https://github.com/polkadot-developers/polkavm-hardhat-examples.git -b v0.0.6
1011+
git clone https://github.com/polkadot-developers/polkavm-hardhat-examples.git
1012+
git checkout hardhat-polkadot-evm
10121013
cd polkavm-hardhat-examples/uniswap-v2-polkadot/
10131014
```
10141015
@@ -1018,31 +1019,14 @@ Start by cloning the Uniswap V2 project:
10181019
npm install
10191020
```
10201021
1021-
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:
1022-
1023-
```js title="hardhat.config.js"
1024-
hardhat: {
1025-
polkavm: true,
1026-
nodeConfig: {
1027-
nodeBinaryPath: '../bin/substrate-node',
1028-
rpcPort: 8000,
1029-
dev: true,
1030-
},
1031-
adapterConfig: {
1032-
adapterBinaryPath: '../bin/eth-rpc',
1033-
dev: true,
1034-
},
1035-
},
1036-
```
1037-
1038-
4. Create a `.env` file in your project root to store your private keys (you can use as an example the `env.example` file):
1022+
3. Create a `.env` file in your project root to store your private keys (you can use as an example the `env.example` file):
10391023
10401024
```text title=".env"
10411025
LOCAL_PRIV_KEY="INSERT_LOCAL_PRIVATE_KEY"
10421026
AH_PRIV_KEY="INSERT_AH_PRIVATE_KEY"
10431027
```
10441028
1045-
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).
1029+
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).
10461030
10471031
!!!warning
10481032
Keep your private key safe, and never share it with anyone. If it is compromised, your funds can be stolen.
@@ -1061,7 +1045,7 @@ If the compilation is successful, you should see the following output:
10611045
<span data-ty>Successfully compiled 12 Solidity files</span>
10621046
</div>
10631047
1064-
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.
1048+
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.
10651049
10661050
## Understanding Uniswap V2 Architecture
10671051
@@ -1119,13 +1103,7 @@ You can run the provided test suite to ensure the contracts are working as expec
11191103
11201104
To test it locally, you can run the following commands:
11211105
1122-
1. Spawn a local node for testing:
1123-
1124-
```bash
1125-
npx hardhat node
1126-
```
1127-
1128-
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`.
1106+
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.
11291107
11301108
2. In a new terminal, run the tests:
11311109
@@ -1190,10 +1168,10 @@ npx hardhat run scripts/deploy.js --network localNode
11901168
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:
11911169
11921170
```bash
1193-
npx hardhat run scripts/deploy.js --network passetHub
1171+
npx hardhat run scripts/deploy.js --network polkadotHubTestNet
11941172
```
11951173
1196-
The command above deploys to the actual Polkadot TestNet. It requires PAS test tokens, persists on the network, and operates under real network conditions.
1174+
The command above deploys to the actual Polkadot Hub TestNet. It requires test tokens, persists on the network, and operates under real network conditions.
11971175
11981176
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:
11991177

.ai/categories/tooling.md

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

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

22942294
## Set Up the Project
@@ -2298,7 +2298,8 @@ Start by cloning the Uniswap V2 project:
22982298
1. Clone the Uniswap V2 repository:
22992299

23002300
```
2301-
git clone https://github.com/polkadot-developers/polkavm-hardhat-examples.git -b v0.0.6
2301+
git clone https://github.com/polkadot-developers/polkavm-hardhat-examples.git
2302+
git checkout hardhat-polkadot-evm
23022303
cd polkavm-hardhat-examples/uniswap-v2-polkadot/
23032304
```
23042305

@@ -2308,31 +2309,14 @@ Start by cloning the Uniswap V2 project:
23082309
npm install
23092310
```
23102311

2311-
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:
2312-
2313-
```js title="hardhat.config.js"
2314-
hardhat: {
2315-
polkavm: true,
2316-
nodeConfig: {
2317-
nodeBinaryPath: '../bin/substrate-node',
2318-
rpcPort: 8000,
2319-
dev: true,
2320-
},
2321-
adapterConfig: {
2322-
adapterBinaryPath: '../bin/eth-rpc',
2323-
dev: true,
2324-
},
2325-
},
2326-
```
2327-
2328-
4. Create a `.env` file in your project root to store your private keys (you can use as an example the `env.example` file):
2312+
3. Create a `.env` file in your project root to store your private keys (you can use as an example the `env.example` file):
23292313

23302314
```text title=".env"
23312315
LOCAL_PRIV_KEY="INSERT_LOCAL_PRIVATE_KEY"
23322316
AH_PRIV_KEY="INSERT_AH_PRIVATE_KEY"
23332317
```
23342318

2335-
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).
2319+
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).
23362320

23372321
!!!warning
23382322
Keep your private key safe, and never share it with anyone. If it is compromised, your funds can be stolen.
@@ -2351,7 +2335,7 @@ If the compilation is successful, you should see the following output:
23512335
<span data-ty>Successfully compiled 12 Solidity files</span>
23522336
</div>
23532337

2354-
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.
2338+
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.
23552339

23562340
## Understanding Uniswap V2 Architecture
23572341

@@ -2409,13 +2393,7 @@ You can run the provided test suite to ensure the contracts are working as expec
24092393

24102394
To test it locally, you can run the following commands:
24112395

2412-
1. Spawn a local node for testing:
2413-
2414-
```bash
2415-
npx hardhat node
2416-
```
2417-
2418-
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`.
2396+
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.
24192397

24202398
2. In a new terminal, run the tests:
24212399

@@ -2480,10 +2458,10 @@ npx hardhat run scripts/deploy.js --network localNode
24802458
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:
24812459

24822460
```bash
2483-
npx hardhat run scripts/deploy.js --network passetHub
2461+
npx hardhat run scripts/deploy.js --network polkadotHubTestNet
24842462
```
24852463

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

24882466
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:
24892467

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

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

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

2626
## Set Up the Project
@@ -30,7 +30,8 @@ Start by cloning the Uniswap V2 project:
3030
1. Clone the Uniswap V2 repository:
3131

3232
```
33-
git clone https://github.com/polkadot-developers/polkavm-hardhat-examples.git -b v0.0.6
33+
git clone https://github.com/polkadot-developers/polkavm-hardhat-examples.git
34+
git checkout hardhat-polkadot-evm
3435
cd polkavm-hardhat-examples/uniswap-v2-polkadot/
3536
```
3637
@@ -40,31 +41,14 @@ Start by cloning the Uniswap V2 project:
4041
npm install
4142
```
4243
43-
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:
44-
45-
```js title="hardhat.config.js"
46-
hardhat: {
47-
polkavm: true,
48-
nodeConfig: {
49-
nodeBinaryPath: '../bin/substrate-node',
50-
rpcPort: 8000,
51-
dev: true,
52-
},
53-
adapterConfig: {
54-
adapterBinaryPath: '../bin/eth-rpc',
55-
dev: true,
56-
},
57-
},
58-
```
59-
60-
4. Create a `.env` file in your project root to store your private keys (you can use as an example the `env.example` file):
44+
3. Create a `.env` file in your project root to store your private keys (you can use as an example the `env.example` file):
6145
6246
```text title=".env"
6347
LOCAL_PRIV_KEY="INSERT_LOCAL_PRIVATE_KEY"
6448
AH_PRIV_KEY="INSERT_AH_PRIVATE_KEY"
6549
```
6650
67-
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).
51+
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).
6852
6953
!!!warning
7054
Keep your private key safe, and never share it with anyone. If it is compromised, your funds can be stolen.
@@ -83,7 +67,7 @@ If the compilation is successful, you should see the following output:
8367
<span data-ty>Successfully compiled 12 Solidity files</span>
8468
</div>
8569
86-
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.
70+
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.
8771
8872
## Understanding Uniswap V2 Architecture
8973
@@ -141,13 +125,7 @@ You can run the provided test suite to ensure the contracts are working as expec
141125

142126
To test it locally, you can run the following commands:
143127

144-
1. Spawn a local node for testing:
145-
146-
```bash
147-
npx hardhat node
148-
```
149-
150-
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`.
128+
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.
151129

152130
2. In a new terminal, run the tests:
153131

@@ -212,10 +190,10 @@ npx hardhat run scripts/deploy.js --network localNode
212190
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:
213191

214192
```bash
215-
npx hardhat run scripts/deploy.js --network passetHub
193+
npx hardhat run scripts/deploy.js --network polkadotHubTestNet
216194
```
217195

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

220198
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:
221199

.ai/site-index.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3147,12 +3147,12 @@
31473147
}
31483148
],
31493149
"stats": {
3150-
"chars": 10874,
3151-
"words": 1505,
3150+
"chars": 10410,
3151+
"words": 1440,
31523152
"headings": 7,
3153-
"estimated_token_count_total": 2601
3153+
"estimated_token_count_total": 2486
31543154
},
3155-
"hash": "sha256:264252e73c47c4d1ca86f3070c4c63051cdba4acff3839e67387df9be13b428e",
3155+
"hash": "sha256:f299ed4390a89f74c80ccb657871c8c771fe7151d7c93b9fd120f0093955d3e5",
31563156
"token_estimator": "heuristic-v1"
31573157
},
31583158
{

0 commit comments

Comments
 (0)