Questions tagged [types]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
1 vote
1 answer
21 views

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

I am trying to submit a Pair of Bytes in a contract call with Taquito but am receiving an error. The contract interaction documentation does not go into exactly how to submit a Pair, but it does go ...
user avatar
  • 399
1 vote
1 answer
31 views

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

Tests are throwing a to_value error in the scenario when trying to unpack a record that contains a key with a bounded type TNat inside the entrypoint being called. There's a minimal reproduction below,...
user avatar
  • 399
3 votes
1 answer
41 views

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?

I am trying to do some maths operations inside an on-chain view and am getting an unexpected result. The reproduction contract tries to perform the following steps: Define an internal contract ...
user avatar
  • 399
2 votes
1 answer
34 views

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

With the raw address 0x0000861299624c9a3b52be10762c64bac282b1c02316 the first 4 characters (0000 in this case) represent tz1 and the rest of the string is the raw Tezos address. From my research it ...
user avatar
  • 399
2 votes
0 answers
44 views

How to use internal hacks to convert from String to Address (or from Address to String) in SmartPy

There is a similar question but it does not fully answer this question. In the answer for that question posted here there is mention that while it is officially not possible it is actually technically ...
user avatar
  • 399
1 vote
1 answer
25 views

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

When I return a list from an on-chain view am receiving a type error but am unsure where to set the type in order to fix it. Returning a string or integer from the view works fine. Is there a set ...
user avatar
  • 399
2 votes
2 answers
31 views

Smartpy restrict entrypoint for originated addresses (KT1)

I would like to know if the entrypoint of my smart contract is called from an implicit(tz1) or an originated address(KT1). How can i do the check in smartpy? Looking at the Smartpy documentation, it's ...
user avatar
  • 23
2 votes
1 answer
62 views

How much storage do numbers take?

I'm trying to figure out how byte storage works for numbers. What size is a Nat vs an Int in bytes? Or, is there a way to encode a u8 vs a u64?
user avatar
  • 576
1 vote
1 answer
59 views

value is invalid for type

I'm trying to call the addLiquidity entrypoint of this contract, which is a copy of the Liquidity Baking CPMM contract, which is itself a copy of the Dexter contract. The original Dexter docs give an ...
user avatar
2 votes
1 answer
60 views

Smartpy Michelson errors only on deployment (inconsistent_annotations, inconsistent_types)

Getting this error ONLY when deploying the smartpy contract. There are otherwise no errors when testing/compiling the code. Is there a way to get a better error message? Is there a way to trigger ...
user avatar
  • 557
0 votes
1 answer
45 views

error Type sp.TInt / sp.TNat mismatch

Error: Type sp.TInt / sp.TNat mismatch sp.is_nat expects a sp.TInt Got: sp.TNat line 119 Line: 119 self.data.shop_items[item_to_purchase.key].amount -= sp.as_nat(item_to_purchase.value) I'm ...
user avatar
  • 557
1 vote
2 answers
62 views

What is a 'valid case' for bls12_381_fr?

I am trying to originate a contract using bls12_381_fr types and am running into an error. The same contract originated successfully on the edo branch of the Metastate repository. Now I am running the ...
user avatar
  • 647
3 votes
1 answer
63 views

How can I avoid sp.TOption type when using sp.unpack()?

Within my smartpy contract, I want to convert from one type into another using sp.pack() and sp.unpack. Below is an example of the method I am trying to use, converting a string to bytes. ...
user avatar
  • 647
1 vote
1 answer
68 views

What's the best way to convert from TMutez to TBytes?

Previously when I asked about converting types, I got this useful suggestion: For mutez, you could start to convert to int (by dividing by 1 mutez) and then use the same techniques. I'm wondering if ...
user avatar
  • 647
1 vote
1 answer
36 views

How to format storage for a contract call with parameters?

I am trying to construct the storage needed to do an on chain contract call but I'm having trouble passing in the parameters. What is making it tricky is that one of the parameters is of type ...
user avatar
  • 647
3 votes
1 answer
135 views

Is it possible to convert types in SmartPy?

For example, converting a TMutez into a TString?
user avatar
  • 647
2 votes
1 answer
118 views

Convert address to string in LIGO

How do I convert an address type to a string type in LIGO?
user avatar