Questions tagged [smart-contracts]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0 votes
2 answers
59 views

Do FA2 entrypoints need to be at the top level in order to comply with the spec?

Most of the example FA2 implementations I've found, as well as the deployed contracts I've investigated have the required FA2 entrypoints (transfer, balance_of, update_operators) buried in the second ...
Nox's user avatar
  • 131
-1 votes
1 answer
37 views

List inside of Map, or equivalent?

I want to have a list of data in a map so I can find it with the key which is associated with a user, but I get: Error: Type Error sp.TIntOrNat is not sp.TList(sp.TUnknown()) bad type for map value (...
user10431502's user avatar
1 vote
1 answer
42 views

How to compare TKeyHash with TAddress? [SmartPy]

I am writing a smart contract which allows the delegate to be changed. I also want incoming payments to be permissioned. Ideally, I want to update the incoming payment whitelist with the baker's ...
Bake ꜩ for Me's user avatar
0 votes
2 answers
62 views

Problem with XTZ wallet

I have a question about XTZ Currency. 2 years ago I deligate XTZ to baker using TEZBOX and all these time I haven't checked it. But today I found out that the TEZBOX wallet is not available. I ...
telecos's user avatar
1 vote
1 answer
148 views

Calling Harbinger using Smartpy to get randomness

I want to get a random value in my smart contract to provide a fair distribution of different tokens. I read that using Harbinger to get values and use it for entropy could be the good way to do. But ...
Noctambul's user avatar
2 votes
2 answers
104 views

In Michelson, is it possible to get the balance of an arbitrary contract?

In Michelson, is it possible to get the balance of a contract other than the current one? According to the Michelson reference, it's possible for a contract to get its own balance. But, is it possible ...
emchristiansen's user avatar
1 vote
0 answers
65 views

How do I call a tezos smart contract over go

I have deployed a smart contract to my tezos blockchain and want to interact with it. I found the go library tzgo (https://github.com/blockwatch-cc/tzgo) to interact with the blockchain and there is ...
Armend's user avatar
  • 11
0 votes
1 answer
81 views

Is there a more sensible way to convert an int to a string in Cameligo?

Is there a more sensible way to convert an int to a string in Cameligo? Alternatively, is there a way to concatenate an int or nat with a string? type lookup = (int, string) map let lookup: lookup = ...
OrderAndChaos's user avatar
1 vote
1 answer
42 views

Type casting craziness

I am trying to execute this line sp.amount == sp.utils.nat_to_mutez(x) * self.data.y where x is the parameter of an entry point function. These are the following types: sp.amount: sp.TMutez, x: sp....
Mixxer's user avatar
  • 13
0 votes
0 answers
13 views

Stress testing making consecutive calls on a contract's entry point

I want to test calling the same entry point on a smart contract repeatedly. I have a smart contract that might linearly increase the gas it consumes after each consecutive call in the entry point. Of ...
Mixxer's user avatar
  • 13
1 vote
1 answer
91 views

Taquito: error when using "parameter" in withTransfer with Batch API

I am trying to transfer an amount to a contract while calling a contract endpoint using the Batch API provided by Taquito. I've tried passing a parameter object as shown in the Taquito documentation, ...
Iz4's user avatar
  • 21
2 votes
1 answer
52 views

Is there any Sapling contract on mainnet?

Is there on mainnet any deployed Sapling contract that anyone really uses (through tezos-client, as I believe it's the only supported way to do it now)?
Qatrach's user avatar
  • 31
1 vote
1 answer
41 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 ...
redbluegreentoast's user avatar
0 votes
1 answer
34 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 = "&...
Lauzaki's user avatar
0 votes
2 answers
57 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 ...
dev's user avatar
  • 3
1 vote
1 answer
45 views

Liquidity Baking subsidies effect on pool ownership

Assume there are 167,659,347 LQT tokens in the storage of the Liquidity Baking CPMM contract currently. If I have 100,000 LQT (a made up amount for the same of this question), that means I own 0....
Whirlybird's user avatar
0 votes
1 answer
48 views

How to airdrop tokens based on ownership of another token?

How would this work? Would it be like this? Fetch all the addresses that hold token A Iterate over those addresses on off-chain code and programmatically send token B to those addresses
JJJ's user avatar
  • 557
1 vote
2 answers
100 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 ...
MohamedLEGH's user avatar
0 votes
3 answers
104 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 ...
Daniel's user avatar
  • 165
2 votes
1 answer
32 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 = ...
Daniel's user avatar
  • 165
0 votes
1 answer
31 views

Can a FAILWITH error be caused by improper gas_limit or storage_limit?

Sanity check question: Can a FAILWITH error be caused by improper (too low) values of gas_limit or storage_limit? I'm guessing the answer is "no", but I'm debugging and stranger things have ...
emchristiansen's user avatar
1 vote
1 answer
46 views

how does the liquidity baking CPMM round up or down?

I'm not sure how to ask this and I may mess up my mathematical terms, if you think I have then please correct me. When I call addLiquidity on the CPMM, I know that I will be sending tez, and that ...
Whirlybird's user avatar
1 vote
1 answer
49 views

Is it possible to automate an action at a certain interval in a tezos smart contract?

Do you know a design who allow to automate an action at a certain interval ? (for example, call another contract every 20 blocks or something like that). Thanks every one for your help !
user6445's user avatar
1 vote
1 answer
54 views

how to calculate current storage values for liquidity baking CPMM

In looking at the storage values of the CPMM one can see that as of right now the CPMM has the following amounts of tzBTC (represented by the contract as tokenPool), xtz (represented as xtzPool), and ...
Whirlybird's user avatar
0 votes
1 answer
172 views

how to send a nat value other than a whole number

How can I send a nat value to a contract that represents a data type which is not a whole number? For example, the xtzToToken entrypoint of the tzBTC contract allows a user to call the xtzToToken ...
Whirlybird's user avatar
1 vote
1 answer
135 views

how to calculate the value of a single LQT token for Liquidity Baking?

In looking at the Granadanet contract storage, I can see the amount of tzBTC, Tez, and LQT tracked in/by the CPMM. Here are those values as of writing this: tokenPool 45805 xtzPool 111379958864916 ...
Whirlybird's user avatar
0 votes
2 answers
83 views

what is the Liquidity Baking subsidy used for and how do liquidity providers benefit?

I've read the official Tezos docs on liquidity baking. However these docs do not explain how the subsidy will be used, or what it's even for. How will this subsidy be used, and how will liquidity ...
Whirlybird's user avatar
0 votes
1 answer
130 views

call to 'approve' entrypoint of tzBTC contract failing with 'UnsafeAllowanceChange'

I'm trying to call addLiquidity on the Liquidity Baking CPMM. I've already called xtzToToken on the CPMM and given my address tzBTC. I can see that my address has tokens on the tzBTC contract when I ...
Whirlybird's user avatar
3 votes
1 answer
67 views

what's a sensible minLqtMinted to send to the Liquidity Baking CPMM when calling addLiquidity?

I'm trying to understand what a sensible value is for the liquidity token (LQT) parameter when calling the Liquidity Baking CPMM. I'm reading the Dexter docs here, since the CPMM is a fork of the ...
Whirlybird's user avatar
0 votes
1 answer
56 views

Originate smart contract with empty arguments

I try to initialize a smart contract with five arguments being nat * timestamp * nat * timestamp * address. However, I only want to fill the last argument with some value but for the first four I try ...
Michelle Song's user avatar
1 vote
1 answer
79 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 ...
Whirlybird's user avatar
5 votes
1 answer
341 views

How to provide liquidity to the upcoming liquidity baking tez/tzBTC?

I've tried to understand how to interact on the interface on Better Call dev but can't seem to figure it out. When I execute them under simulation I get failed transaction. Where do I insert the ...
CuriousET's user avatar
2 votes
1 answer
103 views

Can't get tzBTC out of the tzBTC Granadanet contract

i'm trying to (eventually) add liquidity to the Liquidity Baking CPMM contract on Granadanet. In order to add liquidity, I need some tzBTC from the tzBTC contract here.. I cannot, for the life of me, ...
Whirlybird's user avatar
1 vote
1 answer
115 views

Contract does not exist

I'm using a Granadanet node to experiment with Liquidity Baking. I'm trying to call the tzBTC contract's mint entry point. This is my first time using a test net, but I thought that it was a copy of ...
Whirlybird's user avatar
1 vote
0 answers
29 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?
Arhan Choudhury's user avatar
4 votes
4 answers
969 views

Any way to get the public key of an address?

I am developing a dapp where I need the public key of an address of the user, is it possible to get the public key in the contract (using SmartPy)? Or even on the client side using taquito or any ...
illusion's user avatar
  • 143
1 vote
1 answer
549 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 ...
Geoff's user avatar
  • 233
3 votes
1 answer
128 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 ...
Geoff's user avatar
  • 233
3 votes
2 answers
366 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 ...
Geoff's user avatar
  • 233
1 vote
1 answer
438 views

Pseudo-random numbers for NFT attribute random generation

I'd like to generate an NFT within a contract and give it a randomly occurring attribute. As I search, it seems that the only fully-secure way to do this is to use an Oracle or build some sort of ...
Geoff's user avatar
  • 233
1 vote
1 answer
48 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 ...
Anshu Jalan's user avatar
0 votes
1 answer
85 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&...
ralex21's user avatar
2 votes
1 answer
137 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?
09214124123's user avatar
0 votes
1 answer
79 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/...
murtza gondal's user avatar
1 vote
2 answers
77 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 ...
tichnas's user avatar
  • 51
0 votes
1 answer
112 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 ...
tichnas's user avatar
  • 51
1 vote
1 answer
90 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 ...
tichnas's user avatar
  • 51
3 votes
3 answers
219 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 ...
tichnas's user avatar
  • 51
0 votes
3 answers
93 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 ?
clement's user avatar
  • 103
2 votes
1 answer
220 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(...
asbjornenge's user avatar
  • 1,973

1 2 3
4
5
9