Skip to content

Invalid or misplaced code on line xyz - Parse error? #20

Description

@moodmosaic

Getting weird output with the following contract:

docker run ghcr.io/njordhov/clariform --version
0.4.0

docker run ghcr.io/njordhov/clariform \
"https://raw.githubusercontent.com/kenrogers/cargo/cf56971900c62fc1058e942fc48186dee90c4063/contracts/cargo.clar"
Invalid or misplaced code on line 28: (
Invalid or misplaced code on line 29: (
Invalid or misplaced code on line 38: (
Invalid or misplaced code on line 38: "
;; cargo
;; a simple decentralized shipment tracker

;; constants
(define-constant err-shipment-not-found (err u100))
(define-constant err-tx-sender-unauthorized (err u101))

;; data maps and vars
(define-data-var last-shipment-id uint u0)
(define-map shipments uint {location: (string-ascii 25), status: (string-ascii 25), shipper: principal, receiver: principal})

;; private functions
;;

;; public functions
(define-public (create-new-shipment (starting-location (string-ascii 25)) (receiver principal))
    (let
        (   (new-shipment-id (+ (var-get last-shipment-id) u1)))
        ;; #[filter(starting-location, receiver)]
        (map-set shipments new-shipment-id {location: starting-location, status: "In Transit", shipper: tx-sender, receiver: receiver})
        (ok "Shipment created successfully")))

[:invalid "("]

define-public (update-shipment (shipment-id uint) (current-location (string-ascii 25)))
    [:invalid "("]

let
    (   (previous-shipment (unwrap! (map-get? shipments shipment-id) err-shipment-not-found))
        (shipper (get shipper previous-shipment))
        (new-shipment-info (merge previous-shipment {location: current-location})))
    (asserts! (is-eq tx-sender shipper) err-tx-sender-unauthorized)
        ;; #[filter(shipment-id)]
    (map-set shipments shipment-id new-shipment-info)
    [:invalid "("]

ok [:invalid "\""]

Sh

Invalid or misplaced code on line 1: "
Invalid or misplaced code on line 1: )
Invalid or misplaced code on line 2: )
Invalid or misplaced code on line 3: )
ipment updated successfully

[:invalid "\""]

[:invalid ")"]
[:invalid ")"]
[:invalid ")"]

;; read only functions
(define-read-only (get-shipment (shipment-id uint))
    (ok (unwrap! (map-get? shipments shipment-id) err-shipment-not-found)))

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions