Skip to content

Commit

Permalink
chore: complete ibc-packet-trigger.yaml CI script
Browse files Browse the repository at this point in the history
  • Loading branch information
liyukun committed Oct 30, 2023
1 parent 6d9915b commit e0e9fde
Show file tree
Hide file tree
Showing 2 changed files with 109 additions and 0 deletions.
83 changes: 83 additions & 0 deletions .github/workflows/ibc-packet-trigger.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
name: IBC Communication of Packet between Axon and CKB

on:
workflow_dispatch:
schedule:
- cron: '0 */2 * * *' # runs every 2 hour

jobs:
schedule-run-packet-send:
runs-on: ubuntu-latest
env:
# for forcerelay-ckb-sdk
FORCERELAY_CKB_SDK_COMMIT: f02969f920fa48234959fd25c771992a85619eb6
AXON_RECEIVER: f39fd6e51aad88f6f4ce6ab8827279cfffb92266
SUDT_AMOUNT: 1000
SDK_WORKSPACE: ${{ github.workspace }}/forcerelay-ckb-sdk
SDK_CONFIG: ${{ github.workspace }}/e2e/schedule/sdk.config.toml
# for ibc-solidity-contract
AXON_HTTP_RPC_URL: https://rpc-alphanet-axon.ckbapp.dev
IBC_SOLIDITY_CONTRACT_COMMIT: e0d1f4bf20c40aad721bff5838d8a3fa80c94585
CONTRACT_WORKSPACE: ${{ github.workspace }}/ibc-solidity-contract
RECEIVER: 0xc219351b150b900e50a7039f1e448b844110927e
TRANSFER_CONTRACT_ADDRESS: 0x9E545E3C0baAB3E08CdfD552C960A1050f373042
CHANNEL: channel-8
DENOM: f2a14f50a56b9aab8e960cb1b2c7f1152d7523e6cacb45b1ab2a94acb83e0233
AMOUNT: 1000
# 1. firstly, run ibc-solidity-contract script to send SendPacket to Axon and then, trigger RecvPacket process via forcerleay-ckb-sdk
# 2. secondly, directly run forcerelay-ckb-sdk to send SendPacket to CKB, and then, it'll automatically listen AckPacket
steps:
- name: Prepare start-time for ibc-solidity-contract
uses: actions/github-script@v6
id: solidity-start-time
with:
script: return Date.now()
result-encoding: string

- name: Set Node.js 16.x
uses: actions/setup-node@v3
with:
node-version: 16.x

- name: Install yarn
run: npm install --global yarn

- name: Prepare IBC contracts
run: git clone --recursive https://github.com/synapseweb3/ibc-solidity-contract.git $CONTRACT_WORKSPACE && cd $CONTRACT_WORKSPACE && git checkout $IBC_SOLIDITY_CONTRACT_COMMIT

- name: Print schedule start-time of ibc-solidity-contract
run: echo "${{ steps.solidity-start-time.outputs.result }}"

- name: 1. Trigger SendPacket event on Axon (ERC20)
run: yarn send

- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true

- name: Download forcerelay-ckb-sdk
run: git clone --recursive https://github.com/synapseweb3/forcerelay-ckb-sdk.git $SDK_WORKSPACE && cd $SDK_WORKSPACE && git checkout $FORCERELAY_CKB_SDK_COMMIT

- name: Build forcerelay-ckb-sdk example (sudt-transfer)
uses: actions-rs/cargo@v1
with:
command: build
args: --example sudt-transfer --manifest-path ${{ env.SDK_WORKSPACE }}/Cargo.toml

- name: 2. Listen RecvPacket event on CKB
run: $SDK_WORKSPACE/target/debug/example/sudt-transfer --config $SDK_CONFIG recv

- name: Prepare start-time for ibc-solidity-contract
uses: actions/github-script@v6
id: sdk-start-time
with:
script: return Date.now()
result-encoding: string

- name: Print schedule start-time of forcerelay-ckb-sdk
run: echo "${{ steps.sdk-start-time.outputs.result }}"

- name: 3. Trigger SendPacket on CKB (sUDT)
run: $SDK_WORKSPACE/target/debug/example/sudt-transfer --config $SDK_CONFIG send --receiver &AXON_RECEIVER --amount $SUDT_AMOUNT --sudt yukun_li
26 changes: 26 additions & 0 deletions e2e/schedule/sdk.config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
channel_contract_type_id_args = "0x4d63d2d59c9f8e2b117cde09bb3d705b82e0e21216a3cc54967e715bf19a25b8"
packet_contract_type_id_args = "0x7a06b2df4bc422cfe4702d96dca655397b4b818f04a5ef1426a6591997540fdf"
channel_id = 0
confirmations = 3

ckb_rpc_url = "https://testnet.ckbapp.dev/"

[user_lock_script]
code_hash = "0x12b7f23d284e3221fe0730ca5753c28f9302c7368d83101637684c424b242a95"
hash_type = "type"
args = "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"

[axon_metadata_type_script]
code_hash = "0x00000000000000000000000000000000000000000000000000545950455f4944"
hash_type = "type"
args = "0xb2cb0aafcf2bcf4095930621a7f82f411adec578fe83c4f15e32b8230aa3ec28"

[sudt_transfer_contract_type_script]
code_hash = "0x00000000000000000000000000000000000000000000000000545950455f4944"
hash_type = "type"
args = "0x9f3538c666de488c38a246e4c6e1f95a04d4dd250b7d5b6a26092b6f330e7215"

[sudt.yukun_li]
code_hash = "0xc5e5dcf215925f7ef4dfaf5f4b4f105bc321c02776d6e7d52a1db3fcd9d011a4"
hash_type = "type"
args = "0xc219351b150b900e50a7039f1e448b844110927e5fd9bd30425806cb8ddff1fd"

0 comments on commit e0e9fde

Please sign in to comment.