generated from kurtosis-tech/package-template-repo
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: Ckip 56 add e2e demo script to dive repo (#15)
* chore : Add Readme for test * chore: Add ReadMe for using script * test : Add e2e Demo Script --------- Co-authored-by: hemz10 <sph2740@example.com>
- Loading branch information
Showing
123 changed files
with
19,695 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
PWD = $(abspath ./) | ||
|
||
JAVASCORE_PATH = $(PWD)/../javascore | ||
GRADLE = ./gradlew | ||
|
||
HARDHAT = npx hardhat | ||
TS_NODE = npx ts-node | ||
NETWORK = --network localhost | ||
SOLIDITY_CONTRACTS = ./solidity/contracts | ||
|
||
.DEFAULT_GOAL := all | ||
all: | ||
@echo $(PWD) | ||
|
||
.PHONY: build clean deploy | ||
|
||
clean-java: | ||
(cd $(JAVASCORE_PATH); $(GRADLE) clean) | ||
|
||
clean-solidity: | ||
$(HARDHAT) clean | ||
$(RM) -rf \ | ||
$(SOLIDITY_CONTRACTS)/bmc \ | ||
$(SOLIDITY_CONTRACTS)/bmv* \ | ||
$(SOLIDITY_CONTRACTS)/xcall | ||
|
||
clean: clean-java clean-solidity | ||
|
||
copy-src: | ||
@ echo ">>> Copy BMC/BMV/xCall solidity codes" ; \ | ||
$(TS_NODE) scripts/setup/copy_src.ts | ||
|
||
compile: copy-src | ||
@ echo ">>> Compile solidity codes" ; \ | ||
$(HARDHAT) compile | ||
|
||
build-bmc-java: | ||
@ echo ">>> Build BMC javascore" ; \ | ||
cd $(JAVASCORE_PATH) ; \ | ||
$(GRADLE) bmc:optimizedJar | ||
|
||
build-bmv-java: | ||
@ echo ">>> Build BMV javascore" ; \ | ||
cd $(JAVASCORE_PATH) ; \ | ||
$(GRADLE) bmv:bridge:optimizedJar \ | ||
bmv:btpblock:optimizedJar | ||
|
||
build-xcall-java: | ||
@ echo ">>> Build xCall javascore" ; \ | ||
cd $(JAVASCORE_PATH) ; \ | ||
$(GRADLE) xcall:optimizedJar | ||
|
||
build-dapp-java: | ||
@ echo ">>> Build DApp sample javascore" ; \ | ||
cd $(JAVASCORE_PATH) ; \ | ||
$(GRADLE) dapp-sample:optimizedJar | ||
|
||
build-all: compile build-bmc-java build-bmv-java build-xcall-java build-dapp-java | ||
|
||
deploy-bmc: | ||
@ echo ">>> Deploy BMC contracts" ; \ | ||
JAVASCORE_PATH=$(JAVASCORE_PATH) \ | ||
$(HARDHAT) $(NETWORK) run scripts/setup/deploy_bmc.ts | ||
|
||
deploy-bmv: | ||
@ echo ">>> Deploy BMV contracts" ; \ | ||
JAVASCORE_PATH=$(JAVASCORE_PATH) \ | ||
$(HARDHAT) $(NETWORK) run scripts/setup/deploy_bmv.ts | ||
|
||
deploy-xcall: | ||
@ echo ">>> Deploy xCall contracts" ; \ | ||
JAVASCORE_PATH=$(JAVASCORE_PATH) \ | ||
$(HARDHAT) $(NETWORK) run scripts/setup/deploy_xcall.ts | ||
|
||
deploy-dapp: | ||
@ echo ">>> Deploy DApp contracts" ; \ | ||
JAVASCORE_PATH=$(JAVASCORE_PATH) \ | ||
$(HARDHAT) $(NETWORK) run scripts/setup/deploy_dapp.ts | ||
|
||
deploy-all: deploy-bmc deploy-bmv deploy-xcall deploy-dapp | ||
|
||
start-nodes: | ||
@ echo ">>> Start nodes" ; \ | ||
cd docker; \ | ||
docker compose up -d | ||
|
||
stop-nodes: | ||
@ echo ">>> Stop nodes" ; \ | ||
cd docker; \ | ||
docker compose down | ||
|
||
setup-node: | ||
@ echo ">>> Setup ICON node" ; \ | ||
$(TS_NODE) scripts/setup/setup_node.ts | ||
|
||
run-demo: | ||
@ echo ">>> Run demo_dapp.ts " ; \ | ||
$(HARDHAT) $(NETWORK) run scripts/demo_dapp.ts |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# End-to-End Testing Demo | ||
|
||
This is a demo script from btp2 that demonstrates simple e2e testing scenarios. | ||
|
||
## Prerequisites | ||
|
||
To run the demo, the following software needs to be installed. | ||
|
||
* Node.js 18 (LTS) \[[download](https://nodejs.org/en/download/)\] | ||
* Docker compose (V2) \[[download](https://docs.docker.com/compose/install/)\] | ||
* OpenJDK 11 or above \[[download](https://adoptium.net/)\] | ||
* jq \[[download](https://github.com/stedolan/jq)\] | ||
* go \[[download](https://go.dev/doc/install)\] | ||
|
||
## Steps to run the script | ||
* Step 1: Run the DIVE package that spins ups two chains for sending message using BTP | ||
* Step 2: After you get the contract address from the output, update xCall and dApp address in deployment.json file | ||
* Step 3: Update network and endpoint in the chain_config.json, deployments.json and hardhat.config.ts files | ||
* Step 4: now run the command 'make run-demo' to execute all scenarios. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
{ | ||
"chains": { | ||
"icon0": { | ||
"network": "0x3.icon", | ||
"endpoint": "http://localhost:9080/api/v3/icon_dex", | ||
"keystore": "./docker/icon/config/keystore.json", | ||
"keysecret": "./docker/icon/config/keysecret" | ||
}, | ||
"icon1": { | ||
"network": "0x101.icon", | ||
"endpoint": "http://localhost:9180/api/v3/icon_dex", | ||
"keystore": "./docker/icon/config/keystore.json", | ||
"keysecret": "./docker/icon/config/keysecret" | ||
}, | ||
"hardhat": { | ||
"network": "0x539.hardhat", | ||
"endpoint": "http://localhost:8545", | ||
"keystore": "./docker/hardhat/keystore0.json", | ||
"keypass": "hardhat" | ||
} | ||
}, | ||
"link": { | ||
"src": "icon0", | ||
"dst": "hardhat" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
{ | ||
"icon0": { | ||
"network": "0x3.icon", | ||
"contracts": { | ||
"bmc": "cxd4025033fff4ca78396336bcdd5d7db2472ccd93", | ||
"bmv": "cxd3d50ecc9fc0c5ca772cadb8bdea065db9c2ef55", | ||
"xcall": "cx1b316ad66f3e9fcfdb9e059eba083403cc85e50f", | ||
"dapp": "cx6d462648fda7016e179330e686555cd14900f0cd" | ||
}, | ||
"networkTypeId": "0x1", | ||
"networkId": "0x1", | ||
"blockNum": 1725 | ||
}, | ||
"hardhat": { | ||
"network": "0x301824.eth", | ||
"contracts": { | ||
"bmcm": "0x8A791620dd6260079BF849Dc5567aDC3F2FdC318", | ||
"bmcs": "0xB7f8BC63BbcaD18155201308C8f3540b07f84F5e", | ||
"bmc": "0x0DCd1Bf9A1b36cE34237eEaFef220932846BCD82", | ||
"bmv": "0x68B1D87F95878fE05B998F19b66F4baba5De1aed", | ||
"xcall": "0x5911A6541729C227fAda7D5187ee7518B47fB237", | ||
"dapp": "0x9bE03fF3E1888A216f9e48c68B587A89c5b94CD6" | ||
}, | ||
"blockNum": 890 | ||
}, | ||
"link": { "src": "icon0", "dst": "hardhat" } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
version: "3" | ||
services: | ||
hardhat: | ||
build: ./hardhat | ||
ports: | ||
- 8545:8545 | ||
volumes: | ||
- ./hardhat/logs:/app/logs | ||
command: /bin/sh -c "/app/node_modules/.bin/hardhat --config hardhat.config.js node 2>&1 | tee /app/logs/hardhat.log" | ||
icon-node: | ||
image: iconloop/goloop-icon:v1.3.7 | ||
container_name: "icon-node" | ||
environment: | ||
GOLOOP_LOG_LEVEL: "trace" | ||
GOLOOP_RPC_ADDR: ":9080" | ||
GOLOOP_P2P_LISTEN: ":7080" | ||
ICON_CONFIG: "/goloop/config/icon_config.json" | ||
cap_add: | ||
- SYS_TIME | ||
ports: | ||
- 9080:9080 | ||
- 7080:7080 | ||
volumes: | ||
- ./icon/config:/goloop/config | ||
- ./icon/data:/goloop/data | ||
- ./icon/logs:/goloop/logs | ||
command: /bin/sh -c /goloop/config/start.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
FROM node:lts-alpine | ||
|
||
RUN mkdir -p /app | ||
WORKDIR /app | ||
|
||
RUN npm install --save-dev hardhat | ||
ADD hardhat.config.js /app |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
/** @type import('hardhat/config').HardhatUserConfig */ | ||
module.exports = { | ||
solidity: "0.8.17", | ||
networks: { | ||
hardhat: { | ||
mining: { | ||
auto: false, | ||
interval: 2000 | ||
} | ||
} | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{"address":"f39fd6e51aad88f6f4ce6ab8827279cfffb92266","id":"5e20b25c-a655-49b6-a604-567cfc71d92e","version":3,"crypto":{"cipher":"aes-128-ctr","cipherparams":{"iv":"248d6c71c1b9f41f82c4a9cc68c513a3"},"ciphertext":"648ec06559a1b889778ea82c3b540373b1bf2d033090f81344c66b9e4b5a2d3c","kdf":"scrypt","kdfparams":{"salt":"02f971a5957e9d403770c9409eb273c2dd094cfae8848cc95e6daf529af8599e","n":131072,"dklen":32,"p":1,"r":8},"mac":"4f6b419340042835dd8c0b44ebf68a9f6c4de0cacd7f89b86d8198c3f84e4198"}} |
Oops, something went wrong.