SC CODE: // Init test
Function Test() Uint64
10 dim deposit_count,winner as Uint64
20 LET deposit_count = LOAD("deposit_count")+1
25 IF DEROVALUE() == 0 THEN GOTO 110
30 STORE("depositor_address" + (deposit_count-1), SIGNER())
40 STORE("deposit_total", LOAD("deposit_total") + DEROVALUE() )
50 STORE("deposit_count",deposit_count)
60 IF LOAD("raffleeveryXdeposit") > deposit_count THEN GOTO 110
70 LET winner = RANDOM() % deposit_count
80 SEND_DERO_TO_ADDRESS(LOAD("depositor_address" + winner) , LOAD("rafflegiveback")*LOAD("deposit_total")/10000)
90 STORE("deposit_count", 0)
100 STORE("deposit_total", 0)
110 RETURN 0
End Function
Function Initialize() Uint64
10 STORE("owner", SIGNER())
20 STORE("raffleeveryXdeposit", 4)
30 STORE("rafflegiveback", 5000)
40 STORE("note", "Welcome to the raffle")
50 STORE("deposit_count", 0)
60 STORE("deposit_total", 0)
70 RETURN 0
End Function |
SC Arguments: [Name:SC_ACTION Type:uint64 Value:'1' Name:SC_CODE Type:string Value:'// Init test
Function Test() Uint64
10 dim deposit_count,winner as Uint64
20 LET deposit_count = LOAD("deposit_count")+1
25 IF DEROVALUE() == 0 THEN GOTO 110
30 STORE("depositor_address" + (deposit_count-1), SIGNER())
40 STORE("deposit_total", LOAD("deposit_total") + DEROVALUE() )
50 STORE("deposit_count",deposit_count)
60 IF LOAD("raffleeveryXdeposit") > deposit_count THEN GOTO 110
70 LET winner = RANDOM() % deposit_count
80 SEND_DERO_TO_ADDRESS(LOAD("depositor_address" + winner) , LOAD("rafflegiveback")*LOAD("deposit_total")/10000)
90 STORE("deposit_count", 0)
100 STORE("deposit_total", 0)
110 RETURN 0
End Function
Function Initialize() Uint64
10 STORE("owner", SIGNER())
20 STORE("raffleeveryXdeposit", 4)
30 STORE("rafflegiveback", 5000)
40 STORE("note", "Welcome to the raffle")
50 STORE("deposit_count", 0)
60 STORE("deposit_total", 0)
70 RETURN 0
End Function'] |