Hot answers tagged

4 votes
Accepted

How much storage do numbers take?

Integers have arbitrary precision, meaning that the only size limit is the gas_limit/storage_limit. $ ./tezos-codec describe ground.Z binary schema +-----------------+----------------------+----------...
user avatar
3 votes
Accepted

Why can I not subtract 2 local variables of type nat from each other and assign that result to another local variable in a view in smartpy?

Subtractions are implicitly taken as int due to the possibility of negative results. Therefore, the variable sub is of type int here. To resolve this, wrap sub as sp.as_nat(sub) on the dividend.
user avatar
3 votes

Which hash function is used when converting an address from raw bytes?

It’s not hashed. You simply need to compute the base58 translation with the right prefix. Proof that it’s not hashed: this process is reversible.
user avatar
  • 3,185
2 votes
Accepted

How do you submit a pair when calling an entrypoint on a contract with Taquito?

Your code is correct, but you have to use the methodsObject property instead of methods if you want to use a JavaScript object as the parameter of the contract call. Alternatively, you can split the ...
user avatar
2 votes
Accepted

Why does unpacking a record that has a key containing bounded data fail with `to_value sp.TBounded` in smartpy?

It is unsafe without a dynamic check. We need to determine what the most natural and/or appropriate decision is (very possibly: continue forbidding it).
user avatar
  • 3,185
1 vote
Accepted

value is invalid for type

As you can see in the explorer, the addLiquidity entrypoint accepts parameter of type (pair address (pair nat (pair nat timestamp)) But you pass (according to the original Dexter contract): (pair (...
user avatar
  • 2,317
1 vote
Accepted

Receiving a "doesn't have a comparable type" error when returning a list from an on-chain view

You cannot compare lists in Tezos. However, you can use scenario.verify_equal.
user avatar
  • 3,185
1 vote
Accepted

Smartpy restrict entrypoint for originated addresses (KT1)

If you are specifically interested in the address of your caller there a simpler solution than the one proposed by @rodrigo-quelhas: sp.sender is an implicit account if and only if it is exactly sp....
user avatar
1 vote

Smartpy restrict entrypoint for originated addresses (KT1)

You can use: https://github.com/RomarQ/tezos-sc-utils Usage: Utils = sp.io.import_script_from_url("https://raw.githubusercontent.com/RomarQ/tezos-sc-utils/main/smartpy/utils.py"); # And ...
user avatar

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