SC CODE: Function Initialize(ctrl String) Uint64
10 IF EXISTS("maxSupply") THEN GOTO 100
20 STORE("maxSupply",100000000000000)
30 STORE("totalSupply",100000000000000)
40 STORE("name","Leaf Token")
50 STORE("symbol","LEAF")
60 STORE("decimals",5)
70 STORE("ctrl",ctrl)
80 SEND_ASSET_TO_ADDRESS(SIGNER(),100000000000000,SCID())
99 RETURN 0
100 RETURN 1
End Function
Function Burn() Uint64
10 STORE("totalSupply",LOAD("totalSupply") - ASSETVALUE(SCID()))
20 RETURN 0
End Function
Function UpdateIcon(url String) Uint64
10 IF ASSETVALUE(HEXDECODE(LOAD("ctrl"))) != 1 THEN GOTO 100
20 STORE("image_url",url)
99 RETURN 0
100 RETURN 1
End Function
Function DisplayToken() Uint64
10 add(ADDRESS_STRING(SIGNER()),ASSETVALUE(SCID()))
99 RETURN 0
End Function
Function RetrieveToken(amount Uint64) Uint64
1 DIM storedAmount as Uint64
2 DIM signerString as String
3 LET signerString = ADDRESS_STRING(SIGNER())
4 LET storedAmount = LOAD("owner_" + signerString)
5 IF amount > storedAmount THEN GOTO 13
6 SEND_ASSET_TO_ADDRESS(SIGNER(), amount, SCID())
7 LET storedAmount = storedAmount - amount
8 IF storedAmount == 0 THEN GOTO 11
9 STORE("owner_" + signerString, storedAmount)
10 RETURN 0
11 DELETE("owner_" + signerString)
12 RETURN 0
13 RETURN 1
End Function
Function add(key String, value Uint64) Uint64
10 IF EXISTS(key) THEN GOTO 20
11 RETURN STORE(key,value)
20 RETURN STORE(key,LOAD(key) + value)
End Function |
SC Arguments: [Name:SC_ACTION Type:uint64 Value:'1' Name:SC_CODE Type:string Value:'Function Initialize(ctrl String) Uint64
10 IF EXISTS("maxSupply") THEN GOTO 100
20 STORE("maxSupply",100000000000000)
30 STORE("totalSupply",100000000000000)
40 STORE("name","Leaf Token")
50 STORE("symbol","LEAF")
60 STORE("decimals",5)
70 STORE("ctrl",ctrl)
80 SEND_ASSET_TO_ADDRESS(SIGNER(),100000000000000,SCID())
99 RETURN 0
100 RETURN 1
End Function
Function Burn() Uint64
10 STORE("totalSupply",LOAD("totalSupply") - ASSETVALUE(SCID()))
20 RETURN 0
End Function
Function UpdateIcon(url String) Uint64
10 IF ASSETVALUE(HEXDECODE(LOAD("ctrl"))) != 1 THEN GOTO 100
20 STORE("image_url",url)
99 RETURN 0
100 RETURN 1
End Function
Function DisplayToken() Uint64
10 add(ADDRESS_STRING(SIGNER()),ASSETVALUE(SCID()))
99 RETURN 0
End Function
Function RetrieveToken(amount Uint64) Uint64
1 DIM storedAmount as Uint64
2 DIM signerString as String
3 LET signerString = ADDRESS_STRING(SIGNER())
4 LET storedAmount = LOAD("owner_" + signerString)
5 IF amount > storedAmount THEN GOTO 13
6 SEND_ASSET_TO_ADDRESS(SIGNER(), amount, SCID())
7 LET storedAmount = storedAmount - amount
8 IF storedAmount == 0 THEN GOTO 11
9 STORE("owner_" + signerString, storedAmount)
10 RETURN 0
11 DELETE("owner_" + signerString)
12 RETURN 0
13 RETURN 1
End Function
Function add(key String, value Uint64) Uint64
10 IF EXISTS(key) THEN GOTO 20
11 RETURN STORE(key,value)
20 RETURN STORE(key,LOAD(key) + value)
End Function' Name:ctrl Type:string Value:'9840ab9e6b2a9487af6b63a3d9ef291e30e98a1f766357f848571b0fdcac9684' Name:entrypoint Type:string Value:'Initialize'] |