Source Code

(define-data-var executed bool false)
(define-constant deployer tx-sender)

(define-constant wstx-address .wstx)

(define-constant curve-params { optimal-utilization-rate: u85000000 })

(define-public (run-update)
  (begin
    (asserts! (not (var-get executed)) (err u10))
    (asserts! (is-eq deployer tx-sender) (err u11))

    (try! (contract-call? .pool-reserve-data set-optimal-utilization-rate
      wstx-address
      (get optimal-utilization-rate curve-params))
    )

    (var-set executed true)
    (ok true)
  )
)

(define-read-only (preview-update)
  (begin
    {
      new-curve-params: curve-params,
      old-params:
        {
          optimal-utilization-rate: (contract-call? .pool-reserve-data get-optimal-utilization-rate-read wstx-address)
        }
    }
  )
)


(define-public (disable)
  (begin
    (asserts! (is-eq deployer tx-sender) (err u11))
    (ok (var-set executed true))
  )
)

(define-read-only (can-execute)
  (begin
    (asserts! (not (var-get executed)) (err u10))
    (ok (not (var-get executed)))
  )
)

Functions (4)

FunctionAccessArgs
run-updatepublic
preview-updateread-only
disablepublic
can-executeread-only