/ test / contracts / bytes_to_x.aes
bytes_to_x.aes
 1  include "String.aes"
 2  contract BytesToX =
 3  
 4    entrypoint to_int12(b : bytes(12)) : int = Bytes.to_int(b)
 5    entrypoint to_int32(b : bytes(32)) : int = Bytes.to_int(b)
 6    entrypoint to_int42(b : bytes(42)) : int = Bytes.to_int(b)
 7    entrypoint to_int64(b : bytes(64)) : int = Bytes.to_int(b)
 8    entrypoint to_int65(b : bytes(65)) : int = Bytes.to_int(b)
 9  
10    entrypoint to_str12(b : bytes(12)) : string = Bytes.to_str(b)
11    entrypoint to_str32(b : bytes(32)) : string = Bytes.to_str(b)
12    entrypoint to_str42(b : bytes(42)) : string = Bytes.to_str(b)
13    entrypoint to_str64(b : bytes(64)) : string = Bytes.to_str(b)
14    entrypoint to_str65(b : bytes(65)) : string = Bytes.to_str(b)
15  
16    entrypoint hex(b : bytes(4)) = String.concat("0X", Bytes.to_str(b))
17    entrypoint comp_hex(x : string, y : bytes(4)) = x == String.concat("0X", Bytes.to_str(y))