Browse Source

Update 'examples/lottery.bas'

master
Captain 9 months ago
parent
commit
f5065fc108
1 changed files with 7 additions and 7 deletions
  1. +7
    -7
      examples/lottery.bas

+ 7
- 7
examples/lottery.bas View File

@@ -1,5 +1,5 @@
/* Lotter Smart Contract in DVM-BASIC
This lottery smart contract will give lottery wins every xth try.
/* Lottery Smart Contract Example in DVM-BASIC.
This lottery smart contract will give lottery wins every xth try.
*/


@@ -16,8 +16,8 @@
70 LET winner = RANDOM() % deposit_count // we have a winner
80 SEND_DERO_TO_ADDRESS(LOAD("depositor_address" + winner) , LOAD("lotterygiveback")*LOAD("deposit_total")/10000)
// re initialize for another round
90 STORE("deposit_count", 0) // initial players
// Re initialize for another round
90 STORE("deposit_count", 0) // initial players
100 STORE("deposit_total", 0) // total deposit of all players
110 RETURN 0
End Function
@@ -37,7 +37,7 @@
// used to tune lottery parameters
// Used to tune lottery parameters
Function TuneLotteryParameters(input Uint64, lotteryeveryXdeposit Uint64, lotterygiveback Uint64) Uint64
10 dim key,stored_owner as String
20 dim value_uint64 as Uint64
@@ -51,7 +51,7 @@

// this function is used to change owner
// This function is used to change owner
// owner is an string form of address
Function TransferOwnership(newowner String) Uint64
10 IF LOAD("owner") == SIGNER() THEN GOTO 30
@@ -60,7 +60,7 @@
40 RETURN 0
End Function
// until the new owner claims ownership, existing owner remains owner
// Until the new owner claims ownership, existing owner remains owner
Function ClaimOwnership() Uint64
10 IF LOAD("tmpowner") == SIGNER() THEN GOTO 30
20 RETURN 1


Loading…
Cancel
Save