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 ...
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() {
...
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 ...
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.
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 ...
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) : "...
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 👍.
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 ...
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<[ ...
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 ...
Only top scored, non community-wiki answers of a minimum length are eligible