Questions tagged [smart-contracts]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0
votes
1answer
5 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 ...
0
votes
0answers
27 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 ...
0
votes
1answer
16 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(...
2
votes
1answer
21 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
44 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
81 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 ...
0
votes
1answer
32 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/...
2
votes
1answer
77 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
51 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....
0
votes
1answer
50 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 ...
1
vote
1answer
41 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 ...
1
vote
1answer
32 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 ...
1
vote
1answer
21 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....
0
votes
2answers
36 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 ...
1
vote
2answers
60 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.
2
votes
2answers
76 views

How do I get method arguments using Taquito?

When I have a object of type ContractAbstraction<ContractProvider>, I can get a key/value map of all the endpoints in the deployed contract like this: const contract: ContractAbstraction<...
1
vote
1answer
22 views

How un/reliable is the timestamp provided by NOW in Michelson?

To which extend can bakers manipulate the timestamp Michelson uses for NOW? I am not really sure how this value is provided to the smart contract and how reliable/unreliable it can be... Is it safe to ...
1
vote
1answer
23 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
1answer
32 views

In a SmartPy smart contract, is there 'continue' or 'break' for loop?

In a SmartPy smart contract, is there 'continue' or 'break' for loop? When I use 'continue' for loop, an error occurred. 'Error: invalid syntax'
1
vote
1answer
46 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 ...
1
vote
1answer
15 views

Do on-chain contract calls happen atomically?

I have a couple of questions about on-chain contract calls: Suppose two contracts call each other back and forth (let's say 5 times they transfer messages between them), but at on the last transfer, ...
1
vote
1answer
21 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 ...
1
vote
1answer
21 views

How can I manually create an on chain contract call?

Using tezos sandbox mode, I am trying to test an on chain contract call in isolation of the main contract which calls it. If my contract was the Collatz template, it would like be trying to run the ...
1
vote
1answer
15 views

SmartPy: How to test an invalid transaction sent from a contract call

I am testing a contract in SmartPy that uses a contract call (similar to the Collatz example). Contract 'A' sends a transaction to contract 'B' with some data. Contract 'B' does some computation and ...
1
vote
0answers
33 views

Initialize a record storage with command line

I'm trying to initialize the storage of the record through the command line. I'm trying different variations of: "ligo compile-storage college.religo main 4 Adam 1600" For a record called ...
1
vote
2answers
50 views

How can I write On Chain Contract Calls in Tezos Sandbox?

I am trying to write a test case in Tezos Sandbox that uses an On Chain Contract Call. To start with, I am trying to implement the example from SmartPy "On Chain Contract Calls - Collatz" ...
0
votes
1answer
33 views

Terminology of Address Types

What is the terminologi for an address that starts with tz and for one that starts with KT1? The former is controlled by a secret key, and the latter is controlled by a piece of Michelson code that ...
4
votes
2answers
61 views

How to store a really long string on the Tezos blockchain

Let's say I wanted to store an entire article or a manifest on the Tezos blockchain. Something that is bigger than 100kB. How would I go about doing that?
1
vote
1answer
23 views

Tezos source code overview and orientation

I kindly ask if someone can summarize in plain english what are the main functionalities of Tezos and soon after describe for each functionality where are the folders and the files that implement it, ...
1
vote
1answer
55 views

Batching Transactions FA2

On the Tzip for FA2, I read that Every transfer operation MUST happen atomically and in order. If at least one transfer in the batch cannot be completed, the whole transaction MUST fail, all token ...
1
vote
0answers
27 views

Try to confirm fundamental mechanism about the shielded pool

Can we say, in a nutshell, the shielded pool is the integration of the FA1.2 token protocol and the PGP tech? Many thanks!
2
votes
0answers
19 views

In sandbox mode, can you bake a block with a specific timestamp?

I am testing a smart contract that enforces time delays on state transitions. I want to be able to run the bake command and have the latest block have a particular Unix timestamp (e.g. for 1 day ahead ...
2
votes
1answer
28 views

Overflow/ Underflow in Smart Contract

Is Tezos vulnerable to overflow/ underflow attacks on the smart contracts? If yes, how do you recommend to test whether a particular smart contract suffers from it.
1
vote
1answer
32 views

Can we have a Time clocked transaction in Tezos?

I want to make an escrow contract where the transaction can be done after an interval. Is it possible / any hack that can make it happen? The balance should get deducted from the sender beforehand and ...
1
vote
1answer
36 views

How do you do sp.record(sp.pack()) outside of SmartPy?

I have a smart contract which verifies a signature from Bob in order to do something. The contract was made using SmartPy and for testing the scenario I used the following code to produce a signature: ...
3
votes
1answer
84 views

Which operations can change Tezos address balances?

I am writing a program that would monitor changes in balance of a set of Tezos addresses. I did the same for UTXO based coins, and the logic was pretty simple. All of the changes were directly ...
0
votes
0answers
13 views

Can I stake tez into smartcontract and get reward (named for example testtoken) when a new block is baked? [duplicate]

Can I stake tez into smartcontract and get token reward (named for example testtoken) when a new block is baked? Can I create that smartcontract using tezos? I want to get tokens when a block has been ...
1
vote
1answer
22 views

What guarantees do we have when verifying the sender's identity (in SmartPy)?

When we check the address that called the current entry point e.g. in SmartPy: sp.verify(self.data.authorizedAddr == sp.sender) What guarantees do we have? For example, is it possible for someone ...
1
vote
1answer
30 views

Michelson: Parameter vs Storage

I'm struggling to process what the difference between parameter and storage is in Michelson. From what I've been reading, it just looks like two different types of inputs to a contract. So how should ...
2
votes
1answer
83 views

Why does smartpy use sp.for/sp.while instead of the default loops provided by python?

So I just started out with smartpy and I am kinda confused about the point of having separate expression for loops. My understanding is that it is may be because it's a part of on-chain computations, ...
3
votes
4answers
89 views

Is it possible to use natural logarithmic in your smartpy code?

If not,is there any alternative way to implement a natural log component into your smart contract code?
1
vote
1answer
25 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 ...
2
votes
1answer
78 views

FA2 Permission Policies & Hook permission Behaviour

Is there an example of how to use permission policies and hook permission behaviour with regards to FA2 implementation? https://gitlab.com/tzip/tzip/-/blob/master/proposals/tzip-12/tzip-12.md I am ...
4
votes
1answer
89 views

Calling view of Fa1.2 contract

From my understanding, getBalance, getAllowance, getTotalSupply & getAdministrator entrypoint requires another contract to read the values. How will the entry point of the second contract look ...
0
votes
1answer
24 views

Error: ligo: generated. untyped BIG_MAP_EMPTY

In ligo for a smart-contract I have a big_map in my storage and I want to pass nothing in the map as intial_storage value. { name = "stablecoin"; symbol = "eur"; total_supply = ...
2
votes
4answers
79 views

Is there a formula to build parameter messages to be passed to smart contract entrypoints?

When calling a smart contract entrypoint, it is required to pass the needed entrypoint parameters. This is done through a message that must be sent in JSON/Pairs format. My doubt is: Is there a ...
1
vote
1answer
8 views

Error in dry : different keys in tuple and record

I am trying to dry-run one contract on online Ligo IDE, Access function : main Parameters : (10n, ("tz1KqTpEZ7Yob7QbPE4Hy4Wo8fHG8LhKxZSx" : address)) The logo code is compiling fine and I don't ...
3
votes
2answers
25 views

Contract error location

When you call a smart contract and it fails, it returns an error location. For example: {"kind":"temporary","id":"proto.006-PsCARTHA.michelson_v1.script_rejected","location":2624,"with":{"int":"3"}} ...
4
votes
1answer
42 views

Documentation for Serializing Contract Call Data/Parameters

Is there any documentation available for how to serialize contract call parameters? I found good documentation for serialization of general operations and took a look at the tzips but neither seems ...
3
votes
3answers
73 views

How to delegate the balance of a smart contract?

I am looking to create a smart contact that will delegate the funds it is storing. 1) How does an originated KT address delegate to a baker? 2) If a KT address delegates, can it do anything else? I ...