Skip to content

Commit

Permalink
fix: init.ts rpc url
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeff-CCH committed Jan 19, 2024
1 parent ccbabc5 commit ce7b0ea
Show file tree
Hide file tree
Showing 8 changed files with 24 additions and 9 deletions.
5 changes: 5 additions & 0 deletions .changeset/funny-lies-train.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@protocolink/logics': patch
---

fix init.ts rpc url
1 change: 0 additions & 1 deletion .env.mainnet
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
CHAIN_ID=1
HTTP_RPC_URL=https://mainnet.infura.io/v3/9aa3d95b3bc440fa88ea12eaa4456161
1 change: 0 additions & 1 deletion .env.mainnet.pb
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
CHAIN_ID=1
HTTP_RPC_URL=https://mainnet.infura.io/v3/9aa3d95b3bc440fa88ea12eaa4456161
BLOCK_NUMBER=18989101
3 changes: 3 additions & 0 deletions .github/workflows/e2e-test-latest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ on:
push:
pull_request:

env:
MAINNET_RPC_URL: ${{ secrets.MAINNET_RPC_URL }}

jobs:
run-e2e-test:
name: latest
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/e2e-test-mainnet-pb.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ on:
push:
pull_request:

env:
MAINNET_RPC_URL: ${{ secrets.MAINNET_RPC_URL }}

jobs:
run-e2e-test:
name: mainnet pb
Expand Down
2 changes: 1 addition & 1 deletion hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const config: HardhatUserConfig = {
initialIndex: 0,
},
forking: {
url: process.env.HTTP_RPC_URL ?? 'https://eth.llamarpc.com',
url: process.env.HTTP_RPC_URL ?? process.env.MAINNET_RPC_URL ?? 'https://eth.llamarpc.com',
blockNumber: process.env.BLOCK_NUMBER ? parseInt(process.env.BLOCK_NUMBER) : undefined,
},
},
Expand Down
8 changes: 7 additions & 1 deletion test/init.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
import * as common from '@protocolink/common';

common.setNetwork(common.ChainId.mainnet, { rpcUrl: 'https://mainnet.infura.io/v3/9aa3d95b3bc440fa88ea12eaa4456161' });
if (process.env.CHAIN_ID && process.env.HTTP_RPC_URL) {
common.setNetwork(parseInt(process.env.CHAIN_ID), { rpcUrl: process.env.HTTP_RPC_URL });
} else if (process.env.MAINNET_RPC_URL) {
common.setNetwork(common.ChainId.mainnet, { rpcUrl: process.env.MAINNET_RPC_URL });
} else {
common.setNetwork(common.ChainId.mainnet, { rpcUrl: 'https://eth.llamarpc.com' });
}
10 changes: 5 additions & 5 deletions test/logics/uniswap-v3/swap-token.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ describe('mainnet-pb: Test UniswapV3 SwapToken Logic', function () {
},
{
params: {
input: new common.TokenAmount(mainnetTokens.USDC, '1000'),
input: new common.TokenAmount(mainnetTokens.USDC, '10'),
tokenOut: mainnetTokens.ETH,
slippage: 500,
slippage: 1000,
},
},
{
Expand All @@ -51,9 +51,9 @@ describe('mainnet-pb: Test UniswapV3 SwapToken Logic', function () {
},
{
params: {
input: new common.TokenAmount(mainnetTokens.USDC, '1000'),
input: new common.TokenAmount(mainnetTokens.USDC, '10'),
tokenOut: mainnetTokens.ETH,
slippage: 500,
slippage: 1000,
},
balanceBps: 5000,
},
Expand All @@ -76,7 +76,7 @@ describe('mainnet-pb: Test UniswapV3 SwapToken Logic', function () {
params: {
tokenIn: mainnetTokens.USDC,
output: new common.TokenAmount(mainnetTokens.ETH, '1'),
slippage: 500,
slippage: 1000,
},
},
{
Expand Down

0 comments on commit ce7b0ea

Please sign in to comment.