Questions tagged [smart-contracts]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
1
vote
1answer
30 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 ...
2
votes
1answer
65 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
40 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 ...
1
vote
1answer
38 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
18 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
48 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 ...
1
vote
1answer
20 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 ...
1
vote
1answer
50 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
37 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
17 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
2answers
41 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 ...
1
vote
1answer
22 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
16 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 ...
2
votes
1answer
23 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
21 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 ...
0
votes
1answer
15 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 ...
1
vote
1answer
30 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 ...
1
vote
1answer
75 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
81 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.
0
votes
1answer
34 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 ...
0
votes
0answers
54 views

FA 1.2 Token contract interaction

I want to call an Approve method on a FA1.2 token contract. Michelson code of Approve method at FA1.2 token contract: (pair %approve (address %spender) (nat %value)) My PascaLigo code: type ...
4
votes
1answer
34 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 ...
2
votes
1answer
93 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,...
0
votes
1answer
33 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) ...
0
votes
1answer
27 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(...
1
vote
1answer
50 views

How to create a contract which would delegate XTZs and receive rewards?

I am trying to write a contract that receives rewards from the baker using a default entry point and should only allow me to change the baker from a different entry point. I am using the smartpy tool ...
3
votes
1answer
42 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 ...
1
vote
3answers
39 views

Tezos.get_entrypoint_opt in Ligo issue

I am trying to replace get_contract with Tezos.get_entrypoint_opt I need to transfer FA1.2 tokens in Dex: https://github.com/madfish-solutions/quipuswap-core/blob/master/contracts/Dex.ligo#L21-L28 ...
0
votes
1answer
54 views

Initiate a field in the storage of a contract with the source address of origination

I have the following smart contract where I pass admin address in the init function of the smart contract: (you can run it on smartPy online editor) class SC(sp.Contract): def __init__(self, ...
0
votes
1answer
23 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 ...
0
votes
1answer
13 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 ...
1
vote
0answers
38 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 ...
1
vote
1answer
28 views

Pascaligo map iteration issue

I try to fetch a list of addresses with expired date by appending the address to list(address). However when doing map iteration, it encounters a persistent error says 'not True'. Hope someone can ...
2
votes
1answer
29 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 ...
0
votes
2answers
62 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 ...
1
vote
1answer
39 views

Local variables within smart contracts (Smartpy)

I'd like to share a question that were being worked on Smartpy telegram, and also a few thoughts along the way (it's a long way -- random observation). Some people were talking about local variables ...
1
vote
1answer
332 views

Smart contract transaction of 0 XTZ throwing error from TezBox

I am trying to send transaction to KT1BRudFZEXLYANgmZTka1xCDN5nWTMWY7SZ to complete ledger nano verification using TezBox but I am getting error as below, can someone please guide me? {"status":"...
0
votes
1answer
61 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....
2
votes
3answers
64 views

Originate contract with init

I have a contract of type: pair (pair (list nat) (pair mutez (map address (list nat)))) (pair address (pair address bool)) What is an example of a valid initial storage that can be passed to ...
2
votes
2answers
125 views

smart contract for automatic baking/endorsement rewards to delegators

It seems like a smart contract would be the most natural mechanism to use for implementing a automatic rewards payment system to a baker's delegators, and I'm curious if such a contract is possibly to ...
1
vote
1answer
38 views

Call a method with params that do nothing in a smart contract

I'm trying to invoke a method with parameters that do nothing (blank body) in a smart contract but that doesn't work even if the contract is correctly deployed to the blockchain. Use case: Smart ...
13
votes
3answers
155 views

How can I write tests for my smart contracts?

I like doing TDD and would like to build up a test suite around my contract code. I have been looking at both ReasonML and Liquidity but neither seems to have a great testing story yet. Does it make ...
1
vote
1answer
87 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 ...
9
votes
3answers
188 views

Is there a Tezos equivalent of ERC?

I’d like to read / contribute to existing contract standards on Tezos, is there an open source movement like ERC?
2
votes
2answers
69 views

How do you discover the indexes of the big maps of a contract?

How do you discover the indexes of the big maps of a contract? It seems you would have to inspect the storage, and correlate with the type of the storage, and pick out the numbers that correspond to ...
0
votes
2answers
40 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 ...
0
votes
1answer
38 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/...
1
vote
1answer
60 views

error: Public Cannot be exposed!

const address = 'tz1Qzi4iMowq8z4BEihyU1HvFFxAUXc9PbAF' tezbridge.request({method: 'post_source'}) taquito.Tezos.setProvider({rpc: 'https://rpc.tzkt.io/mainnet', signer: new ...
1
vote
2answers
70 views

Send tezos to contract address after origination using conseiljs

I am trying to send tez from my tz1-AAA account to KT1-AAA contract address means I want my contract address to hold some tez. Disclaimer - I have knowingly replaced some part of address with "....(s)...
2
votes
1answer
54 views

Calling contract invocation operation in loop

I have some set of data which I am trying to push to my smart contract in loop. I use conseiljs to send data to smart contract. Here is the code depicting what I am trying to do. async function ...

1
2 3 4 5