Examples: query, "exact match", wildcard*, wild?ard, wild*rd
Fuzzy search: cake~ (finds cakes, bake)
Term boost: "red velvet"^4, chocolate^2
Field grouping: tags:(+work -"fun-stuff")
Escape special characters +-&|!(){}[]^"~*?:\ - e.g. \+ \* \!
Range search: properties.timestamp:[1587729413488 TO *] (inclusive), properties.title:{A TO Z}(excluding A and Z)
Combinations: chocolate AND vanilla, chocolate OR vanilla, (chocolate OR vanilla) NOT "vanilla pudding"
Field search: properties.title:"The Title" AND text
Answered
Standard method for defining opcodes in func?

Hello,

I've been exploring different repositories and noticed inconsistencies in how opcodes are defined. For example, in the ft and nft implementation within the token-contract repository, opcodes are defined as follows:

int op::transfer() asm "0x5fcc3d14 PUSHINT";

However, in the liquid-staking-contract repository, the definition is quite different:

const int op::nft_transfer = 0x5fcc3d14;

While I understand that these are essentially the same, I'm curious about the more commonly accepted or standard method for defining opcodes in func

Additionally, I've observed that the ft and nft implementation in the token-contract repository might be outdated. It uses builder_null from stdlib.fc in this repo, but the stdlib.fc in the official documentation doesn’t include it.

Could someone clarify these points for me?

  
  
Posted 2 months ago
Edited 2 months ago
Votes Newest

Answers 2


Newer versions of FunC compiler added support for const, so in newly written code, you may use this feature, or use the old approach. Both are supported.

The const way of defining a constant is similar to other programming languages, so it can make your code easier to understand for readers.

1
1
Posted 2 months ago

Thank you for the clarification!

Also, I think the nft standard implementation should be updated. It currently uses builder_null?, which no longer exists in stdlib, and defines opcodes using the outdated method. This can be confusing, especially for newcomers to the language

  
  
Posted 2 months ago
5K Views
2 Answers
2 months ago
2 months ago