SC CODE: /* dShout v2 */
/* - store block height of previous sc call */
Function Initialize() Uint64
10 STORE("height", BLOCK_HEIGHT())
20 STORE("prev", BLOCK_HEIGHT())
30 RETURN 0
End Function
Function Store(data String) Uint64
/* 94 bytes = pubkey (32 bytes) + enc. shared keys (32 bytes each) + 2 seperators (1 byte each) + enc. msg. (at least 28 bytes) */
10 IF STRLEN(data) < 94 THEN GOTO 130
20 DIM h as Uint64
30 DIM ph as Uint64
40 LET h = BLOCK_HEIGHT()
50 LET ph = LOAD("height")
60 IF h == ph THEN GOTO 100
70 STORE("msg",data)
80 STORE("prev", ph)
90 GOTO 110
100 STORE("msg",LOAD("msg")+"+"+data)
110 STORE("height",h)
120 RETURN 0
130 RETURN 1
End Function
|
SC Arguments: [Name:SC_ACTION Type:uint64 Value:'1' Name:SC_CODE Type:string Value:'/* dShout v2 */
/* - store block height of previous sc call */
Function Initialize() Uint64
10 STORE("height", BLOCK_HEIGHT())
20 STORE("prev", BLOCK_HEIGHT())
30 RETURN 0
End Function
Function Store(data String) Uint64
/* 94 bytes = pubkey (32 bytes) + enc. shared keys (32 bytes each) + 2 seperators (1 byte each) + enc. msg. (at least 28 bytes) */
10 IF STRLEN(data) < 94 THEN GOTO 130
20 DIM h as Uint64
30 DIM ph as Uint64
40 LET h = BLOCK_HEIGHT()
50 LET ph = LOAD("height")
60 IF h == ph THEN GOTO 100
70 STORE("msg",data)
80 STORE("prev", ph)
90 GOTO 110
100 STORE("msg",LOAD("msg")+"+"+data)
110 STORE("height",h)
120 RETURN 0
130 RETURN 1
End Function
'] |