-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* fixes failing tests in game entropy library * updates readme to be consistent with latest contract * updates repo to use starkli instead of legacy starknet * adds script to automate starkli account setup * adds script to automate contract deployment * adds DockerFile
- Loading branch information
Showing
8 changed files
with
140 additions
and
105 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,21 @@ | ||
# Use Debian Bookworm as a base image | ||
FROM debian:bookworm-slim | ||
|
||
# Avoid warnings by switching to noninteractive | ||
ENV DEBIAN_FRONTEND=noninteractive | ||
|
||
# Update the package list and install minimal utilities | ||
RUN apt-get update \ | ||
&& apt-get install -y --no-install-recommends \ | ||
curl \ | ||
git \ | ||
ca-certificates \ | ||
unzip \ | ||
&& apt-get clean \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
RUN curl --proto '=https' --tlsv1.2 -sSf https://docs.swmansion.com/scarb/install.sh | bash -s -- -v 2.5.4 | ||
RUN curl https://get.starkli.sh | bash | ||
RUN /root/.starkli/bin/starkliup | ||
# Specify the command to run on container start | ||
CMD ["bash"] |
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 |
---|---|---|
@@ -1,10 +1,12 @@ | ||
#!/bin/bash | ||
|
||
export STARKNET_NETWORK=alpha-goerli | ||
export STARKNET_WALLET=starkware.starknet.wallets.open_zeppelin.OpenZeppelinAccount | ||
export CAIRO_COMPILER_DIR=~/.cairo/target/release/ | ||
export CAIRO_COMPILER_ARGS=--add-pythonic-hints | ||
# Source env vars | ||
ENV_FILE="/workspaces/loot-survivor/.env" | ||
source $ENV_FILE | ||
|
||
scarb contracts/game/build | ||
# build game contract | ||
cd /workspaces/loot-survivor/contracts/ | ||
scarb build | ||
|
||
starknet declare --contract contracts/game/target/dev/game_Game.sierra.json --account deployer_4 | ||
# declare game contract | ||
starkli declare --watch /workspaces/loot-survivor/target/dev/game_Game.contract_class.json --account $STARKNET_ACCOUNT --private-key $PRIVATE_KEY |
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,64 @@ | ||
ENV_FILE="/workspaces/loot-survivor/.env" | ||
|
||
# If there is already an account in .env, skip that | ||
if grep -q "^ACCOUNT_ADDRESS=" "$ENV_FILE"; then | ||
echo "Account already setup, exiting" | ||
exit | ||
fi | ||
|
||
echo "LORDS_ADDRESS=0x059dac5df32cbce17b081399e97d90be5fba726f97f00638f838613d088e5a47" > $ENV_FILE | ||
echo "DAO_ADDRESS=0x059dac5df32cbce17b081399e97d90be5fba726f97f00638f838613d088e5a47" >> $ENV_FILE | ||
|
||
# these are mainnet contracts. If you are running on testnet, please update these to right contracts | ||
echo "GOLDEN_TOKEN_ADDRESS=0x04f5e296c805126637552cf3930e857f380e7c078e8f00696de4fc8545356b1d" >> $ENV_FILE | ||
echo "BEASTS_ADDRESS=0x0158160018d590d93528995b340260e65aedd76d28a686e9daa5c4e8fad0c5dd" >> $ENV_FILE | ||
|
||
echo "ADVENTURER_ID=1" >> $ENV_FILE | ||
|
||
echo "STRENGTH=0" >> $ENV_FILE | ||
echo "DEXTERITY=1" >> $ENV_FILE | ||
echo "VITALITY=2" >> $ENV_FILE | ||
echo "WISDOM=3" >> $ENV_FILE | ||
echo "INTELLIGENCE=4" >> $ENV_FILE | ||
echo "CHARISMA=5" >> $ENV_FILE | ||
|
||
|
||
# initialize starknet directories | ||
mkdir -p $HOME/.starknet | ||
STARKNET_ACCOUNT=$HOME/.starknet/account | ||
STARKNET_KEYSTORE=$HOME/.starknet/keystore | ||
|
||
# Change directory to starkli | ||
cd /root/.starkli/bin/ | ||
|
||
# Generate keypair | ||
output=$(./starkli signer gen-keypair) | ||
|
||
# Store keys as vars so we can use them and later write to .bashrc | ||
private_key=$(echo "$output" | awk '/Private key/ {print $4}') | ||
public_key=$(echo "$output" | awk '/Public key/ {print $4}') | ||
|
||
# Initialize OZ account and save output | ||
account_output=$(./starkli account oz init $STARKNET_ACCOUNT --private-key $private_key 2>&1) | ||
account_address=$(echo "$account_output" | grep -oE '0x[0-9a-fA-F]+') | ||
|
||
# Deploy Account | ||
./starkli account deploy $STARKNET_ACCOUNT --private-key $private_key | ||
|
||
# Output key and account info | ||
echo "Private Key: $private_key" | ||
echo "Public Key: $public_key" | ||
echo "Account: $account_address" | ||
|
||
# Add keys and account to .bashrc as env vars for easy access in shell | ||
echo "PRIVATE_KEY=\"$private_key\"" >> $ENV_FILE | ||
echo "PUBLIC_KEY=\"$public_key\"" >> $ENV_FILE | ||
echo "ACCOUNT_ADDRESS=\"$account_address\"" >> $ENV_FILE | ||
echo "STARKNET_ACCOUNT=$STARKNET_ACCOUNT" >> $ENV_FILE | ||
echo "STARKNET_KEYSTORE=$STARKNET_KEYSTORE" >> $ENV_FILE | ||
|
||
echo "set -o allexport" >> ~/.bashrc | ||
echo "source $ENV_FILE" >> ~/.bashrc | ||
echo "set +o allexport" >> ~/.bashrc | ||
|
||
source ~/.bashrc |