-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Debug text * Update frontend contracts abi * Setup factions sepolia and fix missing args on frontend faction join * go fmt
- Loading branch information
1 parent
e887489
commit a53f327
Showing
6 changed files
with
71 additions
and
1 deletion.
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
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
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
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
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
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,59 @@ | ||
#!/bin/bash | ||
# | ||
# This script runs the integration tests. | ||
|
||
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" | ||
WORK_DIR=$SCRIPT_DIR/../../.. | ||
PROJECT_ROOT=$WORK_DIR | ||
|
||
# Load env variable from `.env` only if they're not already set | ||
if [ -z "$STARKNET_KEYSTORE" ] || [ -z "$STARKNET_ACCOUNT" ]; then | ||
source $PROJECT_ROOT/.env | ||
fi | ||
|
||
# Check if required env variables are set, if not exit | ||
if [ -z "$STARKNET_KEYSTORE" ]; then | ||
echo "Error: STARKNET_KEYSTORE is not set." | ||
exit 1 | ||
elif [ -z "$STARKNET_ACCOUNT" ]; then | ||
echo "Error: STARKNET_ACCOUNT is not set." | ||
exit 1 | ||
fi | ||
|
||
ART_PEACE_CONTRACT_ADDRESS=0x075381b84dd86e87836c257615e59cc46bb78bfae45e56d35595e4253e555e80 | ||
|
||
FACTIONS_CONFIG_FILE=$WORK_DIR/configs/factions.config.json | ||
|
||
for entry in $(cat $FACTIONS_CONFIG_FILE | jq -r '.factions.[] | @base64'); do | ||
_jq() { | ||
echo ${entry} | base64 --decode | jq -r ${1} | ||
} | ||
|
||
FACTION_ID=$(_jq '.id') | ||
FACTION_NAME=$(_jq '.name') | ||
FACTION_LEADER=$(_jq '.leader') | ||
JOINABLE=$(_jq '.joinable') | ||
ALLOCATION=$(_jq '.allocation') | ||
|
||
# Add faction onchain | ||
FACTION_NAME_HEX=0x$(echo -n $FACTION_NAME | xxd -p) | ||
FACTION_JOINABLE_HEX=1 | ||
if [ "$JOINABLE" = "false" ]; then | ||
FACTION_JOINABLE_HEX=0 | ||
fi | ||
|
||
CALLDATA="$FACTION_NAME_HEX $FACTION_LEADER $FACTION_JOINABLE_HEX $ALLOCATION" | ||
echo "starkli invoke --network sepolia --keystore $STARKNET_KEYSTORE --account $STARKNET_ACCOUNT --watch $ART_PEACE_CONTRACT_ADDRESS init_faction $CALLDATA" | ||
starkli invoke --network sepolia --keystore $STARKNET_KEYSTORE --account $STARKNET_ACCOUNT --watch $ART_PEACE_CONTRACT_ADDRESS init_faction $CALLDATA | ||
done | ||
|
||
for entry in $(cat $FACTIONS_CONFIG_FILE | jq -r '.chain_factions.[]'); do | ||
FACTION_NAME=$entry | ||
FACTION_NAME_HEX=0x$(echo -n $FACTION_NAME | xxd -p) | ||
|
||
CALLDATA="$FACTION_NAME_HEX" | ||
echo "starkli invoke --network sepolia --keystore $STARKNET_KEYSTORE --account $STARKNET_ACCOUNT --watch $ART_PEACE_CONTRACT_ADDRESS init_chain_faction $CALLDATA" | ||
starkli invoke --network sepolia --keystore $STARKNET_KEYSTORE --account $STARKNET_ACCOUNT --watch $ART_PEACE_CONTRACT_ADDRESS init_chain_faction $CALLDATA | ||
done | ||
|
||
# #TODO: rename script and make more generic |