We changed our privacy policy. Read more.
11

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


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


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

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

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.


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}; {...


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


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


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

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.


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

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


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


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

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

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

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


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

You put the amount of tez you'd like to supply in the amount field, which represents the tez amount transferred to the contract. maxTokensDeposited and minLqtMinted are the maximum number of tokens (tzBTC on mainnet) that you'd like to provide and the number of liquidity tokens you'd like to receive. The market making contract (CPMM) calculates the exchange ...


2

Does this mean that at the end of this 6 month period I would own 0.0596447509723% of that 1296000 xtz, or 772.99597260151 xtz? Only if your share of the liquidity pools does not change in the meantime. If, for example, more liquidity providers join the pool your share will decrease so you will receive less than this. You also risk impermanent loss. Also, ...


1

When liquidity providers deposit tez and tzBTC they receive a liquidity token in return and when they redeem liquidity tokens they receive back tez and tzBTC. The subsidy means they will receive more back than they put in, which you can think of as a "reward" for providing liquidity. See this question for the actual calculations: how to calculate ...


1

One way to think about it is to think about how many lqt would be minted if the transaction hit the contract in its current state and allow for some slippage. For example, with 10% slippage, you would let minLqt be 10% lower than what you would get if the transaction hit the contract in its current state. The slippage number for this can be quite higher than ...


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


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