Skip to content

Commit

Permalink
🚀 Deploy verifier to testnet (#53)
Browse files Browse the repository at this point in the history
  • Loading branch information
doitian authored Feb 18, 2024
1 parent 943118b commit 4ed7ef7
Show file tree
Hide file tree
Showing 6 changed files with 55 additions and 3 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
/migrations/joyid
/migrations/omnilock
/migrations/dao-action-verifier
/migrations/*/deployment.json

# Contract
/target
Expand Down
2 changes: 1 addition & 1 deletion bin/deploy-to-dev-chain.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ set -e
set -u
[ -n "${DEBUG:-}" ] && set -x || true

if ! [ -f build/release/joyid ]; then
if ! [ -e build/release/joyid ]; then
echo "Expect the contract files in build/release" >&2
echo "Run bin/download-contracts.sh to download them from the testnet" >&2
exit 1
Expand Down
36 changes: 36 additions & 0 deletions bin/deploy-to-testnet.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#!/usr/bin/env bash

set -e
set -u
[ -n "${DEBUG:-}" ] && set -x || true

if ! [ -e build/release/dao-action-verifier ]; then
echo "Expect the contract files in build/release" >&2
echo "Run \`make contract\` to build them" >&2
exit 1
fi

export API_URL="https://testnet.ckbapp.dev/"
export CKB_CHAIN="testnet"

function deploy() {
local DEPLOY_NAME="$1"
local MIGRATION_DIR="migrations/$DEPLOY_NAME-$CKB_CHAIN"
local INFO_FILE="$MIGRATION_DIR/deployment.json"
local CONFIG_FILE="migrations/templates/$DEPLOY_NAME.toml"

mkdir -p "$MIGRATION_DIR"

if ! [ -f "$INFO_FILE" ]; then
ckb-cli deploy gen-txs --from-address ckt1qzda0cr08m85hc8jlnfp3zer7xulejywt49kt2rr0vthywaa50xwsq0yv0tufjegg4an5tmnt5we92t3kr66w5gs8833u \
--fee-rate 1000 --deployment-config "$CONFIG_FILE" --info-file "$INFO_FILE" --migration-dir "$MIGRATION_DIR"
fi

ckb-cli deploy sign-txs --add-signatures --info-file "$INFO_FILE" --from-account 0xe463d7c4cb28457b3a2f735d1d92a971b0f5a751 --output-format json | sed -n 's/: \("[^"]*"\)/: [\1]/p'

ckb-cli deploy apply-txs --info-file "$INFO_FILE" --migration-dir "$MIGRATION_DIR"

rm -f "$INFO_FILE"
}

deploy dao-action-verifier
2 changes: 2 additions & 0 deletions bin/download-contracts.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,5 @@ download joyid_dep3 0x95ecf9b41701b45d431657a67bbfa3f07ef7ceb53bf87097f3674e1a4a
download joyid_dep5 0x8b3255491f3c4dcc1cfca33d5c6bcaec5409efe4bbda243900f9580c47e0242e 1

download omnilock 0x3d4296df1bd2cc2bd3f483f61ab7ebeac462a2f336f2b944168fe6ba5d81c014 0

download dao-action-verifier 0x4a16eb60719c2c091eafb5a30c9e9b722bd287531ba189bd7de46bce872c6499 0
13 changes: 13 additions & 0 deletions migrations/dao-action-verifier-testnet/2024-02-18-082928.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"cell_recipes": [
{
"name": "dao-action-verifier",
"tx_hash": "0x4a16eb60719c2c091eafb5a30c9e9b722bd287531ba189bd7de46bce872c6499",
"index": 0,
"occupied_capacity": 15686200000000,
"data_hash": "0x019de71c1a480e4acf472d07c9011a2437eda719b10716c8dfa7725b8a6f2958",
"type_id": "0xf9788b3ae2d4a328281281ae401c0b38401b468d01e1d9316edacc6367aa7176"
}
],
"dep_group_recipes": []
}
4 changes: 2 additions & 2 deletions src/lib/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ const CKB_CHAINS_CONFIGS = {

DAO_ACTION_VERIFIER: {
CODE_HASH:
"0xbdca5b74e5d0c913fed19d8482a99af1ef8a639541438b2e00189f5e18907ef9",
"0xf9788b3ae2d4a328281281ae401c0b38401b468d01e1d9316edacc6367aa7176",
HASH_TYPE: "type",
TX_HASH:
"0x9157bcc278176ba9e823a50d72631be9e9b964e7a5ca11db2782c059c4c788ad",
"0x4a16eb60719c2c091eafb5a30c9e9b722bd287531ba189bd7de46bce872c6499",
INDEX: "0x0",
DEP_TYPE: "code",
},
Expand Down

0 comments on commit 4ed7ef7

Please sign in to comment.