Questions tagged [smart-contracts]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0 votes
1 answer
58 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&...
user avatar
2 votes
1 answer
100 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?
user avatar
0 votes
1 answer
56 views

tqtezos / minter-sdk installation issue

I am trying to run below command for minter-contract on my local machine and getting error npm i @tqtezos/minter-contracts no such file or directory, chmod ‘/node_modules/@tqtezos/minter-contracts/...
user avatar
1 vote
2 answers
59 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 ...
user avatar
  • 51
0 votes
1 answer
90 views

Calling contract deployed on Tezos sandbox using Taquito

I've a simple contract deployed on Tezos sandbox (https://assets.tqtezos.com/docs/setup/2-sandbox/) and I'm using Taquito in frontend to call this contract. Earlier, I deployed the contract to global ...
user avatar
  • 51
1 vote
1 answer
66 views

How to fetch list of known addresses in Taquito?

Just like we can run tezos-client list known contracts to get a list of deployed contracts and any user accounts, is there a way to do the same using Taquito? So, in short, I've RPC address and wish ...
user avatar
  • 51
3 votes
3 answers
160 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 ...
user avatar
  • 51
0 votes
3 answers
81 views

Is there an equivalent of the Ethereum "selfdestruct" opcode in Tezos?

In Ethereum you can implement a selfdestruct opcode in a smart contract to remove its code from the blockchain and free up storage space. Is there an equivalent on Tezos ?
user avatar
  • 103
