Skip to content

Commit

Permalink
Merge pull request #193 from DecentralCardGame/development
Browse files Browse the repository at this point in the history
Development into master
  • Loading branch information
lxgr-linux authored Dec 23, 2023
2 parents 1359712 + 562799e commit 1d5cca4
Show file tree
Hide file tree
Showing 10 changed files with 125 additions and 34 deletions.
2 changes: 1 addition & 1 deletion config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ genesis:
staking:
params:
bond_denom: ubpf
chain_id: cardtestnet-6
chain_id: cardtestnet-7
validators:
- name: alice
bonded: 5000000ubpf
Expand Down
60 changes: 32 additions & 28 deletions docker-run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@

echo -e "\033[0;32mfasten your seatbelts\033[0m"
FAUCET_SECRET_KEY="0x6F1f5bd93f3D59d6eed1d5ec40E29C1821029759"
CHAIN_ID=Cardchain
USE_SNAP=true
USE_SNAP=false

if [ -z "$FAUCET_SECRET_KEY" ]
then
Expand Down Expand Up @@ -49,35 +48,40 @@ SEEDS=""
echo "peers is:" $PEERS
sed -i.bak -e "s/^seeds *=.*/seeds = \"$SEEDS\"/; s/^persistent_peers *=.*/persistent_peers = \"$PEERS\"/" $HOME/.Cardchain/config/config.toml

mapfile -t snap_rpcs < <(
jq -r '.snap_rpcs[]' peer_nodes.json
)

for i in "${snap_rpcs[@]}"; do
if curl --output /dev/null --silent --head --fail --connect-timeout 5 $i; then
echo "URL exists: $i"
SNAP_RPC=$i
break
else
echo "not reachable $i"
fi
done
if [ -z "$SNAP_RPC" ]
if [ -z $USE_SNAP ]
then
echo -e "\033[0;31mNo SNAP_RPC available\033[0m"
exit
fi

LATEST_HEIGHT=$(curl -s $SNAP_RPC/block | jq -r .result.block.header.height)
echo $LATEST_HEIGHT
BLOCK_HEIGHT=$((LATEST_HEIGHT)); \
TRUST_HASH=$(curl -s "$SNAP_RPC/block?height=$BLOCK_HEIGHT" | jq -r .result.block_id.hash)
echo -e "\033[0;36mlatest height: $LATEST_HEIGHT \nblock height: $BLOCK_HEIGHT \ntrust hash: $TRUST_HASH \033[0m"
mapfile -t snap_rpcs < <(
jq -r '.snap_rpcs[]' peer_nodes.json
)

for i in "${snap_rpcs[@]}"; do
if curl --output /dev/null --silent --head --fail --connect-timeout 5 $i; then
echo "URL exists: $i"
SNAP_RPC=$i
break
else
echo "not reachable $i"
fi
done
if [ -z "$SNAP_RPC" ]
then
echo -e "\033[0;31mNo SNAP_RPC available\033[0m"
exit
fi

LATEST_HEIGHT=$(curl -s $SNAP_RPC/block | jq -r .result.block.header.height)
echo $LATEST_HEIGHT
BLOCK_HEIGHT=$((LATEST_HEIGHT)); \
TRUST_HASH=$(curl -s "$SNAP_RPC/block?height=$BLOCK_HEIGHT" | jq -r .result.block_id.hash)
echo -e "\033[0;36mlatest height: $LATEST_HEIGHT \nblock height: $BLOCK_HEIGHT \ntrust hash: $TRUST_HASH \033[0m"

sed -i.bak -E "s|^(enable[[:space:]]+=[[:space:]]+).*$|\1true| ; \
s|^(rpc_servers[[:space:]]+=[[:space:]]+).*$|\1\"$SNAP_RPC,$SNAP_RPC\"| ; \
s|^(trust_height[[:space:]]+=[[:space:]]+).*$|\1$BLOCK_HEIGHT| ; \
s|^(trust_hash[[:space:]]+=[[:space:]]+).*$|\1\"$TRUST_HASH\"|" $HOME/.Cardchain/config/config.toml ; \

