We changed our privacy policy. Read more.

Hot answers tagged

10

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 "library" contracts directly. As far as I understand, Archetype includes no user-extendable mechanisms for code reuse. Actions (akin to methods) ...


6

Ad 1. I am not sure whether it is what you look for, but look at: https://smartpy.io/demo/ SmartPy offers different tools: Analytics: elements of the UI in SmartPy.io to analyse smart contracts and their properties; SmartML: a virtual machine written in OCaml; Compiler: used to translate contracts from SmartML to Michelson; Python library: facilitates the ...


6

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' extension on a role adds to the contract the necessary actions (ie entry points) to transfer the role to another address. For example, invoking the '...


5

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 reporting, the Ligo devs usually quickly answer these kinds of issues. Archetype however is purposely not Turing complete and in particular you cannot do ...


4

Here is the preview version of truffle tools for working with smart contacts in Tezos: https://www.trufflesuite.com:8443/docs/tezos/truffle/quickstart


4

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 considered production-ready and well-documented. Your choice of implementation language should rather be guided by your specific needs. What type of testing ...


4

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://SmartPy.io/dev). It's accessible here: https://smartpy.io/dev/index.html?template=inlineMichelson.py. import smartpy_michelson as mi ... @sp.entry_point ...


3

In your example, you send a transaction that calls the increment entry point of the contract. For that to happen, the transaction will have to be included in a block and, as you mention, blocks come about every minute. However, a single block could contain many such transactions and, as a result, the counter could be incremented by more than one during the ...


3

You should type the Big_map.empty. For instance (I do not know the type of your big map): (Big_map.empty : (nat , token) big_map)


2

Here is the corrected version of createArtwork: let createArtwork (store, id, ihash : artwork_storage * artworkId * ipfsHash) : artwork_storage = Map.update (id : artworkId) (Some ({ artist = Tezos.self_address; owner = Tezos.self_address; ipfsArtworkAddress = ihash; } : artwork)) store You had switched place on the actual record and the ...


2

Here's the parameter values to initialize storage for the fa1.2 contract. It is working well on my side. If you want to more look at pascaligo syntax, you can visit ligolang doc pages on https://ligolang.org/docs/language-basics/maps-records and https://ligolang.org/docs/tutorials/get-started/tezos-taco-shop-smart-contract/#populating-our-storage-in-a-dry-...


2

You cannot convert an address to a string in Michelson. You could cheat by going through pack and inspecting the binary representation but it is unlikely something you would want to do.


2

Accumulating the results to a linked list, and reversing the result would be more concise (and efficient, because your implementation traverses the entire input list, while this only looks at the prefix): let take (count: int) (input: message list): message list = let rec go (acc, n, xs: message list * int * message list): message list = if n <= 0 ...


2

SmartPy is a smart-contract programming language on its own. You can use the Online IDE or use your local IDE and test the contracts with the CLI. You can find more information here: Help Section Example contract: Example Side note: Both SmartPy and Ligo languages allow you to compile to Michelson, neither of them depends on each other.


2

Unfortunately, the string type in Michelson is restricted to : [...] the printable subset of 7-bit ASCII, namely characters with codes from within [32, 126] range, plus the following escape characters \n, \, ". As LIGO compiles to Michelson, we'll not have emojis in LIGO. How, indeed, will we crypto? 🤦🏻 But, do not fret! A major advantage of Tezos ...


1

On top of Rodrigo’s answer. In scenarios, every call generates the corresponding Michelson parameters. https://smartpy.io/docs/scenarios/testing#registering-and-displaying-calls-to-entry-points


1

You can use sp.add_expression_compilation_target("<name>", <expression>) https://smartpy.io/docs/compilation_targets#expression-compilation And then you can compile it with: ~/smartpy-cli/SmartPy.sh compile <...> The parameters will be generated inside the <output-directory> you provided. EDIT: In the web IDE, you can find ...


1

Not yet. This is in the works though, and you are welcome to help if you are interested :)


1

It worked as soon as I provided the HEX of the addressSet[] values. Maybe someone can explain why this is the case. I stumbled upon this solution after trying out for hours by accident.


1

In PascaLIGO and CameLIGO, the block comments are anything (including UTF-8 encoded glyphs) between (* and *). In ReasonLIGO, the delimiters are /* and */. In all three LIGO syntaxes, line comments are introduced by //.


1

Yes, you can, using exactly the same syntax. For instance, in CameLIGO, you could write let x = Bytes.pack "toto\n\x53woo".


1

In LIGO entrypoint name corresponds to your router enum value types, not function names. So "Transfer" should start with uppercase letter. In you case you should call it as follows: Tezos.get_entrypoint_opt("%Transfer", s.tokenAddress)


1

The one I raised the question above, map.add is not a function that returns a map, instead it returns unsigned int. So, one of the correct ways is, function addCreditor (const creditor : address ; const lendingValue : nat ; var s : contract_storage) : contract_storage is begin // If debtor and the creditor is same, skip if s.debtor = creditor then ...


1

If nobody gets back to you soon you can always contact the Ligo team directly on Telegram at: https://t.me/LigoLang You can also find them on Twitter at: https://twitter.com/ligolang And can file an issue if necessary at: https://gitlab.com/ligolang/ligo/issues


1

As far as I know, you have to create the default storage for your contract when you deploy it and that's when you will instantiate your storage (and your empty map), so I don't think it is necessary to instantiate it in the contract. Did you try to compile the contract with the instantiated empty map? I use ReasonLigo more than PascalLigo, but the docs ...


1

You could use Tezster-CLI for setting up local environment and use Tezster-Bundle to develop,deploy and test your contracts. Tezster-CLI: https://github.com/Tezsure/Tezster-CLI Tezster-Bundle: https://github.com/Tezsure/Bundle-react


1

Use the function failwith with a string argument describing the error, and cast it to the desired type if necessary (for example, if you are in an expression), like so: failwith ("My error"); or (failwith ("My error") : my_expected_type) Note the parentheses around the string, as failwith is a function, not a keyword.


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