Skip to content

Ligo test: Timestamp arithmetic returns 'Unbound primitive' error

Timestamp arithmetic seems to not be working in ligo test. It returns an unbound primitive error. Here is a minimal example:

// Minimal e.g.
type storage = timestamp

type parameter =
  Change of timestamp
| Do_nothing

type return = operation list * storage

// Main function
let main (param, store : parameter * storage) : return =
 ([] : operation list),
 (match param with
   Change new_store -> new_store
 | Do_nothing -> store)


// Test 
let test = 
    // initialize contract
    let now = ("2000-01-01t10:10:10Z" : timestamp) in 
    let last_block = now - 3_000 in 
    let init_storage = last_block in 
    let (typed_addr, pgm, size) = 
        Test.originate main init_storage 0tez in 
    ()
Edited by Derek Sorensen