2 votes
1 answer
146 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(...
user avatar
  • 1,973
2 votes
1 answer
99 views

Can a smart contract know its own address?

Is it possible to create a smart contract that knows the value of its KT1 address? E.g. if you wanted the contract to check that there was a signature signed over its contract address, would it be ...
user avatar
  • 639
0 votes
1 answer
23 views

decidability of real world contracts

I'm wondering if there has been any work done on the decidability of real world, legal contracts. Michelson is great because it lends itself to users bring able to write smart contracts that are ...
user avatar
0 votes
1 answer
27 views

Checking total amount sent to a contract (ever) within the contract execution

I'd like to create a contract that behaves a certain way based on how much total tez has been sent to the contract. How should I track and check the total amount ever sent to a contract? Example: ...
user avatar
  • 233
1 vote
2 answers
117 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 ...
user avatar
  • 557
2 votes
1 answer
86 views

Node issues with multiple transactions to the same smart contract (FA1.2)

I was wondering if there is any explanation available to some unexpected behavior when trying to make multiple transactions to the same smart contract. Transaction We have an FA1.2 token whereby we ...
user avatar
  • 187
1 vote
1 answer
55 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 ...
user avatar
  • 557
1 vote
1 answer
78 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 ...
user avatar
  • 557
2 votes
1 answer
120 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 ...
user avatar
  • 557
2 votes
1 answer
136 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 ...
user avatar
  • 557
1 vote
1 answer
323 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 ...
user avatar
  • 557
1 vote
1 answer
35 views

How to migrate existing smart contract data to a new one when needing additional storage requirements?

Obviously the first answer is to try to avoid running into this scenario by having some flexibility in storing additional fields using maps (example). However, let's think about the scenario where ...
user avatar
  • 557
1 vote
1 answer
78 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 ...
user avatar
  • 557
1 vote
1 answer
27 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 ...
user avatar
  • 557
1 vote
1 answer
140 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 ...
user avatar
  • 557
1 vote
2 answers
141 views

How to fetch all the values in a big map using taquito?

Per the BigMapAbstraction Taquito API docs, there isn't a way to fetch all the values in that map. Is the suggested way to fetch all of values in the map by doing batch queries on it then? Or what's ...
user avatar
  • 557
1 vote
1 answer
76 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 ...
user avatar
  • 557
3 votes
1 answer
183 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 ...
user avatar
  • 557
0 votes
2 answers
132 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 ...
user avatar
  • 557
0 votes
1 answer
155 views

How do I transfer tez while invoking a smart contract using Taquito?

const op = await contract.methods .buy(contractParams?.height, contractParams?.width) .send(); I have a buy entrypoint and would like to pass in some parameters and some tez at the ...
user avatar
  • 557
2 votes
1 answer
445 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 ...
user avatar
  • 557
0 votes
1 answer
83 views

What is the one-time 0.257 tz burn fee?

I have deployed a contract on a test net and I want to send some tez to it to test out some operations. When I try to send through Temple wallet, I get: Failed Unable to estimate transaction to ...
user avatar
  • 119
0 votes
1 answer
72 views

Get entrypoint operation (get_entrypoint_opt) fails

I have some troubles to call a contract. This is the scenario: Contract B (Entrypoint method "transfer"): (pair %transfer (bytes %args1) (pair (string %args2) ...
user avatar
1 vote
2 answers
114 views

Read another contract's storage without making a transaction?

Is it possible for contract X to read the storage of contract Y without making a transaction? I think I understand how I can make X call a function on Y using a callback pattern. But since I only want ...
user avatar
  • 1,973
4 votes
1 answer
99 views

Upgradeable Contracts: Proxy Delegate vs Stored Lambdas

There are a number of design patterns for contracts that already exist on Ethereum. For upgradeable contracts, one of them is the use of a Proxy Delegate contract. My understanding is that the Proxy ...
user avatar
  • 670
3 votes
1 answer
68 views

Is it possible to retrieve only a single variable from contract storage?

As far as I can tell using the taquito npm package, in order to get any storage from a contract, you have to get all of a contract's storage. This seems like it can become highly inefficient if you ...
user avatar
  • 31
0 votes
1 answer
48 views

Is there a way to list the supported networks from Temple using Taquito?

I'm using Taquito with Temple wallet (prev. Thanos) i my dapp. To connect the wallet I need to do wallet.connect(<name_of_network>). If I'm using the wrong network name here I get an error from ...
user avatar
  • 1,973
0 votes
1 answer
33 views

How is a contract ID generated?

Let's say I have a raw transaction that I broadcast to the network. At what point does its operation hash (opHash) get generated? Is it when the baker is forming the block? And what are the inputs to ...
user avatar
  • 639
1 vote
0 answers
100 views

Random # Generating Smart Contracts

I've had an idea about being able to utilize effectively random #s on tezos, but I don't know if it's totally stupid and impossible to utilize, or a possible and really simple solution: I need to ...
user avatar
  • 65
0 votes
1 answer
71 views

Cannot get transfer entrypoint

I'm trying to call an FA1.2 transfer function from another contract. Here is my endpoint in the FA1.2 contract: type action is | Transfer of michelson_pair(address, "from", michelson_pair(...
user avatar
2 votes
1 answer
45 views

What different multisig contracts are supported by `tezos-client`?

What are the different multisig contracts are currently supported by tezos-client and which ones are planned to be supported? What is the difference between them and their respective hashes? Which ...
user avatar
  • 2,348
1 vote
2 answers
221 views

Listen for operations of a deployed contract

Coming from an ethereum web3 background, I'm accustomed to listening for a contract's events to figure out when things happen in my contract and react accordingly in the application. I'm looking for ...
user avatar
  • 133
1 vote
1 answer
119 views

Why are formal proofs and verification important for smart contracts?

On the Ethereum blockchain, there is a lot of talk about formal proofs and verification of smart contracts. In particular, ERC20 tokens and various exchange contracts will mention that they are ...
user avatar
  • 670
1 vote
1 answer
137 views

Smart contracts - get tz address from signature like ecrecover ethereum

I want to be able to verify that a signature is signed by a public key's address in my smart contract method on tezos. For example with solidity see: https://ethereum.stackexchange.com/questions/2171/...
user avatar
  • 133
2 votes
1 answer
218 views

Tezos on a ERC20 Wallet

Sorry in advanced, my english is not the best. but i have to try. Situation: I bought Tezos on the Binance App. Then i sent all the Tezos to my Wallet (ERC20 Wallet). Now its not showing on the wallet,...
user avatar
0 votes
1 answer
183 views

proto.007-PsDELPH1.storage_exhausted.operation when originating contract (storage_limit is set)

I am trying to deploy a contract to delphinet with truffle. On a local sandbox the contract deploys just fine, but for the deployment on Delphi I am getting: proto.007-PsDELPH1.storage_exhausted....
user avatar
  • 11
0 votes
1 answer
89 views

"Invalid bytes error" on migration of PascalLigo contract

I am trying to write tests for my contract, which stores an user as follows: type userData is record [ addressSet : set(bytes); storedAmount : tez; ] My storage is a big_map as ...
user avatar
  • 11
1 vote
1 answer
219 views

SmartPy Contract: Receive a balance?

I'm learning SmartPy and I'm trying to make a simple escrow contract. I read that contract.balance can be used to access the balance of a contract. In that case, how would I go about receiving XTZ to ...
user avatar
  • 119
1 vote
1 answer
53 views

How to resolve sp.TKey is not sp.TAddress error in SmartPy?

I have a function like this @sp.entry_point def _verifySigPersonalSign(self,req,sig): sp.verify((req.deadline != sp.timestamp(0)) | (sp.now<=req.deadline), "request ...
user avatar
  • 125
1 vote
1 answer
65 views

How to compare timestamps in tezos smartpy?

req passed to _verifySigPersonalSign will be of type ERC import smartpy as sp ERC = sp.TRecord(sender=sp.TAddress,to=sp.TAddress,deadline=sp.TTimestamp) class StoreValue(sp.Contract): @sp....
user avatar
  • 125
0 votes
2 answers
85 views

How can I save the gas cost of operations when running contracts in sandbox pytest?

I am testing smart contracts in sandbox mode using python scripts. I want to be able to store how much an operation cost. So for example when I get the output of a contract origination after baking a ...
user avatar
  • 639
1 vote
2 answers
163 views

Implementing Contract Metadata (tzip-16) on an already originated FA1.2 Smart Contract

Referring to the documents and examples of tzip-16, how would one implement the contract metadata on a Fa1.2 contract on SmartPy? In order to provide balance updates and offchain events.
user avatar
  • 495

1 2
3
4 5
7