Skip to content

Commit

Permalink
renamed btpsimple -> iconbridge
Browse files Browse the repository at this point in the history
  • Loading branch information
bbist committed Jul 4, 2022
1 parent f00eafa commit b1b2de7
Show file tree
Hide file tree
Showing 38 changed files with 491 additions and 493 deletions.
16 changes: 8 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ endef
$(foreach M,$(CMDS),$(eval $(call CMD_template,$(M))))

# Build flags for each command
btpsimple_LDFLAGS = -X 'main.version=$(GL_VERSION)' -X 'main.build=$(BUILD_INFO)'
BUILD_TARGETS += btpsimple
iconbridge_LDFLAGS = -X 'main.version=$(GL_VERSION)' -X 'main.build=$(BUILD_INFO)'
BUILD_TARGETS += iconbridge

linux : $(addsuffix -linux,$(BUILD_TARGETS))

Expand Down Expand Up @@ -117,18 +117,18 @@ dist-sol: dist-sol-bmc dist-sol-token_bsh dist-sol-native_bsh
dist-javascore:
$(BUILD_ROOT)/docker/javascore/build.sh

BTPSIMPLE_IMAGE = btpsimple:$(GL_TAG)
BTPSIMPLE_DOCKER_DIR = $(BUILD_ROOT)/build/btpsimple
ICONBRIDGE_IMAGE = iconbridge:$(GL_TAG)
ICONBRIDGE_DOCKER_DIR = $(BUILD_ROOT)/build/iconbridge

btpsimple-image: btpsimple-linux
@ echo "[#] Building image $(BTPSIMPLE_IMAGE) for $(GL_VERSION)"
@ rm -rf $(BTPSIMPLE_DOCKER_DIR)
iconbridge-image: iconbridge-linux
@ echo "[#] Building image $(ICONBRIDGE_IMAGE) for $(GL_VERSION)"
@ rm -rf $(ICONBRIDGE_DOCKER_DIR)
@ \
BIN_DIR=$(abspath $(LINUX_BIN_DIR)) \
BIN_VERSION=$(GL_VERSION) \
BUILD_TAGS="$(GOBUILD_TAGS)" \
DIST_DIR="$(BUILD_ROOT)/build/contracts" \
$(BUILD_ROOT)/docker/btpsimple/build.sh $(BTPSIMPLE_IMAGE) $(BUILD_ROOT) $(BTPSIMPLE_DOCKER_DIR)
$(BUILD_ROOT)/docker/iconbridge/build.sh $(ICONBRIDGE_IMAGE) $(BUILD_ROOT) $(ICONBRIDGE_DOCKER_DIR)

.PHONY: test

Expand Down
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ Terminologies

- [Build Guide](doc/build.md)
- [Tutorial](doc/tutorial.md)
- [btpsimple command line](doc/btpsimple_cli.md)
- [iconbridge command line](doc/iconbridge_cli.md)
- [Binance Smart Chain Guide](doc/bsc-guide.md)
- [Harmony Guide](doc/hmny-guide.md)

Expand All @@ -59,10 +59,10 @@ Terminologies
| Directory | Description |
| :----------------------------------- | :------------------------------------------------------------------------------------------------ |
| /cmd | Root of implement of BMR |
| /cmd/btpsimple | Reference implement of BMR. only provide unidirectional relay. (golang) |
| /cmd/btpsimple/relay | Implement of common logic of BMR, uses chain package |
| /cmd/btpsimple/chain | BMR module interface, common code, and chain specific packages |
| /cmd/btpsimple/chain/`<blockchain>` | Implement of BMR module (`Sender`,`Receiver`), `<blockchain>` is name of blockchain |
| /cmd/iconbridge | Reference implement of BMR. only provide unidirectional relay. (golang) |
| /cmd/iconbridge/relay | Implement of common logic of BMR, uses chain package |
| /cmd/iconbridge/chain | BMR module interface, common code, and chain specific packages |
| /cmd/iconbridge/chain/`<blockchain>` | Implement of BMR module (`Sender`,`Receiver`), `<blockchain>` is name of blockchain |
| /common | Common code (golang) |
| /doc | Documents |
| /docker | Docker related resources |
Expand All @@ -77,5 +77,5 @@ Terminologies

