Questions tagged [smartpy]

Discussion about the SmartPy language

Filter by
Sorted by
Tagged with
0
votes
0answers
15 views

Packing args in taquito to match sp.pack / PACK

How can i pack on taquito side params so that they match what i would get in smartpy with sp.pack? Say i have params two ints and a string: 1, 3, "something" What do i need to do in taquito ...
1
vote
2answers
29 views

Is it possible to read external smart contract data with smartpy

I would like to make a smart contract (A) where I call an entrypoint on contract B Is it possible to either check the return value of the entrypoint interaction or read a big_map of B's
0
votes
0answers
24 views

missing token metadata

I believe with this operation ooDavbDYs9SkBR4JoaUxTBysvEnd7y1gP1ZDGddQgfQZaURpdjx I have created a token. This is the entry point I called @sp.entry_point def mintDiezDAO(self, params): sp....
1
vote
1answer
19 views

Best way to duplicate/sync private database with FA2 contract transactions & balances

If you wanted a private DB to have all of the transactions,balances etc. of a particular FA2 contract deployed on mainnet, what would be the best way of achieving this? Is it possible to have a ...
0
votes
1answer
17 views

sp.contract from hash key

In the test, I am trying to replace the admin with a fixed account. But I cannot find what t should be. admin = sp.contract( t,"tz1dQXqXZ3Y5sgYwU9Aq9xRJPxEZNUwyE6ht", entry_point = "&...
0
votes
2answers
30 views

Calling Harbinger price contract get method in taquito

I am trying to call the get method of the coinbase normalizer harbinger price contract (KT1AdbYiPYb5hDuEuVrfxmFehtnBCXv4Np7r). Is this the correct way to call the get method, as it doesn't seem to be ...
0
votes
0answers
22 views

is there an implementation of the FA1.2 template in ligo with metadata ( TZIP-016)?

I have find 2 implementations of the FA1.2 template, one in PascaLigo (https://gitlab.com/camlcase-dev/fa1.2/-/blob/master/ligo/fa1.2.ligo) and one in CameLigo https://gitlab.com/ligolang/ligo/-/blob/...
1
vote
2answers
42 views

what is the equivalent of ligo "compile-parameter" for smartpy?

The Smartpy compiler allow to compile a contract (compiling the code and the initial storage) but I don't see any "compile-parameter" option, that would allow to convert a smartpy command to ...
0
votes
3answers
62 views

More than a few hundred NFTs?

Is is possible to use Tezos to make more than 100ish NFTS? Using this template it seems that if over ~100 NFTs are minted, the contracts storage runs out. This is also concerning because it seems if ...
2
votes
1answer
23 views

How to assign a variable based on the output of a function

I cannot figure out how to assign a variable based on the output of a function. I basically want to do this in my __init__ method def square(x): y = x * x return y toSquare = 10 result = ...
2
votes
1answer
39 views

How do I delete an item in a smartpy list

I am trying to figure out how to delete an item from my list that I created with possible_values = sp.range(0, 100, step = 1) I have tried possible_values.pop(index), that doesnt work. I have tried ...
0
votes
0answers
16 views

Is there any default FA2 / FA1.2 config to mint non-transferable tokens?

I am working on a requirement that needs a non-transferable token (similar to ERC 1238 requirement). ie the token can be transferred only from token contract/ admin to the user and the user cannot ...
2
votes
1answer
19 views

How to get the current time/timestamp in smartpy contract?

I deployed a smartpy contract in florencenet via smartpy.io. The command sp.timestamp_from_utc_now() used inside the program seems to be not giving the current time. Instead it is giving the same time ...
1
vote
0answers
26 views

How can we accept USDTZ in smartpy smart contracts, is it even posible?

I was working on a token sale, so is there any way we can accept USDTZ as a mode of payment for the tokens?
0
votes
0answers
87 views

Mint FA2 NFT when contract is called by purchaser

I'm working on a smart contract which allows a caller to "purchase" an NFT simply by calling the contract and providing payment. I'd like the contract to mint the NFT at the time the ...
1
vote
1answer
19 views

Getting error at time of testnet deployment

I was familiarising with smartpy IDE by executing the code as mentioned in the below link https://tezos.b9lab.com/smartpy/exercise-2 However, when I proceeded to deploy the contract, I am getting the ...
1
vote
1answer
256 views

Converting a hash into an int within a range

I have a contract where I'd like to convert a hash (sha256 in this case, but I'm open to any of the other hashing algorithms available) into an Int (or Nat) between 1 and 100. I have the code that ...
2
votes
1answer
85 views

Limiting the time (time/date based) that a contract method can be called

I'd like to publish a contract that allows calls up until a certain time and date. For example, say I want to allow anyone to call it for 1 year after publishing the contract to the blockchain, then ...
2
votes
1answer
132 views

Using sp.create_contract to generate pseudorandom numbers on-chain

In this answer, the answerer suggested that CREATE_CONTRACT could be used to generate a contract address which could then be used as a seed for a pseudorandom number in a contract. What would a simple ...
1
vote
1answer
35 views

Tweaking FA1.2 to add level based balance snapshots to assist token voting in a DAO

DAOs functioning on a token voting mechanism (using either FA1.2 or FA2) mostly require the locking up of tokens for the entirety of the voting period essentially to prevent double-voting or any form ...
2
votes
1answer
28 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 ...
0
votes
1answer
24 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 ...
0
votes
1answer
37 views

Error: list indices must be integer, not Expr

I am trying to get the first N prime numbers in the following way: @sp.entry_point def n_primes(self, num): primes = [2] p = sp.local("p", 1) i = sp.local("i&...
2
votes
1answer
39 views

Smart contract break for loop in smartpy

I need to break a for loop in smartpy, but break does not work. Is there any other solution I could use?
1
vote
2answers
31 views

Keeping original sender in inter-contract call

I have a token contract (let's say it TC) and creating a contract Wallet. Now, is it possible for a user to call Wallet's entrypoint deposit which will do an inter-contract call to TC's transfer ...
2
votes
3answers
51 views

Big map of map vs Big map of pairs

In the FA2 example (https://smartpy.io/ide?template=FA2.py) with multiple assets, we are using a big map of pairs (of user and token). Another option might be storing big map mapping users to another ...
0
votes
0answers
22 views

how to work with map of map

I have a structure that looks like this: struc = sp.TRecord( addr = sp.TAddress, value = sp.TNat ) struct2 = sp.big_map( tkey=sp.TAddress, tvalue=sp.TMap( sp.TNat, sp....
2
votes
1answer
65 views

Variable callback entrypoint in smartpy

Is it possible to use a variable as the entry_point for a callback in smartpy? This works: @sp.entry_point def getProofs(self, address, callback_address): c = sp.contract(...
0
votes
1answer
32 views

sp.if not working as it should

I am using sp.if in an internal function, then I call it in an entry point, but whatever I enter in sp.if, it always is read as "True". Why? And how to fix it? My code : def is_something(...
0
votes
2answers
52 views

What's the best IDE and language to create a FA2 Token?

Does SmartPy provide the best interface to do it? https://smartpy.io/ide?template=FA2.py Does this example provide everything you need to create your own token? Any help would be appreciated.
0
votes
0answers
18 views

Can anyone refer me to a good code example that creates a Token crowdfunding STO/IDO/ICO contract in Tezos?

Can anyone refer me to a good code example that creates a Token crowdfunding STO/IDO/ICO contract in Tezos? (Comparable to ERC-20 crowdfunding contracts)
1
vote
2answers
76 views

Why is this big map update using up so many bytes?

In this question I asked why so much Tezos was burned when updating 380 cells in a grid. It's surprising to see how many bytes it actually took though. If you look at the transaction, there were 380 ...
1
vote
1answer
107 views

Best way to create FA1.2 token with TZIP016

What is the best way to implement a FA1.2 token with TZIP-016 metadata (symbol, name, decimals...)? I am using SmartPy. So far, I noted two methods: the first one is to implement a FA1.2 token with a ...
1
vote
1answer
46 views

How can I encode a 2D matrix of booleans in the least amount of bytes?

I'm looking at this ethereum smart contract that iterates over an area in a 2D bool matrix to reserve pixels. When looking at a call to that ethereum smart contract for a 20x11 area, it used 0.0315 ...
1
vote
1answer
46 views

What would be the simplest way to connect a smartpy contract to an oracle tracking the XTZ/USD pair?

I see there's a smartpy chainlink oracle example and a github repo for Harbinger. I briefly looked at the code and it appears they are for setting up Oracles + clients. Are there any existing XTZ/USD ...
2
votes
1answer
63 views

How should a contract check whether an address owns a FA2 token created in another contract?

I've broken up my code into 2 contracts. FA2 contract and other one managing its data and providing additional functionality on top. This is to not overload a single contract, however, it does ...
2
votes
1answer
100 views

Is there a list of public repos using smartpy?

I'd like to see more complex examples of smartpy being used in main net contracts. So far, I've found tzcolor's auction house contract SUPER helpful. Are there any other really good examples (that are ...
1
vote
1answer
112 views

How do offchain views work and what guarantees do they provide?

What are the technical differences between offchain views vs onchain entry points? I know one of the differences is that onchain entry points mutate while offchain views don't. Are there any other ...
1
vote
1answer
45 views

How to add new record fields in data storage after contract deployment? Is storing JSON in a field viable?

AFAIK, there is no way to update storage types(ex: can't add a new record field to a Map<sp.Nat, sp.record(a=1)>) of a contract after deployment. (Correct me if I'm wrong). This means, after a ...
1
vote
1answer
23 views

Does smartpy propagate exceptions?

I'm doing something like this, but the invalid scenario assertion fails. Is there a way to propagate the exception from the other contract? Or do I just have to test that contract separately? class ...
1
vote
1answer
56 views

What are good examples of upgradable smartpy contracts using Proxy delegates or stored lambdas?

I'm trying to ensure my contract is upgradable and I learn best by looking at existing examples. Does anyone have any good examples to look at? Here are some links to previous stackoverflow Q&A's ...
0
votes
1answer
30 views

Incompatible parameter error when calling another smart contract

I'm getting this weird error when trying to call the mint entrypoint from another contract... I had additional parameters in the BuyLandRequest and was overriding the TezosHomepageAdNft.mint ...
3
votes
1answer
79 views

Why aren't the offchain views appearing?

I'm extending the smartpy FA2 template # FA2 = sp.import_script_from_url("https://smartpy.io/dev/templates/FA2.py") class TezosLandNft(FA2.FA2): ... which has the following offchain views ...
0
votes
1answer
39 views

How can I do string interpolation on smartpy?

I'm trying to provide better error messages. I've tried several things already that don't work such as regular python fstrings, regular string concatenation. I'm tried to using the sp.string function ...
2
votes
1answer
191 views

How to store and load custom FA2 NFT metadata?

First time I'm writing a smart contract. If anything doesn't make sense at all, feel free to call out what specifically doesn't make sense and suggest a better approach. Thanks! At a high level I just ...
1
vote
2answers
125 views

Best Language to Use with Tezos

There are a lot of options when it comes to coding Smart Contracts on Tezos. My question is simple, which of the supported languages is the best in terms of support, east of use, documentation, and ...
0
votes
1answer
30 views

import_script_from_url syntax

i'd like to ask if it's possible to load another smart contract from an IPFS Hash or from a SmartPy url. What would be the best way to handle them with urls? Contract A: https://smartpy.io/ide?cid=...
0
votes
1answer
64 views

Smartpy transfer contract balance to an address

I'm trying to figure out how to withdraw money from the contract within a smartpy entrypoint, and test the result in my scenario. When I test the entrypoint: @sp.entry_point def withdraw(self, ...
0
votes
1answer
19 views

Is SmartPy package inside All Michaelson Supported Languages?

I've discovered that Liquidity, LigoLang and Ocamel Support Tezos development, but I've only found 1 resource that states that SmartPy supports only LigoLang. I wanted to use the right language to ...
-1
votes
1answer
57 views

Tezos SmartPy Developer Course video 1.2

How do I get find the Tezos test net as opposed to the web browser smart py interface? Regards WF