sed -i.bak -E "s|^(enable[[:space:]]+=[[:space:]]+).*$|\1true| ; \
s|^(rpc_servers[[:space:]]+=[[:space:]]+).*$|\1\"$SNAP_RPC,$SNAP_RPC\"| ; \
s|^(trust_height[[:space:]]+=[[:space:]]+).*$|\1$BLOCK_HEIGHT| ; \
s|^(trust_hash[[:space:]]+=[[:space:]]+).*$|\1\"$TRUST_HASH\"|" $HOME/.Cardchain/config/config.toml; \
fi

# config pruning
indexer="kv"
Expand Down
1 change: 1 addition & 0 deletions peer_nodes.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"https://rpc-testnet-cardchain.nodeist.net"
],
"peers": [
"202.61.225.157:26656",
"cardchain-testnet-peer.itrocket.net:31656",
"crowd.peer.stavr.tech:21206",
"rpc-testnet-cardchain.nodeist.net:26656"
Expand Down
1 change: 1 addition & 0 deletions scripts/migrate_with_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@
for user in new_dict["app_state"]["cardchain"]["users"]:
if "voteRights" in user:
del user["voteRights"]
user["boosterPacks"] = [pack for pack in user["boosterPacks"] if pack["setId"] not in ["0", "2"]] # turn of later

with open(file_path_new, "w") as file:
json.dump(new_dict, file, indent=2)
4 changes: 2 additions & 2 deletions scripts/paramchange/paramchange.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"title": "Param change setSize: 140",
"title": "Param change setSize: 135",
"description": "We want to change the set size",
"changes": [
{
"subspace": "cardchain",
"key": "SetSize",
"value": "120"
"value": "135"
}
],
"deposit": "10000000ubpf"
Expand Down
4 changes: 3 additions & 1 deletion scripts/paramchange/submitproposal.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,6 @@ parent_path=$( cd "$(dirname "${BASH_SOURCE[0]}")" ; pwd -P )

cd "$parent_path"

Cardchaind tx gov submit-legacy-proposal param-change paramchange.json --from jannik
Cardchaind tx gov submit-legacy-proposal param-change paramchange.json --from jannik

Cardchaind q gov proposals
29 changes: 28 additions & 1 deletion scripts/sets/add-cards.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ if [ $# -lt 1 ]; then
exit 2
fi

#technology
Cardchaind tx cardchain add-card-to-set $1 71 --from jannik
Cardchaind tx cardchain add-card-to-set $1 44 --from jannik
Cardchaind tx cardchain add-card-to-set $1 142 --from jannik
Expand Down Expand Up @@ -35,9 +36,10 @@ Cardchaind tx cardchain add-card-to-set $1 139 --from jannik
Cardchaind tx cardchain add-card-to-set $1 253 --from jannik
Cardchaind tx cardchain add-card-to-set $1 381 --from jannik
Cardchaind tx cardchain add-card-to-set $1 412 --from jannik
#nature
Cardchaind tx cardchain add-card-to-set $1 407 --from jannik
Cardchaind tx cardchain add-card-to-set $1 73 --from jannik
Cardchaind tx cardchain add-card-to-set $1 411 --from jannik SHIT
Cardchaind tx cardchain add-card-to-set $1 411 --from jannik
Cardchaind tx cardchain add-card-to-set $1 154 --from jannik
Cardchaind tx cardchain add-card-to-set $1 147 --from jannik
Cardchaind tx cardchain add-card-to-set $1 156 --from jannik
Expand Down Expand Up @@ -65,6 +67,7 @@ Cardchaind tx cardchain add-card-to-set $1 397 --from jannik
Cardchaind tx cardchain add-card-to-set $1 159 --from jannik
Cardchaind tx cardchain add-card-to-set $1 410 --from jannik
Cardchaind tx cardchain add-card-to-set $1 158 --from jannik
#mysticism
Cardchaind tx cardchain add-card-to-set $1 47 --from jannik
Cardchaind tx cardchain add-card-to-set $1 36 --from jannik
Cardchaind tx cardchain add-card-to-set $1 65 --from jannik
Expand Down Expand Up @@ -95,6 +98,7 @@ Cardchaind tx cardchain add-card-to-set $1 24 --from jannik
Cardchaind tx cardchain add-card-to-set $1 102 --from jannik
Cardchaind tx cardchain add-card-to-set $1 104 --from jannik
Cardchaind tx cardchain add-card-to-set $1 224 --from jannik
#culture
Cardchaind tx cardchain add-card-to-set $1 255 --from jannik
Cardchaind tx cardchain add-card-to-set $1 41 --from jannik
Cardchaind tx cardchain add-card-to-set $1 8 --from jannik
Expand Down Expand Up @@ -124,3 +128,26 @@ Cardchaind tx cardchain add-card-to-set $1 141 --from jannik
Cardchaind tx cardchain add-card-to-set $1 257 --from jannik
Cardchaind tx cardchain add-card-to-set $1 16 --from jannik
Cardchaind tx cardchain add-card-to-set $1 138 --from jannik
# multi class
Cardchaind tx cardchain add-card-to-set $1 562 --from jannik
Cardchaind tx cardchain add-card-to-set $1 189 --from jannik
Cardchaind tx cardchain add-card-to-set $1 152 --from jannik
Cardchaind tx cardchain add-card-to-set $1 126 --from jannik
Cardchaind tx cardchain add-card-to-set $1 514 --from jannik
Cardchaind tx cardchain add-card-to-set $1 379 --from jannik
Cardchaind tx cardchain add-card-to-set $1 238 --from jannik
Cardchaind tx cardchain add-card-to-set $1 128 --from jannik
Cardchaind tx cardchain add-card-to-set $1 118 --from jannik
Cardchaind tx cardchain add-card-to-set $1 13 --from jannik
Cardchaind tx cardchain add-card-to-set $1 132 --from jannik
Cardchaind tx cardchain add-card-to-set $1 87 --from jannik
Cardchaind tx cardchain add-card-to-set $1 29 --from jannik
Cardchaind tx cardchain add-card-to-set $1 1 --from jannik
Cardchaind tx cardchain add-card-to-set $1 397 --from jannik
Cardchaind tx cardchain add-card-to-set $1 131 --from jannik
Cardchaind tx cardchain add-card-to-set $1 129 --from jannik
Cardchaind tx cardchain add-card-to-set $1 120 --from jannik
Cardchaind tx cardchain add-card-to-set $1 507 --from jannik
Cardchaind tx cardchain add-card-to-set $1 215 --from jannik
Cardchaind tx cardchain add-card-to-set $1 124 --from jannik
Cardchaind tx cardchain add-card-to-set $1 115 --from jannik
29 changes: 28 additions & 1 deletion scripts/sets/card-rarity.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ if [ $# -lt 1 ]; then
exit 2
fi

#technology
Cardchaind tx cardchain set-card-rarity 71 $1 common --from jannik
Cardchaind tx cardchain set-card-rarity 44 $1 common --from jannik
Cardchaind tx cardchain set-card-rarity 142 $1 uncommon --from jannik
Expand Down Expand Up @@ -35,6 +36,7 @@ Cardchaind tx cardchain set-card-rarity 139 $1 uncommon --from jannik
Cardchaind tx cardchain set-card-rarity 253 $1 uncommon --from jannik
Cardchaind tx cardchain set-card-rarity 381 $1 uncommon --from jannik
Cardchaind tx cardchain set-card-rarity 412 $1 rare --from jannik
#nature
Cardchaind tx cardchain set-card-rarity 407 $1 uncommon --from jannik
Cardchaind tx cardchain set-card-rarity 73 $1 common --from jannik
Cardchaind tx cardchain set-card-rarity 411 $1 common --from jannik SHIT
Expand Down Expand Up @@ -65,6 +67,7 @@ Cardchaind tx cardchain set-card-rarity 397 $1 rare --from jannik
Cardchaind tx cardchain set-card-rarity 159 $1 rare --from jannik
Cardchaind tx cardchain set-card-rarity 410 $1 uncommon --from jannik
Cardchaind tx cardchain set-card-rarity 158 $1 uncommon --from jannik
#mysticism
Cardchaind tx cardchain set-card-rarity 47 $1 common --from jannik
Cardchaind tx cardchain set-card-rarity 36 $1 uncommon --from jannik
Cardchaind tx cardchain set-card-rarity 65 $1 uncommon --from jannik
Expand Down Expand Up @@ -95,6 +98,7 @@ Cardchaind tx cardchain set-card-rarity 24 $1 uncommon --from jannik
Cardchaind tx cardchain set-card-rarity 102 $1 uncommon --from jannik
Cardchaind tx cardchain set-card-rarity 104 $1 uncommon --from jannik
Cardchaind tx cardchain set-card-rarity 224 $1 rare --from jannik
#culture
Cardchaind tx cardchain set-card-rarity 255 $1 uncommon --from jannik
Cardchaind tx cardchain set-card-rarity 41 $1 common --from jannik
Cardchaind tx cardchain set-card-rarity 8 $1 common --from jannik
Expand Down Expand Up @@ -123,4 +127,27 @@ Cardchaind tx cardchain set-card-rarity 20 $1 common --from jannik
Cardchaind tx cardchain set-card-rarity 141 $1 rare --from jannik
Cardchaind tx cardchain set-card-rarity 257 $1 common --from jannik
Cardchaind tx cardchain set-card-rarity 16 $1 rare --from jannik
Cardchaind tx cardchain set-card-rarity 138 $1 uncommon --from jannik
Cardchaind tx cardchain set-card-rarity 138 $1 uncommon --from jannik
# multi class
Cardchaind tx cardchain set-card-rarity 562 $1 common --from jannik
Cardchaind tx cardchain set-card-rarity 189 $1 common --from jannik
Cardchaind tx cardchain set-card-rarity 152 $1 common --from jannik
Cardchaind tx cardchain set-card-rarity 126 $1 common --from jannik
Cardchaind tx cardchain set-card-rarity 514 $1 common --from jannik
Cardchaind tx cardchain set-card-rarity 379 $1 common --from jannik
Cardchaind tx cardchain set-card-rarity 238 $1 common --from jannik
Cardchaind tx cardchain set-card-rarity 128 $1 uncommon --from jannik
Cardchaind tx cardchain set-card-rarity 118 $1 uncommon --from jannik
Cardchaind tx cardchain set-card-rarity 13 $1 uncommon --from jannik
Cardchaind tx cardchain set-card-rarity 132 $1 uncommon --from jannik
Cardchaind tx cardchain set-card-rarity 87 $1 uncommon --from jannik
Cardchaind tx cardchain set-card-rarity 29 $1 uncommon --from jannik
Cardchaind tx cardchain set-card-rarity 1 $1 uncommon --from jannik
Cardchaind tx cardchain set-card-rarity 397 $1 rare --from jannik
Cardchaind tx cardchain set-card-rarity 131 $1 rare --from jannik
Cardchaind tx cardchain set-card-rarity 129 $1 rare --from jannik
Cardchaind tx cardchain set-card-rarity 120 $1 rare --from jannik
Cardchaind tx cardchain set-card-rarity 507 $1 rare --from jannik
Cardchaind tx cardchain set-card-rarity 215 $1 rare --from jannik
Cardchaind tx cardchain set-card-rarity 124 $1 rare --from jannik
Cardchaind tx cardchain set-card-rarity 115 $1 rare --from jannik
27 changes: 27 additions & 0 deletions scripts/sets/howto.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
1. voting power to jannik -> delegate to validator
Cardchaind q staking validators
Cardchaind tx staking delegate ccvaloper1c2htcglks224ua32qd4p95p4ydumd0zaq9y3sj 5000000ubpf --from jannik

2. set size adjust? => paramchange folder

3.
bash create-set.sh
Cardchaind query cardchain q-sets design "[]" "[]" ""

4.
yes | bash add-cards.sh 1

5.
yes | bash card-rarity.sh 1

6.
bash story.sh

7.
bash add-artwork.sh

8.
bash finalize-set.sh

9.
bash vote.sh
2 changes: 2 additions & 0 deletions x/cardchain/keeper/msg_server_open_booster_pack.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ import (
func (k msgServer) OpenBoosterPack(goCtx context.Context, msg *types.MsgOpenBoosterPack) (*types.MsgOpenBoosterPackResponse, error) {
ctx := sdk.UnwrapSDKContext(goCtx)

rand.Seed(ctx.BlockHeight())

creator, err := k.GetUserFromString(ctx, msg.Creator)
if err != nil {
return nil, sdkerrors.Wrap(types.ErrUserDoesNotExist, err.Error())
Expand Down

0 comments on commit 1d5cca4

Please sign in to comment.