Questions tagged [types]
The types tag has no usage guidance.
17
questions
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.
...
3
votes
1
answer
49
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 ...
3
votes
1
answer
142
views
Is it possible to convert types in SmartPy?
For example, converting a TMutez into a TString?
2
votes
1
answer
68
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?
2
votes
1
answer
37
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 ...
2
votes
2
answers
33
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 ...
2
votes
1
answer
69
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 ...
2
votes
1
answer
125
views
Convert address to string in LIGO
How do I convert an address type to a string type in LIGO?
2
votes
0
answers
46
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 ...
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 ...
1
vote
1
answer
23
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 ...
1
vote
1
answer
33
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,...
1
vote
1
answer
27
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 ...
1
vote
1
answer
63
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 ...
1
vote
1
answer
72
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 ...
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 ...
0
votes
1
answer
50
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 ...