SC CODE: // Domain Validation
Function InitializePrivate() Uint64
10 initSetup()
20 RETURN 0
End Function
Function SmartDNS(webURL String, webIP String, webDesc String) Uint64
10 dim index,min_post,max_post,active as Uint64
20 LET index = LOAD("index") + 1
30 LET min_post = LOAD("min_post")
40 LET max_post = LOAD("max_post")
50 LET active = LOAD("active")
60 IF active == 0 THEN GOTO 200
70 IF max_post < index THEN GOTO 200
80 IF DEROVALUE() < min_post THEN GOTO 200
90 STORE("total", LOAD("total") + DEROVALUE())
100 STORE("index", index)
110 STORE("s" + (index-1), ADDRESS_STRING(SIGNER()))
120 STORE("w" + (index-1), SIGNER())
130 STORE("x" + (index-1), webURL)
140 STORE("y" + (index-1), webIP)
150 STORE("z" + (index-1), webDesc)
200 RETURN 0
End Function
Function initSetup() Uint64
10 STORE("owner", SIGNER())
20 STORE("version", "v1.0.1")
30 STORE("readme", "Domain Validation")
40 STORE("min_post", 45000)
50 STORE("max_post", 100)
60 STORE("index", 0)
70 STORE("total", 0)
80 STORE("active", 1)
90 STORE("w", "DNS Signer")
100 STORE("x", "www.website.com")
110 STORE("y", "11.111.11.1")
120 STORE("z", "Description")
130 RETURN 0
End Function
Function UpdateEntry(i Uint64, webURL String, webIP String, webDesc String) Uint64
10 IF LOAD("w" + i) == SIGNER() THEN GOTO 30
20 RETURN 1
30 STORE("x" + i, webURL)
40 STORE("y" + i, webIP)
50 STORE("z" + i, webDesc)
60 RETURN 0
End Function
Function TuneParams(note String, x0 Uint64, x1 Uint64, x2 Uint64, x3 Uint64) Uint64
10 IF LOAD("owner") == SIGNER() THEN GOTO 30
20 RETURN 1
30 STORE("readme", note)
40 STORE("min_post", x0)
50 STORE("max_post", x1)
60 STORE("total", x2)
70 STORE("active", x3)
80 RETURN 0
End Function
Function TuneIndex(x0 Uint64) Uint64
10 IF LOAD("owner") == SIGNER() THEN GOTO 30
20 RETURN 1
30 STORE("index", x0)
40 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
Function TransferOwnership(newOwner String) Uint64
10 IF ADDRESS_RAW(LOAD("owner")) == ADDRESS_RAW(SIGNER()) THEN GOTO 30
20 RETURN 1
30 STORE("tmpowner",newOwner)
40 RETURN 0
End Function
Function ClaimOwnership() Uint64
10 IF ADDRESS_RAW(LOAD("tmpowner")) == ADDRESS_RAW(SIGNER()) THEN GOTO 30
20 RETURN 1
30 STORE("owner",SIGNER())
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 RETURN 0
End Function |
SC Arguments: [Name:SC_ACTION Type:uint64 Value:'1' Name:SC_CODE Type:string Value:'// Domain Validation
Function InitializePrivate() Uint64
10 initSetup()
20 RETURN 0
End Function
Function SmartDNS(webURL String, webIP String, webDesc String) Uint64
10 dim index,min_post,max_post,active as Uint64
20 LET index = LOAD("index") + 1
30 LET min_post = LOAD("min_post")
40 LET max_post = LOAD("max_post")
50 LET active = LOAD("active")
60 IF active == 0 THEN GOTO 200
70 IF max_post < index THEN GOTO 200
80 IF DEROVALUE() < min_post THEN GOTO 200
90 STORE("total", LOAD("total") + DEROVALUE())
100 STORE("index", index)
110 STORE("s" + (index-1), ADDRESS_STRING(SIGNER()))
120 STORE("w" + (index-1), SIGNER())
130 STORE("x" + (index-1), webURL)
140 STORE("y" + (index-1), webIP)
150 STORE("z" + (index-1), webDesc)
200 RETURN 0
End Function
Function initSetup() Uint64
10 STORE("owner", SIGNER())
20 STORE("version", "v1.0.1")
30 STORE("readme", "Domain Validation")
40 STORE("min_post", 45000)
50 STORE("max_post", 100)
60 STORE("index", 0)
70 STORE("total", 0)
80 STORE("active", 1)
90 STORE("w", "DNS Signer")
100 STORE("x", "www.website.com")
110 STORE("y", "11.111.11.1")
120 STORE("z", "Description")
130 RETURN 0
End Function
Function UpdateEntry(i Uint64, webURL String, webIP String, webDesc String) Uint64
10 IF LOAD("w" + i) == SIGNER() THEN GOTO 30
20 RETURN 1
30 STORE("x" + i, webURL)
40 STORE("y" + i, webIP)
50 STORE("z" + i, webDesc)
60 RETURN 0
End Function
Function TuneParams(note String, x0 Uint64, x1 Uint64, x2 Uint64, x3 Uint64) Uint64
10 IF LOAD("owner") == SIGNER() THEN GOTO 30
20 RETURN 1
30 STORE("readme", note)
40 STORE("min_post", x0)
50 STORE("max_post", x1)
60 STORE("total", x2)
70 STORE("active", x3)
80 RETURN 0
End Function
Function TuneIndex(x0 Uint64) Uint64
10 IF LOAD("owner") == SIGNER() THEN GOTO 30
20 RETURN 1
30 STORE("index", x0)
40 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
Function TransferOwnership(newOwner String) Uint64
10 IF ADDRESS_RAW(LOAD("owner")) == ADDRESS_RAW(SIGNER()) THEN GOTO 30
20 RETURN 1
30 STORE("tmpowner",newOwner)
40 RETURN 0
End Function
Function ClaimOwnership() Uint64
10 IF ADDRESS_RAW(LOAD("tmpowner")) == ADDRESS_RAW(SIGNER()) THEN GOTO 30
20 RETURN 1
30 STORE("owner",SIGNER())
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 RETURN 0
End Function'] |