예제 #1
0
def main(operation: int) -> Any:

    # create an array
    stuff = ['a', 3, ['j', 3, 5], 'jk', 'lmnopqr']

    # serialize it
    to_save = StdLib.serialize(stuff)
    put('serialized', to_save)

    if operation == 1:
        return to_save

    elif operation == 2:
        to_retrieve = get('serialized')
        return to_retrieve

    elif operation == 3:

        to_retrieve = get('serialized')
        deserialized = StdLib.deserialize(to_retrieve)
        return deserialized

    elif operation == 4:

        to_retrieve = get('serialized')
        deserialized = StdLib.deserialize(to_retrieve)
        return cast(list, deserialized)[2]

    return False
예제 #2
0
def search_storage(prefix: str) -> dict:
    data_list = {}
    data = storage.find(prefix)

    while data.next():
        data_list[data.value[0]] = StdLib.deserialize(
            cast(bytes, data.value[1]))
    return data_list
예제 #3
0
def search_storage(prefix: str) -> dict:
    data_list = {}
    data = storage.find(prefix)

    while data.next():
        iterator_value = data.value
        key: str = iterator_value[0]
        serialized_value: bytes = iterator_value[1]
        value = StdLib.deserialize(serialized_value)
        data_list[key] = value
    return data_list
예제 #4
0
def deserialize_arg(arg: bytes) -> Any:
    return StdLib.deserialize(arg)
예제 #5
0
파일: Itoa.py 프로젝트: CityOfZion/neo3-boa
def main(value: int, base: int) -> str:
    return StdLib.itoa(value, base)
예제 #6
0
def Main(key: str) -> bytes:
    return StdLib.base64_decode(key)
예제 #7
0
def Main(key: int) -> bytes:
    return StdLib.base58_decode(key)
예제 #8
0
def serialize_sequence() -> bytes:
    return StdLib.serialize([2, 3, 5, 7])
예제 #9
0
def main() -> str:
    return StdLib.json_serialize(b'unit test')
예제 #10
0
def main(mem1: ByteString) -> int:
    return StdLib.memory_compare(mem1)
예제 #11
0
def main(mem: ByteString, value: ByteString, start: int) -> int:
    return StdLib.memory_search(mem, value, start)
예제 #12
0
def Main(key: int) -> str:
    return StdLib.base58_encode(key)
예제 #13
0
def main():
    StdLib.atoi(10, 10)
예제 #14
0
def serialize_int() -> bytes:
    return StdLib.serialize(42)
def main(mem1: ByteString, mem2: ByteString, arg: Any) -> int:
    return StdLib.memory_compare(mem1, mem2, arg)
예제 #16
0
def serialize_bool() -> bytes:
    return StdLib.serialize(True)
예제 #17
0
def main() -> str:
    return StdLib.json_serialize(True)
예제 #18
0
def main():
    StdLib.itoa()
예제 #19
0
def store(prefix: str, value: Any):
    serialized_value = StdLib.serialize(value)
    storage.put(prefix, serialized_value)
예제 #20
0
def main() -> int:
    return StdLib.atoi()
예제 #21
0
파일: Atoi.py 프로젝트: CityOfZion/neo3-boa
def main(value: str, base: int) -> int:
    return StdLib.atoi(value, base)
예제 #22
0
def main():
    StdLib.itoa('123', 10)
def Main(key: int) -> str:
    return StdLib.base64_decode(key)
예제 #24
0
def main(mem: ByteString, value: ByteString) -> int:
    return StdLib.memory_search(mem, value)
예제 #25
0
def main(key: int) -> bytes:
    return StdLib.base58_check_decode(key)
예제 #26
0
def main(json: str) -> Any:
    return StdLib.json_deserialize(json)
예제 #27
0
def main(item: Any) -> str:
    return StdLib.json_serialize(item)
def main(key: int) -> str:
    return StdLib.base58_check_encode(key)
예제 #29
0
def main(mem: ByteString, value: ByteString, start: int,
         backward: bool) -> int:
    return StdLib.memory_search(mem, value, start, backward)
예제 #30
0
def deserialize_arg() -> Any:
    return StdLib.deserialize(1)