deploy

โดย convex-dev

ปรับใช้ actor (สัญญาอัจฉริยะ) ไปยังเครือข่าย Convex ใช้เมื่อผู้ใช้ต้องการสร้าง actor บนเชนใหม่ที่มีฟังก์ชันที่ส่งออก

npx skills add https://github.com/convex-dev/convex --skill deploy

Deploy a Convex Actor

Actors are autonomous on-chain programs with their own address, state, and callable functions.

See the convex-lisp skill for CVM conventions and error codes. Deploying is a transaction, so it needs a key the user has supplied — see transact.

Actor Structure

A typical actor deployment:

(deploy
  '(do
     ;; Internal state (private to the actor)
     (def counter 0)

     ;; Callable functions: mark each with ^:callable so it can be
     ;; invoked from outside the actor via (call ...)
     (defn ^:callable increment []
       (set! counter (+ counter 1))
       counter)

     (defn ^:callable get-count []
       counter)))

Key Rules

  • deploy returns the new actor's address (e.g. #12345)
  • Only functions tagged with ^:callable metadata can be called from outside (there is no export form). The equivalent map form is ^{:callable true}
  • Use set! to update an existing def from inside a function; plain defs declared in the actor body are private state
  • Actors have their own *address* and *balance*
  • Use (set-controller #ADDR) inside the actor to set who can upgrade it
  • deploy also accepts a vector of code forms, which is how library builders are composed into one actor: (deploy [(@convex.fungible/build-token {…}) (@convex.fungible/add-mint {…})])

After Deployment

  1. Note the returned address for the user
  2. Optionally register a CNS name: (*registry*/create 'my.actor.name #NEW-ADDR) — needs control of the parent namespace; see the cns skill
  3. Test by calling a ^:callable function: (call #NEW-ADDR (get-count))

Workflow

  1. Help the user design the actor based on $ARGUMENTS
  2. Write the Convex Lisp source
  3. Deploy using transact with the (deploy ...) expression
  4. Verify the deployment with a test query

Skills เพิ่มเติมจาก convex-dev

convex-lisp
convex-dev
เอกสารอ้างอิงภาษา Convex Lisp — ข้อกำหนด CVM, การเรียกใช้โค้ดไลบรารี, นิยามแอ็กเตอร์, juice และรหัสข้อผิดพลาด ใช้เมื่อเขียนหรือดีบักซอร์ส CVM สำหรับ…
ecosystem
convex-dev
การปฐมนิเทศในระบบนิเวศ Convex — อะไรอยู่ใน repository ใด, เอกสาร spec และ docs อยู่ที่ไหน, และมี client libraries ใดบ้าง ใช้เมื่อคุณต้องการบริบท...
local-network
convex-dev
เรียกใช้เครือข่ายทดสอบ Convex ในเครื่องเพื่อการพัฒนา ใช้เมื่อทดสอบการเปลี่ยนแปลงกับเครือข่ายจริง จำลองปัญหาจากเพียร์ หรือเมื่อไม่มีเครือข่ายระยะไกล…
protocol-versions
convex-dev
โปรโตคอลเวอร์ชัน การย้ายข้อมูล และการอัปเกรด v1 — ควรเขียนตามความหมายใด และจะเปลี่ยนพฤติกรรมของ CVM ได้อย่างไรโดยไม่ต้องแยกเครือข่าย ใช้เมื่อ…
etch
convex-dev
ตรวจสอบและบำรุงรักษา Etch store — ฐานข้อมูลแบบ content-addressed ของ Convex ใช้เมื่อตรวจสอบพื้นที่จัดเก็บของ peer วินิจฉัยความเสียหายของข้อมูล การเก็บขยะ หรือ…
juice
convex-dev
การคิดบัญชี Juice — ต้นทุนของการคำนวณและแบนด์วิดท์บน CVM ใช้เมื่อพิจารณาเกี่ยวกับต้นทุนการดำเนินการธุรกรรม วินิจฉัยความล้มเหลว :JUICE หรือ…
trust
convex-dev
Trust monitors — โมเดลการอนุญาตบนเชนที่ประกอบได้ของ Convex ใช้เมื่อเขียนการควบคุมการเข้าถึง จำกัดฟังก์ชันของนักแสดง กำหนดว่าใครสามารถ mint หรือ…
memory
convex-dev
การบันทึกบัญชีหน่วยความจำและวงเงิน — ต้นทุนของการจัดเก็บข้อมูลบนเชน และวิธีลดและเรียกคืนต้นทุนดังกล่าว ใช้เมื่อพิจารณาเกี่ยวกับการเติบโตของสถานะ วิเคราะห์…