ligo/src/test/contracts/bytes_unpack.religo
2020-03-02 18:01:56 +01:00

15 lines
416 B
Plaintext

let id_string = (p : string) : option(string) => {
let packed : bytes = Bytes.pack (p);
((Bytes.unpack (packed)) : option (string));
};
let id_int = (p : int) : option (int) => {
let packed : bytes = Bytes.pack (p);
((Bytes.unpack (packed)) : option (int));
};
let id_address = (p : address) : option (address) => {
let packed : bytes = Bytes.pack (p);
((Bytes.unpack (packed)) : option (address));
};