9

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) ...


9

This is an obsolete example. Contract calls do not return values anymore (it should not be in the repo). Have a look here instead (contract calls create operations that are executed sequentially after the calling contract execution terminates, note that the operations must be returned in order at the end).


8

You can use Loop.left (with and accumulator) but it is easier to use List.fold and tail recursive functions (those are encoded with loops). Here is a way to do it (you can call the entry point test with parameter [{name="A"; value=5}; {name="B"; value=10}; {name="C"; value=20}] and storage [{name="A"; value=15}; {name="B"; value=8}; {name="C"; value=15}; {...


8

It's not clear what decrypting data from within a smart contract would achieve since all operations are public.


8

There are currently no encrypt/decrypt instructions for Michelson. You can view the full list of instructions here: http://tezos.gitlab.io/mainnet/whitedoc/michelson.html


8

If what you mean is a non-predictable source of randomness, no, there is none. Any information that could be used for that could either be predictable by a user, or tempered by a malicious baker. You should probably use an external source of randomness, as the oracle presented in here. An improvement of that would be to use commitments, i.e. the oracle ...


7

So apparently, this feature is no longer available in Liquidity, and the docs are incorrect in this case. You can read a reply from Liquidity Lead Dev here.


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 '...


6

Actually, error 57: Synopsis and description must not be both empty should be seen as a warning emitted by opam. The reason of the failure is given at the end. It's due to absence of some system dependencies. Try to install them as follows before recompiling Liquidity: sudo apt-get install libcurl4-gnutls-dev libsodium-dev


5

If you use the next branch of Liquidity, you can use : liquidity CONTRACT.liq --call-arg main '{ name = "test"; sig = "abcd" }' to print the argument to be used by tezos-client (where main is the entry point you want) liquidity --re CONTRACT.liq to directly compile a file in ReasonML syntax (add the --re argument in the previous command also) (the double ...


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 ...


4

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

Turns out this supposed to be passed like this: '(Pair "tz1PKKC9NTsxxfwYpg1bVAY5k5AKuPYe9gpg" "KT1GE2AZhazRxGsAjRVkQccHcB2pvANXQWd7")'


4

You cannot create a contract and call it immediately. It goes like this, chronologically: Your script is running. You invoke CREATE_CONTRACT or CREATE_ACCOUNT. An operation and address are returned and your script continues on. The operation will create the account after your script returns it. Right now, the account does not exist. You now immediately try ...


4

You cannot exceed the hard_gas_limit_per_operation = 400000. It will probably be increased in future protocols, though (see e.g. the "Athens" proposals). Internal transfers can use up a lot of gas. First, there is a fixed cost of 10000 gas per transfer. Second, and more importantly, when a contract is 'parsed', the contract's entire code and storage are ...


4

Indeed, Liquidity does not implement deep pattern-matching as in OCaml or Reason. You have to match only one level (constructor or tuple) at a time. We hope to be able to improve that in later versions.


4

This is the 'optimized' Micheline representation of an address value. In the future, I think we should extend the client and RPC a bit, to make things easier here. For now... You can see optimized encoding referenced in parse_data and unparse_data for the address type. The encoding is defined in contract_repr.ml. There is a 'tag' byte first: If the ...


4

As per the Michelson spec you need to use the correct calling convention. You should use the following: (Pair "this is a string" "a signature string") One other obeservation - Why do you have SWAP repeated? This effectively returns the stack to how it was.


3

You may want to follow this project: https://medium.com/tezos/introducing-ligo-a-new-smart-contract-language-for-tezos-233fa17f21c7 Not many answers for now, syntax apart, it looks like Liquidity or Fi.


3

After compiling in the liquidity IDE, we see that the type of the storage is storage (pair :storage (map %candidates string int) (map %voters address bool)); For the initialization, the annotations (:storage,%candidates and %voters) can be ignored. As you can see, the type of the storage is a pair of values: the map of candidates and the map of voters. ...


2

One way is to build the deploy command using https://fi-code.com/ . You can build the command by specifying the contract code in fi, the initial storage and balance, and the manager, then pressing "Deploy" button. Test deployment in Alphanet is strongly recommended before doing this directly to the Mainnet.


2

There are no Michelson ops for formatting values as strings. Unless a protocol change adds such operations, it seems that the best way to convert mutez (or int, nat) to string will be to write the algorithm manually: First, we can convert mutez to nat by dividing by 1 mutez, using EDIV. Now we can do a loop, iteratively dividing the nat value by 10, again ...


2

You are using a private key which do not correspond to any account on the alphanet. It works with liquidity --tezos-node http://alphanet-node.tzscan.io:80 --private-key edsk2j7Ka5nRzh2QkGCtcD1dFLbHYvYw7XAafWL3YEAQQ3Zd61NiqS --protocol alphanet simple.liq --deploy Main contract Simple New contract KT18bLbXyH5yMY9ShDfCwtiXegWHMTa4aS8H deployed in operation ...


1

Hehey, ok if this is true, it is sad. but i found a solution; liquidity -> .liq -> .tz and deploy with tezos-client. :) – candlez Jan 6 at 15:00


1

In Liquidity/Michelson, a program does not return a value. It returns the new storage and a list of new operations. So, the equivalent of a function returning a value is actually a program that takes a contract and transfers to this contract, with the value as argument. The contract will do whatever it is supposed to do with the balance, in the case of token....


1

tuples indexing can only work with static constant indexes in languages with static typing like Liquidity and OCaml, otherwise you cannot know the type of an expression like (1, "string", true)[x] without knowing the value of x(which you don't at compilation time) (c) doublexone


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