I'm following the https://baking-bad.github.io/pytezos/#originate-contract refs to originate a contract. I suspect that it has something to do with how I usually iniatialize the storage, so if anyone can help me with that I would be really greatful, I'm digging it forever.
While trying to deploy I get the following error:
Michelson error:
Traceback (most recent call last):
File "<ipython-input-47-c91371e05a4c>", line 1, in <module>
runfile('~/testpytezos.py', wdir='~')
File "~/.local/lib/python3.6/site-packages/spyder_kernels/customize/spydercustomize.py", line 827, in runfile
execfile(filename, namespace)
File "~/.local/lib/python3.6/site-packages/spyder_kernels/customize/spydercustomize.py", line 110, in execfile
exec(compile(f.read(), filename, 'exec'), namespace)
File "~/testpytezos.py", line 33, in <module>
op = pytezos.origination(script=contract.script()).autofill().sign().inject()
File "/usr/local/lib/python3.6/dist-packages/pytezos/operation/group.py", line 171, in autofill
raise RpcError.from_errors(OperationResult.errors(opg_with_metadata)) from None
MichelsonRuntimeError: ({'id': 'proto.005-PsBabyM1.michelson_v1.unexpected_annotation',
'kind': 'permanent',
'location': 8},)
Micheline error:
File "/home/crzy/Documents/hicetnunc/tezos-storage-flask/testpytezos.py", line 30, in <module>
contract = Contract.from_file('./smart_contracts/transaction_micheline.tz')
File "/usr/local/lib/python3.6/dist-packages/pytezos/michelson/contract.py", line 306, in from_file
return cls.from_michelson(f.read())
File "/usr/local/lib/python3.6/dist-packages/pytezos/michelson/contract.py", line 296, in from_michelson
return cls(michelson_to_micheline(text))
File "/usr/local/lib/python3.6/dist-packages/pytezos/michelson/micheline.py", line 493, in michelson_to_micheline
return michelson_parser().parse(data)
File "/usr/local/lib/python3.6/dist-packages/pytezos/michelson/grammar.py", line 163, in parse
return self.parser.parse(code)
File "/usr/lib/python3/dist-packages/ply/yacc.py", line 333, in parse
return self.parseopt_notrack(input, lexer, debug, tracking, tokenfunc)
File "/usr/lib/python3/dist-packages/ply/yacc.py", line 1201, in parseopt_notrack
tok = call_errorfunc(self.errorfunc, errtoken, self)
File "/usr/lib/python3/dist-packages/ply/yacc.py", line 192, in call_errorfunc
r = errorfunc(token)
File "/usr/local/lib/python3.6/dist-packages/pytezos/michelson/grammar.py", line 152, in p_error
raise MichelsonParserError(p)
MichelsonParserError: LexToken([,'[',1,0)
context:
python code:
with open('./faucets/tz1WGhT231BgqK7CrjbMB5xDsbdDSBJZiw5E.json') as json_file:
data = json.load(json_file)
pytezos = pytezos.using(
key='./faucets/tz1WGhT231BgqK7CrjbMB5xDsbdDSBJZiw5E.json',
shell='babylonnet')
r = requests.post('http://hicetnunc.glitch.me/api/reveal', json=data)
print (r.json().get('privateKey'))
pytezos.using(key=r.json().get('privateKey'))
contract = Contract.from_file('./smart_contracts/transaction.tz')
print(contract.script)
op = pytezos.origination(script=contract.script()).autofill().sign().inject()
Michelson smartcontract code:
parameter (or (or (nat %divisor) (unit %double)) (nat %value));
storage (nat %storedValue);
code
{
DUP;
CDR;
SWAP;
CAR;
IF_LEFT
{
IF_LEFT
{
PAIR;
DUP;
CAR;
PUSH nat 5;
SWAP;
COMPARE;
GT;
IF
{
}
{
PUSH string "WrongCondition: params.divisor > 5";
FAILWITH;
};
DUP;
CDR;
DUUP;
CAR;
EDIV;
IF_SOME
{
CAR;
}
{
PUSH string "division by zero";
FAILWITH;
};
SWAP;
DROP;
NIL operation;
PAIR;
}
{
PAIR;
DUP;
CDR;
PUSH nat 2;
MUL;
SWAP;
DROP;
NIL operation;
PAIR;
};
}
{
PAIR;
DUP;
CAR;
SWAP;
DROP;
NIL operation;
PAIR;
};
}