Skip to content
This repository has been archived by the owner on Dec 5, 2021. It is now read-only.

Commit

Permalink
Merge pull request #25 from enyalabs/nft2
Browse files Browse the repository at this point in the history
TEST ONLY DO NOT MERGE
  • Loading branch information
Jan Liphardt authored May 10, 2021
2 parents d4659ae + a7c5ae8 commit ea5ef94
Show file tree
Hide file tree
Showing 26 changed files with 812 additions and 1,113 deletions.
4 changes: 2 additions & 2 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ ETH1_ADDRESS_RESOLVER_ADDRESS=0xa32cf2433ba24595d3aCE5cc9A7079d3f1CC5E0c
TEST_PRIVATE_KEY_1=
TEST_PRIVATE_KEY_2=
TARGET_GAS_LIMIT=9000000000
CHAIN_ID=420
CHAIN_ID=28

# Local
NODE_ENV=local
Expand All @@ -16,4 +16,4 @@ ETH1_ADDRESS_RESOLVER_ADDRESS=0x3e4CFaa8730092552d9425575E49bB542e329981
TEST_PRIVATE_KEY_1=0x754fde3f5e60ef2c7649061e06957c29017fe21032a8017132c0078e37f6193a
TEST_PRIVATE_KEY_2=0x23d9aeeaa08ab710a57972eb56fc711d9ab13afdecc92c89586e0150bfa380a6
TARGET_GAS_LIMIT=9000000000
CHAIN_ID=420
CHAIN_ID=28
92 changes: 51 additions & 41 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,62 +25,70 @@ Create a `.env` file in the root directory of this project. Add environment-spec

### 1.1 Using Rinkeby Testnet

If you just want to work on the wallet, you can use the stable testnet on Rinkeby and AWS. To test on Rinkeby (ChainID 4), you will need an Infura key and two accounts with Rinkeby ETH in them. The test wallets must contain enough ETH to cover the tests. The `.env` parameters are
If you just want to work on the wallet, you can use the stable testnet on Rinkeby (ChainID 4) and AWS. To test on Rinkeby, you will need an Infura key and two accounts with Rinkeby ETH in them. The test wallets must contain enough ETH to cover the tests. The `.env` parameters are

```bash

NODE_ENV=local
L1_NODE_WEB3_URL=https://rinkeby.infura.io/v3/KEY
L2_NODE_WEB3_URL=http://54.161.5.63:8545
ETH1_ADDRESS_RESOLVER_ADDRESS=0xa32cf2433ba24595d3aCE5cc9A7079d3f1CC5E0c
TEST_PRIVATE_KEY_1=0xPRIVATE KEY OF THE FIRST TEST WALLET
TEST_PRIVATE_KEY_2=0xPRIVATE KEY OF THE SECOND TEST WALLET
TARGET_GAS_LIMIT=9000000000
CHAIN_ID=420
CHAIN_ID=28

```

### 1.2 Using Local Net
If you do not know what these values are, you can get them from the values written to the terminal as your local OMGX spins up.

### 1.2 Using a Local Testnet

If would like to change the wallet-associated smart contracts and/or work on other aspects of the system, you should run a local development system. You can do this by

```bash
# Git clone with submodules

$ git clone git@github.com:enyalabs/optimism-integration.git
$ cd optimism-integration
$ docker-compose pull
$ yarn install
$ ./up_local.sh
```

If you do not know what these values are, you can get them from the values written to the terminal as your local OMGX spins up.

```

As the system boots, you'll see several things zip by in the terminal that you will need to correctly configure your `.env`, namely the values for the

```bash

ETH1_ADDRESS_RESOLVER_ADDRESS=0x______
TEST_PRIVATE_KEY_1=0x_____
TEST_PRIVATE_KEY_2=0x______

```

For the test private keys, we normally use the ones generated by hardhat as it spins up the local L1. Each of those is funded with 1000 ETH. You can get the test private keys from the hardhat (`l1_chain`) Docker terminal or from your main terminal. You will also need the `ADDRESS_RESOLVER_ADDRESS`, which will zip by as your local system deploys (see the `deployer` Docker terminal output or your main terminal window). Fill these values into your `.env`. Your final `.env` should look something like this
For the test private keys, we normally use the ones generated by hardhat as it sets up the local L1. Each of those is funded with 1000 ETH. You can get the test private keys from the hardhat (`l1_chain`) Docker terminal or from your main terminal. You will also need the `ADDRESS_RESOLVER_ADDRESS`, which will zip by as your local system deploys (see the `deployer` Docker terminal output or your main terminal window). Fill these values into your `.env`. Your final `.env` should look something like this

```bash

