Skip to content

Commit

Permalink
Merge pull request #114 from renproject/feat/separate-testnets
Browse files Browse the repository at this point in the history
feat: make different testnets possible for ethereum based testnets
  • Loading branch information
jazg authored Jul 29, 2021
2 parents 8b202dd + 168116a commit 528bccd
Show file tree
Hide file tree
Showing 8 changed files with 91 additions and 0 deletions.
5 changes: 5 additions & 0 deletions infra/.env
Original file line number Diff line number Diff line change
Expand Up @@ -94,3 +94,8 @@ export AVAX_ADDRESS="X-local18jma8ppw3nhx5r4ap8clazz0dps7rv5u00z96u"
export C_AVAX_PK="0xb8c1b5c1d81f9475fdf2e334517d29f733bdfa40682207571b12fc1142cbf329"
export C_AVAX_HEX_ADDRESS="0xa0df350d2637096571F7A701CBc1C5fdE30dF76A"
export C_AVAX_BECH32_ADDRESS="C-local18jma8ppw3nhx5r4ap8clazz0dps7rv5u00z96u"

#
# Goerli
#
export GOERLI_PRIVATE_KEY=b8c1b5c1d81f9475fdf2e334517d29f733bdfa40682207571b12fc1142cbf329
9 changes: 9 additions & 0 deletions infra/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -178,3 +178,12 @@ services:
- "${C_AVAX_PK}"
- "${C_AVAX_HEX_ADDRESS}"
- "${C_AVAX_BECH32_ADDRESS}"

#
# Goerli (EIP-1559 compatible)
#
goerli:
build:
context: ./goerli
ports:
- "0.0.0.0:1545:8545"
14 changes: 14 additions & 0 deletions infra/goerli/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
FROM node:alpine

WORKDIR /root/app

COPY package.json .
RUN npm install

COPY hardhat.config.js .
COPY run.sh .
RUN chmod +x run.sh

EXPOSE 8545

ENTRYPOINT ["./run.sh"]
18 changes: 18 additions & 0 deletions infra/goerli/hardhat.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/**
* @type import('hardhat/config').HardhatUserConfig
*/
module.exports = {
solidity: "0.7.3",
defaultNetwork: "hardhat",
networks: {
hardhat: {
chainId: 5,
blockGasLimit: 15000000,
hardfork: "london",
accounts: {
mnemonic: "clutch captain shoe salt awake harvest setup primary inmate ugly among become",
count: 105
}
}
}
}
6 changes: 6 additions & 0 deletions infra/goerli/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"name": "hardhat-project",
"devDependencies": {
"hardhat": "^2.5.0"
}
}
3 changes: 3 additions & 0 deletions infra/goerli/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/sh

npx hardhat --config hardhat.config.js node
28 changes: 28 additions & 0 deletions multichain.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,12 @@ const (
REN = Asset("REN") // Ren
USDC = Asset("USDC") // Circle USD

// These assets are defined separately because their purpose is to help us
// differentiate between different testnets for the same blockchain.

KETH = Asset("KETH") // Kovan ETH
GETH = Asset("GETH") // Goerli ETH

// These assets are defined separately because they are mock assets. These
// assets should only be used for testing.

Expand Down Expand Up @@ -199,6 +205,11 @@ func (asset Asset) OriginChain() Chain {
case ZEC:
return Zcash

case KETH:
return Kovan
case GETH:
return Goerli

// These assets are handled separately because they are mock assets. These
// assets should only be used for testing.

Expand All @@ -222,6 +233,9 @@ func (asset Asset) ChainType() ChainType {
case ArbETH, AVAX, BNB, ETH, FIL, FTM, GLMR, LUNA, MATIC, REN, SOL, USDC:
return ChainTypeAccountBased

case KETH, GETH:
return ChainTypeAccountBased

// These assets are handled separately because they are mock assets. These
// assets should only be used for testing.

Expand All @@ -243,6 +257,9 @@ func (asset Asset) Type() AssetType {
case REN, USDC:
return AssetTypeToken

case KETH, GETH:
return AssetTypeNative

// These assets are handled separately because they are mock assets. These
// assets should only be used for testing.

Expand Down Expand Up @@ -295,6 +312,9 @@ const (
Terra = Chain("Terra")
Zcash = Chain("Zcash")

Kovan = Chain("Kovan")
Goerli = Chain("Goerli")

// These chains are defined separately because they are mock chains. These
// chains should only be used for testing.

Expand Down Expand Up @@ -330,6 +350,9 @@ func (chain Chain) ChainType() ChainType {
case Avalanche, BinanceSmartChain, Ethereum, Arbitrum, Fantom, Filecoin, Moonbeam, Polygon, Solana, Terra:
return ChainTypeAccountBased

case Kovan, Goerli:
return ChainTypeAccountBased

// These chains are handled separately because they are mock chains. These
// chains should only be used for testing.

Expand Down Expand Up @@ -390,6 +413,11 @@ func (chain Chain) NativeAsset() Asset {
case Arbitrum:
return ArbETH

case Kovan:
return KETH
case Goerli:
return GETH

// These chains are handled separately because they are mock chains. These
// chains should only be used for testing.

Expand Down
8 changes: 8 additions & 0 deletions multichain_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,14 @@ var _ = Describe("Multichain", func() {
multichain.Terra,
multichain.LUNA,
},
{
multichain.Kovan,
multichain.KETH,
},
{
multichain.Goerli,
multichain.GETH,
},
}
utxoChains := []struct {
chain multichain.Chain
Expand Down

0 comments on commit 528bccd

Please sign in to comment.