We have prepared a very simple contract that contains only two files:
Define the contract name, version number, and several files that the contract depends on. Here we have only one data structure definition file.
Define the data structures and new transaction types that will be used in the contract.
The above code has been placed on GitHub, and the acquisition method is relatively simple:
TODO: There should be a few additional tools installed here
Then execute directly
forge contract:compile ./protocolAnd get the following output:
contract:compile Can produce can give
Forge Elixir SDK with
Forge JS SDK The files used also produce result files that can be used directly for deployment to chain nodes.
If you want to execute the contract directly:
forge protocol:deploy .compiled/create_product/elixir/create_product/create_product.itx.jsonAnd the result is as follows:
forge contract:ls | grep create_productIf you can see the results, the deployment is normal.
In wangshijun/forge-product-factory-contract Examples of how to use compiled code in the Forge JS SDK: