Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/OasisDEX/e2e-tests
Browse files Browse the repository at this point in the history
  • Loading branch information
juan-langa committed Dec 15, 2023
2 parents d0cc7ec + 6439680 commit 5808fe3
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 13 deletions.
14 changes: 12 additions & 2 deletions .github/workflows/createForkWithFunds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ jobs:
create-for-with-funds:
name: 'Create fork and add funds'
runs-on: ubuntu-latest
env:
TENDERLY_PROJECT: ${{ secrets.TENDERLY_PROJECT }}
TENDERLY_USER: ${{ secrets.TENDERLY_USER }}
TENDERLY_ACCESS_KEY: ${{ secrets.TENDERLY_ACCESS_KEY }}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
Expand All @@ -27,5 +31,11 @@ jobs:
run: npm install typescript ts-node
- name: Install dependencies
run: yarn
- name: Run create-fork
run: NETWORK=${{ inputs.network }} WALLET_ADDRESS=${{ inputs.wallet}} yarn create-fork-github
- name: Run create-fork-github
run: |
TENDERLY_PROJECT=${{ secrets.TENDERLY_PROJECT }} \
TENDERLY_USER=${{ secrets.TENDERLY_USER }} \
TENDERLY_ACCESS_KEY=${{ secrets.TENDERLY_ACCESS_KEY }} \
NETWORK=${{ inputs.network }} \
WALLET_ADDRESS=${{ inputs.wallet}} \
yarn create-fork-github
6 changes: 0 additions & 6 deletions additional.d.ts

This file was deleted.

4 changes: 2 additions & 2 deletions utilsManualTesting/createFork.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,11 @@ import * as tenderly from '../utils/tenderly';

const resp = await tenderly.createFork({ network });
const forkId = resp.data.root_transaction.fork_id;
console.log(`Selected network: ${network}`);

if (network === 'mainnet') {
walletAddress = await input({ message: 'Enter your wallet address: ' });
console.log(`Wallet address: ${walletAddress}`);

// When using 'Promise.all()' some of the transactions randomly fail
await tenderly.setTokenBalance({ forkId, token: 'ETH', balance: '5000', walletAddress });
Expand All @@ -29,9 +31,7 @@ import * as tenderly from '../utils/tenderly';
await tenderly.setTokenBalance({ forkId, token: 'WBTC', balance: '10', walletAddress });
}

console.log(`Selected network: ${network}`);
if (network === 'mainnet') {
console.log(`Wallet address: ${walletAddress}`);
console.log('-------------------------------------');
console.log('Tokens and balance:');
console.log('ETH - 5000');
Expand Down
26 changes: 23 additions & 3 deletions utilsManualTesting/createForkGithub.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,37 @@
import * as tenderly from '../utils/tenderly';

type Networks = 'mainnet' | 'optimism' | 'arbitrum' | 'base';

const { NETWORK, WALLET_ADDRESS } = process.env;
let network: Networks;
switch (NETWORK) {
case 'mainnet':
default:
network = 'mainnet';
break;
case 'arbitrum':
network = 'arbitrum';
break;
case 'base':
network = 'base';
break;
case 'optimism':
network = 'optimism';
break;
}

let walletAddress: string = WALLET_ADDRESS;

(async () => {
const resp = await tenderly.createFork({ network: NETWORK });
const resp = await tenderly.createFork({ network });
const forkId = resp.data.root_transaction.fork_id;

if (NETWORK === 'mainnet') {
await tenderly.setTokenBalance({
forkId,
token: 'ETH',
balance: '5000',
walletAddress: WALLET_ADDRESS,
walletAddress: walletAddress,
});
await tenderly.setTokenBalance({
forkId,
Expand All @@ -23,7 +43,7 @@ const { NETWORK, WALLET_ADDRESS } = process.env;
forkId,
token: 'SDAI',
balance: '200000',
walletAddress: WALLET_ADDRESS,
walletAddress: walletAddress,
});
await tenderly.setTokenBalance({
forkId,
Expand Down

0 comments on commit 5808fe3

Please sign in to comment.