11 votes
Accepted

Ethereum/Solidity dev here, looking to migrate some Solidity contracts onto Tezos. Was hoping to have some light shed on a few questions

In response to question 4: Reuse and modularity We discuss reuse and modularity, of which inheritance is one of many mechanisms: Michelson has no mechanism for code reuse, except for calling existing ...
arvidj's user avatar
  • 2,378
7 votes

Ethereum/Solidity dev here, looking to migrate some Solidity contracts onto Tezos. Was hoping to have some light shed on a few questions

Here is a complement to Arvid's answer regarding Archetype: Reuse and modularity Indeed Archetype's extensions are reusable codes to add features to a contract. For example, using the 'transferable' ...
Benoit Rognier's user avatar
6 votes
Accepted

How to retrieve data from smart-contract using javascript?

As of the current Babylon protocol and the upcoming Carthage, the RPC only provides you the ability to retrieve the value for a known key that you provide to the RPC. But even in this scenario you ...
cousinit's user avatar
  • 1,999
5 votes

Ethereum/Solidity dev here, looking to migrate some Solidity contracts onto Tezos. Was hoping to have some light shed on a few questions

Do Archetype/Ligo provide everything that Michelson can currently do, or are there limitations with either? I think if something is possible in Michelson and not in Ligo, it is probably a bug worth ...
Raphaël Cauderlier's user avatar
5 votes
Accepted

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

Your understanding is quite correct. SmartPy is a Python library, not a Python-inspired language so we use Python everywhere and overload Python's constructions. This approach is called meta-...
FFF's user avatar
  • 3,260
5 votes
Accepted

Using sp.create_contract to generate pseudorandom numbers on-chain

For the example provided by Rafael, you can do the following in SmartPy. import smartpy as sp class Creator(sp.Contract): def __init__(self): self.init(address = sp.none) @sp....
Rodrigo Quelhas's user avatar
5 votes
Accepted

Error in Inter contract call from a contract to quipuswap dex2 contracts swap entrypoint

The contract giving you this error is KT1F8Ei743RE8wH4BEdpq2uuqoHgb6jkfuJe, which is a FA1.2. The error code is 75. Running Factori's analyze command, factori analyze kt1 --network ghostnet ...
user3078439's user avatar
4 votes
Accepted

Where are the API docs for SmartPy?

I believe what you are looking for is this: sp.send(sp.address("tz1"), sp.tez(420)) I can't find much documentation for sp.send but I have seen many SmartPy examples with sp.send and sp.amount
Isaiah Heath's user avatar
4 votes

Ethereum/Solidity dev here, looking to migrate some Solidity contracts onto Tezos. Was hoping to have some light shed on a few questions

