Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support ThunderCore #105

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions infra/.env
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,13 @@ export FILECOIN_ADDRESS=f1ej2tountzqwnu6uswhqdzvw6yy5xvcig6rxl2qa
export TERRA_PK=a96e62ed3955e65be32703f12d87b6b5cf26039ecfa948dc5107a495418e5330
export TERRA_ADDRESS=terra10s4mg25tu6termrk8egltfyme4q7sg3hl8s38u

#
# ThunderCore
#

export THUNDERCORE_MNEMONIC="clutch captain shoe salt awake harvest setup primary inmate ugly among become"
export THUNDERCORE_ADDRESS=0xa0df350d2637096571F7A701CBc1C5fdE30dF76A

#
# Zcash
#
Expand Down
13 changes: 13 additions & 0 deletions infra/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,19 @@ services:
ports:
- "0.0.0.0:8899-8900:8899-8900"

#
# ThunderCore
#
thundercore:
build:
context: ./thundercore
ports:
- "0.0.0.0:8565:8565"
entrypoint:
- "./root/run.sh"
- "${THUNDERCORE_MNEMONIC}"
- "${THUNDERCORE_ADDRESS}"

##
## Moonbeam
##
Expand Down
22 changes: 22 additions & 0 deletions infra/thundercore/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
FROM ubuntu:xenial

RUN apt-get update --fix-missing
RUN apt-get install --yes curl

RUN curl -sL https://deb.nodesource.com/setup_12.x | bash -
RUN apt-get install --yes nodejs git
RUN useradd -ms /bin/bash node

# workaround for npm not running prepare script when running as root
USER node
RUN npm config set prefix /home/node
RUN npm install -g thundercore/ganache-cli#tt
USER root
RUN ln -s /home/node/bin/ganache-cli /usr/bin/ganache-cli

COPY run.sh /root/run.sh
RUN chmod +x /root/run.sh

EXPOSE 8565

ENTRYPOINT ["./root/run.sh"]
12 changes: 12 additions & 0 deletions infra/thundercore/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/bash
MNEMONIC=$1
ADDRESS=$2

ganache-cli \
-h 0.0.0.0 \
-a 105 \
-k pala \
-i 420 \
-m "$MNEMONIC" \
-p 8565 \
-u $ADDRESS
10 changes: 8 additions & 2 deletions multichain.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ const (
LUNA = Asset("LUNA") // Luna
MATIC = Asset("MATIC") // Matic PoS (Polygon)
SOL = Asset("SOL") // Solana
TT = Asset("TT") // ThunderCore
ZEC = Asset("ZEC") // Zcash

// These assets are defined separately because they are mock assets. These
Expand Down Expand Up @@ -152,6 +153,8 @@ func (asset Asset) OriginChain() Chain {
return Polygon
case SOL:
return Solana
case TT:
return ThunderCore
case ZEC:
return Zcash

Expand All @@ -175,7 +178,7 @@ func (asset Asset) ChainType() ChainType {
switch asset {
case BCH, BTC, DGB, DOGE, ZEC:
return ChainTypeUTXOBased
case AVAX, BNB, ETH, FIL, GLMR, LUNA, MATIC:
case AVAX, BNB, ETH, FIL, GLMR, LUNA, MATIC, TT:
return ChainTypeAccountBased

// These assets are handled separately because they are mock assets. These
Expand Down Expand Up @@ -227,6 +230,7 @@ const (
Polygon = Chain("Polygon")
Solana = Chain("Solana")
Terra = Chain("Terra")
ThunderCore = Chain("ThunderCore")
Zcash = Chain("Zcash")

// These chains are defined separately because they are mock chains. These
Expand Down Expand Up @@ -261,7 +265,7 @@ func (chain Chain) ChainType() ChainType {
switch chain {
case Bitcoin, BitcoinCash, DigiByte, Dogecoin, Zcash:
return ChainTypeUTXOBased
case Avalanche, BinanceSmartChain, Ethereum, Fantom, Filecoin, Moonbeam, Polygon, Solana, Terra:
case Avalanche, BinanceSmartChain, Ethereum, Fantom, Filecoin, Moonbeam, Polygon, Solana, Terra, ThunderCore:
return ChainTypeAccountBased

// These chains are handled separately because they are mock chains. These
Expand Down Expand Up @@ -319,6 +323,8 @@ func (chain Chain) NativeAsset() Asset {
return SOL
case Terra:
return LUNA
case ThunderCore:
return TT
case Zcash:
return ZEC

Expand Down
4 changes: 4 additions & 0 deletions multichain_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,10 @@ var _ = Describe("Multichain", func() {
multichain.Terra,
multichain.LUNA,
},
{
multichain.ThunderCore,
multichain.TT,
},
}
utxoChains := []struct {
chain multichain.Chain
Expand Down