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 can I check if an address is a contract vs account (or how can I convert an address to a string) in archetype?

There are two very common special cases for which you can simply restrict your contract to implicit accounts: if the address you want to check is the sender of the operation, you have the guarentee ...
Raphaël Cauderlier's user avatar
3 votes
Accepted

How to call an entrypoint from the current contract?

The called entrypoint must be defined before the calling entrypoint: entry anotherEntryPoint() { effect { const dothings = "things done"; } } entry callAnotherEntryPoint() { ...
dzonda's user avatar
  • 101
3 votes

Smart contract availability and diversity on Tezos

We can confirm that LigoLANG is used by the following open-source projects: Quipuswap, Yupana, cTez, Juster, Vortex DEX, Flame DeFi, Deku Sidechain, TzPortal Bridge.
Marigold_Dev's user avatar
2 votes

Smart contract availability and diversity on Tezos

I can confirm that SmartPy is used by the following dApps (I restrict to the TOP 10 most used): objkt.com, fx hash, Hic et Nunc (repos), Teia (contract), Versum, Plenty, Kolibri (harbinger contracts), ...
Jordan_tez's user avatar
  • 1,041
2 votes
Accepted

Random number on-chain

There are a few things you can do: If you're playing a two-player game, you can have each player commit to some bytes of their choice, have them open the commitment, and hash the result to get a ...
Arthur B's user avatar
  • 4,599
2 votes

Random number on-chain

The only way to achieve randomness in Tezos smartcontract is to use commit/reveal scheme. There is an audited template contracts in ligo: randomness-jsligo randomness-cameligo You can initiate a ...
Thomas's user avatar
  • 380
2 votes
Accepted

Let bakers pass their own entropy to generate random numbers on chain

That is how randomness for PoS is generated. That plus a VDF. The issue with this scheme is that, while it's quite robust, producing entropy takes quite a long time.
Arthur B's user avatar
  • 4,599
2 votes

How can I perform operations on smartpy sp.TBytes?

What kind of mutation do you want to feature? There is currently no arithmetic operation on bytes but you can compare and concatenate bytes which might be enough for your use case. Or you can switch ...
Raphaël Cauderlier's user avatar
2 votes
Accepted

How do you originate an archetype contract from within a dapp?

there is a completium command to generate the Json Micheline: completium-cli generate michelson mycontract.arl --json This generates a Json structure, whose "code" field is what you pass to ...
Benoit Rognier's user avatar
2 votes

Extracting entropy from bytes

The next protocol Mumbai brings new features to Michelson. It will be possible to perform logical operations on bytes, including converting between bytes and integers. Documentation
Rodrigo Quelhas's user avatar
2 votes
Accepted

How to extract content of an archetype option, but fail if content is `none`?

short answer is: const lastBuyerConst ?= lastBuyer : "EXPECTED_SOME_BUYER" fail is an instruction that takes anything as a parameter, hence it is called fail() or fail("SOMETHING")...
Benoit Rognier's user avatar
2 votes
Accepted

Archetype Error: types have seperate declarations of a private property '_content'

it is a npm error message relative to two package versions, experiment-ts and archetype-ts-types (the former has a dependency on the later). Either there is an issue in the last versions of these ...
Benoit Rognier's user avatar
2 votes
Accepted

How can I convert duration to int or nat in archetype?

try to divide by 1s, for example: transfer (d/1s * balance) to grum where d is a duration value; the division of duration returns a rational, and you can multiply rational by tez.
Benoit Rognier's user avatar
2 votes
Accepted

Got this error during ghostnet deployment, "No case matched: At /kind, unexpected string instead of endorsement"

In sp.emit(), spaces should not be given on tag. sp.emit(tag="eventGenerated") if you are giving space, then there will be an issue.
Kin's user avatar
  • 184
2 votes

Can you update the storage of an external contract and retrieve the updated storage item via on-chain view in the same contract call?

View calls are executed immediately but the transfers are not (they are delayed until the end of the execution of the script) so in particular, calling the same view of the same contract several times ...
Raphaël Cauderlier's user avatar
2 votes
Accepted

archetype: how to remove the bytes that are prepended by the pack() routine

the slice builtin returns an option as mentioned here. Hence you need to extract the value from the option, with ?= assignment instruction for example: var byt2 ?= slice(str3, 0, 6) : "...
Benoit Rognier's user avatar
2 votes
Accepted

HttpRequestFailed with taq originate counter.tz from quickstart

I faced the exact same error going through taqueria Quickstart guide. Just like you, I used node 19 version, but on Linux. I saw the issue that you created and noticed that reinstalling the node ...
ztepler's user avatar
  • 158
2 votes

What's wrong with my calculation of fees and burn here?

You need to multiply paid_storage_size_diff by 250, instead of 1000, because according to the current procotol constants cost per byte is 0.000250 tez. Also, don't forget to add +100 in the fees ...
Groxan's user avatar
  • 2,691
2 votes
Accepted

How to write enum in smartPy?

SmartPy offers the variant system (see doc for new and legacy syntax). It's more powerful than enum as they associate a value with a type so you can create enum with them and even more. Basically an ...
Jordan_tez's user avatar
  • 1,041
2 votes

Rollup Q&A: Why are Tezos "enshrined" rollup better than Ethereum smart contract rollup?

Response from whalesniper ETH rollups are built into specific contracts. So imagine I deploy my own KT1 which has a multisig and a bunch of rollup commitment logic or whatever. This rollup is built ...
greeneye12's user avatar
2 votes

Creation of a FA2 Token (Fungible) and not an NFT

FA2.0 standard doesn't describe how to distinguish NFT from non-NFT, so there is actually no way to precisely tell what your token is. TzKT uses heuristics to classify tokens. In particular, it ...
Groxan's user avatar
  • 2,691
1 vote

Using Pytezos to Properly call a smart contract with correct parameters ( to purchase token from objkt )

Your destination contract doesn't seem to have a fulfill_ask entrypoint. https://tzkt.io/KT1KXXZ758wtyf2NBjWKPeXugDh5Mm7kyckw/entrypoints And according to betterCallDev, there is no deployed Tezos ...
iguerNL's user avatar
  • 1,141
1 vote
Accepted

How do we achieve a variable type of struct in smartPy

In SmartPy it corresponds to records. With the new syntax: import smartpy as sp @sp.module def main(): Asset: type = sp.record( coinName=sp.string, value=sp.nat, ) ...
Jordan_tez's user avatar
  • 1,041
1 vote
Accepted

Do partitions reduce gas usage?

short answer is 20. Indeed partitions are compiled as set containers of identifiers. So your usage of partitions seems good 👍.
Benoit Rognier's user avatar
1 vote
Accepted

How can I assign values for a map-type in an archetype test script?

I think you should try with this: const tmdMap : Array<[ string, Bytes ]> = [[" ", tmdBytes]] In typescript, tuple and array have the same literal []. And here, it is a tuple into an ...
Guillaume Duhamel's user avatar
1 vote

How can I assign values for a map-type in an archetype test script?

The expected type reads "an array of pairs of string and bytes", and [" ", tmdBytes] is just a pair, hence I guess the following value should make ti: const tmdMap : Array<[ ...
Benoit Rognier's user avatar
1 vote
Accepted

NatValidationError when deploying an archetype contract with taquito

Because the storage is a nat, Taquito expects a number as the storage (not an object): ttk.wallet.originate({ code: testJSON, storage: 0, }) I imagine Archetype would give a name to the storage ...
Claude Barde's user avatar
1 vote
Accepted

Vanity address generator for contracts

The problem is that the address of a smart-contract is the hash of parameters including for example the timestamp of the block in which the contract is originated. unlike implicit addresses which are ...
charles Dehlinger's user avatar
1 vote
Accepted

Is there an equivelant of javascript template literals in archetype?

sorry for late reply. Short answer is no, not as you describe it, but it is possible to embed any value in an fail value thanks to tuple. fail(("A MESSAGE", feeOne, feeTwo, feeTotal));
Benoit Rognier's user avatar

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