With respect to question 3, following @ezy remark, SmartPy has some inlining capabilities including with new opcodes as shown in the Inline Michelson template (of the new version, currently https://...
FFF's user avatar
  • 3,260
4 votes
Accepted

How to create a mapping in smartpy ? Do we need to define the datatypes of the key & value like in solidity?

No, you do not need to specify the type of the keys of values. Instead, without needing the declare the map, you simply use it and the types are inferred. To construct a mapping called m, use m = sp....
arvidj's user avatar
  • 2,378
4 votes
Accepted

Taquito default entrypoint not found

The contract you point to takes a single parameter of type address. Thus, as you write, it only has the default entrypoint. In taquito, the main entry point can be call through contract.methods.main. ...
arvidj's user avatar
  • 2,378
4 votes

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

You have to do it manually... Here's one approach for compute log(x) assuming you are representing x as a fraction find integer m through binary search such that 2^m <= x < 2^(m+1) (m may be ...
Arthur B's user avatar
  • 4,599
4 votes

Can we have a Time clocked transaction in Tezos?

You have access to a "time" with sp.now so you can compute conditions, etc. There is nothing like "send in 30 minutes". You need external input to trigger operations Tezos. You can ...
FFF's user avatar
  • 3,260
4 votes
Accepted

How can I avoid sp.TOption type when using sp.unpack()?

sp.unpack gives you an option (because Michelson gives an option when you call UNPACK) that you need to open. You can do it like this myBytes = sp.unpack(packedString, t = sp.TBytes).open_some(...
FFF's user avatar
  • 3,260
4 votes
Accepted

Best Language to Use with Tezos

First of all, Fi is no longer updated and Liquidity no longer supports Tezos, which leaves Ligo, SmartPy, Michelson and Morley. To this list, I would also add Archetype. All of these languages can be ...
arvidj's user avatar
  • 2,378
4 votes
Accepted

How to store and load custom FA2 NFT metadata?

Your code above has some issues that I will describe below. Also, you are confusing off-chain metadata with on-chain metadata, tzip16 and tzip21 allow those structures because they were designed to be ...
Rodrigo Quelhas's user avatar
4 votes
Accepted

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

You can do this by simply adding a time check. import smartpy as sp class TimedCall(sp.Contract): def __init__(self): self.init( time_limit = sp.timestamp_from_utc_now()....
Anshu Jalan's user avatar
4 votes
Accepted

Using dummy address for randomization

The address of these dummy contracts depends directly on the hash of the transaction, so it can be easily manipulated by the one creating it. So if the transactions are created by users, they can ...
LucasF's user avatar
  • 126
3 votes

How to retrieve data from smart-contract using javascript?

We maintain an index of all historic bigmap data at TzStats. To fetch all current keys and values in a bigmap call https://api.tzstats.com/explorer/bigmap/:id/values If your bigmap is very large you ...
Alexander Eichhorn's user avatar
3 votes
Accepted

Type error, (sp.TRecord(addr = sp.TAddress)) is not (sp.TUnit) in smartPy

Contratry to my initial answer, as FFF pointed out, the problem is that an entrypoint in SmartPy cannot return a value to the calling contract, nor in the underlying Michelson language. The typical ...
arvidj's user avatar
  • 2,378
3 votes

How do I get a list of a Tezos smart contract KT1 address entrypoints and its parameters?

The SmartPy contract explorer allows you to see all the entry point of a given contract in any of the networks (main and test) along with autogenerated forms to interact with all those entrypoints. ...
Ezy's user avatar
  • 6,064
3 votes

How do I get a list of a Tezos smart contract KT1 address entrypoints and its parameters?

To find all the entrypoints and their types using tezos-client you can use the following command: tezos-client get contract entrypoints for <src> To check a specific entrypoint you can also ...
Tomáš Zemanovič's user avatar
3 votes
Accepted

How to deploy a smart contract influenced by UI inputs using ConseilJS and SmartPy generated Michelson?

I cannot answer all your questions but at least, I can say that, in SmartPy.io, the storage sent to ConseilJS is the content of the tab "Storage" (in either Michelson or Micheline formats) and the ...
FFF's user avatar
  • 3,260
3 votes

set a ui to allow to nodes interact via smartpy contract

Give ConseilJS a try. Here’s a set of tutorials: https://medium.com/the-cryptonomic-aperiodical/blockchain-development-with-tezos-698aa930e50f If you just want straight code samples, check this out:...
Crypto Mike's user avatar
3 votes
Accepted

How to delegate the balance of a smart contract?

1) How does an originated KT address delegate to a baker? During the origination of a smart contract, an initial delegate can be set. After origination, only the smart contract itself can change its ...
Raphaël Cauderlier's user avatar
3 votes
Accepted

How to get a contract storage data from another contract in smartPy?

There are several example templates, such as FA2 (real world token contracts) and Collatz (small demo and test template). https://www.smartpy.io/dev/?template=FA2.py https://www.smartpy.io/dev/?...
FFF's user avatar
  • 3,260
3 votes

Calling view of Fa1.2 contract

I am unsure how to interpret params.target, so i modified getBalance by adding an entrypoint and address @sp.entry_point def getBalance(self, params): sp.transfer(sp.as_nat(self.data....
Vinnyson's user avatar
  • 515
3 votes

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

I have a contract for binary log that uses few multiplications and can be adjusted for any fixed point precision: https://github.com/Sophia-Gold/michelson/blob/master/log2fix.tz. I don't think it can ...
Sophia Gold's user avatar
3 votes

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

You are guaranteed (if the crypto behind Tezos is not broken) that the person who signed the transaction knew the corresponding private key (in case of an implicit account) so, for all reasonable ...
FFF's user avatar
  • 3,260
3 votes
Accepted

Is it possible to convert types in SmartPy?

Yes and no. There are no built-in convertors in Michelson. Some operations are doable nonetheless. For example, the string manipulations template demonstrates kind of extreme string manipulations in ...
FFF's user avatar
  • 3,260

Only top scored, non community-wiki answers of a minimum length are eligible