deploy

Развернуть актор (смарт-контракт) в сети Convex. Используется, когда пользователь хочет создать новый ончейн-актор с экспортируемыми функциями.

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

account
convex-dev
Создание или проверка аккаунтов Convex. Используйте, когда пользователь хочет настроить новый аккаунт, проверить детали аккаунта или управлять ключами.
account
convex-dev
Создание или просмотр аккаунтов Convex. Используйте, когда пользователь хочет создать новый аккаунт, проверить детали аккаунта или управлять ключами.
token
convex-dev
Создание и управление взаимозаменяемыми токенами на Convex. Используйте, когда пользователь хочет создать новый токен, проверить балансы токенов или управлять эмиссией токенов.
build-convex
convex-dev
Собрать проект Convex из исходного кода. Используйте, когда участник хочет скомпилировать, протестировать или упаковать Convex.
convex-db
convex-dev
Используйте Convex DB — SQL-базу данных на основе решётки. Используйте, когда помогаете пользователям писать запросы, подключаться через JDBC или PostgreSQL-клиенты, создавать таблицы, вставлять/запрашивать данные,…
convex-lisp
convex-dev
Справочник по языку Convex Lisp — соглашения CVM, вызов библиотечного кода, определения акторов, коды juice и ошибок. Используйте при написании или отладке исходного кода CVM для…
deploy
convex-dev
Разверните актор (смарт-контракт) в сети Convex. Используйте, когда пользователь хочет создать новый ончейн-актор с экспортируемыми функциями.
ecosystem
convex-dev
Ориентация в экосистеме Convex — что находится в каком репозитории, где находятся спецификации и документация, и какие клиентские библиотеки существуют. Используйте, когда нужен контекст…