Skip to main content

Contract Origination

The smart contract is written in Archetype language. Go to the Smart contract section for a detailed presentation.

In VSCode, open the terminal and enter the following command line to originate (deploy) the smart contract is:

cat ./contracts/! /bin/bash
addrs=()for coin in $COINS; do  completium-cli deploy coin_fa12.arl --named $coin > /dev/null  addr=`completium-cli show contract $coin | sed 's/ *$//g'`  addrs+=(@$addr)  echo $coin "deployed: " $addrdoneprintf -v params '%s,' "${addrs[@]}"
completium-cli deploy dex.arl --init "(${params%,})" --named dex > /dev/nullecho "dex deployed, done"

The originate command triggers two operations:

  • the contract compilation to Michelson with archetype compiler
  • the Michelson contract origination with Tezos client

The contract may then be referred to as dex in future interactions.

If you are using the preset Gitpod environement, note that completium-cli is pre-installed with the admin account. See this section for more information.

The address of the newly originated contract is visible with this command:

completium-cli show contract dex

A smart contract address starts with KT1. In the situation above, the new contract's address is KT1UTJoUXgyXPW34wca92dGfiP4tjQyrG64f.

You may got to Better call dev contract explorer to check it:

The new contract address needs to be set in the DApp's src/settings.js file, like for example:

export const dexContract = "KT1MNgjnJg7c2WmnCwCAkhmcAGbrrPMoxcSa"