| Directory | Description |
| :------------------------- | :-------------------------------- |
| /cmd/btpsimple/module/icon | BMR module for ICON blockchain |
| /cmd/btpsimple/module/hmny | BMR module for Harmony blockchain |
| /cmd/iconbridge/module/icon | BMR module for ICON blockchain |
| /cmd/iconbridge/module/hmny | BMR module for Harmony blockchain |
44 changes: 22 additions & 22 deletions devnet/docker/icon-bsc/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
ARG BTPSIMPLE_VERSION=latest
ARG ICONBRIDGE_VERSION=latest
ARG GOLOOP_IMAGE=iconloop/goloop-icon:v0.9.7

FROM ${GOLOOP_IMAGE} as goloop
FROM canhlinh/truffle:5.3.0-alpine as truffle
FROM btpsimple:${BTPSIMPLE_VERSION} AS btpsimple
FROM iconbridge:${ICONBRIDGE_VERSION} AS iconbridge
FROM node:16.1-alpine as node

# install truffle cli
Expand All @@ -18,38 +18,38 @@ RUN yarn --version
#install eth-cli
RUN yarn global add eth-cli

# install btpsimple cli
COPY --from=btpsimple . .
ENV PATH $PATH:/btpsimple/bin
# install iconbridge cli
COPY --from=iconbridge . .
ENV PATH $PATH:/iconbridge/bin

# install goloop cli
COPY --from=goloop /goloop/bin /goloop/bin
ENV PATH $PATH:/goloop/bin