NODE_ENV=local
L1_NODE_WEB3_URL=http://localhost:9545
L2_NODE_WEB3_URL=http://localhost:8545
ETH1_ADDRESS_RESOLVER_ADDRESS=0x3e4CFaa8730092552d9425575E49bB542e329981
TEST_PRIVATE_KEY_1=0x754fde3f5e60ef2c7649061e06957c29017fe21032a8017132c0078e37f6193a
TEST_PRIVATE_KEY_2=0x23d9aeeaa08ab710a57972eb56fc711d9ab13afdecc92c89586e0150bfa380a6
TARGET_GAS_LIMIT=9000000000
CHAIN_ID=420
CHAIN_ID=28

```

## 2. Running the Integration Tests

```bash

$ yarn install
$ yarn build #builds the contracts
$ yarn deploy #if needed - this will test and deploy the contracts, and write their addresses to /deployments/addresses.json

```

The information generated during the deploy (e.g the `/deployments/addresses.json`) is used by the web wallet front end to set things up correctly. **The full test suite includes some very slow transactions such as withdrawals, which can take 300 seconds each. Please be patient.**
Expand Down Expand Up @@ -140,22 +148,22 @@ If you are working on a local testnet, please deploy **L2LiquidityPool.sol** fir

```javascript

L2LiquidityPool = await Factory__L2LiquidityPool.deploy(
env.watcher.l2.messengerAddress,
)
await L2LiquidityPool.deployTransaction.wait()
L1LiquidityPool = await Factory__L1LiquidityPool.deploy(
L2LiquidityPool.address,
env.watcher.l1.messengerAddress,
env.L2ETHGateway.address,
3
)
await L1LiquidityPool.deployTransaction.wait()
const L2LiquidityPoolTX = await L2LiquidityPool.init(L1LiquidityPool.address, "3")
await L2LiquidityPoolTX.wait()
console.log(' L2 LP initialized:',L2LiquidityPoolTX.hash);
L2LiquidityPool = await Factory__L2LiquidityPool.deploy(
env.watcher.l2.messengerAddress,
)
await L2LiquidityPool.deployTransaction.wait()

L1LiquidityPool = await Factory__L1LiquidityPool.deploy(
L2LiquidityPool.address,
env.watcher.l1.messengerAddress,
env.L2ETHGateway.address,
3
)
await L1LiquidityPool.deployTransaction.wait()

const L2LiquidityPoolTX = await L2LiquidityPool.init(L1LiquidityPool.address, "3")
await L2LiquidityPoolTX.wait()
console.log(' L2 LP initialized:',L2LiquidityPoolTX.hash);

```

Expand All @@ -170,21 +178,27 @@ Used to swap ERC20 tokens.
* `expire` sets the status of the swap to be **EXPIRED**.
* `check` returns the **Swap** construct

## 4. Running the web wallet
## 4. Running the Web Wallet

```bash

$ cd /wallet
$ yarn install
$ yarn start

```

You will need to set up MetaMask to know about the two accounts you are using for local testing. You will need to point MetaMask at your local chains (at :9545 and :8545) and add the account used for testing, which is typically whatever you used a `TEST_PRIVATE_KEY_2` aka `Alice`:

```bash

TEST_PRIVATE_KEY_2=0x23d9aeeaa08ab710a57972eb56fc711d9ab13afdecc92c89586e0150bfa380a6

```

You also need to add networks to your MetaMask.
### Metamask Settings

You also need to add networks to your MetaMask:

* Local L1

Expand All @@ -197,31 +211,27 @@ You also need to add networks to your MetaMask.

```
URL = http://localhost:8545
ChainID = 420
ChainID = 28
```

> You have to reset the MetaMask when you re-run the local networks! The reset button is in **Settings > Advanced > Reset Account**.
> You might have to reset MetaMask when you re-start the local network. The reset button is in **Settings > Advanced > Reset Account**.
* Rinkeby
* Rinkeby L1

Select Rinkeby Test Network
Select the dewfault Rinkeby Test Network

* AWS L2
* OMGX L2

```
URL = http://18.208.138.49:8545
ChainID = 420
ChainID = 28
```

Here's a step-by-step process on how to do that while in your browser:

1. Open MetaMask the browser extension and click on your currently connected network at the top pane, next to your jazzicon.

2. You'll see a modal open up with list of networks. Click on the "Custom RPC" button at the very bottom. (See example image below.)
### Wallet Use and Supported Functions

![Custom RPC button](https://community.optimism.io/assets/img/custom-metamask-network-1.d6908890.png)
1. Open the MetaMask browser extension and click on your currently connected network at the top pane, next to your jazzicon.

3. Next, you'll enter in the network parameters and save it:
2. You'll see a modal open up with list of networks. If you are working on a local system, click on the "Custom RPC" button at the very bottom. Enter/select your L1 and L2 network parameters.

![image](https://user-images.githubusercontent.com/46272347/116638580-7c53a600-a91b-11eb-86c5-75242eb0507b.png)
3. Account Page. here you can see your balances, and move tokens from L1 to L2, and back.

189 changes: 0 additions & 189 deletions contracts/Address.sol

This file was deleted.

Loading

0 comments on commit ea5ef94

Please sign in to comment.