SC Arguments: [Name:SC_ACTION Type:uint64 Value:'0' Name:SC_ID Type:hash Value:'d6ad66e39c99520d4ed42defa4643da2d99f297a506d3ddb6c2aaefbe011f3dc' Name:code Type:string Value:'Function WL(L String, H String, T Uint64, f Uint64, F Uint64) Uint64
10 IF ASSETVALUE(HEXDECODE(H)) !=1 THEN GOTO 100
15 SEND_ASSET_TO_ADDRESS(SIGNER(),1,HEXDECODE(H))
20 dim i as Uint64
30 LET i = 0
40 STORE(H+T+"_W_"+(f+i),SUBSTR(L,i*66,66))
50 LET i=i+1
60 IF i > F - f THEN GOTO 99 ELSE GOTO 40
99 RETURN 0
100 RETURN 1
End Function
Function NF(G Uint64, D Uint64, A String, H String, i Uint64, name String, t String) Uint64
10 IF ASSETVALUE(HEXDECODE(H)) !=1 THEN GOTO 100
15 IF EXISTS(H+i+"_G") THEN GOTO 100
20 SEND_ASSET_TO_ADDRESS(SIGNER(),1,HEXDECODE(H))
25 STORE(H+i+"_name_0",name)
30 STORE(H+i+"_G", G)
40 STORE(H+i+"_D", D)
50 STORE(H+i+"_F", A)
60 STORE(H+i+"_R",0)
70 STORE(H+i+"_C",0)
80 STORE(H+i+"_version",0)
85 IF STRLEN(t)!=64 THEN GOTO 99
86 STORE(H+i+"_T",ASSETVALUE(HEXDECODE(t))*9/10) //store ico amount.
87 IF EXISTS("T_"+t) THEN GOTO 91
88 STORE("T_"+t,ASSETVALUE(HEXDECODE(t))/10)
89 STORE(H+i+"_t",t)
90 RETURN 0
91 STORE("T_"+t,LOAD("T_"+t)+ASSETVALUE(HEXDECODE(t))/10)
99 RETURN 0
100 RETURN 1
End Function
Function SetName(H String,i Uint64, Name String) Uint64
10 IF ASSETVALUE(HEXDECODE(H)) != 1 THEN GOTO 100
20 dim version as Uint64
30 let version = LOAD(H+i+"_version") + 1
40 SEND_ASSET_TO_ADDRESS(SIGNER(),1,HEXDECODE(H))
50 STORE(H+i+"_name_"+version,Name)
60 STORE(H+i+"_version",version)
99 RETURN 0
100 RETURN 1
End Function
Function SetImage(H String,i Uint64, Image String) Uint64
10 IF ASSETVALUE(HEXDECODE(H)) != 1 THEN GOTO 100
20 dim version as Uint64
30 let version = LOAD(H+i+"_version") + 1
40 SEND_ASSET_TO_ADDRESS(SIGNER(),1,HEXDECODE(H))
50 STORE(H+i+"_image_"+version,Image)
60 STORE(H+i+"_version",version)
99 RETURN 0
100 RETURN 1
End Function
Function SetTagline(H String, i Uint64, Tagline String) Uint64
10 IF ASSETVALUE(HEXDECODE(H)) != 1 THEN GOTO 100
20 dim version as Uint64
30 let version = LOAD(H+i+"_version") + 1
40 SEND_ASSET_TO_ADDRESS(SIGNER(),1,HEXDECODE(H))
50 STORE(H+i+"_tagline_"+version,Tagline)
60 STORE(H+i+"_version",version)
99 RETURN 0
100 RETURN 1
End Function
Function SetDescription(H String, i Uint64, Description String) Uint64
10 IF ASSETVALUE(HEXDECODE(H)) != 1 THEN GOTO 100
20 dim version as Uint64
30 let version = LOAD(H+i+"_version") + 1
40 SEND_ASSET_TO_ADDRESS(SIGNER(),1,HEXDECODE(H))
50 STORE(H+i+"_desc_"+version,Description)
60 STORE(H+i+"_version",version)
99 RETURN 0
100 RETURN 1
End Function
Function SetMetadata(H String, i Uint64, Name String, Image String, Tagline String, Description String) Uint64
10 IF ASSETVALUE(HEXDECODE(H)) != 1 THEN GOTO 100
20 dim version as Uint64
30 let version = LOAD(H+i+"_version") + 1
40 STORE(H+i+"_image_"+version,Image)
50 STORE(H+i+"_tagline_"+version,Tagline)
60 STORE(H+i+"_desc_"+version,Description)
70 STORE(H+i+"_name_"+version,Name)
80 SEND_ASSET_TO_ADDRESS(SIGNER(),1,HEXDECODE(H))
90 STORE(H+i+"_version",version)
99 RETURN 0
100 RETURN 1
End Function
//working on sg storing ico token reserved for supporter... could also implement revenue share for ico tokens if 10% goes to treasury. not crucial now
Function SG(H String, R Uint64) Uint64
10 IF EXISTS(H+"_D") == 0 THEN GOTO 100
20 IF LOAD(H+"_D") < BLOCK_TIMESTAMP() THEN GOTO 100
30 STORE(H+"_R", LOAD(H+"_R") + DEROVALUE())
33 IF STRLEN(LOAD(H+"_T")) != 64 THEN GOTO 40
34 IF EXISTS(H+"::"+ADDRESS_STRING(SIGNER())+"::TOKEN") THEN GOTO 37
35 STORE(H+"::"+ADDRESS_STRING(SIGNER())+"::TOKEN",DEROVALUE())
36 GOTO 40
37 STORE(H+"::"+ADDRESS_STRING(SIGNER())+"::TOKEN",DEROVALUE()+LOAD(H+"::"+ADDRESS_STRING(SIGNER())+"::TOKEN"))
40 IF EXISTS(H+"::"+ADDRESS_STRING(SIGNER())+"::DERO") == 1 THEN GOTO 70
45 IF R == 0 THEN GOTO 55
50 STORE(H+"::"+ADDRESS_STRING(SIGNER())+"::DERO",DEROVALUE()*9/10)
52 RETURN 0
55 SEND_DERO_TO_ADDRESS(ADDRESS_RAW(LOAD(H+"_F")),DEROVALUE()*9/10)
57 STORE(H+"_C",LOAD(H+"_C")+DEROVALUE())
60 RETURN 0
70 IF R == 0 THEN GOTO 77
75 STORE(H+"::"+ADDRESS_STRING(SIGNER())+"::DERO",LOAD(H+"::"+ADDRESS_STRING(SIGNER())+"::DERO")+DEROVALUE()*9/10)
76 RETURN 0
77 SEND_DERO_TO_ADDRESS(ADDRESS_RAW(LOAD(H+"_F")),DEROVALUE()*9/10)
78 STORE(H+"_C",LOAD(H+"_C")+DEROVALUE())
80 RETURN 0
100 RETURN 1
End Function
Function WFF(H String, i Uint64) Uint64
10 IF EXISTS(H+i+"_D") == 0 THEN GOTO 100 //CHECK FUNDRAISER EXISTS
20 IF LOAD(H+i+"_D") > BLOCK_TIMESTAMP() THEN GOTO 65 //IF ACTIVE GO TO 65
30 IF LOAD(H+i+"_R") >= LOAD(H+i+"_G") THEN GOTO 70 //DEADLINE PAST. IF GOAL MET GOTO 70
40 IF EXISTS(H+i+"::"+ADDRESS_STRING(SIGNER())) == 0 THEN GOTO 100 //CHECK FOR REFUNDABLE DONATION
50 SEND_DERO_TO_ADDRESS(SIGNER(),LOAD(H+i+"::"+ADDRESS_STRING(SIGNER()))) //SEND REFUND
56 DELETE(H+i+"::"+ADDRESS_STRING(SIGNER())) //DELETE REFUND RECORD
60 RETURN 0
65 IF LOAD(H+i+"_R") < LOAD(H+i+"_G") THEN GOTO 100 //FUNDRAISER ACTIVE. IF GOAL NOT MET RETURN 1
70 SEND_DERO_TO_ADDRESS(ADDRESS_RAW(LOAD(H+i+"_F")), (LOAD(H+i+"_R")-LOAD(H+i+"_C"))*9/10) //FUNDRAISER ACTIVE AND GOAL MET. SEND UNCLAIMED FUNDS TO FUNDEE
75 STORE(H+i+"_C",LOAD(H+i+"_R")) //UPDATE RECORD OF CLAIMED FUNDS
99 RETURN 0
100 RETURN 1
End Function
Function WT(H String) Uint64
10 IF EXISTS(H+"_D") ==0 THEN GOTO 100 // CHECK FUNDRAISER EXISTS
20 IF LOAD(H+"_D")>BLOCK_TIMESTAMP() THEN GOTO 100 //IF ACTIVE RETURN 1
30 IF LOAD(H+"_R") < LOAD(H+"_G") THEN GOTO 70 //IF FAILED TO REACH GOAL GOTO 70
40 IF EXISTS(H+"::"+ADDRESS_STRING(SIGNER())+"::TOKEN") == 0 THEN GOTO 100 //IF NO TOKENS OWED RETURN 1
50 SEND_ASSET_TO_ADDRESS(SIGNER(),LOAD(H+"_T")*LOAD(H+"::"+ADDRESS_STRING(SIGNER())+"::TOKEN")/LOAD(H+"_R"),HEXDECODE(LOAD(H+"_t"))) //OWED TOKENS = DERO DONATED / TOTAL DERO RAISED * ICO TOTAL
60 DELETE(H+"::"+ADDRESS_STRING(SIGNER())+"::TOKEN") //DELETE RECORD OF TOKENS OWED
99 RETURN 0
100 RETURN 1
End Function
Function D() Uint64
10 IF ASSETVALUE(HEXDECODE(LOAD("COCO"))) % 10000 != 0 THEN GOTO 100
13 STORE("T_DERO",LOAD("T_DERO")+DEROVALUE())
14 STORE("T_COCO",LOAD("T_COCO")+ASSETVALUE(HEXDECODE(LOAD("COCO"))))
15 STORE(ADDRESS_STRING(SIGNER())+"_EPOCH",(BLOCK_TIMESTAMP() - LOAD("EPOCH-INIT"))/2629743)
16 IF EXISTS(ADDRESS_STRING(SIGNER())+"_SHARES") THEN GOTO 30
20 STORE(ADDRESS_STRING(SIGNER())+"_SHARES",ASSETVALUE(HEXDECODE(LOAD("COCO")))/10000)
25 RETURN 0
30 STORE(ADDRESS_STRING(SIGNER())+"_SHARES",LOAD(ADDRESS_STRING(SIGNER())+"_SHARES")+ASSETVALUE(HEXDECODE(LOAD("COCO")))/10000)
35 RETURN 0
100 RETURN 1
End Function
Function W() Uint64
10 DIM EPOCH as Uint64
11 LET EPOCH = (BLOCK_TIMESTAMP()-LOAD("EPOCH-INIT"))/2629743
14 IF EXISTS(ADDRESS_STRING(SIGNER())+"_SHARES") ==0 THEN GOTO 100
15 IF LOAD(ADDRESS_STRING(SIGNER())+"_EPOCH") >= EPOCH THEN GOTO 100
16 DIM SHARE as Uint64
17 LET SHARE = LOAD(ADDRESS_STRING(SIGNER())+"_SHARES")*10000*LOAD("T_DERO")/(LOAD("T_COCO"))
18 SEND_DERO_TO_ADDRESS(SIGNER(),SHARE)
19 STORE(ADDRESS_STRING(SIGNER())+"_EPOCH",EPOCH)
20 STORE("T_DERO",LOAD("T_DERO")-SHARE)
25 RETURN 0
100 RETURN 1
End Function
Function SS(shares Uint64) Uint64
10 IF EXISTS(ADDRESS_STRING(SIGNER())+"_SHARES") == 0 THEN GOTO 100
20 IF LOAD(ADDRESS_STRING(SIGNER())+"_SHARES") < shares THEN GOTO 100
30 STORE(ADDRESS_STRING(SIGNER())+"_SHARES",LOAD(ADDRESS_STRING(SIGNER())+"_SHARES")-shares)
40 SEND_ASSET_TO_ADDRESS(SIGNER(),shares*10000,HEXDECODE(LOAD("COCO")))
50 STORE("T_COCO",LOAD("T_COCO")-shares*10000)
99 RETURN 0
100 RETURN 1
End Function
Function Propose(hash String, k String, u Uint64, s String, t Uint64, seat Uint64) Uint64
10 IF ASSETVALUE(HEXDECODE(LOAD("CEO"))) != 1 THEN GOTO 13
11 SEND_ASSET_TO_ADDRESS(SIGNER(),1,HEXDECODE(LOAD("CEO")))
12 GOTO 15
13 IF ASSETVALUE(HEXDECODE(LOAD("SEAT_"+seat))) !=1 THEN GOTO 100
14 SEND_ASSET_TO_ADDRESS(SIGNER(),1,HEXDECODE(LOAD("SEAT_"+seat)))
15 STORE("APPROVE", 0)
20 IF hash =="" THEN GOTO 40
25 STORE("HASH",hash)
30 STORE("k","")
35 RETURN 0
40 STORE("k",k)
45 STORE("HASH","")
49 STORE("t",t)
50 IF t == 1 THEN GOTO 80
60 STORE("s", s)
70 RETURN 0
80 STORE("u",u)
90 RETURN 0
100 RETURN 1
End Function
Function Approve(seat Uint64) Uint64
10 IF ASSETVALUE(HEXDECODE(LOAD("SEAT_"+seat)))!=1 THEN GOTO 100
20 STORE("APPROVE",LOAD("APPROVE")+1)
30 STORE("SEAT_"+seat+"_OWNER",SIGNER())
99 RETURN 0
100 RETURN 1
End Function
Function ClaimSeat(seat Uint64) Uint64
10 IF SIGNER()!= LOAD("SEAT_"+seat+"_OWNER") THEN GOTO 100
20 SEND_ASSET_TO_ADDRESS(SIGNER(),1,HEXDECODE(LOAD("SEAT_"+seat)))
30 IF LOAD("APPROVE") == 0 THEN GOTO 99
40 STORE("APPROVE",LOAD("APPROVE")-1)
99 RETURN 0
100 RETURN 1
End Function
Function Update(code String) Uint64
10 IF ASSETVALUE(HEXDECODE(LOAD("CEO")))!=1 THEN GOTO 100
15 SEND_ASSET_TO_ADDRESS(SIGNER(),1,HEXDECODE(LOAD("CEO")))
20 IF SHA256(code) != HEXDECODE(LOAD("HASH")) THEN GOTO 100
30 IF LOAD("APPROVE") < LOAD("QUORUM") THEN GOTO 100
40 UPDATE_SC_CODE(code)
99 RETURN 0
100 RETURN 1
End Function
Function Store(k String, u Uint64, s String) Uint64
20 IF k != LOAD("k") THEN GOTO 999
40 IF LOAD("APPROVE") < LOAD("QUORUM") THEN GOTO 999
45 STORE("APPROVE",0)
50 dim t as Uint64
60 let t = LOAD("t")
110 IF t == 0 THEN GOTO 150
120 IF t == 1 THEN GOTO 170
130 IF s!=LOAD("s") THEN GOTO 999
135 STORE(k, HEX(s))
140 RETURN 0
150 IF s!=LOAD("s") THEN GOTO 999
155 STORE(k, s)
160 RETURN 0
170 IF u!=LOAD("u") THEN GOTO 999
175 STORE(k,u)
180 RETURN 0
999 RETURN 1
End Function' Name:entrypoint Type:string Value:'Update'] |