Hot answers tagged

2

That was fixed in granadanet by this merge request: https://gitlab.com/tezos/tezos/-/merge_requests/2815 You need to add self.add_flag("initial-cast") in the contract constructor to solve the issue until mainnet adopts the new protocol.


2

Doing math on nats casts them to an int. The value needs to be casted back to a nat after the subtraction: self.data.shop_items[item_to_purchase.key].amount = sp.as_nat(self.data.shop_items[item_to_purchase.key].amount - item_to_purchase.value)


2

SmartPy test interpreter already handles internal operations failures really well. Here is an example: https://smartpy.io/ide?cid=QmV3nwdkwHGXdJbWwV8LDgm3TPbC49Es7Wm6GufMeh8Pz2&k=184987b7b8089b73396a Please, don't provide incomplete examples. I always find myself wasting tremendous amounts of time just to put those examples to work.


1

It is not possible to cast an int to a string in Michelson. I recommend you to have static error messages, such as: class Errors: SOME_ERROR = "SOME_ERROR" # some contract class Contract(sp.Contract): ... x_i = (sp.to_int(params.x + I)) y_j = (sp.to_int(params.y + j)) sp.failwith(Errors.SOME_ERROR) SmartPy also gives you the option to ...


1

Both transactions sent from your address have the same fee 0.01 tez that is not enough, taking into account the gas limit 50000. Try to set the fee 0.015 tez. If this doesn't help, it also can be a problem with the node you use, so try to use another one, like Tezos Giga Node. And yes, operations stay in the mempool for only an hour, however TzKT explorer ...


1

Don't worry, your funds are safe. You need to wait a bit and then try again with a higher fee or lower gas_limit. Why did that happen? You sent a transaction with large gas_limit: 50000 (despite a simple tz-to-tz transfer consumes about 1427 gas) and rather small, for such gas limit, fee:10000. So no one baker picked your transaction to include into a block ...


1

A common cause of transfer errors from KT1 accounts is that there is not enough tez in the manager account to cover the fee.


Only top voted, non community-wiki answers of a minimum length are eligible