Example #1
0
def do_begin(ctx: Context, prim, args, annots):
    p_type_expr = ctx.get('parameter')
    assert p_type_expr, f'parameter type is not initialized'

    entrypoint = next((a for a in annots if a[0] == '%'), '%default')
    ctx.print(f'use {entrypoint}')

    network = ctx.get('NETWORK')
    if network:
        ctx.print(f'use {network}')

    p_val_expr = restore_entry_expr(val_expr=args[0],
                                    type_expr=p_type_expr,
                                    field_annot=entrypoint)
    parameter = ctx.big_maps.pre_alloc(p_val_expr,
                                       p_type_expr,
                                       copy=True,
                                       network=network)

    s_type_expr = ctx.get('storage')
    assert s_type_expr, f'storage type is not initialized'
    s_val_expr = ctx.get('STORAGE') if is_prim(args[1], 'STORAGE') else args[1]
    storage = ctx.big_maps.pre_alloc(s_val_expr, s_type_expr, network=network)

    ctx.drop_all()
    run_input = Pair.new(parameter, storage)
    ctx.push(run_input, annots=annots)
Example #2
0
def do_reset(ctx: Context, prim, args, annots):
    network = get_string(args[0])
    assert network in networks, f'expected on of {", ".join(networks)}, got {network}'
    ctx.set('NETWORK', network)
    chain_id = ChainID(Interop().using(network).shell.chains.main.chain_id())
    ctx.set('CHAIN_ID', chain_id)
    ctx.big_maps.reset()
    ctx.drop_all()
Example #3
0
def do_drop_all(ctx: Context, prim, args, annots):
    ctx.drop_all()
Example #4
0
def do_reset_none(ctx: Context, prim, args, annots):
    ctx.unset('NETWORK')
    ctx.unset('CHAIN_ID')
    ctx.big_maps.reset()
    ctx.drop_all()