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
comments addressed
  • Loading branch information
fbielejec committed Aug 16, 2022
commit efb5ec588ede3b14dc8ed6acad2172f6c686dae3
2 changes: 1 addition & 1 deletion contracts/early_bird_special/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ mod early_bird_special {

fn score(&self, now: BlockNumber) -> Balance {
let deadline = ButtonGame::deadline(self);
(deadline - now) as Balance
deadline.saturating_sub(now) as Balance
}
}

Expand Down
4 changes: 0 additions & 4 deletions contracts/scripts/deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,6 @@ function instrument_ticket_token {

cd "$CONTRACTS_PATH"/$contract_name

# local contract_address=$(cargo contract instantiate --url $NODE --constructor new --args $token_name $token_symbol $TOTAL_BALANCE --suri "$AUTHORITY_SEED" --salt $salt)

# local contract_address=$(cargo contract instantiate --url $NODE --constructor new --args \"fubar\" \"fu\" $TOTAL_BALANCE --suri "$AUTHORITY_SEED" --salt $salt)

local contract_address=$(cargo contract instantiate --url $NODE --constructor new --args \"$token_name\" \"$token_symbol\" $TOTAL_BALANCE --suri "$AUTHORITY_SEED" --salt $salt)

local contract_address=$(echo "$contract_address" | grep Contract | tail -1 | cut -c 15-)
Expand Down
3 changes: 1 addition & 2 deletions contracts/scripts/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,7 @@ PLAYER1_SEED=//0
PLAYER2=5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY
PLAYER2_SEED=//Alice

# GAMES=(early_bird_special back_to_the_future)
GAMES=(early_bird_special)
GAMES=(early_bird_special back_to_the_future)
for GAME in "${GAMES[@]}"; do
(
play $GAME
Expand Down
18 changes: 9 additions & 9 deletions contracts/ticket_token/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,13 @@ pub mod ticket_token {
impl Transfer for TicketToken {
fn _before_token_transfer(
&mut self,
_from: Option<&AccountId>,
_to: Option<&AccountId>,
from: Option<&AccountId>,
to: Option<&AccountId>,
amount: &Balance,
) -> 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_some() && !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 All @@ -59,16 +59,16 @@ pub mod ticket_token {
impl Internal for TicketToken {
fn _emit_transfer_event(
&self,
_from: Option<AccountId>,
_to: Option<AccountId>,
_amount: Balance,
from: Option<AccountId>,
to: Option<AccountId>,
amount: Balance,
) {
TicketToken::emit_event(
self.env(),
Event::TransferEvent(TransferEvent {
from: _from,
to: _to,
value: _amount,
from,
to,
value: amount,
}),
);
}
Expand Down