hirosystems / clarinet

Write, test and deploy high-quality smart contracts to the Stacks blockchain and Bitcoin.
https://hiro.so/clarinet
GNU General Public License v3.0
298 stars 131 forks source link

Unable to use the 'replace-at?' function in contract #1407

Closed JoE11-y closed 5 months ago

JoE11-y commented 5 months ago

Describe the bug A clear and concise description of what the bug is.

Unable to use the replace-at? function in a contract, but in clarinet console it works fine. Is there anything I'm doing wrong?

To Reproduce Steps to reproduce the behavior:

(define-private (test) 
  (ok (replace-at? u"ab" u1 u"c"))
)

See error

error: use of unresolved function 'replace-at?'
--> contracts/locker.clar:116:4
  (ok (replace-at? u"ab" u1 u"c"))
   ^~
  (ok (replace-at? u"ab" u1 u"c"))

Expected behavior A clear and concise description of what you expected to happen.

A call made on the clarinet console

>> (replace-at? u"ab" u1 u"c")
(some u"ac")

Screenshots If applicable, add screenshots or consol.log to help explain your problem.

Environment (please complete the following information):

hugocaillard commented 5 months ago

Hello @JoE11-y

It's probably that in your manifest, the clarity version is too low. Because replace-at? was introduced in Clarity 2. See an example here: https://github.com/hirosystems/clarity-starter/blob/main/Clarinet.toml#L9-L12

JoE11-y commented 5 months ago

Whoa man, thanks. It solved that issue and a bunch of others. 🫡