Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
wip : test
  • Loading branch information
fbielejec committed Aug 16, 2022
commit 46bc61290b4c9332abbfa2d389c81fd9c804222e
12 changes: 8 additions & 4 deletions contracts/scripts/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ set -euo pipefail

# --- FUNCTIONS

# TODO : give allowance

function play {

local contract_name=$1
Expand All @@ -21,13 +23,15 @@ function play {

cargo contract call --url $NODE --contract $contract_address --message IButtonGame::press --suri $PLAYER2_SEED

# --- TRIGGER DEATH AND REWARDS DISTRIBUTION
# --- WAIT FOR BUTTON DEATH

sleep $(($LIFETIME + 1))

echo "claiming rewards for" $contract_name
cargo contract call --url $NODE --contract $contract_address --message IButtonGame::claim_reward --args $PLAYER1 --suri $AUTHORITY_SEED
cargo contract call --url $NODE --contract $contract_address --message IButtonGame::claim_reward --args $PLAYER2 --suri $AUTHORITY_SEED
# --- TRIGGER RESTART (PAYS OUT PRESSIAH REWARD)

# echo "claiming rewards for" $contract_name
# cargo contract call --url $NODE --contract $contract_address --message IButtonGame::claim_reward --args $PLAYER1 --suri $AUTHORITY_SEED
# cargo contract call --url $NODE --contract $contract_address --message IButtonGame::claim_reward --args $PLAYER2 --suri $AUTHORITY_SEED

echo "Done playing" $contract_name
}
Expand Down
2 changes: 1 addition & 1 deletion contracts/ticket_token/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ pub mod ticket_token {
) -> core::result::Result<(), PSP22Error> {
// if from is None this is an initial mint in the constructor
// and we don't want to enforce it there
if _from.is_some() && _to.is_none() && !amount.eq(&1u128) {
if _from.is_some() && _to.is_some() && !amount.eq(&1u128) {
return Err(PSP22Error::Custom(String::from(
"Only single ticket can be transferred at once",
)));
Expand Down