ENV BTPSIMPLE_BASE_DIR=/btpsimple
ENV BTPSIMPLE_CONFIG_DIR=${BTPSIMPLE_BASE_DIR}/config
ENV BTPSIMPLE_CONTRACTS_DIR=${BTPSIMPLE_BASE_DIR}/contracts
ENV BTPSIMPLE_SCRIPTS_DIR=${BTPSIMPLE_BASE_DIR}/js
ENV BTPSIMPLE_BIN_DIR=/btpsimple/bin
COPY ./*.sh /btpsimple/bin/
COPY ./scripts/*.sh /btpsimple/bin/
ENV ICONBRIDGE_BASE_DIR=/iconbridge
ENV ICONBRIDGE_CONFIG_DIR=${ICONBRIDGE_BASE_DIR}/config
ENV ICONBRIDGE_CONTRACTS_DIR=${ICONBRIDGE_BASE_DIR}/contracts
ENV ICONBRIDGE_SCRIPTS_DIR=${ICONBRIDGE_BASE_DIR}/js
ENV ICONBRIDGE_BIN_DIR=/iconbridge/bin

COPY ./*.sh /iconbridge/bin/
COPY ./scripts/*.sh /iconbridge/bin/
COPY ./entrypoint.sh /
COPY ./scripts/provision.sh /
COPY ./iconvalidators /btpsimple/bin/
COPY ./iconvalidators /iconbridge/bin/


#RUN mkdir {BTPSIMPLE_SCRIPTS_DIR}
#COPY ./*.js /btpsimple/js/
COPY ./scripts/*.js /btpsimple/js/
#RUN mkdir {ICONBRIDGE_SCRIPTS_DIR}
#COPY ./*.js /iconbridge/js/
COPY ./scripts/*.js /iconbridge/js/

RUN chmod +x /provision.sh
RUN chmod +x /entrypoint.sh
RUN chmod +x /btpsimple/bin/wait-for-it.sh
RUN chmod +x /iconbridge/bin/wait-for-it.sh

RUN yarn --cwd $BTPSIMPLE_CONTRACTS_DIR/solidity/bmc --prod
RUN yarn --cwd $BTPSIMPLE_CONTRACTS_DIR/solidity/bsh --prod
RUN yarn --cwd $BTPSIMPLE_CONTRACTS_DIR/solidity/TokenBSH --prod
RUN yarn --cwd $ICONBRIDGE_CONTRACTS_DIR/solidity/bmc --prod
RUN yarn --cwd $ICONBRIDGE_CONTRACTS_DIR/solidity/bsh --prod
RUN yarn --cwd $ICONBRIDGE_CONTRACTS_DIR/solidity/TokenBSH --prod

WORKDIR /btpsimple/config
WORKDIR /iconbridge/config
ENTRYPOINT ["entrypoint.sh"]
32 changes: 16 additions & 16 deletions devnet/docker/icon-bsc/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ remove:
docker-compose down -v --remove-orphans
docker rmi -f icon-bsc_btp
docker rm -f javascore-dist
docker rmi -f btpsimple
docker rmi -f iconbridge
docker rmi -f btp/javascore
rm -rf local/artifacts local/log
rm -rf ../../../build/*
Expand All @@ -13,7 +13,7 @@ clean:
rm -rf local/artifacts

build:
make -C ../../../ dist-javascore dist-sol btpsimple-image
make -C ../../../ dist-javascore dist-sol iconbridge-image
mkdir -p ./data/bsc/node1
docker-compose build

Expand All @@ -24,49 +24,49 @@ run:
docker-compose up --remove-orphans -d

build-testnet:
make -C ../../../ dist-javascore dist-sol btpsimple-image
make -C ../../../ dist-javascore dist-sol iconbridge-image
docker-compose -f docker-compose.testnet.yml build

run-testnet:
docker-compose -f docker-compose.testnet.yml up --remove-orphans -d

solidity:
make -C ../../../ dist-sol btpsimple-image
make -C ../../../ dist-sol iconbridge-image
docker-compose up --remove-orphans -d binancesmartchain

alice_transfer_eth:
docker-compose exec btp sh /btpsimple/bin/transfer_eth.sh
docker-compose exec btp sh /iconbridge/bin/transfer_eth.sh

alice_transfer_icx:
docker-compose exec btp sh /btpsimple/bin/transfer_icx.sh
docker-compose exec btp sh /iconbridge/bin/transfer_icx.sh

alice_transfer_bnb:
docker-compose exec btp sh /btpsimple/bin/transfer_bnb.sh
docker-compose exec btp sh /iconbridge/bin/transfer_bnb.sh

bob_transfer_eth:
docker-compose exec btp sh /btpsimple/bin/transfer_eth_bsc.sh
docker-compose exec btp sh /iconbridge/bin/transfer_eth_bsc.sh

bob_transfer_bnb:
docker-compose exec btp sh /btpsimple/bin/transfer_bnb_bsc.sh
docker-compose exec btp sh /iconbridge/bin/transfer_bnb_bsc.sh

bob_transfer_icx:
docker-compose exec btp sh /btpsimple/bin/transfer_icx_bsc.sh
docker-compose exec btp sh /iconbridge/bin/transfer_icx_bsc.sh


testnet_alice_transfer_eth:
docker-compose -f docker-compose.testnet.yml exec btp_testnet sh /btpsimple/bin/transfer_eth.sh
docker-compose -f docker-compose.testnet.yml exec btp_testnet sh /iconbridge/bin/transfer_eth.sh

testnet_alice_transfer_icx:
docker-compose -f docker-compose.testnet.yml exec btp_testnet sh /btpsimple/bin/transfer_icx.sh
docker-compose -f docker-compose.testnet.yml exec btp_testnet sh /iconbridge/bin/transfer_icx.sh

testnet_alice_transfer_bnb:
docker-compose -f docker-compose.testnet.yml exec btp_testnet sh /btpsimple/bin/transfer_bnb.sh
docker-compose -f docker-compose.testnet.yml exec btp_testnet sh /iconbridge/bin/transfer_bnb.sh

testnet_bob_transfer_eth:
docker-compose -f docker-compose.testnet.yml exec btp_testnet sh /btpsimple/bin/transfer_eth_bsc.sh
docker-compose -f docker-compose.testnet.yml exec btp_testnet sh /iconbridge/bin/transfer_eth_bsc.sh

testnet_bob_transfer_bnb:
docker-compose -f docker-compose.testnet.yml exec btp_testnet sh /btpsimple/bin/transfer_bnb_bsc.sh
docker-compose -f docker-compose.testnet.yml exec btp_testnet sh /iconbridge/bin/transfer_bnb_bsc.sh

testnet_bob_transfer_icx:
docker-compose -f docker-compose.testnet.yml exec btp_testnet sh /btpsimple/bin/transfer_icx_bsc.sh
docker-compose -f docker-compose.testnet.yml exec btp_testnet sh /iconbridge/bin/transfer_icx_bsc.sh
2 changes: 1 addition & 1 deletion devnet/docker/icon-bsc/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ docker-compose rm
docker image rm icon-bsc_goloop
rm -rf work/*
#docker-compose -f docker-compose.yml -f docker-compose.provision.yml up -d --force-recreate && docker-compose stop
#docker inspect btpsimple_src -f '{{ json .State.Health.Log }}' | jq .
#docker inspect iconbridge_src -f '{{ json .State.Health.Log }}' | jq .
docker-compose build
26 changes: 13 additions & 13 deletions devnet/docker/icon-bsc/docker-compose.testnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,28 +5,28 @@ services:
build:
context: .
volumes:
- ./testnet/artifacts:/btpsimple/config
- ./testnet:/btpsimple/data
- ./testnet/keys:/btpsimple/keys
command: btpsimple --config /btpsimple/config/bmr.config.json
- ./testnet/artifacts:/iconbridge/config
- ./testnet:/iconbridge/data
- ./testnet/keys:/iconbridge/keys
command: iconbridge --config /iconbridge/config/bmr.config.json
environment:
- GOLOOPCHAIN=berlin.net.solidwallet.io
- GOLOOP_RPC_NID=0x7
- GOLOOP_RPC_CHANNEL=icon_dex
- BASE_DIR=/btpsimple/data/btp
- LOG_FILENAME=/btpsimple/data/log/btp.log
- CONFIG=/btpsimple/config/bmr.config.json
- ICON_BTP_ADDRESS=/btpsimple/config/btp.icon
- BASE_DIR=/iconbridge/data/btp
- LOG_FILENAME=/iconbridge/data/log/btp.log
- CONFIG=/iconbridge/config/bmr.config.json
- ICON_BTP_ADDRESS=/iconbridge/config/btp.icon
- ICON_ENDPOINT=https://berlin.net.solidwallet.io/api/v3/icon_dex
- ICON_KEY_STORE=/btpsimple/config/berlin.net.solidwallet.io.keystore.json
- ICON_SECRET=/btpsimple/config/berlin.net.solidwallet.io.keysecret
- ICON_KEY_STORE=/iconbridge/config/berlin.net.solidwallet.io.keystore.json
- ICON_SECRET=/iconbridge/config/berlin.net.solidwallet.io.keysecret
- BSC_ENDPOINT=https://nd-417-046-686.p2pify.com/cdb13d717192e3eeefa4535075260dd3
- BSC_KEY_STORE=/btpsimple/config/bsc.ks.json
- BSC_SECRET=/btpsimple/config/bsc.secret
- BSC_KEY_STORE=/iconbridge/config/bsc.ks.json
- BSC_SECRET=/iconbridge/config/bsc.secret

# - binance_smart_chain
healthcheck:
test: [ "CMD-SHELL", "test -f /btpsimple/config/provision" ]
test: [ "CMD-SHELL", "test -f /iconbridge/config/provision" ]
interval: 5s
timeout: 5s
retries: 300
26 changes: 13 additions & 13 deletions devnet/docker/icon-bsc/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ services:
build:
context: ../goloop
args:
BTPSIMPLE_VERSION: latest
ICONBRIDGE_VERSION: latest
GOLOOP_IMAGE: iconloop/goloop-icon:v0.9.7
ports:
- "9080:9080"
Expand All @@ -30,29 +30,29 @@ services:
build:
context: .
volumes:
- ./local/artifacts:/btpsimple/config
- ./local:/btpsimple/data
- ./local/keys:/btpsimple/keys
command: btpsimple --config /btpsimple/config/bmr.config.json
- ./local/artifacts:/iconbridge/config
- ./local:/iconbridge/data
- ./local/keys:/iconbridge/keys
command: iconbridge --config /iconbridge/config/bmr.config.json
depends_on:
- goloop
- binancesmartchain
environment:
- GOLOOPCHAIN=goloop:9080
- GOLOOP_RPC_CHANNEL=icon
- BASE_DIR=/btpsimple/data/btp
- LOG_FILENAME=/btpsimple/data/log/btp.log
- CONFIG=/btpsimple/config/bmr.config.json
- BASE_DIR=/iconbridge/data/btp
- LOG_FILENAME=/iconbridge/data/log/btp.log
- CONFIG=/iconbridge/config/bmr.config.json
- ICON_ENDPOINT=http://goloop:9080/api/v3/icon
- ICON_KEY_STORE=/btpsimple/config/goloop.keystore.json
- ICON_SECRET=/btpsimple/config/goloop.keysecret
- ICON_KEY_STORE=/iconbridge/config/goloop.keystore.json
- ICON_SECRET=/iconbridge/config/goloop.keysecret
- BSC_ENDPOINT=http://binancesmartchain:8545
- BSC_KEY_STORE=/btpsimple/config/bsc.ks.json
- BSC_SECRET=/btpsimple/config/bsc.secret
- BSC_KEY_STORE=/iconbridge/config/bsc.ks.json
- BSC_SECRET=/iconbridge/config/bsc.secret

# - binance_smart_chain
healthcheck:
test: ["CMD-SHELL", "test -f /btpsimple/config/provision"]
test: ["CMD-SHELL", "test -f /iconbridge/config/provision"]
interval: 5s
timeout: 5s
retries: 300
48 changes: 24 additions & 24 deletions devnet/docker/icon-bsc/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,40 +3,40 @@ set -e

source provision.sh

if [ "$BTPSIMPLE_OFFSET" != "" ] && [ -f "$BTPSIMPLE_OFFSET" ]; then
export BTPSIMPLE_OFFSET=$(cat ${BTPSIMPLE_OFFSET})
if [ "$ICONBRIDGE_OFFSET" != "" ] && [ -f "$ICONBRIDGE_OFFSET" ]; then
export ICONBRIDGE_OFFSET=$(cat ${ICONBRIDGE_OFFSET})
fi

if [ "$BTPSIMPLE_CONFIG" != "" ] && [ ! -f "$BTPSIMPLE_CONFIG" ]; then
echo "Setup configuration $BTPSIMPLE_CONFIG"
UNSET="BTPSIMPLE_CONFIG"
CMD="btpsimple save $BTPSIMPLE_CONFIG"
if [ "$BTPSIMPLE_KEY_SECRET" != "" ] && [ ! -f "$BTPSIMPLE_KEY_SECRET" ]; then
mkdir -p $(dirname $BTPSIMPLE_KEY_SECRET)
printf $(date|md5sum|head -c16) > $BTPSIMPLE_KEY_SECRET
if [ "$ICONBRIDGE_CONFIG" != "" ] && [ ! -f "$ICONBRIDGE_CONFIG" ]; then
echo "Setup configuration $ICONBRIDGE_CONFIG"
UNSET="ICONBRIDGE_CONFIG"
CMD="iconbridge save $ICONBRIDGE_CONFIG"
if [ "$ICONBRIDGE_KEY_SECRET" != "" ] && [ ! -f "$ICONBRIDGE_KEY_SECRET" ]; then
mkdir -p $(dirname $ICONBRIDGE_KEY_SECRET)
printf $(date | md5sum | head -c16) >$ICONBRIDGE_KEY_SECRET
fi
if [ "$BTPSIMPLE_KEY_STORE" != "" ] && [ ! -f "$BTPSIMPLE_KEY_STORE" ]; then
echo "Save keystore $BTPSIMPLE_CONFIG"
UNSET="$UNSET BTPSIMPLE_KEY_STORE"
CMD="$CMD --save_key_store=$BTPSIMPLE_KEY_STORE"
if [ "$ICONBRIDGE_KEY_STORE" != "" ] && [ ! -f "$ICONBRIDGE_KEY_STORE" ]; then
echo "Save keystore $ICONBRIDGE_CONFIG"
UNSET="$UNSET ICONBRIDGE_KEY_STORE"
CMD="$CMD --save_key_store=$ICONBRIDGE_KEY_STORE"
fi
if [ "$BTPSIMPLE_OFFSET" != "" ] && [ -f "$BTPSIMPLE_OFFSET" ]; then
export BTPSIMPLE_OFFSET=$(cat ${BTPSIMPLE_OFFSET})
if [ "$ICONBRIDGE_OFFSET" != "" ] && [ -f "$ICONBRIDGE_OFFSET" ]; then
export ICONBRIDGE_OFFSET=$(cat ${ICONBRIDGE_OFFSET})
fi

if [ "$BTPSIMPLE_SRC_ADDRESS" != "" ] && [ -f "$BTPSIMPLE_SRC_ADDRESS" ]; then
export BTPSIMPLE_SRC_ADDRESS=$(cat ${BTPSIMPLE_SRC_ADDRESS})
if [ "$ICONBRIDGE_SRC_ADDRESS" != "" ] && [ -f "$ICONBRIDGE_SRC_ADDRESS" ]; then
export ICONBRIDGE_SRC_ADDRESS=$(cat ${ICONBRIDGE_SRC_ADDRESS})
fi
if [ "$BTPSIMPLE_SRC_ENDPOINT" != "" ] && [ -f "$BTPSIMPLE_SRC_ENDPOINT" ]; then
export BTPSIMPLE_SRC_ENDPOINT=$(cat ${BTPSIMPLE_SRC_ENDPOINT})
if [ "$ICONBRIDGE_SRC_ENDPOINT" != "" ] && [ -f "$ICONBRIDGE_SRC_ENDPOINT" ]; then
export ICONBRIDGE_SRC_ENDPOINT=$(cat ${ICONBRIDGE_SRC_ENDPOINT})
fi
if [ "$BTPSIMPLE_DST_ADDRESS" != "" ] && [ -f "$BTPSIMPLE_DST_ADDRESS" ]; then
export BTPSIMPLE_DST_ADDRESS=$(cat ${BTPSIMPLE_DST_ADDRESS})
if [ "$ICONBRIDGE_DST_ADDRESS" != "" ] && [ -f "$ICONBRIDGE_DST_ADDRESS" ]; then
export ICONBRIDGE_DST_ADDRESS=$(cat ${ICONBRIDGE_DST_ADDRESS})
fi
if [ "$BTPSIMPLE_DST_ENDPOINT" != "" ] && [ -f "$BTPSIMPLE_DST_ENDPOINT" ]; then
export BTPSIMPLE_DST_ENDPOINT=$(cat ${BTPSIMPLE_DST_ENDPOINT})
if [ "$ICONBRIDGE_DST_ENDPOINT" != "" ] && [ -f "$ICONBRIDGE_DST_ENDPOINT" ]; then
export ICONBRIDGE_DST_ENDPOINT=$(cat ${ICONBRIDGE_DST_ENDPOINT})
fi
sh -c "unset $UNSET ; $CMD"
fi

exec "$@"
exec "$@"
Loading

0 comments on commit b1b2de7

Please sign in to comment.