SC Arguments: [Name:SC_ACTION Type:uint64 Value:'0' Name:SC_ID Type:hash Value:'a6fc0033327073dd54e448192af929466596fce4d689302e558bc85ea8734a82' Name:code Type:string Value:'///dReams Tarot v0.1
Function InitializePrivate() Uint64
10 IF EXISTS("owner:") == 0 THEN GOTO 30
20 RETURN 1
30 STORE("owner:", SIGNER())
40 STORE("readings:", 0)
50 STORE("V", 1)
60 RETURN 0
End Function
Function Draw(num Uint64) Uint64
10 IF DEROVALUE() >= LOAD("Fee") THEN GOTO 30
20 RETURN 1
30 DIM c1, c2, c3 as Uint64
40 STORE("readings:", LOAD("readings:")+1)
50 STORE(ITOA(LOAD("readings:"))+"-readingTXID:", TXID())
60 LET c1 = 1+ RANDOM(78)
70 STORE(c1, c1)
80 STORE(ITOA(LOAD("readings:"))+"-card1:", SHA256(ITOA(c1)))
90 IF num == 3 THEN GOTO 100 ELSE GOTO 180
100 LET c2 = 1+ RANDOM(78)
110 IF EXISTS(c2) THEN GOTO 100
120 STORE(c2, c2)
130 STORE(ITOA(LOAD("readings:"))+"-card2:", SHA256(ITOA(c2)))
140 LET c3 = 1+ RANDOM(78)
150 IF EXISTS(c3) THEN GOTO 140
160 STORE(c3, c3)
170 STORE(ITOA(LOAD("readings:"))+"-card3:", SHA256(ITOA(c3)))
180 DELETE(c1)
190 DELETE(c2)
200 DELETE(c3)
210 clear()
1000 RETURN 0
End Function
Function clear() Uint64
5 DIM d as Uint64
6 LET d = LOAD("Display")
10 DELETE(ITOA(LOAD("readings:")-d)+"-readingTXID:")
20 DELETE(ITOA(LOAD("readings:")-d)+"-card1:")
30 DELETE(ITOA(LOAD("readings:")-d)+"-card2:")
40 DELETE(ITOA(LOAD("readings:")-d)+"-card3:")
50 RETURN 0
End Function
Function Withdraw(amount Uint64 fee Uint64 display Uint64) Uint64
10 IF LOAD("owner:") == SIGNER() THEN GOTO 30
20 RETURN 1
30 SEND_DERO_TO_ADDRESS(SIGNER(), amount)
35 STORE("Fee", fee)
36 STORE("Display", display)
40 RETURN 0
End Function
Function UpdateCode(code String) Uint64
10 IF LOAD("owner:") == SIGNER() THEN GOTO 30
20 RETURN 1
30 UPDATE_SC_CODE(code)
40 STORE("V", LOAD("V")+1)
50 RETURN 0
End Function' Name:entrypoint Type:string Value:'UpdateCode'] |