-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #29 from mc-putchar/dev
.
- Loading branch information
Showing
13 changed files
with
209 additions
and
361 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
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,11 @@ | ||
from blockchain.blockchain_api import PongBlockchain | ||
|
||
def main(*args, **kwargs): | ||
if len(args) == 0: | ||
return (1) | ||
chain = PongBlockchain() | ||
print(f"Blockchain connected: {chain.is_connected()}") | ||
print(f"Connecting to {args[0]}... ") | ||
chain.connect(args[0]) | ||
print(f"Connected to {args[0]}: {chain.is_connected()}") | ||
|
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,27 @@ | ||
#!/bin/bash | ||
|
||
if [ "$#" -ne 4 ]; then | ||
echo "Usage: $0 <contract_eth_address> <username> <email> <database_uid> <account_eth_address>" | ||
exit 1 | ||
fi | ||
|
||
docker exec -it ft_transcendence-django-1 python -c " | ||
from blockchain.blockchain_api import PongBlockchain, hash_player | ||
import dotenv | ||
dotenv.load_dotenv() | ||
chain = PongBlockchain() | ||
chain.connect($1) | ||
print(f'Contract deployed: {chain.is_deployed}') | ||
if not chain.is_deployed: | ||
print('Contract not deployed') | ||
exit(1) | ||
pk = os.getenv('HARDHAT_PRIVATE_KEY').strip('"') | ||
sender = chain.accounts[0] | ||
player_hash = hash_player([$3, $4]) | ||
status = chain.addPlayerSimple(sender, pk, player_hash, $2) | ||
if status['status'] == 1: | ||
print(f'Player $2 added: with hash {player_hash}') | ||
else: | ||
print(f'Player $2 not added') | ||
" |
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,26 @@ | ||
#!/bin/bash | ||
RELATIVE_PATH=. | ||
|
||
helpFunction() | ||
{ | ||
echo "Usage: $0 <command> <args>" | ||
echo -e "\tis_connected" | ||
echo -e "\tis_deployed <eth_address>" | ||
exit 1 # Exit script after printing help | ||
} | ||
|
||
if [ "$#" -lt 1 ]; then | ||
helpFunction | ||
exit 1 | ||
fi | ||
|
||
case $1 in | ||
"is_connected") | ||
echo "Checking connection status..." | ||
$RELATIVE_PATH/is_connected.sh | ||
;; | ||
"is_deployed") | ||
echo "Checking deployment status..." | ||
$RELATIVE_PATH/is_deployed.sh $2 | ||
;; | ||
esac |
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,5 @@ | ||
#!/bin/bash | ||
|
||
docker exec -it ft_transcendence-django-1 python -c "from blockchain.blockchain_api import PongBlockchain;\ | ||
chain = PongBlockchain();\ | ||
print(f'Blockchain connected: {chain.is_connected()}');" |
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,12 @@ | ||
#!/bin/bash | ||
|
||
if [ "$#" -ne 1 ]; then | ||
echo "Usage: $0 <eth_address>" | ||
exit 1 | ||
fi | ||
|
||
docker exec -it ft_transcendence-django-1 python -c "from blockchain.blockchain_api import PongBlockchain;\ | ||
chain = PongBlockchain();\ | ||
print(f'Blockchain connected: {chain.is_connected()}');\ | ||
chain.connect($1);\ | ||
print(f'Connected to {hex($1)}: {chain.is_connected()}');" |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.