Инструментарий разработки контрактов WAX (WAX CDT) - dapplicaio/waxio_document_russian GitHub Wiki

Инструментарий разработки контрактов WAX (WAX-CDT) включает в себя C / C ++ API и набор инструментов на основе Clang, используемый для создания и развертывания ваших смарт-контрактов.

Инструменты WAX-CDT включены в образ Docker waxteam/dev, и мы также предоставляем отдельный образ Docker waxteam/cdt. Чтобы запустить интерактивный контейнер WAX-CDT, вы можете использовать следующие команды:

docker run -it --name waxcdt -v /var/share/wax:/wax waxteam/cdt bash

Обратитесь к нашему Pуководству по быстрому запуску Docker для получения дополнительной информации.

Если вы хотите получить доступ к нашим образцам контрактов и сценариев с локального диска или вам нужно установить WAX-CDT вместо использования Docker, вы можете использовать это руководство, чтобы загрузить и при необходимости собрать исходный код WAX-CDT.


Важное замечание: В настоящее время предварительно скомпилированные пакеты недоступны. Поддержка недоступна при сборке WAX-CDT из исходного кода.


Что включено

  • Библиотека API C/C++ для связи с WAX блокчейном
  • Образцы смарт-контрактов для ускорения разработки dApp
  • Инструменты для создания новых шаблонов смарт-контрактов
  • Сценарии и инструменты CMake для создания оптимизированных, высокопроизводительных файлов WASM
  • Поддержка рикардианских файлов

Когда вы будете готовы развернуть ваш смарт-контракт в локальной среде разработки или в сети WAX, вы можете использовать Инструментарий разработки контрактов WAX (WAX-CDT) для преобразования вашего контракта в файл WebAssembly (WASM). Вы также можете использовать WAX-CDT для создания файла Application Binary Interface (ABI), который включает в себя Рикардианские контракты и рикардианские положения.

  • Файлы WebAssembly (WASM): Файл WASM - это компактный двоичный формат вашего C++ смарт-контракта, оптимизированный для скорости и производительности в сети. WAX блокчейн использует этот файл для выполнения действий, определенных в вашем смарт-контракте.

  • Файлы Application Binary Interface (ABI): Файл ABI представляет собой описание JSON структур, типов, действий, таблиц и других определений вашего смарт-контракта. Это позволяет разработчикам и клиентским интерфейсам легко интерпретировать функциональность вашего контракта.

Пример ABI

Этот пример включает в себя рикардианский контракт для действия «hi» и рикардианское положение для контракта.

{
    "____comment": "This file was generated with eosio-abigen. DO NOT EDIT Fri Jul 19 13:36:50 2019",
    "version": "eosio::abi/1.1",
    "structs": [
        {
            "name": "hi",
            "base": "",
            "fields": [
                {
                    "name": "user",
                    "type": "name"
                }
            ]
        }
    ],
    "types": [],
    "actions": [
        {
            "name": "hi",
            "type": "hi",
            "ricardian_contract": "### Parameters\nInput parameters:\n\n* `user` (string to include in the output)\n\nImplied parameters: \n\n* `account_name` (name of the party invoking and signing the contract)\n\n### Intent\nINTENT. The intention of the author and the invoker of this contract is to print output. It shall have no other effect.\n\n### Term\nTERM. This Contract expires at the conclusion of code execution."
        }
    ],
    "tables": [],
    "ricardian_clauses": [
        {
            "id": "Warranty",
            "body": "The invoker of the contract action shall uphold its Obligations under this Contract in a timely and workmanlike manner, using knowledge and recommendations for performing the services which meet generally acceptable standards set forth by EOS.IO Blockchain Block Producers."
        },
        {
            "id": "Default",
            "body": "The occurrence of any of the following shall constitute a material default under this Contract:"
        },
        {
            "id": "Remedies",
            "body": "In addition to any and all other rights a party may have available according to law, if a party defaults by failing to substantially perform any provision, term or condition of this Contract, the other party may terminate the Contract by providing written notice to the defaulting party. This notice shall describe with sufficient detail the nature of the default. The party receiving such notice shall promptly be removed from being a Block Producer and this Contract shall be automatically terminated."
        },
        {
            "id": "ForceMajeure",
            "body": "If performance of this Contract or any obligation under this Contract is prevented, restricted, or interfered with by causes beyond either party's reasonable control (\"Force Majeure\"), and if the party unable to carry out its obligations gives the other party prompt written notice of such event, then the obligations of the party invoking this provision shall be suspended to the extent necessary by such event. The term Force Majeure shall include, without limitation, acts of God, fire, explosion, vandalism, storm or other similar occurrence, orders or acts of military or civil authority, or by national emergencies, insurrections, riots, or wars, or strikes, lock-outs, work stoppages, or supplier failures. The excused party shall use reasonable efforts under the circumstances to avoid or remove such causes of non-performance and shall proceed to perform with reasonable dispatch whenever such causes are removed or ceased. An act or omission shall be deemed within the reasonable control of a party if committed, omitted, or caused by such party, or its employees, officers, agents, or affiliates."
        },
        {
            "id": "DisputeResolution",
            "body": "Any controversies or disputes arising out of or relating to this Contract will be resolved by binding arbitration under the default rules set forth by the EOS.IO Blockchain. The arbitrator's award will be final, and judgment may be entered upon it by any court having proper jurisdiction."
        },
        {
            "id": "Agreement",
            "body": "This Contract contains the entire agreement of the parties, and there are no other promises or conditions in any other agreement whether oral or written concerning the subject matter of this Contract. This Contract supersedes any prior written or oral agreements between the parties."
        },
        {
            "id": "Severability",
            "body": "If any provision of this Contract will be held to be invalid or unenforceable for any reason, the remaining provisions will continue to be valid and enforceable. If a court finds that any provision of this Contract is invalid or unenforceable, but that by limiting such provision it would become valid and enforceable, then such provision will be deemed to be written, construed, and enforced as so limited."
        },
        {
            "id": "Amendment",
            "body": "This Contract may be modified or amended in writing by mutual agreement between the parties, if the writing is signed by the party obligated under the amendment."
        },
        {
            "id": "GoverningLaw",
            "body": "This Contract shall be construed in accordance with the Maxims of Equity."
        },
        {
            "id": "Notice",
            "body": "Any notice or communication required or permitted under this Contract shall be sufficiently given if delivered to a verifiable email address or to such other email address as one party may have publicly furnished in writing, or published on a broadcast contract provided by this blockchain for purposes of providing notices of this type."
        },
        {
            "id": "WaiverOfContractualRight",
            "body": "The failure of either party to enforce any provision of this Contract shall not be construed as a waiver or limitation of that party's right to subsequently enforce and compel strict compliance with every provision of this Contract."
        },
        {
            "id": "ArbitratorsFeesToPrevailingParty",
            "body": "In any action arising hereunder or any separate action pertaining to the validity of this Agreement, both sides shall pay half the initial cost of arbitration, and the prevailing party shall be awarded reasonable arbitrator's fees and costs."
        },
        {
            "id": "ConstructionAndInterpretation",
            "body": "The rule requiring construction or interpretation against the drafter is waived. The document shall be deemed as if it were drafted by both parties in a mutual effort."
        },
        {
            "id": "InWitnessWhereof",
            "body": "In witness whereof, the parties hereto have caused this Agreement to be executed by themselves or their duly authorized representatives as of the date of execution, and authorized as proven by the cryptographic signature on the transaction that invokes this contract."
        }
    ],
    "variants": [],
    "abi_extensions": []
}

Что дальше?


Установка WAX CDT