Skip to content

Commit

Permalink
Do not append %default when converting from address to contract
Browse files Browse the repository at this point in the history
  • Loading branch information
m-kus committed Aug 11, 2020
1 parent c0d440a commit 40dd480
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions pytezos/repl/blockchain.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,10 @@ def do_self(ctx: Context, prim, args, annots):
p_type_expr = ctx.get('parameter')
assert p_type_expr, f'parameter type is not initialized'

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

p_type_expr, _ = get_entry_expr(p_type_expr, entry_annot)
p_type_expr, _ = get_entry_expr(p_type_expr, entry_annot or "%default")
res = Contract.new(ctx.dummy_gen.self + entry_annot, type_expr=p_type_expr)
ctx.push(res, annots=['@self'])

Expand Down Expand Up @@ -109,7 +109,7 @@ def check_contract(ctx: Context, address, entry_annot, type_expr):
try:
script = Interop(shell=network).shell.contracts[address].script()
p_type_expr = next(s for s in script['code'] if s['prim'] == 'parameter')
actual, _ = get_entry_expr(p_type_expr, entry_annot)
actual, _ = get_entry_expr(p_type_expr, entry_annot or '%default')
if expr_equal(type_expr, actual):
return True
else:
Expand All @@ -135,7 +135,7 @@ def do_contract(ctx: Context, prim, args, annots):
top = ctx.pop1()
assert_stack_type(top, Address)

entry_annot = next((a for a in annots if a[0] == '%'), '%default')
entry_annot = next((a for a in annots if a[0] == '%'), '')
contract = Contract.new(str(top) + entry_annot, type_expr=args[0])

if check_contract(ctx, address=str(top), entry_annot=entry_annot, type_expr=args[0]):
Expand Down

0 comments on commit 40dd480

Please sign in to comment.