SC CODE: // Smart Raffle
Function SmartRaffle(a String, x String, y String, z String) Uint64
10 dim deposit_count,win,min_play,active,max_deposit as Uint64
20 LET deposit_count = LOAD("deposit_count")+1
30 LET min_play = LOAD("min_play")
40 LET active = LOAD("active")
50 LET max_deposit = LOAD("max_deposit")
70 STORE("depositor_address" + (deposit_count-1), SIGNER())
80 STORE("deposit_total", LOAD("deposit_total") + DEROVALUE())
90 STORE("deposit_count",deposit_count)
100 STORE("a" + (deposit_count-1), a)
110 STORE("x" + (deposit_count-1), x)
120 STORE("y" + (deposit_count-1), y)
130 STORE("z" + (deposit_count-1), z)
140 IF deposit_count < max_deposit THEN GOTO 220
150 LET win = RANDOM() % deposit_count
160 STORE("winner",LOAD("a" + win))
170 STORE("winnum", win)
180 SEND_DERO_TO_ADDRESS(LOAD("owner"),LOAD("deposit_total"))
190 STORE("deposit_count", 0)
200 STORE("deposit_total", 0)
210 STORE("active", 0)
220 RETURN 0
End Function
Function InitializePrivate() Uint64
10 STORE("owner", SIGNER())
20 STORE("version","1.1.5")
30 STORE("deposit_count", 0)
40 STORE("deposit_total", 0)
50 STORE("max_deposit", 2)
60 STORE("min_play", 100)
70 STORE("readme", "Readme")
80 STORE("winner", "NA")
90 STORE("winnum", "NA")
100 STORE("active", 0)
110 RETURN 0
End Function
Function TuneParameters(note String, x Uint64, y Uint64, z Uint64) Uint64
10 IF LOAD("owner") == SIGNER() THEN GOTO 30
20 RETURN 1
30 STORE("readme", note)
40 STORE("max_deposit", x)
50 STORE("min_play", y)
60 STORE("active", z)
70 RETURN 0
End Function
Function Withdraw(amount Uint64) Uint64
10 IF LOAD("owner") == SIGNER() THEN GOTO 30
20 RETURN 1
30 SEND_DERO_TO_ADDRESS(SIGNER(),amount)
40 RETURN 0
End Function |
SC Arguments: [Name:SC_ACTION Type:uint64 Value:'1' Name:SC_CODE Type:string Value:'// Smart Raffle
Function SmartRaffle(a String, x String, y String, z String) Uint64
10 dim deposit_count,win,min_play,active,max_deposit as Uint64
20 LET deposit_count = LOAD("deposit_count")+1
30 LET min_play = LOAD("min_play")
40 LET active = LOAD("active")
50 LET max_deposit = LOAD("max_deposit")
70 STORE("depositor_address" + (deposit_count-1), SIGNER())
80 STORE("deposit_total", LOAD("deposit_total") + DEROVALUE())
90 STORE("deposit_count",deposit_count)
100 STORE("a" + (deposit_count-1), a)
110 STORE("x" + (deposit_count-1), x)
120 STORE("y" + (deposit_count-1), y)
130 STORE("z" + (deposit_count-1), z)
140 IF deposit_count < max_deposit THEN GOTO 220
150 LET win = RANDOM() % deposit_count
160 STORE("winner",LOAD("a" + win))
170 STORE("winnum", win)
180 SEND_DERO_TO_ADDRESS(LOAD("owner"),LOAD("deposit_total"))
190 STORE("deposit_count", 0)
200 STORE("deposit_total", 0)
210 STORE("active", 0)
220 RETURN 0
End Function
Function InitializePrivate() Uint64
10 STORE("owner", SIGNER())
20 STORE("version","1.1.5")
30 STORE("deposit_count", 0)
40 STORE("deposit_total", 0)
50 STORE("max_deposit", 2)
60 STORE("min_play", 100)
70 STORE("readme", "Readme")
80 STORE("winner", "NA")
90 STORE("winnum", "NA")
100 STORE("active", 0)
110 RETURN 0
End Function
Function TuneParameters(note String, x Uint64, y Uint64, z Uint64) Uint64
10 IF LOAD("owner") == SIGNER() THEN GOTO 30
20 RETURN 1
30 STORE("readme", note)
40 STORE("max_deposit", x)
50 STORE("min_play", y)
60 STORE("active", z)
70 RETURN 0
End Function
Function Withdraw(amount Uint64) Uint64
10 IF LOAD("owner") == SIGNER() THEN GOTO 30
20 RETURN 1
30 SEND_DERO_TO_ADDRESS(SIGNER(),amount)
40 RETURN 0
End Function'] |